From 6ba028958e79ce25c0d685a11fa2d0f969f93ca1 Mon Sep 17 00:00:00 2001 From: ap0calypse644 <91111707+ap0calypse644@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:44:14 +0530 Subject: [PATCH] updating ts-client and openapi docs (#229) --- docs/static/openapi.yml | 2 +- ts-client/cosmos.auth.v1beta1/module.ts | 626 +- ts-client/cosmos.auth.v1beta1/registry.ts | 94 +- .../cosmos.auth.v1beta1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../cosmos.auth.v1beta1/types/route-name.eta | 45 + ts-client/cosmos.authz.v1beta1/module.ts | 448 +- ts-client/cosmos.authz.v1beta1/registry.ts | 60 +- .../cosmos.authz.v1beta1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../cosmos.authz.v1beta1/types/route-name.eta | 45 + ts-client/cosmos.bank.v1beta1/module.ts | 1086 +-- ts-client/cosmos.bank.v1beta1/registry.ts | 162 +- .../cosmos.bank.v1beta1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../cosmos.bank.v1beta1/types/route-name.eta | 45 + ts-client/cosmos.base.node.v1beta1/module.ts | 8 +- .../cosmos.base.node.v1beta1/registry.ts | 8 +- .../types/amino/amino.ts | 9 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 329 + .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 9 + .../types/cosmos_proto/cosmos.ts | 302 + .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + .../cosmos.base.tendermint.v1beta1/module.ts | 444 +- .../registry.ts | 68 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 9 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + ts-client/cosmos.circuit.v1/module.ts | 324 +- ts-client/cosmos.circuit.v1/registry.ts | 36 +- .../cosmos.circuit.v1/types/amino/amino.ts | 9 + .../cosmos/app/runtime/v1alpha1/module.ts | 378 ++ .../types/cosmos/app/v1alpha1/config.ts | 339 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../types/cosmos/app/v1alpha1/query.ts | 174 + .../types/cosmos/auth/module/v1/module.ts | 224 + .../types/cosmos/auth/v1beta1/auth.ts | 517 ++ .../types/cosmos/auth/v1beta1/genesis.ts | 123 + .../types/cosmos/auth/v1beta1/query.ts | 1545 +++++ .../types/cosmos/auth/v1beta1/tx.ts | 211 + .../types/cosmos/authz/module/v1/module.ts | 78 + .../types/cosmos/authz/v1beta1/authz.ts | 403 ++ .../types/cosmos/authz/v1beta1/event.ts | 235 + .../types/cosmos/authz/v1beta1/genesis.ts | 100 + .../types/cosmos/authz/v1beta1/query.ts | 629 ++ .../types/cosmos/authz/v1beta1/tx.ts | 565 ++ .../types/cosmos/autocli/v1/options.ts | 1019 +++ .../types/cosmos/autocli/v1/query.ts | 288 + .../types/cosmos/bank/module/v1/module.ts | 147 + .../types/cosmos/bank/v1beta1/authz.ts | 127 + .../types/cosmos/bank/v1beta1/bank.ts | 755 +++ .../types/cosmos/bank/v1beta1/genesis.ts | 270 + .../types/cosmos/bank/v1beta1/query.ts | 2382 +++++++ .../types/cosmos/bank/v1beta1/tx.ts | 687 ++ .../types/cosmos/base/abci/v1beta1/abci.ts | 1425 ++++ .../types/cosmos/base/node/v1beta1/query.ts | 476 ++ .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../base/reflection/v1beta1/reflection.ts | 325 + .../base/reflection/v2alpha1/reflection.ts | 2057 ++++++ .../cosmos/base/tendermint/v1beta1/query.ts | 1974 ++++++ .../cosmos/base/tendermint/v1beta1/types.ts | 530 ++ .../types/cosmos/base/v1beta1/coin.ts | 335 + .../types/cosmos/circuit/module/v1/module.ts | 98 + .../types/cosmos/circuit/v1/query.ts | 104 +- .../types/cosmos/circuit/v1/tx.ts | 122 +- .../types/cosmos/circuit/v1/types.ts | 66 +- .../cosmos/consensus/module/v1/module.ts | 98 + .../types/cosmos/consensus/v1/query.ts | 180 + .../types/cosmos/consensus/v1/tx.ts | 266 + .../types/cosmos/crisis/module/v1/module.ts | 117 + .../types/cosmos/crisis/v1beta1/genesis.ts | 104 + .../types/cosmos/crisis/v1beta1/tx.ts | 362 + .../types/cosmos/crypto/ed25519/keys.ts | 193 + .../types/cosmos/crypto/hd/v1/hd.ts | 173 + .../types/cosmos/crypto/keyring/v1/record.ts | 432 ++ .../types/cosmos/crypto/multisig/keys.ts | 122 + .../crypto/multisig/v1beta1/multisig.ts | 215 + .../types/cosmos/crypto/secp256k1/keys.ts | 190 + .../types/cosmos/crypto/secp256r1/keys.ts | 191 + .../cosmos/distribution/module/v1/module.ts | 116 + .../distribution/v1beta1/distribution.ts | 1149 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1000 +++ .../cosmos/distribution/v1beta1/query.ts | 1674 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1161 ++++ .../types/cosmos/evidence/module/v1/module.ts | 78 + .../types/cosmos/evidence/v1beta1/evidence.ts | 190 + .../types/cosmos/evidence/v1beta1/genesis.ts | 97 + .../types/cosmos/evidence/v1beta1/query.ts | 408 ++ .../types/cosmos/evidence/v1beta1/tx.ts | 240 + .../types/cosmos/feegrant/module/v1/module.ts | 78 + .../types/cosmos/feegrant/v1beta1/feegrant.ts | 501 ++ .../types/cosmos/feegrant/v1beta1/genesis.ts | 100 + .../types/cosmos/feegrant/v1beta1/query.ts | 586 ++ .../types/cosmos/feegrant/v1beta1/tx.ts | 490 ++ .../types/cosmos/genutil/module/v1/module.ts | 78 + .../types/cosmos/genutil/v1beta1/genesis.ts | 121 + .../types/cosmos/gov/module/v1/module.ts | 131 + .../types/cosmos/gov/v1/genesis.ts | 321 + .../types/cosmos/gov/v1/gov.ts | 2031 ++++++ .../types/cosmos/gov/v1/query.ts | 1575 +++++ .../types/cosmos/gov/v1/tx.ts | 1531 +++++ .../types/cosmos/gov/v1beta1/genesis.ts | 234 + .../types/cosmos/gov/v1beta1/gov.ts | 1356 ++++ .../types/cosmos/gov/v1beta1/query.ts | 1413 ++++ .../types/cosmos/gov/v1beta1/tx.ts | 880 +++ .../types/cosmos/group/module/v1/module.ts | 139 + .../types/cosmos/group/v1/events.ts | 780 +++ .../types/cosmos/group/v1/genesis.ts | 257 + .../types/cosmos/group/v1/query.ts | 2395 +++++++ .../types/cosmos/group/v1/tx.ts | 2576 +++++++ .../types/cosmos/group/v1/types.ts | 1799 +++++ .../types/cosmos/mint/module/v1/module.ts | 116 + .../types/cosmos/mint/v1beta1/genesis.ts | 124 + .../types/cosmos/mint/v1beta1/mint.ts | 285 + .../types/cosmos/mint/v1beta1/query.ts | 450 ++ .../types/cosmos/mint/v1beta1/tx.ts | 211 + .../types/cosmos/msg/textual/v1/textual.ts | 9 + .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos/nft/module/v1/module.ts | 78 + .../types/cosmos/nft/v1beta1/event.ts | 349 + .../types/cosmos/nft/v1beta1/genesis.ts | 200 + .../types/cosmos/nft/v1beta1/nft.ts | 336 + .../types/cosmos/nft/v1beta1/query.ts | 1152 ++++ .../types/cosmos/nft/v1beta1/tx.ts | 224 + .../cosmos/orm/module/v1alpha1/module.ts | 82 + .../types/cosmos/orm/query/v1alpha1/query.ts | 911 +++ .../types/cosmos/orm/v1/orm.ts | 444 ++ .../types/cosmos/orm/v1alpha1/schema.ts | 316 + .../types/cosmos/params/module/v1/module.ts | 78 + .../types/cosmos/params/v1beta1/params.ts | 230 + .../types/cosmos/params/v1beta1/query.ts | 433 ++ .../types/cosmos/query/v1/query.ts | 6 + .../types/cosmos/reflection/v1/reflection.ts | 178 + .../types/cosmos/slashing/module/v1/module.ts | 98 + .../types/cosmos/slashing/v1beta1/genesis.ts | 415 ++ .../types/cosmos/slashing/v1beta1/query.ts | 481 ++ .../types/cosmos/slashing/v1beta1/slashing.ts | 411 ++ .../types/cosmos/slashing/v1beta1/tx.ts | 333 + .../types/cosmos/staking/module/v1/module.ts | 157 + .../types/cosmos/staking/v1beta1/authz.ts | 301 + .../types/cosmos/staking/v1beta1/genesis.ts | 367 + .../types/cosmos/staking/v1beta1/query.ts | 2495 +++++++ .../types/cosmos/staking/v1beta1/staking.ts | 2506 +++++++ .../types/cosmos/staking/v1beta1/tx.ts | 1403 ++++ .../cosmos/store/internal/kv/v1beta1/kv.ts | 202 + .../cosmos/store/snapshots/v1/snapshot.ts | 728 ++ .../types/cosmos/store/streaming/abci/grpc.ts | 362 + .../types/cosmos/store/v1beta1/commit_info.ts | 363 + .../types/cosmos/store/v1beta1/listening.ts | 294 + .../types/cosmos/tx/config/v1/config.ts | 123 + .../cosmos/tx/signing/v1beta1/signing.ts | 620 ++ .../types/cosmos/tx/v1beta1/service.ts | 1855 ++++++ .../types/cosmos/tx/v1beta1/tx.ts | 1615 +++++ .../types/cosmos/upgrade/module/v1/module.ts | 98 + .../types/cosmos/upgrade/v1beta1/query.ts | 811 +++ .../types/cosmos/upgrade/v1beta1/tx.ts | 337 + .../types/cosmos/upgrade/v1beta1/upgrade.ts | 513 ++ .../types/cosmos/vesting/module/v1/module.ts | 78 + .../types/cosmos/vesting/v1beta1/tx.ts | 628 ++ .../types/cosmos/vesting/v1beta1/vesting.ts | 610 ++ .../types/cosmos_proto/cosmos.ts | 302 + .../cosmos.circuit.v1/types/gogoproto/gogo.ts | 9 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 381 +- .../types/google/protobuf/any.ts | 257 + .../types/google/protobuf/descriptor.ts | 3082 +++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/google/protobuf/timestamp.ts | 227 + .../cosmos.circuit.v1/types/route-name.eta | 45 + .../types/tendermint/abci/types.ts | 5925 +++++++++++++++++ .../types/tendermint/crypto/keys.ts | 140 + .../types/tendermint/crypto/proof.ts | 520 ++ .../types/tendermint/libs/bits/types.ts | 137 + .../types/tendermint/p2p/types.ts | 528 ++ .../types/tendermint/types/block.ts | 154 + .../types/tendermint/types/evidence.ts | 489 ++ .../types/tendermint/types/params.ts | 686 ++ .../types/tendermint/types/types.ts | 2065 ++++++ .../types/tendermint/types/validator.ts | 415 ++ .../types/tendermint/version/types.ts | 214 + ts-client/cosmos.consensus.v1/module.ts | 64 +- ts-client/cosmos.consensus.v1/registry.ts | 10 +- .../cosmos.consensus.v1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 329 + .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 73 +- .../cosmos.consensus.v1/types/route-name.eta | 45 + ts-client/cosmos.crisis.v1beta1/module.ts | 56 +- ts-client/cosmos.crisis.v1beta1/registry.ts | 12 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 329 + .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 9 + .../types/google/api/http.ts | 756 +++ .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + .../cosmos.distribution.v1beta1/module.ts | 1270 ++-- .../cosmos.distribution.v1beta1/registry.ts | 194 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + ts-client/cosmos.evidence.v1beta1/module.ts | 156 +- ts-client/cosmos.evidence.v1beta1/registry.ts | 12 +- .../types/amino/amino.ts | 6 + .../cosmos/app/runtime/v1alpha1/module.ts | 378 ++ .../types/cosmos/app/v1alpha1/config.ts | 339 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../types/cosmos/app/v1alpha1/query.ts | 174 + .../types/cosmos/auth/module/v1/module.ts | 224 + .../types/cosmos/auth/v1beta1/auth.ts | 517 ++ .../types/cosmos/auth/v1beta1/genesis.ts | 123 + .../types/cosmos/auth/v1beta1/query.ts | 1545 +++++ .../types/cosmos/auth/v1beta1/tx.ts | 211 + .../types/cosmos/authz/module/v1/module.ts | 78 + .../types/cosmos/authz/v1beta1/authz.ts | 403 ++ .../types/cosmos/authz/v1beta1/event.ts | 235 + .../types/cosmos/authz/v1beta1/genesis.ts | 100 + .../types/cosmos/authz/v1beta1/query.ts | 629 ++ .../types/cosmos/authz/v1beta1/tx.ts | 565 ++ .../types/cosmos/autocli/v1/options.ts | 1019 +++ .../types/cosmos/autocli/v1/query.ts | 288 + .../types/cosmos/bank/module/v1/module.ts | 147 + .../types/cosmos/bank/v1beta1/authz.ts | 127 + .../types/cosmos/bank/v1beta1/bank.ts | 755 +++ .../types/cosmos/bank/v1beta1/genesis.ts | 270 + .../types/cosmos/bank/v1beta1/query.ts | 2382 +++++++ .../types/cosmos/bank/v1beta1/tx.ts | 687 ++ .../types/cosmos/base/abci/v1beta1/abci.ts | 1425 ++++ .../types/cosmos/base/node/v1beta1/query.ts | 476 ++ .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../base/reflection/v1beta1/reflection.ts | 325 + .../base/reflection/v2alpha1/reflection.ts | 2057 ++++++ .../cosmos/base/tendermint/v1beta1/query.ts | 1974 ++++++ .../cosmos/base/tendermint/v1beta1/types.ts | 530 ++ .../types/cosmos/base/v1beta1/coin.ts | 335 + .../types/cosmos/circuit/module/v1/module.ts | 98 + .../types/cosmos/circuit/v1/query.ts | 470 ++ .../types/cosmos/circuit/v1/tx.ts | 566 ++ .../types/cosmos/circuit/v1/types.ts | 356 + .../cosmos/consensus/module/v1/module.ts | 98 + .../types/cosmos/consensus/v1/query.ts | 180 + .../types/cosmos/consensus/v1/tx.ts | 266 + .../types/cosmos/crisis/module/v1/module.ts | 117 + .../types/cosmos/crisis/v1beta1/genesis.ts | 104 + .../types/cosmos/crisis/v1beta1/tx.ts | 362 + .../types/cosmos/crypto/ed25519/keys.ts | 193 + .../types/cosmos/crypto/hd/v1/hd.ts | 173 + .../types/cosmos/crypto/keyring/v1/record.ts | 432 ++ .../types/cosmos/crypto/multisig/keys.ts | 122 + .../crypto/multisig/v1beta1/multisig.ts | 215 + .../types/cosmos/crypto/secp256k1/keys.ts | 190 + .../types/cosmos/crypto/secp256r1/keys.ts | 191 + .../cosmos/distribution/module/v1/module.ts | 116 + .../distribution/v1beta1/distribution.ts | 1149 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1000 +++ .../cosmos/distribution/v1beta1/query.ts | 1674 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1161 ++++ .../types/cosmos/evidence/module/v1/module.ts | 78 + .../types/cosmos/evidence/v1beta1/evidence.ts | 87 +- .../types/cosmos/evidence/v1beta1/genesis.ts | 36 +- .../types/cosmos/evidence/v1beta1/query.ts | 109 +- .../types/cosmos/evidence/v1beta1/tx.ts | 79 +- .../types/cosmos/feegrant/module/v1/module.ts | 78 + .../types/cosmos/feegrant/v1beta1/feegrant.ts | 501 ++ .../types/cosmos/feegrant/v1beta1/genesis.ts | 100 + .../types/cosmos/feegrant/v1beta1/query.ts | 586 ++ .../types/cosmos/feegrant/v1beta1/tx.ts | 490 ++ .../types/cosmos/genutil/module/v1/module.ts | 78 + .../types/cosmos/genutil/v1beta1/genesis.ts | 121 + .../types/cosmos/gov/module/v1/module.ts | 131 + .../types/cosmos/gov/v1/genesis.ts | 321 + .../types/cosmos/gov/v1/gov.ts | 2031 ++++++ .../types/cosmos/gov/v1/query.ts | 1575 +++++ .../types/cosmos/gov/v1/tx.ts | 1531 +++++ .../types/cosmos/gov/v1beta1/genesis.ts | 234 + .../types/cosmos/gov/v1beta1/gov.ts | 1356 ++++ .../types/cosmos/gov/v1beta1/query.ts | 1413 ++++ .../types/cosmos/gov/v1beta1/tx.ts | 880 +++ .../types/cosmos/group/module/v1/module.ts | 139 + .../types/cosmos/group/v1/events.ts | 780 +++ .../types/cosmos/group/v1/genesis.ts | 257 + .../types/cosmos/group/v1/query.ts | 2395 +++++++ .../types/cosmos/group/v1/tx.ts | 2576 +++++++ .../types/cosmos/group/v1/types.ts | 1799 +++++ .../types/cosmos/mint/module/v1/module.ts | 116 + .../types/cosmos/mint/v1beta1/genesis.ts | 124 + .../types/cosmos/mint/v1beta1/mint.ts | 285 + .../types/cosmos/mint/v1beta1/query.ts | 450 ++ .../types/cosmos/mint/v1beta1/tx.ts | 211 + .../types/cosmos/msg/textual/v1/textual.ts | 9 + .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos/nft/module/v1/module.ts | 78 + .../types/cosmos/nft/v1beta1/event.ts | 349 + .../types/cosmos/nft/v1beta1/genesis.ts | 200 + .../types/cosmos/nft/v1beta1/nft.ts | 336 + .../types/cosmos/nft/v1beta1/query.ts | 1152 ++++ .../types/cosmos/nft/v1beta1/tx.ts | 224 + .../cosmos/orm/module/v1alpha1/module.ts | 82 + .../types/cosmos/orm/query/v1alpha1/query.ts | 911 +++ .../types/cosmos/orm/v1/orm.ts | 444 ++ .../types/cosmos/orm/v1alpha1/schema.ts | 316 + .../types/cosmos/params/module/v1/module.ts | 78 + .../types/cosmos/params/v1beta1/params.ts | 230 + .../types/cosmos/params/v1beta1/query.ts | 433 ++ .../types/cosmos/query/v1/query.ts | 9 + .../types/cosmos/reflection/v1/reflection.ts | 178 + .../types/cosmos/slashing/module/v1/module.ts | 98 + .../types/cosmos/slashing/v1beta1/genesis.ts | 415 ++ .../types/cosmos/slashing/v1beta1/query.ts | 481 ++ .../types/cosmos/slashing/v1beta1/slashing.ts | 411 ++ .../types/cosmos/slashing/v1beta1/tx.ts | 333 + .../types/cosmos/staking/module/v1/module.ts | 157 + .../types/cosmos/staking/v1beta1/authz.ts | 301 + .../types/cosmos/staking/v1beta1/genesis.ts | 367 + .../types/cosmos/staking/v1beta1/query.ts | 2495 +++++++ .../types/cosmos/staking/v1beta1/staking.ts | 2506 +++++++ .../types/cosmos/staking/v1beta1/tx.ts | 1403 ++++ .../cosmos/store/internal/kv/v1beta1/kv.ts | 202 + .../cosmos/store/snapshots/v1/snapshot.ts | 728 ++ .../types/cosmos/store/streaming/abci/grpc.ts | 362 + .../types/cosmos/store/v1beta1/commit_info.ts | 363 + .../types/cosmos/store/v1beta1/listening.ts | 294 + .../types/cosmos/tx/config/v1/config.ts | 123 + .../cosmos/tx/signing/v1beta1/signing.ts | 620 ++ .../types/cosmos/tx/v1beta1/service.ts | 1855 ++++++ .../types/cosmos/tx/v1beta1/tx.ts | 1615 +++++ .../types/cosmos/upgrade/module/v1/module.ts | 98 + .../types/cosmos/upgrade/v1beta1/query.ts | 811 +++ .../types/cosmos/upgrade/v1beta1/tx.ts | 337 + .../types/cosmos/upgrade/v1beta1/upgrade.ts | 513 ++ .../types/cosmos/vesting/module/v1/module.ts | 78 + .../types/cosmos/vesting/v1beta1/tx.ts | 628 ++ .../types/cosmos/vesting/v1beta1/vesting.ts | 610 ++ .../types/cosmos_proto/cosmos.ts | 54 +- .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 381 +- .../types/google/protobuf/any.ts | 72 +- .../types/google/protobuf/descriptor.ts | 3082 +++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/google/protobuf/timestamp.ts | 75 +- .../types/route-name.eta | 45 + .../types/tendermint/abci/types.ts | 5925 +++++++++++++++++ .../types/tendermint/crypto/keys.ts | 140 + .../types/tendermint/crypto/proof.ts | 520 ++ .../types/tendermint/libs/bits/types.ts | 137 + .../types/tendermint/p2p/types.ts | 528 ++ .../types/tendermint/types/block.ts | 154 + .../types/tendermint/types/evidence.ts | 489 ++ .../types/tendermint/types/params.ts | 686 ++ .../types/tendermint/types/types.ts | 2065 ++++++ .../types/tendermint/types/validator.ts | 415 ++ .../types/tendermint/version/types.ts | 214 + ts-client/cosmos.feegrant.v1beta1/module.ts | 364 +- ts-client/cosmos.feegrant.v1beta1/registry.ts | 40 +- .../types/amino/amino.ts | 6 + .../cosmos/app/runtime/v1alpha1/module.ts | 378 ++ .../types/cosmos/app/v1alpha1/config.ts | 339 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../types/cosmos/app/v1alpha1/query.ts | 174 + .../types/cosmos/auth/module/v1/module.ts | 224 + .../types/cosmos/auth/v1beta1/auth.ts | 517 ++ .../types/cosmos/auth/v1beta1/genesis.ts | 123 + .../types/cosmos/auth/v1beta1/query.ts | 1545 +++++ .../types/cosmos/auth/v1beta1/tx.ts | 211 + .../types/cosmos/authz/module/v1/module.ts | 78 + .../types/cosmos/authz/v1beta1/authz.ts | 403 ++ .../types/cosmos/authz/v1beta1/event.ts | 235 + .../types/cosmos/authz/v1beta1/genesis.ts | 100 + .../types/cosmos/authz/v1beta1/query.ts | 629 ++ .../types/cosmos/authz/v1beta1/tx.ts | 565 ++ .../types/cosmos/autocli/v1/options.ts | 1019 +++ .../types/cosmos/autocli/v1/query.ts | 288 + .../types/cosmos/bank/module/v1/module.ts | 147 + .../types/cosmos/bank/v1beta1/authz.ts | 127 + .../types/cosmos/bank/v1beta1/bank.ts | 755 +++ .../types/cosmos/bank/v1beta1/genesis.ts | 270 + .../types/cosmos/bank/v1beta1/query.ts | 2382 +++++++ .../types/cosmos/bank/v1beta1/tx.ts | 687 ++ .../types/cosmos/base/abci/v1beta1/abci.ts | 1425 ++++ .../types/cosmos/base/node/v1beta1/query.ts | 476 ++ .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../base/reflection/v1beta1/reflection.ts | 325 + .../base/reflection/v2alpha1/reflection.ts | 2057 ++++++ .../cosmos/base/tendermint/v1beta1/query.ts | 1974 ++++++ .../cosmos/base/tendermint/v1beta1/types.ts | 530 ++ .../types/cosmos/base/v1beta1/coin.ts | 178 +- .../types/cosmos/circuit/module/v1/module.ts | 98 + .../types/cosmos/circuit/v1/query.ts | 470 ++ .../types/cosmos/circuit/v1/tx.ts | 566 ++ .../types/cosmos/circuit/v1/types.ts | 356 + .../cosmos/consensus/module/v1/module.ts | 98 + .../types/cosmos/consensus/v1/query.ts | 180 + .../types/cosmos/consensus/v1/tx.ts | 266 + .../types/cosmos/crisis/module/v1/module.ts | 117 + .../types/cosmos/crisis/v1beta1/genesis.ts | 104 + .../types/cosmos/crisis/v1beta1/tx.ts | 362 + .../types/cosmos/crypto/ed25519/keys.ts | 193 + .../types/cosmos/crypto/hd/v1/hd.ts | 173 + .../types/cosmos/crypto/keyring/v1/record.ts | 432 ++ .../types/cosmos/crypto/multisig/keys.ts | 122 + .../crypto/multisig/v1beta1/multisig.ts | 215 + .../types/cosmos/crypto/secp256k1/keys.ts | 190 + .../types/cosmos/crypto/secp256r1/keys.ts | 191 + .../cosmos/distribution/module/v1/module.ts | 116 + .../distribution/v1beta1/distribution.ts | 1149 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1000 +++ .../cosmos/distribution/v1beta1/query.ts | 1674 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1161 ++++ .../types/cosmos/evidence/module/v1/module.ts | 78 + .../types/cosmos/evidence/v1beta1/evidence.ts | 190 + .../types/cosmos/evidence/v1beta1/genesis.ts | 97 + .../types/cosmos/evidence/v1beta1/query.ts | 408 ++ .../types/cosmos/evidence/v1beta1/tx.ts | 240 + .../types/cosmos/feegrant/module/v1/module.ts | 78 + .../types/cosmos/feegrant/v1beta1/feegrant.ts | 102 +- .../types/cosmos/feegrant/v1beta1/genesis.ts | 36 +- .../types/cosmos/feegrant/v1beta1/query.ts | 116 +- .../types/cosmos/feegrant/v1beta1/tx.ts | 98 +- .../types/cosmos/genutil/module/v1/module.ts | 78 + .../types/cosmos/genutil/v1beta1/genesis.ts | 121 + .../types/cosmos/gov/module/v1/module.ts | 131 + .../types/cosmos/gov/v1/genesis.ts | 321 + .../types/cosmos/gov/v1/gov.ts | 2031 ++++++ .../types/cosmos/gov/v1/query.ts | 1575 +++++ .../types/cosmos/gov/v1/tx.ts | 1531 +++++ .../types/cosmos/gov/v1beta1/genesis.ts | 234 + .../types/cosmos/gov/v1beta1/gov.ts | 1356 ++++ .../types/cosmos/gov/v1beta1/query.ts | 1413 ++++ .../types/cosmos/gov/v1beta1/tx.ts | 880 +++ .../types/cosmos/group/module/v1/module.ts | 139 + .../types/cosmos/group/v1/events.ts | 780 +++ .../types/cosmos/group/v1/genesis.ts | 257 + .../types/cosmos/group/v1/query.ts | 2395 +++++++ .../types/cosmos/group/v1/tx.ts | 2576 +++++++ .../types/cosmos/group/v1/types.ts | 1799 +++++ .../types/cosmos/mint/module/v1/module.ts | 116 + .../types/cosmos/mint/v1beta1/genesis.ts | 124 + .../types/cosmos/mint/v1beta1/mint.ts | 285 + .../types/cosmos/mint/v1beta1/query.ts | 450 ++ .../types/cosmos/mint/v1beta1/tx.ts | 211 + .../types/cosmos/msg/textual/v1/textual.ts | 9 + .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos/nft/module/v1/module.ts | 78 + .../types/cosmos/nft/v1beta1/event.ts | 349 + .../types/cosmos/nft/v1beta1/genesis.ts | 200 + .../types/cosmos/nft/v1beta1/nft.ts | 336 + .../types/cosmos/nft/v1beta1/query.ts | 1152 ++++ .../types/cosmos/nft/v1beta1/tx.ts | 224 + .../cosmos/orm/module/v1alpha1/module.ts | 82 + .../types/cosmos/orm/query/v1alpha1/query.ts | 911 +++ .../types/cosmos/orm/v1/orm.ts | 444 ++ .../types/cosmos/orm/v1alpha1/schema.ts | 316 + .../types/cosmos/params/module/v1/module.ts | 78 + .../types/cosmos/params/v1beta1/params.ts | 230 + .../types/cosmos/params/v1beta1/query.ts | 433 ++ .../types/cosmos/query/v1/query.ts | 9 + .../types/cosmos/reflection/v1/reflection.ts | 178 + .../types/cosmos/slashing/module/v1/module.ts | 98 + .../types/cosmos/slashing/v1beta1/genesis.ts | 415 ++ .../types/cosmos/slashing/v1beta1/query.ts | 481 ++ .../types/cosmos/slashing/v1beta1/slashing.ts | 411 ++ .../types/cosmos/slashing/v1beta1/tx.ts | 333 + .../types/cosmos/staking/module/v1/module.ts | 157 + .../types/cosmos/staking/v1beta1/authz.ts | 301 + .../types/cosmos/staking/v1beta1/genesis.ts | 367 + .../types/cosmos/staking/v1beta1/query.ts | 2495 +++++++ .../types/cosmos/staking/v1beta1/staking.ts | 2506 +++++++ .../types/cosmos/staking/v1beta1/tx.ts | 1403 ++++ .../cosmos/store/internal/kv/v1beta1/kv.ts | 202 + .../cosmos/store/snapshots/v1/snapshot.ts | 728 ++ .../types/cosmos/store/streaming/abci/grpc.ts | 362 + .../types/cosmos/store/v1beta1/commit_info.ts | 363 + .../types/cosmos/store/v1beta1/listening.ts | 294 + .../types/cosmos/tx/config/v1/config.ts | 123 + .../cosmos/tx/signing/v1beta1/signing.ts | 620 ++ .../types/cosmos/tx/v1beta1/service.ts | 1855 ++++++ .../types/cosmos/tx/v1beta1/tx.ts | 1615 +++++ .../types/cosmos/upgrade/module/v1/module.ts | 98 + .../types/cosmos/upgrade/v1beta1/query.ts | 811 +++ .../types/cosmos/upgrade/v1beta1/tx.ts | 337 + .../types/cosmos/upgrade/v1beta1/upgrade.ts | 513 ++ .../types/cosmos/vesting/module/v1/module.ts | 78 + .../types/cosmos/vesting/v1beta1/tx.ts | 628 ++ .../types/cosmos/vesting/v1beta1/vesting.ts | 610 ++ .../types/cosmos_proto/cosmos.ts | 54 +- .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 381 +- .../types/google/protobuf/any.ts | 72 +- .../types/google/protobuf/descriptor.ts | 3082 +++++++-- .../types/google/protobuf/duration.ts | 73 +- .../types/google/protobuf/timestamp.ts | 75 +- .../types/route-name.eta | 45 + .../types/tendermint/abci/types.ts | 5925 +++++++++++++++++ .../types/tendermint/crypto/keys.ts | 140 + .../types/tendermint/crypto/proof.ts | 520 ++ .../types/tendermint/libs/bits/types.ts | 137 + .../types/tendermint/p2p/types.ts | 528 ++ .../types/tendermint/types/block.ts | 154 + .../types/tendermint/types/evidence.ts | 489 ++ .../types/tendermint/types/params.ts | 686 ++ .../types/tendermint/types/types.ts | 2065 ++++++ .../types/tendermint/types/validator.ts | 415 ++ .../types/tendermint/version/types.ts | 214 + ts-client/cosmos.gov.v1/module.ts | 1110 +-- ts-client/cosmos.gov.v1/registry.ts | 164 +- ts-client/cosmos.gov.v1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../cosmos.gov.v1/types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../cosmos.gov.v1/types/fairyring/pep/tx.ts | 1665 +++++ .../cosmos.gov.v1/types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../cosmos.gov.v1/types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 73 +- ts-client/cosmos.gov.v1/types/route-name.eta | 45 + ts-client/cosmos.gov.v1beta1/module.ts | 826 +-- ts-client/cosmos.gov.v1beta1/registry.ts | 130 +- .../cosmos.gov.v1beta1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 73 +- .../cosmos.gov.v1beta1/types/route-name.eta | 45 + ts-client/cosmos.group.v1/module.ts | 1868 +++--- ts-client/cosmos.group.v1/registry.ts | 288 +- .../cosmos.group.v1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../cosmos.group.v1/types/fairyring/pep/tx.ts | 1665 +++++ .../cosmos.group.v1/types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../cosmos.group.v1/types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 73 +- .../cosmos.group.v1/types/route-name.eta | 45 + ts-client/cosmos.mint.v1beta1/module.ts | 244 +- ts-client/cosmos.mint.v1beta1/registry.ts | 36 +- .../cosmos.mint.v1beta1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 329 + .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../cosmos.mint.v1beta1/types/route-name.eta | 45 + ts-client/cosmos.nft.v1beta1/module.ts | 466 +- ts-client/cosmos.nft.v1beta1/registry.ts | 56 +- .../cosmos.nft.v1beta1/types/amino/amino.ts | 9 + .../cosmos/app/runtime/v1alpha1/module.ts | 378 ++ .../types/cosmos/app/v1alpha1/config.ts | 339 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../types/cosmos/app/v1alpha1/query.ts | 174 + .../types/cosmos/auth/module/v1/module.ts | 224 + .../types/cosmos/auth/v1beta1/auth.ts | 517 ++ .../types/cosmos/auth/v1beta1/genesis.ts | 123 + .../types/cosmos/auth/v1beta1/query.ts | 1545 +++++ .../types/cosmos/auth/v1beta1/tx.ts | 211 + .../types/cosmos/authz/module/v1/module.ts | 78 + .../types/cosmos/authz/v1beta1/authz.ts | 403 ++ .../types/cosmos/authz/v1beta1/event.ts | 235 + .../types/cosmos/authz/v1beta1/genesis.ts | 100 + .../types/cosmos/authz/v1beta1/query.ts | 629 ++ .../types/cosmos/authz/v1beta1/tx.ts | 565 ++ .../types/cosmos/autocli/v1/options.ts | 1019 +++ .../types/cosmos/autocli/v1/query.ts | 288 + .../types/cosmos/bank/module/v1/module.ts | 147 + .../types/cosmos/bank/v1beta1/authz.ts | 127 + .../types/cosmos/bank/v1beta1/bank.ts | 755 +++ .../types/cosmos/bank/v1beta1/genesis.ts | 270 + .../types/cosmos/bank/v1beta1/query.ts | 2382 +++++++ .../types/cosmos/bank/v1beta1/tx.ts | 687 ++ .../types/cosmos/base/abci/v1beta1/abci.ts | 1425 ++++ .../types/cosmos/base/node/v1beta1/query.ts | 476 ++ .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../base/reflection/v1beta1/reflection.ts | 325 + .../base/reflection/v2alpha1/reflection.ts | 2057 ++++++ .../cosmos/base/tendermint/v1beta1/query.ts | 1974 ++++++ .../cosmos/base/tendermint/v1beta1/types.ts | 530 ++ .../types/cosmos/base/v1beta1/coin.ts | 335 + .../types/cosmos/circuit/module/v1/module.ts | 98 + .../types/cosmos/circuit/v1/query.ts | 470 ++ .../types/cosmos/circuit/v1/tx.ts | 566 ++ .../types/cosmos/circuit/v1/types.ts | 356 + .../cosmos/consensus/module/v1/module.ts | 98 + .../types/cosmos/consensus/v1/query.ts | 180 + .../types/cosmos/consensus/v1/tx.ts | 266 + .../types/cosmos/crisis/module/v1/module.ts | 117 + .../types/cosmos/crisis/v1beta1/genesis.ts | 104 + .../types/cosmos/crisis/v1beta1/tx.ts | 362 + .../types/cosmos/crypto/ed25519/keys.ts | 193 + .../types/cosmos/crypto/hd/v1/hd.ts | 173 + .../types/cosmos/crypto/keyring/v1/record.ts | 432 ++ .../types/cosmos/crypto/multisig/keys.ts | 122 + .../crypto/multisig/v1beta1/multisig.ts | 215 + .../types/cosmos/crypto/secp256k1/keys.ts | 190 + .../types/cosmos/crypto/secp256r1/keys.ts | 191 + .../cosmos/distribution/module/v1/module.ts | 116 + .../distribution/v1beta1/distribution.ts | 1149 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1000 +++ .../cosmos/distribution/v1beta1/query.ts | 1674 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1161 ++++ .../types/cosmos/evidence/module/v1/module.ts | 78 + .../types/cosmos/evidence/v1beta1/evidence.ts | 190 + .../types/cosmos/evidence/v1beta1/genesis.ts | 97 + .../types/cosmos/evidence/v1beta1/query.ts | 408 ++ .../types/cosmos/evidence/v1beta1/tx.ts | 240 + .../types/cosmos/feegrant/module/v1/module.ts | 78 + .../types/cosmos/feegrant/v1beta1/feegrant.ts | 501 ++ .../types/cosmos/feegrant/v1beta1/genesis.ts | 100 + .../types/cosmos/feegrant/v1beta1/query.ts | 586 ++ .../types/cosmos/feegrant/v1beta1/tx.ts | 490 ++ .../types/cosmos/genutil/module/v1/module.ts | 78 + .../types/cosmos/genutil/v1beta1/genesis.ts | 121 + .../types/cosmos/gov/module/v1/module.ts | 131 + .../types/cosmos/gov/v1/genesis.ts | 321 + .../types/cosmos/gov/v1/gov.ts | 2031 ++++++ .../types/cosmos/gov/v1/query.ts | 1575 +++++ .../types/cosmos/gov/v1/tx.ts | 1531 +++++ .../types/cosmos/gov/v1beta1/genesis.ts | 234 + .../types/cosmos/gov/v1beta1/gov.ts | 1356 ++++ .../types/cosmos/gov/v1beta1/query.ts | 1413 ++++ .../types/cosmos/gov/v1beta1/tx.ts | 880 +++ .../types/cosmos/group/module/v1/module.ts | 139 + .../types/cosmos/group/v1/events.ts | 780 +++ .../types/cosmos/group/v1/genesis.ts | 257 + .../types/cosmos/group/v1/query.ts | 2395 +++++++ .../types/cosmos/group/v1/tx.ts | 2576 +++++++ .../types/cosmos/group/v1/types.ts | 1799 +++++ .../types/cosmos/mint/module/v1/module.ts | 116 + .../types/cosmos/mint/v1beta1/genesis.ts | 124 + .../types/cosmos/mint/v1beta1/mint.ts | 285 + .../types/cosmos/mint/v1beta1/query.ts | 450 ++ .../types/cosmos/mint/v1beta1/tx.ts | 211 + .../types/cosmos/msg/textual/v1/textual.ts | 9 + .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos/nft/module/v1/module.ts | 78 + .../types/cosmos/nft/v1beta1/event.ts | 70 +- .../types/cosmos/nft/v1beta1/genesis.ts | 54 +- .../types/cosmos/nft/v1beta1/nft.ts | 64 +- .../types/cosmos/nft/v1beta1/query.ts | 261 +- .../types/cosmos/nft/v1beta1/tx.ts | 50 +- .../cosmos/orm/module/v1alpha1/module.ts | 82 + .../types/cosmos/orm/query/v1alpha1/query.ts | 911 +++ .../types/cosmos/orm/v1/orm.ts | 444 ++ .../types/cosmos/orm/v1alpha1/schema.ts | 316 + .../types/cosmos/params/module/v1/module.ts | 78 + .../types/cosmos/params/v1beta1/params.ts | 230 + .../types/cosmos/params/v1beta1/query.ts | 433 ++ .../types/cosmos/query/v1/query.ts | 9 + .../types/cosmos/reflection/v1/reflection.ts | 178 + .../types/cosmos/slashing/module/v1/module.ts | 98 + .../types/cosmos/slashing/v1beta1/genesis.ts | 415 ++ .../types/cosmos/slashing/v1beta1/query.ts | 481 ++ .../types/cosmos/slashing/v1beta1/slashing.ts | 411 ++ .../types/cosmos/slashing/v1beta1/tx.ts | 333 + .../types/cosmos/staking/module/v1/module.ts | 157 + .../types/cosmos/staking/v1beta1/authz.ts | 301 + .../types/cosmos/staking/v1beta1/genesis.ts | 367 + .../types/cosmos/staking/v1beta1/query.ts | 2495 +++++++ .../types/cosmos/staking/v1beta1/staking.ts | 2506 +++++++ .../types/cosmos/staking/v1beta1/tx.ts | 1403 ++++ .../cosmos/store/internal/kv/v1beta1/kv.ts | 202 + .../cosmos/store/snapshots/v1/snapshot.ts | 728 ++ .../types/cosmos/store/streaming/abci/grpc.ts | 362 + .../types/cosmos/store/v1beta1/commit_info.ts | 363 + .../types/cosmos/store/v1beta1/listening.ts | 294 + .../types/cosmos/tx/config/v1/config.ts | 123 + .../cosmos/tx/signing/v1beta1/signing.ts | 620 ++ .../types/cosmos/tx/v1beta1/service.ts | 1855 ++++++ .../types/cosmos/tx/v1beta1/tx.ts | 1615 +++++ .../types/cosmos/upgrade/module/v1/module.ts | 98 + .../types/cosmos/upgrade/v1beta1/query.ts | 811 +++ .../types/cosmos/upgrade/v1beta1/tx.ts | 337 + .../types/cosmos/upgrade/v1beta1/upgrade.ts | 513 ++ .../types/cosmos/vesting/module/v1/module.ts | 78 + .../types/cosmos/vesting/v1beta1/tx.ts | 628 ++ .../types/cosmos/vesting/v1beta1/vesting.ts | 610 ++ .../types/cosmos_proto/cosmos.ts | 54 +- .../types/gogoproto/gogo.ts | 9 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 381 +- .../types/google/protobuf/any.ts | 72 +- .../types/google/protobuf/descriptor.ts | 3082 +++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/google/protobuf/timestamp.ts | 227 + .../cosmos.nft.v1beta1/types/route-name.eta | 45 + .../types/tendermint/abci/types.ts | 5925 +++++++++++++++++ .../types/tendermint/crypto/keys.ts | 140 + .../types/tendermint/crypto/proof.ts | 520 ++ .../types/tendermint/libs/bits/types.ts | 137 + .../types/tendermint/p2p/types.ts | 528 ++ .../types/tendermint/types/block.ts | 154 + .../types/tendermint/types/evidence.ts | 489 ++ .../types/tendermint/types/params.ts | 686 ++ .../types/tendermint/types/types.ts | 2065 ++++++ .../types/tendermint/types/validator.ts | 415 ++ .../types/tendermint/version/types.ts | 214 + ts-client/cosmos.params.v1beta1/module.ts | 142 +- ts-client/cosmos.params.v1beta1/registry.ts | 20 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 329 + .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 9 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + ts-client/cosmos.slashing.v1beta1/module.ts | 362 +- ts-client/cosmos.slashing.v1beta1/registry.ts | 50 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 73 +- .../types/route-name.eta | 45 + ts-client/cosmos.staking.v1beta1/module.ts | 1596 ++--- ts-client/cosmos.staking.v1beta1/registry.ts | 240 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 73 +- .../types/route-name.eta | 45 + ts-client/cosmos.tx.v1beta1/module.ts | 724 +- ts-client/cosmos.tx.v1beta1/registry.ts | 100 +- .../cosmos.tx.v1beta1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 9 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../cosmos.tx.v1beta1/types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 73 +- .../cosmos.tx.v1beta1/types/route-name.eta | 45 + ts-client/cosmos.upgrade.v1beta1/module.ts | 356 +- ts-client/cosmos.upgrade.v1beta1/registry.ts | 48 +- .../types/amino/amino.ts | 6 + .../cosmos/app/runtime/v1alpha1/module.ts | 378 ++ .../types/cosmos/app/v1alpha1/config.ts | 339 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../types/cosmos/app/v1alpha1/query.ts | 174 + .../types/cosmos/auth/module/v1/module.ts | 224 + .../types/cosmos/auth/v1beta1/auth.ts | 517 ++ .../types/cosmos/auth/v1beta1/genesis.ts | 123 + .../types/cosmos/auth/v1beta1/query.ts | 1545 +++++ .../types/cosmos/auth/v1beta1/tx.ts | 211 + .../types/cosmos/authz/module/v1/module.ts | 78 + .../types/cosmos/authz/v1beta1/authz.ts | 403 ++ .../types/cosmos/authz/v1beta1/event.ts | 235 + .../types/cosmos/authz/v1beta1/genesis.ts | 100 + .../types/cosmos/authz/v1beta1/query.ts | 629 ++ .../types/cosmos/authz/v1beta1/tx.ts | 565 ++ .../types/cosmos/autocli/v1/options.ts | 1019 +++ .../types/cosmos/autocli/v1/query.ts | 288 + .../types/cosmos/bank/module/v1/module.ts | 147 + .../types/cosmos/bank/v1beta1/authz.ts | 127 + .../types/cosmos/bank/v1beta1/bank.ts | 755 +++ .../types/cosmos/bank/v1beta1/genesis.ts | 270 + .../types/cosmos/bank/v1beta1/query.ts | 2382 +++++++ .../types/cosmos/bank/v1beta1/tx.ts | 687 ++ .../types/cosmos/base/abci/v1beta1/abci.ts | 1425 ++++ .../types/cosmos/base/node/v1beta1/query.ts | 476 ++ .../cosmos/base/query/v1beta1/pagination.ts | 329 + .../base/reflection/v1beta1/reflection.ts | 325 + .../base/reflection/v2alpha1/reflection.ts | 2057 ++++++ .../cosmos/base/tendermint/v1beta1/query.ts | 1974 ++++++ .../cosmos/base/tendermint/v1beta1/types.ts | 530 ++ .../types/cosmos/base/v1beta1/coin.ts | 335 + .../types/cosmos/circuit/module/v1/module.ts | 98 + .../types/cosmos/circuit/v1/query.ts | 470 ++ .../types/cosmos/circuit/v1/tx.ts | 566 ++ .../types/cosmos/circuit/v1/types.ts | 356 + .../cosmos/consensus/module/v1/module.ts | 98 + .../types/cosmos/consensus/v1/query.ts | 180 + .../types/cosmos/consensus/v1/tx.ts | 266 + .../types/cosmos/crisis/module/v1/module.ts | 117 + .../types/cosmos/crisis/v1beta1/genesis.ts | 104 + .../types/cosmos/crisis/v1beta1/tx.ts | 362 + .../types/cosmos/crypto/ed25519/keys.ts | 193 + .../types/cosmos/crypto/hd/v1/hd.ts | 173 + .../types/cosmos/crypto/keyring/v1/record.ts | 432 ++ .../types/cosmos/crypto/multisig/keys.ts | 122 + .../crypto/multisig/v1beta1/multisig.ts | 215 + .../types/cosmos/crypto/secp256k1/keys.ts | 190 + .../types/cosmos/crypto/secp256r1/keys.ts | 191 + .../cosmos/distribution/module/v1/module.ts | 116 + .../distribution/v1beta1/distribution.ts | 1149 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1000 +++ .../cosmos/distribution/v1beta1/query.ts | 1674 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1161 ++++ .../types/cosmos/evidence/module/v1/module.ts | 78 + .../types/cosmos/evidence/v1beta1/evidence.ts | 190 + .../types/cosmos/evidence/v1beta1/genesis.ts | 97 + .../types/cosmos/evidence/v1beta1/query.ts | 408 ++ .../types/cosmos/evidence/v1beta1/tx.ts | 240 + .../types/cosmos/feegrant/module/v1/module.ts | 78 + .../types/cosmos/feegrant/v1beta1/feegrant.ts | 501 ++ .../types/cosmos/feegrant/v1beta1/genesis.ts | 100 + .../types/cosmos/feegrant/v1beta1/query.ts | 586 ++ .../types/cosmos/feegrant/v1beta1/tx.ts | 490 ++ .../types/cosmos/genutil/module/v1/module.ts | 78 + .../types/cosmos/genutil/v1beta1/genesis.ts | 121 + .../types/cosmos/gov/module/v1/module.ts | 131 + .../types/cosmos/gov/v1/genesis.ts | 321 + .../types/cosmos/gov/v1/gov.ts | 2031 ++++++ .../types/cosmos/gov/v1/query.ts | 1575 +++++ .../types/cosmos/gov/v1/tx.ts | 1531 +++++ .../types/cosmos/gov/v1beta1/genesis.ts | 234 + .../types/cosmos/gov/v1beta1/gov.ts | 1356 ++++ .../types/cosmos/gov/v1beta1/query.ts | 1413 ++++ .../types/cosmos/gov/v1beta1/tx.ts | 880 +++ .../types/cosmos/group/module/v1/module.ts | 139 + .../types/cosmos/group/v1/events.ts | 780 +++ .../types/cosmos/group/v1/genesis.ts | 257 + .../types/cosmos/group/v1/query.ts | 2395 +++++++ .../types/cosmos/group/v1/tx.ts | 2576 +++++++ .../types/cosmos/group/v1/types.ts | 1799 +++++ .../types/cosmos/mint/module/v1/module.ts | 116 + .../types/cosmos/mint/v1beta1/genesis.ts | 124 + .../types/cosmos/mint/v1beta1/mint.ts | 285 + .../types/cosmos/mint/v1beta1/query.ts | 450 ++ .../types/cosmos/mint/v1beta1/tx.ts | 211 + .../types/cosmos/msg/textual/v1/textual.ts | 9 + .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos/nft/module/v1/module.ts | 78 + .../types/cosmos/nft/v1beta1/event.ts | 349 + .../types/cosmos/nft/v1beta1/genesis.ts | 200 + .../types/cosmos/nft/v1beta1/nft.ts | 336 + .../types/cosmos/nft/v1beta1/query.ts | 1152 ++++ .../types/cosmos/nft/v1beta1/tx.ts | 224 + .../cosmos/orm/module/v1alpha1/module.ts | 82 + .../types/cosmos/orm/query/v1alpha1/query.ts | 911 +++ .../types/cosmos/orm/v1/orm.ts | 444 ++ .../types/cosmos/orm/v1alpha1/schema.ts | 316 + .../types/cosmos/params/module/v1/module.ts | 78 + .../types/cosmos/params/v1beta1/params.ts | 230 + .../types/cosmos/params/v1beta1/query.ts | 433 ++ .../types/cosmos/query/v1/query.ts | 9 + .../types/cosmos/reflection/v1/reflection.ts | 178 + .../types/cosmos/slashing/module/v1/module.ts | 98 + .../types/cosmos/slashing/v1beta1/genesis.ts | 415 ++ .../types/cosmos/slashing/v1beta1/query.ts | 481 ++ .../types/cosmos/slashing/v1beta1/slashing.ts | 411 ++ .../types/cosmos/slashing/v1beta1/tx.ts | 333 + .../types/cosmos/staking/module/v1/module.ts | 157 + .../types/cosmos/staking/v1beta1/authz.ts | 301 + .../types/cosmos/staking/v1beta1/genesis.ts | 367 + .../types/cosmos/staking/v1beta1/query.ts | 2495 +++++++ .../types/cosmos/staking/v1beta1/staking.ts | 2506 +++++++ .../types/cosmos/staking/v1beta1/tx.ts | 1403 ++++ .../cosmos/store/internal/kv/v1beta1/kv.ts | 202 + .../cosmos/store/snapshots/v1/snapshot.ts | 728 ++ .../types/cosmos/store/streaming/abci/grpc.ts | 362 + .../types/cosmos/store/v1beta1/commit_info.ts | 363 + .../types/cosmos/store/v1beta1/listening.ts | 294 + .../types/cosmos/tx/config/v1/config.ts | 123 + .../cosmos/tx/signing/v1beta1/signing.ts | 620 ++ .../types/cosmos/tx/v1beta1/service.ts | 1855 ++++++ .../types/cosmos/tx/v1beta1/tx.ts | 1615 +++++ .../types/cosmos/upgrade/module/v1/module.ts | 98 + .../types/cosmos/upgrade/v1beta1/query.ts | 201 +- .../types/cosmos/upgrade/v1beta1/tx.ts | 70 +- .../types/cosmos/upgrade/v1beta1/upgrade.ts | 133 +- .../types/cosmos/vesting/module/v1/module.ts | 78 + .../types/cosmos/vesting/v1beta1/tx.ts | 628 ++ .../types/cosmos/vesting/v1beta1/vesting.ts | 610 ++ .../types/cosmos_proto/cosmos.ts | 54 +- .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 381 +- .../types/google/protobuf/any.ts | 72 +- .../types/google/protobuf/descriptor.ts | 3082 +++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/google/protobuf/timestamp.ts | 75 +- .../types/route-name.eta | 45 + .../types/tendermint/abci/types.ts | 5925 +++++++++++++++++ .../types/tendermint/crypto/keys.ts | 140 + .../types/tendermint/crypto/proof.ts | 520 ++ .../types/tendermint/libs/bits/types.ts | 137 + .../types/tendermint/p2p/types.ts | 528 ++ .../types/tendermint/types/block.ts | 154 + .../types/tendermint/types/evidence.ts | 489 ++ .../types/tendermint/types/params.ts | 686 ++ .../types/tendermint/types/types.ts | 2065 ++++++ .../types/tendermint/types/validator.ts | 415 ++ .../types/tendermint/version/types.ts | 214 + ts-client/cosmos.vesting.v1beta1/module.ts | 204 +- ts-client/cosmos.vesting.v1beta1/registry.ts | 34 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 329 + .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 9 + .../types/google/api/http.ts | 756 +++ .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + ts-client/cosmwasm.wasm.v1/module.ts | 2360 +++---- ts-client/cosmwasm.wasm.v1/registry.ts | 364 +- .../cosmwasm.wasm.v1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../cosmwasm.wasm.v1/types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../cosmwasm.wasm.v1/types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../cosmwasm.wasm.v1/types/route-name.eta | 45 + ts-client/fairyring.keyshare/module.ts | 2000 +++--- ts-client/fairyring.keyshare/registry.ts | 284 +- .../fairyring.keyshare/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 66 +- .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 663 +- .../fairyring/keyshare/authorized_address.ts | 41 +- .../types/fairyring/keyshare/commitments.ts | 40 +- .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 191 +- .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 32 +- .../types/fairyring/keyshare/packet.ts | 972 ++- .../types/fairyring/keyshare/params.ts | 97 +- .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 1202 ++-- .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 988 ++- .../types/fairyring/keyshare/validator_set.ts | 46 +- .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 73 +- .../fairyring.keyshare/types/route-name.eta | 45 + ts-client/fairyring.pep/module.ts | 1485 +++-- ts-client/fairyring.pep/registry.ts | 178 +- ts-client/fairyring.pep/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 66 +- .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../fairyring.pep/types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 663 +- .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 246 +- .../types/fairyring/pep/genesis.ts | 150 +- .../types/fairyring/pep/module/module.ts | 32 +- .../types/fairyring/pep/params.ts | 92 +- .../types/fairyring/pep/pep_nonce.ts | 77 +- .../types/fairyring/pep/query.ts | 1145 ++-- .../types/fairyring/pep/request_id.ts | 421 +- .../fairyring.pep/types/fairyring/pep/tx.ts | 1225 +++- .../fairyring.pep/types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../fairyring.pep/types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 73 +- ts-client/fairyring.pep/types/route-name.eta | 45 + ts-client/ibc.applications.fee.v1/module.ts | 920 +-- ts-client/ibc.applications.fee.v1/registry.ts | 140 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + .../module.ts | 254 +- .../registry.ts | 34 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 329 + .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + .../module.ts | 114 +- .../registry.ts | 14 +- .../types/amino/amino.ts | 9 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 329 + .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 302 + .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + .../ibc.applications.transfer.v1/module.ts | 444 +- .../ibc.applications.transfer.v1/registry.ts | 68 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 48 +- .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + ts-client/ibc.core.channel.v1/module.ts | 2016 +++--- ts-client/ibc.core.channel.v1/registry.ts | 312 +- .../ibc.core.channel.v1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../ibc.core.channel.v1/types/route-name.eta | 45 + ts-client/ibc.core.client.v1/module.ts | 992 +-- ts-client/ibc.core.client.v1/registry.ts | 148 +- .../ibc.core.client.v1/types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../ibc.core.client.v1/types/route-name.eta | 45 + ts-client/ibc.core.connection.v1/module.ts | 678 +- ts-client/ibc.core.connection.v1/registry.ts | 104 +- .../types/amino/amino.ts | 6 + .../types/cosmos/app/v1alpha1/module.ts | 342 + .../cosmos/base/query/v1beta1/pagination.ts | 115 +- .../types/cosmos/base/v1beta1/coin.ts | 205 + .../distribution/v1beta1/distribution.ts | 1150 ++++ .../cosmos/distribution/v1beta1/genesis.ts | 1005 +++ .../cosmos/distribution/v1beta1/query.ts | 1669 +++++ .../types/cosmos/distribution/v1beta1/tx.ts | 1145 ++++ .../types/cosmos/msg/v1/msg.ts | 6 + .../types/cosmos_proto/cosmos.ts | 54 +- .../types/fairyring/common/shared_types.ts | 1010 +++ .../fairyring/keyshare/authorized_address.ts | 131 + .../types/fairyring/keyshare/commitments.ts | 100 + .../fairyring/keyshare/decryption_key.ts | 126 + .../types/fairyring/keyshare/genesis.ts | 288 + .../types/fairyring/keyshare/keyshare.ts | 542 ++ .../types/fairyring/keyshare/module/module.ts | 98 + .../types/fairyring/keyshare/packet.ts | 1458 ++++ .../types/fairyring/keyshare/params.ts | 228 + .../types/fairyring/keyshare/pubkey.ts | 389 ++ .../types/fairyring/keyshare/query.ts | 2156 ++++++ .../keyshare/requested_decryption_key.ts | 642 ++ .../types/fairyring/keyshare/tx.ts | 2228 +++++++ .../types/fairyring/keyshare/validator_set.ts | 150 + .../types/fairyring/pep/decryption_key.ts | 145 + .../types/fairyring/pep/encrypted_tx.ts | 637 ++ .../types/fairyring/pep/genesis.ts | 269 + .../types/fairyring/pep/module/module.ts | 98 + .../types/fairyring/pep/params.ts | 299 + .../types/fairyring/pep/pep_nonce.ts | 129 + .../types/fairyring/pep/query.ts | 1846 +++++ .../types/fairyring/pep/request_id.ts | 501 ++ .../types/fairyring/pep/tx.ts | 1665 +++++ .../types/gogoproto/gogo.ts | 6 + .../types/google/api/annotations.ts | 6 + .../types/google/api/http.ts | 373 +- .../types/google/protobuf/descriptor.ts | 3461 ++++++++-- .../types/google/protobuf/duration.ts | 198 + .../types/route-name.eta | 45 + 1864 files changed, 1076928 insertions(+), 46636 deletions(-) create mode 100644 ts-client/cosmos.auth.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.auth.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.authz.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.authz.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.bank.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.bank.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.base.node.v1beta1/types/amino/amino.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/cosmos/msg/v1/msg.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/cosmos_proto/cosmos.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.base.node.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/msg/v1/msg.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.base.tendermint.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.circuit.v1/types/amino/amino.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/app/runtime/v1alpha1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/config.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/auth/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/auth.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/authz/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/authz.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/event.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/autocli/v1/options.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/autocli/v1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/bank/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/authz.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/bank.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/base/abci/v1beta1/abci.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/base/node/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/base/reflection/v1beta1/reflection.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/base/reflection/v2alpha1/reflection.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/base/tendermint/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/base/tendermint/v1beta1/types.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/circuit/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/consensus/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/consensus/v1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/consensus/v1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crisis/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crisis/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crisis/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crypto/ed25519/keys.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crypto/hd/v1/hd.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crypto/keyring/v1/record.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crypto/multisig/keys.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crypto/multisig/v1beta1/multisig.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crypto/secp256k1/keys.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/crypto/secp256r1/keys.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/distribution/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/evidence/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/evidence.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/feegrant/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/feegrant.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/genutil/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/genutil/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/gov/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/gov.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/gov.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/group/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/group/v1/events.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/group/v1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/group/v1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/group/v1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/group/v1/types.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/mint/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/mint.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/msg/textual/v1/textual.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/nft/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/event.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/nft.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/orm/module/v1alpha1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/orm/query/v1alpha1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/orm/v1/orm.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/orm/v1alpha1/schema.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/params/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/params/v1beta1/params.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/params/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/reflection/v1/reflection.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/slashing/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/slashing.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/staking/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/authz.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/staking.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/store/internal/kv/v1beta1/kv.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/store/snapshots/v1/snapshot.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/store/streaming/abci/grpc.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/store/v1beta1/commit_info.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/store/v1beta1/listening.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/tx/config/v1/config.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/tx/signing/v1beta1/signing.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/tx/v1beta1/service.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/tx/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/upgrade/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/query.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/upgrade.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/vesting/module/v1/module.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/vesting/v1beta1/tx.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos/vesting/v1beta1/vesting.ts create mode 100644 ts-client/cosmos.circuit.v1/types/cosmos_proto/cosmos.ts create mode 100644 ts-client/cosmos.circuit.v1/types/gogoproto/gogo.ts create mode 100644 ts-client/cosmos.circuit.v1/types/google/protobuf/any.ts create mode 100644 ts-client/cosmos.circuit.v1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.circuit.v1/types/google/protobuf/timestamp.ts create mode 100644 ts-client/cosmos.circuit.v1/types/route-name.eta create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/abci/types.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/crypto/keys.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/crypto/proof.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/libs/bits/types.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/p2p/types.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/types/block.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/types/evidence.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/types/params.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/types/types.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/types/validator.ts create mode 100644 ts-client/cosmos.circuit.v1/types/tendermint/version/types.ts create mode 100644 ts-client/cosmos.consensus.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.consensus.v1/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 ts-client/cosmos.consensus.v1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.consensus.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.consensus.v1/types/route-name.eta create mode 100644 ts-client/cosmos.crisis.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/google/api/annotations.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/google/api/http.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.crisis.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.distribution.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.distribution.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/config.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/auth.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/authz.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/event.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/autocli/v1/options.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/autocli/v1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/authz.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/bank.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/base/node/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/types.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/v1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/v1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/ed25519/keys.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/hd/v1/hd.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/keyring/v1/record.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/multisig/keys.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/secp256k1/keys.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/secp256r1/keys.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/genutil/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/gov.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/gov.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/group/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/events.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/types.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/mint.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/msg/textual/v1/textual.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/event.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/nft.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/v1/orm.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/v1alpha1/schema.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/params/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/params/v1beta1/params.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/params/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/query/v1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/reflection/v1/reflection.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/authz.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/staking.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/store/streaming/abci/grpc.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/store/v1beta1/commit_info.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/store/v1beta1/listening.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/config/v1/config.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/v1beta1/service.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/query.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/module/v1/module.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/v1beta1/tx.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/abci/types.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/crypto/keys.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/crypto/proof.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/libs/bits/types.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/p2p/types.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/types/block.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/types/evidence.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/types/params.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/types/types.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/types/validator.ts create mode 100644 ts-client/cosmos.evidence.v1beta1/types/tendermint/version/types.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/config.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/auth.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/authz.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/event.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/autocli/v1/options.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/autocli/v1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/authz.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/bank.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/node/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/types.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/v1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/v1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/ed25519/keys.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/hd/v1/hd.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/keyring/v1/record.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/multisig/keys.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/secp256k1/keys.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/secp256r1/keys.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/genutil/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/gov.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/gov.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/events.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/types.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/mint.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/msg/textual/v1/textual.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/event.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/nft.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/v1/orm.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/v1alpha1/schema.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/v1beta1/params.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/query/v1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/reflection/v1/reflection.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/authz.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/staking.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/streaming/abci/grpc.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/v1beta1/commit_info.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/v1beta1/listening.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/config/v1/config.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/v1beta1/service.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/query.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/module/v1/module.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/v1beta1/tx.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/abci/types.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/crypto/keys.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/crypto/proof.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/libs/bits/types.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/p2p/types.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/block.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/evidence.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/params.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/types.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/validator.ts create mode 100644 ts-client/cosmos.feegrant.v1beta1/types/tendermint/version/types.ts create mode 100644 ts-client/cosmos.gov.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.gov.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.gov.v1/types/route-name.eta create mode 100644 ts-client/cosmos.gov.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.gov.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.group.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.group.v1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.group.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.group.v1/types/route-name.eta create mode 100644 ts-client/cosmos.mint.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.mint.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.nft.v1beta1/types/amino/amino.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/config.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/auth/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/auth.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/authz/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/authz.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/event.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/autocli/v1/options.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/autocli/v1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/bank/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/authz.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/bank.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/base/node/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/types.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/v1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/v1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/ed25519/keys.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/hd/v1/hd.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/keyring/v1/record.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/multisig/keys.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/secp256k1/keys.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/secp256r1/keys.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/genutil/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/gov/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/gov.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/gov.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/group/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/events.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/types.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/mint/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/mint.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/msg/textual/v1/textual.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/nft/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/orm/v1/orm.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/orm/v1alpha1/schema.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/params/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/params/v1beta1/params.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/params/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/query/v1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/reflection/v1/reflection.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/staking/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/authz.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/staking.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/store/streaming/abci/grpc.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/store/v1beta1/commit_info.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/store/v1beta1/listening.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/tx/config/v1/config.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/tx/v1beta1/service.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/tx/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/query.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/module/v1/module.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/v1beta1/tx.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/gogoproto/gogo.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/google/protobuf/timestamp.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/abci/types.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/crypto/keys.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/crypto/proof.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/libs/bits/types.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/p2p/types.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/types/block.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/types/evidence.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/types/params.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/types/types.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/types/validator.ts create mode 100644 ts-client/cosmos.nft.v1beta1/types/tendermint/version/types.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/cosmos/msg/v1/msg.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.params.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.slashing.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.slashing.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.staking.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.staking.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.tx.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/cosmos/msg/v1/msg.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.tx.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/config.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/auth.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/authz.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/event.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/autocli/v1/options.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/autocli/v1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/authz.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/bank.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/node/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/types.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/v1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/v1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/ed25519/keys.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/hd/v1/hd.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/keyring/v1/record.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/multisig/keys.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/secp256k1/keys.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/secp256r1/keys.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/genutil/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/gov.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/gov.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/events.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/types.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/mint.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/msg/textual/v1/textual.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/event.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/nft.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/v1/orm.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/v1alpha1/schema.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/v1beta1/params.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/query/v1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/reflection/v1/reflection.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/authz.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/query.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/staking.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/streaming/abci/grpc.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/v1beta1/commit_info.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/v1beta1/listening.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/config/v1/config.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/v1beta1/service.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/module/v1/module.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/v1beta1/tx.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/abci/types.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/crypto/keys.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/crypto/proof.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/libs/bits/types.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/p2p/types.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/block.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/evidence.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/params.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/types.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/validator.ts create mode 100644 ts-client/cosmos.upgrade.v1beta1/types/tendermint/version/types.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/google/api/annotations.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/google/api/http.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmos.vesting.v1beta1/types/route-name.eta create mode 100644 ts-client/cosmwasm.wasm.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/google/protobuf/duration.ts create mode 100644 ts-client/cosmwasm.wasm.v1/types/route-name.eta create mode 100644 ts-client/fairyring.keyshare/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/pep/genesis.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/pep/module/module.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/pep/params.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/pep/query.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/pep/request_id.ts create mode 100644 ts-client/fairyring.keyshare/types/fairyring/pep/tx.ts create mode 100644 ts-client/fairyring.keyshare/types/route-name.eta create mode 100644 ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/params.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/query.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/fairyring.pep/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/fairyring.pep/types/route-name.eta create mode 100644 ts-client/ibc.applications.fee.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/google/protobuf/duration.ts create mode 100644 ts-client/ibc.applications.fee.v1/types/route-name.eta create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/protobuf/duration.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.controller.v1/types/route-name.eta create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/amino/amino.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos_proto/cosmos.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/google/protobuf/duration.ts create mode 100644 ts-client/ibc.applications.interchain_accounts.host.v1/types/route-name.eta create mode 100644 ts-client/ibc.applications.transfer.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/google/protobuf/duration.ts create mode 100644 ts-client/ibc.applications.transfer.v1/types/route-name.eta create mode 100644 ts-client/ibc.core.channel.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/ibc.core.channel.v1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/ibc.core.channel.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/ibc.core.channel.v1/types/google/protobuf/duration.ts create mode 100644 ts-client/ibc.core.channel.v1/types/route-name.eta create mode 100644 ts-client/ibc.core.client.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/ibc.core.client.v1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/ibc.core.client.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/ibc.core.client.v1/types/google/protobuf/duration.ts create mode 100644 ts-client/ibc.core.client.v1/types/route-name.eta create mode 100644 ts-client/ibc.core.connection.v1/types/cosmos/app/v1alpha1/module.ts create mode 100644 ts-client/ibc.core.connection.v1/types/cosmos/base/v1beta1/coin.ts create mode 100644 ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/distribution.ts create mode 100644 ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/genesis.ts create mode 100644 ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/query.ts create mode 100644 ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/tx.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/common/shared_types.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/authorized_address.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/commitments.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/decryption_key.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/genesis.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/keyshare.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/module/module.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/packet.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/params.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/pubkey.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/query.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/requested_decryption_key.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/tx.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/keyshare/validator_set.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/pep/decryption_key.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/pep/encrypted_tx.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/pep/genesis.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/pep/module/module.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/pep/params.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/pep/pep_nonce.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/pep/query.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/pep/request_id.ts create mode 100644 ts-client/ibc.core.connection.v1/types/fairyring/pep/tx.ts create mode 100644 ts-client/ibc.core.connection.v1/types/google/protobuf/duration.ts create mode 100644 ts-client/ibc.core.connection.v1/types/route-name.eta diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 1bcc0eb1..51f1d051 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -1 +1 @@ -{"id":"github.com/Fairblock/fairyring","consumes":["application/json"],"produces":["application/json"],"swagger":"2.0","info":{"description":"Chain github.com/Fairblock/fairyring REST API","title":"HTTP API Console","contact":{"name":"github.com/Fairblock/fairyring"},"version":"version not set"},"paths":{"/Fairblock/fairyring/pep/decrypt_data/{aggrKeyshare}/{encryptedData}":{"get":{"tags":["Query"],"summary":"Queries a list of DecryptData items.","operationId":"GithubComFairblockfairyringQuery_DecryptData","parameters":[{"type":"string","name":"aggrKeyshare","in":"path","required":true},{"type":"string","name":"encryptedData","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryDecryptDataResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/Fairblock/fairyring/pep/show_private_keyshare_req/{reqId}":{"get":{"tags":["Query"],"summary":"Queries a list of ShowPrivateKeyshareReq items.","operationId":"GithubComFairblockfairyringQuery_ShowPrivateKeyshareReq","parameters":[{"type":"string","name":"reqId","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryShowPrivateKeyshareReqResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/CreateAuthorizedAddress":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_CreateAuthorizedAddress","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateAuthorizedAddress"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateAuthorizedAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/CreateGeneralKeyShare":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_CreateGeneralKeyShare","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateGeneralKeyShare"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateGeneralKeyShareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/CreateLatestPubKey":{"post":{"tags":["Msg"],"summary":"this line is used by starport scaffolding # proto/tx/rpc","operationId":"GithubComFairblockfairyringMsg_CreateLatestPubKey","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateLatestPubKey"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateLatestPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/DeRegisterValidator":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_DeRegisterValidator","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgDeRegisterValidator"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgDeRegisterValidatorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/DeleteAuthorizedAddress":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_DeleteAuthorizedAddress","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgDeleteAuthorizedAddress"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgDeleteAuthorizedAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/OverrideLatestPubKey":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_OverrideLatestPubKey","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgOverrideLatestPubKey"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgOverrideLatestPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/RegisterValidator":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_RegisterValidator","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgRegisterValidator"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgRegisterValidatorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/SendKeyshare":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_SendKeyshare","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSendKeyshare"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSendKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/SubmitEncryptedKeyshare":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_SubmitEncryptedKeyshare","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSubmitEncryptedKeyshare"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSubmitEncryptedKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/UpdateAuthorizedAddress":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_UpdateAuthorizedAddress","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgUpdateAuthorizedAddress"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgUpdateAuthorizedAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/UpdateParams":{"post":{"tags":["Msg"],"summary":"UpdateParams defines a (governance) operation for updating the module\nparameters. The authority defaults to the x/gov module account.","operationId":"GithubComFairblockfairyringMsg_UpdateParams","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/CreateAggregatedKeyShare":{"post":{"tags":["Msg"],"summary":"this line is used by starport scaffolding # proto/tx/rpc","operationId":"GithubComFairblockfairyringMsg_CreateAggregatedKeyShare","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgCreateAggregatedKeyShare"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgCreateAggregatedKeyShareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/GetGeneralKeyshare":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_GetGeneralKeyshare","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgGetGeneralKeyshare"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgGetGeneralKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/GetPrivateKeyshares":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_GetPrivateKeyshares","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgGetPrivateKeyshares"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgGetPrivateKeysharesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/RequestGeneralKeyshare":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_RequestGeneralKeyshare","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestGeneralKeyshare"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestGeneralKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/RequestPrivateIdentity":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_RequestPrivateIdentity","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestPrivateIdentity"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestPrivateIdentityResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/SubmitEncryptedTx":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_SubmitEncryptedTx","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitEncryptedTx"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitEncryptedTxResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/SubmitGeneralEncryptedTx":{"post":{"tags":["Msg"],"operationId":"GithubComFairblockfairyringMsg_SubmitGeneralEncryptedTx","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitGeneralEncryptedTx"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitEncryptedTxResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/UpdateParams":{"post":{"tags":["Msg"],"summary":"UpdateParams defines a (governance) operation for updating the module\nparameters. The authority defaults to the x/gov module account.","operationId":"GithubComFairblockfairyringMsg_UpdateParamsMixin21","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/aggregated_key_share":{"get":{"tags":["Query"],"operationId":"GithubComFairblockfairyringQuery_AggregatedKeyShareAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryAllAggregatedKeyShareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/aggregated_key_share/{height}":{"get":{"tags":["Query"],"summary":"Queries a list of AggregatedKeyShare items.","operationId":"GithubComFairblockfairyringQuery_AggregatedKeyShare","parameters":[{"type":"string","format":"uint64","name":"height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryGetAggregatedKeyShareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/authorized_address":{"get":{"tags":["Query"],"operationId":"GithubComFairblockfairyringQuery_AuthorizedAddressAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryAllAuthorizedAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/authorized_address/{target}":{"get":{"tags":["Query"],"summary":"Queries a list of AuthorizedAddress items.","operationId":"GithubComFairblockfairyringQuery_AuthorizedAddress","parameters":[{"type":"string","name":"target","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryGetAuthorizedAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/commitments":{"get":{"tags":["Query"],"operationId":"GithubComFairblockfairyringQuery_Commitments","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryCommitmentsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/general_key_share":{"get":{"tags":["Query"],"operationId":"GithubComFairblockfairyringQuery_GeneralKeyShareAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryAllGeneralKeyShareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/general_key_share/{validator}/{idType}/{idValue}":{"get":{"tags":["Query"],"summary":"Queries a list of GeneralKeyShare items.","operationId":"GithubComFairblockfairyringQuery_GeneralKeyShare","parameters":[{"type":"string","name":"validator","in":"path","required":true},{"type":"string","name":"idType","in":"path","required":true},{"type":"string","name":"idValue","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryGetGeneralKeyShareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/key_share":{"get":{"tags":["Query"],"summary":"Queries a list of KeyShare items.","operationId":"GithubComFairblockfairyringQuery_KeyShareAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryAllKeyShareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/key_share/{validator}/{blockHeight}":{"get":{"tags":["Query"],"summary":"Queries a KeyShare by index.","operationId":"GithubComFairblockfairyringQuery_KeyShare","parameters":[{"type":"string","name":"validator","in":"path","required":true},{"type":"string","format":"uint64","name":"blockHeight","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryGetKeyShareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComFairblockfairyringQuery_Params","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/pub_key":{"get":{"tags":["Query"],"summary":"Queries the public keys","operationId":"GithubComFairblockfairyringQuery_PubKey","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/validator_set":{"get":{"tags":["Query"],"summary":"Queries a list of ValidatorSet items.","operationId":"GithubComFairblockfairyringQuery_ValidatorSetAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryAllValidatorSetResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/validator_set/{index}":{"get":{"tags":["Query"],"summary":"Queries a ValidatorSet by index.","operationId":"GithubComFairblockfairyringQuery_ValidatorSet","parameters":[{"type":"string","name":"index","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryGetValidatorSetResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/verifiable_randomness":{"get":{"tags":["Query"],"operationId":"GithubComFairblockfairyringQuery_VerifiableRandomness","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryVerifiableRandomnessResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/encrypted_tx":{"get":{"tags":["Query"],"summary":"Queries a list of EncryptedTx items.","operationId":"GithubComFairblockfairyringQuery_EncryptedTxAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryAllEncryptedTxResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/encrypted_tx/{targetHeight}":{"get":{"tags":["Query"],"summary":"Queries a list of EncryptedTx items.","operationId":"GithubComFairblockfairyringQuery_EncryptedTxAllFromHeight","parameters":[{"type":"string","format":"uint64","name":"targetHeight","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryAllEncryptedTxFromHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/encrypted_tx/{targetHeight}/{index}":{"get":{"tags":["Query"],"summary":"Queries a EncryptedTx by index.","operationId":"GithubComFairblockfairyringQuery_EncryptedTx","parameters":[{"type":"string","format":"uint64","name":"targetHeight","in":"path","required":true},{"type":"string","format":"uint64","name":"index","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryGetEncryptedTxResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/keyshare":{"get":{"tags":["Query"],"operationId":"GithubComFairblockfairyringQuery_KeyshareReqAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryAllKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/keyshare/{req_id}":{"get":{"tags":["Query"],"operationId":"GithubComFairblockfairyringQuery_KeyshareReq","parameters":[{"type":"string","name":"req_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/latest_height":{"get":{"tags":["Query"],"summary":"Queries a list of LatestHeight items.","operationId":"GithubComFairblockfairyringQuery_LatestHeight","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryLatestHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComFairblockfairyringQuery_ParamsMixin19","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/pep_nonce":{"get":{"tags":["Query"],"summary":"Queries a list of PepNonce items.","operationId":"GithubComFairblockfairyringQuery_PepNonceAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryAllPepNonceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/pep_nonce/{address}":{"get":{"tags":["Query"],"summary":"Queries a PepNonce by index.","operationId":"GithubComFairblockfairyringQuery_PepNonce","parameters":[{"type":"string","name":"address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryGetPepNonceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/pub_key":{"get":{"tags":["Query"],"summary":"Queries the public keys","operationId":"GithubComFairblockfairyringQuery_PubKeyMixin19","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}}},"definitions":{"cosmos.base.query.v1beta1.PageRequest":{"description":"message SomeRequest {\n Foo some_parameter = 1;\n PageRequest pagination = 2;\n }","type":"object","title":"PageRequest is to be embedded in gRPC request messages for efficient\npagination. Ex:","properties":{"count_total":{"description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","type":"boolean"},"key":{"description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","type":"string","format":"byte"},"limit":{"description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","type":"string","format":"uint64"},"offset":{"description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","type":"string","format":"uint64"},"reverse":{"description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","type":"boolean"}}},"cosmos.base.query.v1beta1.PageResponse":{"description":"PageResponse is to be embedded in gRPC response messages where the\ncorresponding request message has used PageRequest.\n\n message SomeResponse {\n repeated Bar results = 1;\n PageResponse page = 2;\n }","type":"object","properties":{"next_key":{"description":"next_key is the key to be passed to PageRequest.key to\nquery the next page most efficiently. It will be empty if\nthere are no more results.","type":"string","format":"byte"},"total":{"type":"string","format":"uint64","title":"total is total number of results available if PageRequest.count_total\nwas set, its value is undefined otherwise"}}},"cosmos.base.v1beta1.Coin":{"description":"Coin defines a token with a denomination and an amount.\n\nNOTE: The amount field is an Int which implements the custom method\nsignatures required by gogoproto.","type":"object","properties":{"amount":{"type":"string"},"denom":{"type":"string"}}},"fairyring.common.ActivePublicKey":{"type":"object","properties":{"creator":{"type":"string"},"expiry":{"type":"string","format":"uint64"},"publicKey":{"type":"string"}}},"fairyring.common.EncryptedKeyshare":{"type":"object","properties":{"private_keyshares":{"type":"array","items":{"type":"string"}},"requester":{"type":"string"}}},"fairyring.common.QueuedPublicKey":{"type":"object","properties":{"creator":{"type":"string"},"expiry":{"type":"string","format":"uint64"},"publicKey":{"type":"string"}}},"fairyring.keyshare.ActivePubKey":{"type":"object","properties":{"creator":{"type":"string"},"encryptedKeyShares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.EncryptedKeyShare"}},"expiry":{"type":"string","format":"uint64"},"numberOfValidators":{"type":"string","format":"uint64"},"publicKey":{"type":"string"}}},"fairyring.keyshare.AggregatedKeyShare":{"type":"object","properties":{"data":{"type":"string"},"height":{"type":"string","format":"uint64"}}},"fairyring.keyshare.AuthorizedAddress":{"type":"object","properties":{"authorizedBy":{"type":"string"},"isAuthorized":{"type":"boolean"},"target":{"type":"string"}}},"fairyring.keyshare.Commitments":{"type":"object","properties":{"commitments":{"type":"array","items":{"type":"string"}}}},"fairyring.keyshare.EncryptedKeyShare":{"type":"object","properties":{"data":{"type":"string"},"validator":{"type":"string"}}},"fairyring.keyshare.GeneralKeyShare":{"type":"object","properties":{"idType":{"type":"string"},"idValue":{"type":"string"},"keyShare":{"type":"string"},"keyShareIndex":{"type":"string","format":"uint64"},"receivedBlockHeight":{"type":"string","format":"uint64"},"receivedTimestamp":{"type":"string","format":"uint64"},"validator":{"type":"string"}}},"fairyring.keyshare.KeyShare":{"type":"object","properties":{"blockHeight":{"type":"string","format":"uint64"},"keyShare":{"type":"string"},"keyShareIndex":{"type":"string","format":"uint64"},"receivedBlockHeight":{"type":"string","format":"uint64"},"receivedTimestamp":{"type":"string","format":"uint64"},"validator":{"type":"string"}}},"fairyring.keyshare.MsgCreateAuthorizedAddress":{"type":"object","properties":{"creator":{"type":"string"},"target":{"type":"string"}}},"fairyring.keyshare.MsgCreateAuthorizedAddressResponse":{"type":"object"},"fairyring.keyshare.MsgCreateGeneralKeyShare":{"type":"object","properties":{"creator":{"type":"string"},"idType":{"type":"string"},"idValue":{"type":"string"},"keyShare":{"type":"string"},"keyShareIndex":{"type":"string","format":"uint64"},"receivedBlockHeight":{"type":"string","format":"uint64"},"receivedTimestamp":{"type":"string","format":"uint64"}}},"fairyring.keyshare.MsgCreateGeneralKeyShareResponse":{"type":"object","properties":{"creator":{"type":"string"},"errorMessage":{"type":"string"},"idType":{"type":"string"},"idValue":{"type":"string"},"keyShare":{"type":"string"},"keyShareIndex":{"type":"string","format":"uint64"},"receivedBlockHeight":{"type":"string","format":"uint64"},"success":{"type":"boolean"}}},"fairyring.keyshare.MsgCreateLatestPubKey":{"type":"object","title":"this line is used by starport scaffolding # proto/tx/message","properties":{"commitments":{"type":"array","items":{"type":"string"}},"creator":{"type":"string"},"encryptedKeyShares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.EncryptedKeyShare"}},"numberOfValidators":{"type":"string","format":"uint64"},"publicKey":{"type":"string"}}},"fairyring.keyshare.MsgCreateLatestPubKeyResponse":{"type":"object"},"fairyring.keyshare.MsgDeRegisterValidator":{"type":"object","properties":{"creator":{"type":"string"}}},"fairyring.keyshare.MsgDeRegisterValidatorResponse":{"type":"object","properties":{"creator":{"type":"string"}}},"fairyring.keyshare.MsgDeleteAuthorizedAddress":{"type":"object","properties":{"creator":{"type":"string"},"target":{"type":"string"}}},"fairyring.keyshare.MsgDeleteAuthorizedAddressResponse":{"type":"object"},"fairyring.keyshare.MsgOverrideLatestPubKey":{"type":"object","properties":{"commitments":{"type":"array","items":{"type":"string"}},"creator":{"type":"string"},"encryptedKeyShares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.EncryptedKeyShare"}},"numberOfValidators":{"type":"string","format":"uint64"},"publicKey":{"type":"string"}}},"fairyring.keyshare.MsgOverrideLatestPubKeyResponse":{"type":"object"},"fairyring.keyshare.MsgRegisterValidator":{"type":"object","properties":{"creator":{"type":"string"}}},"fairyring.keyshare.MsgRegisterValidatorResponse":{"type":"object","properties":{"creator":{"type":"string"}}},"fairyring.keyshare.MsgSendKeyshare":{"type":"object","properties":{"blockHeight":{"type":"string","format":"uint64"},"creator":{"type":"string"},"keyShareIndex":{"type":"string","format":"uint64"},"message":{"type":"string"}}},"fairyring.keyshare.MsgSendKeyshareResponse":{"type":"object","properties":{"blockHeight":{"type":"string","format":"uint64"},"creator":{"type":"string"},"errorMessage":{"type":"string"},"keyshare":{"type":"string"},"keyshareIndex":{"type":"string","format":"uint64"},"receivedBlockHeight":{"type":"string","format":"uint64"},"success":{"type":"boolean"}}},"fairyring.keyshare.MsgSubmitEncryptedKeyshare":{"type":"object","properties":{"creator":{"type":"string"},"encryptedKeyshare":{"type":"string"},"identity":{"type":"string"},"keyShareIndex":{"type":"string","format":"uint64"},"receivedBlockHeight":{"type":"string","format":"uint64"},"receivedTimestamp":{"type":"string","format":"uint64"},"requester":{"type":"string"}}},"fairyring.keyshare.MsgSubmitEncryptedKeyshareResponse":{"type":"object"},"fairyring.keyshare.MsgUpdateAuthorizedAddress":{"type":"object","properties":{"creator":{"type":"string"},"isAuthorized":{"type":"boolean"},"target":{"type":"string"}}},"fairyring.keyshare.MsgUpdateAuthorizedAddressResponse":{"type":"object"},"fairyring.keyshare.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"NOTE: All parameters must be supplied.","$ref":"#/definitions/fairyring.keyshare.Params"}}},"fairyring.keyshare.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.","type":"object"},"fairyring.keyshare.Params":{"description":"Params defines the parameters for the module.","type":"object","properties":{"key_expiry":{"type":"string","format":"uint64"},"max_idled_block":{"type":"string","format":"uint64"},"minimum_bonded":{"type":"string","format":"uint64"},"slash_fraction_no_keyshare":{"type":"string","format":"byte"},"slash_fraction_wrong_keyshare":{"type":"string","format":"byte"},"trusted_addresses":{"type":"array","items":{"type":"string"}}}},"fairyring.keyshare.QueryAllAggregatedKeyShareResponse":{"type":"object","properties":{"aggregatedKeyShare":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.AggregatedKeyShare"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.keyshare.QueryAllAuthorizedAddressResponse":{"type":"object","properties":{"authorizedAddress":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.AuthorizedAddress"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.keyshare.QueryAllGeneralKeyShareResponse":{"type":"object","properties":{"generalKeyShare":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.GeneralKeyShare"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.keyshare.QueryAllKeyShareResponse":{"type":"object","properties":{"keyShare":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.KeyShare"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.keyshare.QueryAllValidatorSetResponse":{"type":"object","properties":{"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"validatorSet":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.ValidatorSet"}}}},"fairyring.keyshare.QueryCommitmentsResponse":{"type":"object","properties":{"activeCommitments":{"$ref":"#/definitions/fairyring.keyshare.Commitments"},"queuedCommitments":{"$ref":"#/definitions/fairyring.keyshare.Commitments"}}},"fairyring.keyshare.QueryGetAggregatedKeyShareResponse":{"type":"object","properties":{"aggregatedKeyShare":{"$ref":"#/definitions/fairyring.keyshare.AggregatedKeyShare"}}},"fairyring.keyshare.QueryGetAuthorizedAddressResponse":{"type":"object","properties":{"authorizedAddress":{"$ref":"#/definitions/fairyring.keyshare.AuthorizedAddress"}}},"fairyring.keyshare.QueryGetGeneralKeyShareResponse":{"type":"object","properties":{"generalKeyShare":{"$ref":"#/definitions/fairyring.keyshare.GeneralKeyShare"}}},"fairyring.keyshare.QueryGetKeyShareResponse":{"type":"object","properties":{"keyShare":{"$ref":"#/definitions/fairyring.keyshare.KeyShare"}}},"fairyring.keyshare.QueryGetValidatorSetResponse":{"type":"object","properties":{"validatorSet":{"$ref":"#/definitions/fairyring.keyshare.ValidatorSet"}}},"fairyring.keyshare.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/fairyring.keyshare.Params"}}},"fairyring.keyshare.QueryPubKeyResponse":{"type":"object","properties":{"activePubKey":{"$ref":"#/definitions/fairyring.keyshare.ActivePubKey"},"queuedPubKey":{"$ref":"#/definitions/fairyring.keyshare.QueuedPubKey"}}},"fairyring.keyshare.QueryVerifiableRandomnessResponse":{"type":"object","properties":{"randomness":{"type":"string"},"round":{"type":"string","format":"uint64"}}},"fairyring.keyshare.QueuedPubKey":{"type":"object","properties":{"creator":{"type":"string"},"encryptedKeyShares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.EncryptedKeyShare"}},"expiry":{"type":"string","format":"uint64"},"numberOfValidators":{"type":"string","format":"uint64"},"publicKey":{"type":"string"}}},"fairyring.keyshare.ValidatorSet":{"type":"object","properties":{"consAddr":{"type":"string"},"index":{"type":"string"},"isActive":{"type":"boolean"},"validator":{"type":"string"}}},"fairyring.pep.EncryptedTx":{"type":"object","properties":{"chargedGas":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"creator":{"type":"string"},"data":{"type":"string"},"expired":{"type":"boolean"},"index":{"type":"string","format":"uint64"},"processedAtChainHeight":{"type":"string","format":"uint64"},"targetHeight":{"type":"string","format":"uint64"}}},"fairyring.pep.EncryptedTxArray":{"type":"object","properties":{"encryptedTx":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.EncryptedTx"}}}},"fairyring.pep.GenEncTxExecutionQueue":{"type":"object","properties":{"aggr_keyshare":{"type":"string"},"creator":{"type":"string"},"identity":{"type":"string"},"pubkey":{"type":"string"},"request_id":{"type":"string"},"tx_list":{"$ref":"#/definitions/fairyring.pep.GeneralEncryptedTxArray"}}},"fairyring.pep.GeneralEncryptedTx":{"type":"object","properties":{"chargedGas":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"creator":{"type":"string"},"data":{"type":"string"},"identity":{"type":"string"},"index":{"type":"string","format":"uint64"}}},"fairyring.pep.GeneralEncryptedTxArray":{"type":"object","properties":{"encryptedTx":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.GeneralEncryptedTx"}}}},"fairyring.pep.MsgCreateAggregatedKeyShare":{"type":"object","title":"this line is used by starport scaffolding # proto/tx/message","properties":{"creator":{"type":"string"},"data":{"type":"string"},"height":{"type":"string","format":"uint64"}}},"fairyring.pep.MsgCreateAggregatedKeyShareResponse":{"type":"object"},"fairyring.pep.MsgGetGeneralKeyshare":{"type":"object","properties":{"creator":{"type":"string"},"req_id":{"type":"string"}}},"fairyring.pep.MsgGetGeneralKeyshareResponse":{"type":"object"},"fairyring.pep.MsgGetPrivateKeyshares":{"type":"object","properties":{"creator":{"type":"string"},"reqId":{"type":"string"},"rsa_64_pubkey":{"type":"string"}}},"fairyring.pep.MsgGetPrivateKeysharesResponse":{"type":"object"},"fairyring.pep.MsgRequestGeneralKeyshare":{"type":"object","properties":{"creator":{"type":"string"},"estimated_delay":{"type":"string"},"req_id":{"type":"string"}}},"fairyring.pep.MsgRequestGeneralKeyshareResponse":{"type":"object","properties":{"req_id":{"type":"string"}}},"fairyring.pep.MsgRequestPrivateIdentity":{"type":"object","properties":{"amount":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"creator":{"type":"string"},"reqId":{"type":"string"}}},"fairyring.pep.MsgRequestPrivateIdentityResponse":{"type":"object","properties":{"req_id":{"type":"string"}}},"fairyring.pep.MsgSubmitEncryptedTx":{"type":"object","properties":{"creator":{"type":"string"},"data":{"type":"string"},"targetBlockHeight":{"type":"string","format":"uint64"}}},"fairyring.pep.MsgSubmitEncryptedTxResponse":{"type":"object"},"fairyring.pep.MsgSubmitGeneralEncryptedTx":{"type":"object","properties":{"creator":{"type":"string"},"data":{"type":"string"},"req_id":{"type":"string"}}},"fairyring.pep.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"NOTE: All parameters must be supplied.","$ref":"#/definitions/fairyring.pep.Params"}}},"fairyring.pep.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.","type":"object"},"fairyring.pep.Params":{"description":"Params defines the parameters for the module.","type":"object","properties":{"is_source_chain":{"type":"boolean"},"keyshare_channel_id":{"type":"string"},"min_gas_price":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"trusted_addresses":{"type":"array","items":{"type":"string"}},"trusted_counter_parties":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.TrustedCounterParty"}}}},"fairyring.pep.PepNonce":{"type":"object","properties":{"address":{"type":"string"},"nonce":{"type":"string","format":"uint64"}}},"fairyring.pep.QueryAllEncryptedTxFromHeightResponse":{"type":"object","properties":{"encryptedTxArray":{"$ref":"#/definitions/fairyring.pep.EncryptedTxArray"}}},"fairyring.pep.QueryAllEncryptedTxResponse":{"type":"object","properties":{"encryptedTxArray":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.EncryptedTxArray"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.pep.QueryAllKeyshareResponse":{"type":"object","properties":{"keyshares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.GenEncTxExecutionQueue"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.pep.QueryAllPepNonceResponse":{"type":"object","properties":{"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"pepNonce":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.PepNonce"}}}},"fairyring.pep.QueryDecryptDataResponse":{"type":"object"},"fairyring.pep.QueryGetEncryptedTxResponse":{"type":"object","properties":{"encryptedTx":{"$ref":"#/definitions/fairyring.pep.EncryptedTx"}}},"fairyring.pep.QueryGetPepNonceResponse":{"type":"object","properties":{"pepNonce":{"$ref":"#/definitions/fairyring.pep.PepNonce"}}},"fairyring.pep.QueryKeyshareResponse":{"type":"object","properties":{"keyshare":{"$ref":"#/definitions/fairyring.pep.GenEncTxExecutionQueue"}}},"fairyring.pep.QueryLatestHeightResponse":{"type":"object","properties":{"height":{"type":"string","format":"uint64"}}},"fairyring.pep.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/fairyring.pep.Params"}}},"fairyring.pep.QueryPubKeyResponse":{"type":"object","properties":{"activePubKey":{"$ref":"#/definitions/fairyring.common.ActivePublicKey"},"queuedPubKey":{"$ref":"#/definitions/fairyring.common.QueuedPublicKey"}}},"fairyring.pep.QueryShowPrivateKeyshareReqResponse":{"type":"object","properties":{"amount":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"creator":{"type":"string"},"encrypted_keyshares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.common.EncryptedKeyshare"}},"pubkey":{"type":"string"},"req_id":{"type":"string"}}},"fairyring.pep.TrustedCounterParty":{"type":"object","properties":{"channel_id":{"type":"string"},"client_id":{"type":"string"},"connection_id":{"type":"string"}}},"google.protobuf.Any":{"type":"object","properties":{"@type":{"type":"string"}},"additionalProperties":{}},"google.rpc.Status":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"details":{"type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"message":{"type":"string"}}}},"tags":[{"name":"Query"},{"name":"Msg"}]} \ No newline at end of file +{"id":"github.com/Fairblock/fairyring","consumes":["application/json"],"produces":["application/json"],"swagger":"2.0","info":{"description":"Chain github.com/Fairblock/fairyring REST API","title":"HTTP API Console","contact":{"name":"github.com/Fairblock/fairyring"},"version":"version not set"},"paths":{"/Fairblock/fairyring/pep/decrypt_data/{pubkey}/{decryption_key}/{encrypted_data}":{"get":{"tags":["Query"],"summary":"Queries a list of DecryptData items.","operationId":"GithubComFairblockfairyringQuery_DecryptData","parameters":[{"type":"string","name":"pubkey","in":"path","required":true},{"type":"string","name":"decryption_key","in":"path","required":true},{"type":"string","name":"encrypted_data","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryDecryptDataResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/Fairblock/fairyring/pep/private_identity/{req_id}":{"get":{"tags":["Query"],"summary":"Queries a Private Identity request item by req id.","operationId":"GithubComFairblockfairyringQuery_PrivateIdentity","parameters":[{"type":"string","name":"req_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryPrivateIdentityResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.auth.v1beta1.Msg/UpdateParams":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"UpdateParams defines a (governance) operation for updating the x/auth module\nparameters. The authority defaults to the x/gov module account.","operationId":"UpgradeMsg_UpdateParams","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.authz.v1beta1.Msg/Exec":{"post":{"tags":["Msg"],"summary":"Exec attempts to execute the provided messages using\nauthorizations granted to the grantee. Each message should have only\none signer corresponding to the granter of the authorization.","operationId":"UpgradeMsg_Exec","parameters":[{"description":"MsgExec attempts to execute the provided messages using\nauthorizations granted to the grantee. Each message should have only\none signer corresponding to the granter of the authorization.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.authz.v1beta1.MsgExec"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.authz.v1beta1.MsgExecResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.authz.v1beta1.Msg/Grant":{"post":{"tags":["Msg"],"summary":"Grant grants the provided authorization to the grantee on the granter's\naccount with the provided expiration time. If there is already a grant\nfor the given (granter, grantee, Authorization) triple, then the grant\nwill be overwritten.","operationId":"UpgradeMsg_Grant","parameters":[{"description":"MsgGrant is a request type for Grant method. It declares authorization to the grantee\non behalf of the granter with the provided expiration time.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.authz.v1beta1.MsgGrant"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.authz.v1beta1.MsgGrantResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.authz.v1beta1.Msg/Revoke":{"post":{"tags":["Msg"],"summary":"Revoke revokes any authorization corresponding to the provided method name on the\ngranter's account that has been granted to the grantee.","operationId":"UpgradeMsg_Revoke","parameters":[{"description":"MsgRevoke revokes any authorization with the provided sdk.Msg type on the\ngranter's account with that has been granted to the grantee.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.authz.v1beta1.MsgRevoke"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.authz.v1beta1.MsgRevokeResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.autocli.v1.Query/AppOptions":{"post":{"tags":["Query"],"summary":"AppOptions returns the autocli options for all of the modules in an app.","operationId":"UpgradeQuery_AppOptions","parameters":[{"description":"AppOptionsRequest is the RemoteInfoService/AppOptions request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.autocli.v1.AppOptionsRequest"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.autocli.v1.AppOptionsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.bank.v1beta1.Msg/MultiSend":{"post":{"tags":["Msg"],"summary":"MultiSend defines a method for sending coins from some accounts to other accounts.","operationId":"UpgradeMsg_MultiSend","parameters":[{"description":"MsgMultiSend represents an arbitrary multi-in, multi-out send message.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.MsgMultiSend"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.MsgMultiSendResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.bank.v1beta1.Msg/Send":{"post":{"tags":["Msg"],"summary":"Send defines a method for sending coins from one account to another account.","operationId":"UpgradeMsg_Send","parameters":[{"description":"MsgSend represents a message to send coins from one account to another.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.MsgSend"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.MsgSendResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.bank.v1beta1.Msg/SetSendEnabled":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"SetSendEnabled is a governance operation for setting the SendEnabled flag\non any number of Denoms. Only the entries to add or update should be\nincluded. Entries that already exist in the store, but that aren't\nincluded in this message, will be left unchanged.","operationId":"UpgradeMsg_SetSendEnabled","parameters":[{"description":"MsgSetSendEnabled is the Msg/SetSendEnabled request type.\n\nOnly entries to add/update/delete need to be included.\nExisting SendEnabled entries that are not included in this\nmessage are left unchanged.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.MsgSetSendEnabled"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.MsgSetSendEnabledResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.bank.v1beta1.Msg/UpdateParams":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"UpdateParams defines a governance operation for updating the x/bank module parameters.\nThe authority is defined in the keeper.","operationId":"UpgradeMsg_UpdateParamsMixin37","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.circuit.v1.Msg/AuthorizeCircuitBreaker":{"post":{"tags":["Msg"],"summary":"AuthorizeCircuitBreaker allows a super-admin to grant (or revoke) another\naccount's circuit breaker permissions.","operationId":"UpgradeMsg_AuthorizeCircuitBreaker","parameters":[{"description":"MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.circuit.v1.MsgAuthorizeCircuitBreakerResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.circuit.v1.Msg/ResetCircuitBreaker":{"post":{"tags":["Msg"],"summary":"ResetCircuitBreaker resumes processing of Msg's in the state machine that\nhave been been paused using TripCircuitBreaker.","operationId":"UpgradeMsg_ResetCircuitBreaker","parameters":[{"description":"MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.circuit.v1.MsgResetCircuitBreaker"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.circuit.v1.MsgResetCircuitBreakerResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.circuit.v1.Msg/TripCircuitBreaker":{"post":{"tags":["Msg"],"summary":"TripCircuitBreaker pauses processing of Msg's in the state machine.","operationId":"UpgradeMsg_TripCircuitBreaker","parameters":[{"description":"MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.circuit.v1.MsgTripCircuitBreaker"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.circuit.v1.MsgTripCircuitBreakerResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.consensus.v1.Msg/UpdateParams":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"UpdateParams defines a governance operation for updating the x/consensus module parameters.\nThe authority is defined in the keeper.","operationId":"UpgradeMsg_UpdateParamsMixin50","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.consensus.v1.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.consensus.v1.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.crisis.v1beta1.Msg/UpdateParams":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"UpdateParams defines a governance operation for updating the x/crisis module\nparameters. The authority is defined in the keeper.","operationId":"UpgradeMsg_UpdateParamsMixin52","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.crisis.v1beta1.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.crisis.v1beta1.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.crisis.v1beta1.Msg/VerifyInvariant":{"post":{"tags":["Msg"],"summary":"VerifyInvariant defines a method to verify a particular invariant.","operationId":"UpgradeMsg_VerifyInvariant","parameters":[{"description":"MsgVerifyInvariant represents a message to verify a particular invariance.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.crisis.v1beta1.MsgVerifyInvariant"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.distribution.v1beta1.Msg/CommunityPoolSpend":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"CommunityPoolSpend defines a governance operation for sending tokens from\nthe community pool in the x/distribution module to another account, which\ncould be the governance module itself. The authority is defined in the\nkeeper.","operationId":"UpgradeMsg_CommunityPoolSpend","parameters":[{"description":"MsgCommunityPoolSpend defines a message for sending tokens from the community\npool to another account. This message is typically executed via a governance\nproposal with the governance module being the executing authority.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgCommunityPoolSpend"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.distribution.v1beta1.Msg/DepositValidatorRewardsPool":{"post":{"description":"Since: cosmos-sdk 0.50","tags":["Msg"],"summary":"DepositValidatorRewardsPool defines a method to provide additional rewards\nto delegators to a specific validator.","operationId":"UpgradeMsg_DepositValidatorRewardsPool","parameters":[{"description":"DepositValidatorRewardsPool defines the request structure to provide\nadditional rewards to delegators from a specific validator.\n\nSince: cosmos-sdk 0.50","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.distribution.v1beta1.Msg/FundCommunityPool":{"post":{"tags":["Msg"],"summary":"FundCommunityPool defines a method to allow an account to directly\nfund the community pool.","operationId":"UpgradeMsg_FundCommunityPool","parameters":[{"description":"MsgFundCommunityPool allows an account to directly\nfund the community pool.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgFundCommunityPool"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.distribution.v1beta1.Msg/SetWithdrawAddress":{"post":{"tags":["Msg"],"summary":"SetWithdrawAddress defines a method to change the withdraw address\nfor a delegator (or validator self-delegation).","operationId":"UpgradeMsg_SetWithdrawAddress","parameters":[{"description":"MsgSetWithdrawAddress sets the withdraw address for\na delegator (or validator self-delegation).","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgSetWithdrawAddress"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.distribution.v1beta1.Msg/UpdateParams":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"UpdateParams defines a governance operation for updating the x/distribution\nmodule parameters. The authority is defined in the keeper.","operationId":"UpgradeMsg_UpdateParamsMixin63","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.distribution.v1beta1.Msg/WithdrawDelegatorReward":{"post":{"tags":["Msg"],"summary":"WithdrawDelegatorReward defines a method to withdraw rewards of delegator\nfrom a single validator.","operationId":"UpgradeMsg_WithdrawDelegatorReward","parameters":[{"description":"MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator\nfrom a single validator.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.distribution.v1beta1.Msg/WithdrawValidatorCommission":{"post":{"tags":["Msg"],"summary":"WithdrawValidatorCommission defines a method to withdraw the\nfull commission to the validator address.","operationId":"UpgradeMsg_WithdrawValidatorCommission","parameters":[{"description":"MsgWithdrawValidatorCommission withdraws the full commission to the validator\naddress.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.evidence.v1beta1.Msg/SubmitEvidence":{"post":{"tags":["Msg"],"summary":"SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or\ncounterfactual signing.","operationId":"UpgradeMsg_SubmitEvidence","parameters":[{"description":"MsgSubmitEvidence represents a message that supports submitting arbitrary\nEvidence of misbehavior such as equivocation or counterfactual signing.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.evidence.v1beta1.MsgSubmitEvidence"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.feegrant.v1beta1.Msg/GrantAllowance":{"post":{"tags":["Msg"],"summary":"GrantAllowance grants fee allowance to the grantee on the granter's\naccount with the provided expiration time.","operationId":"UpgradeMsg_GrantAllowance","parameters":[{"description":"MsgGrantAllowance adds permission for Grantee to spend up to Allowance\nof fees from the account of Granter.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.feegrant.v1beta1.MsgGrantAllowance"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.feegrant.v1beta1.Msg/PruneAllowances":{"post":{"description":"Since cosmos-sdk 0.50","tags":["Msg"],"summary":"PruneAllowances prunes expired fee allowances, currently up to 75 at a time.","operationId":"UpgradeMsg_PruneAllowances","parameters":[{"description":"MsgPruneAllowances prunes expired fee allowances.\n\nSince cosmos-sdk 0.50","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.feegrant.v1beta1.MsgPruneAllowances"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.feegrant.v1beta1.Msg/RevokeAllowance":{"post":{"tags":["Msg"],"summary":"RevokeAllowance revokes any fee allowance of granter's account that\nhas been granted to the grantee.","operationId":"UpgradeMsg_RevokeAllowance","parameters":[{"description":"MsgRevokeAllowance removes any existing Allowance from Granter to Grantee.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.feegrant.v1beta1.MsgRevokeAllowance"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1.Msg/CancelProposal":{"post":{"description":"Since: cosmos-sdk 0.50","tags":["Msg"],"summary":"CancelProposal defines a method to cancel governance proposal","operationId":"UpgradeMsg_CancelProposal","parameters":[{"description":"MsgCancelProposal is the Msg/CancelProposal request type.\n\nSince: cosmos-sdk 0.50","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgCancelProposal"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgCancelProposalResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1.Msg/Deposit":{"post":{"tags":["Msg"],"summary":"Deposit defines a method to add deposit on a specific proposal.","operationId":"UpgradeMsg_Deposit","parameters":[{"description":"MsgDeposit defines a message to submit a deposit to an existing proposal.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgDeposit"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgDepositResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1.Msg/ExecLegacyContent":{"post":{"tags":["Msg"],"summary":"ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal\nto execute a legacy content-based proposal.","operationId":"UpgradeMsg_ExecLegacyContent","parameters":[{"description":"MsgExecLegacyContent is used to wrap the legacy content field into a message.\nThis ensures backwards compatibility with v1beta1.MsgSubmitProposal.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgExecLegacyContent"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgExecLegacyContentResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1.Msg/SubmitProposal":{"post":{"tags":["Msg"],"summary":"SubmitProposal defines a method to create new proposal given the messages.","operationId":"UpgradeMsg_SubmitProposal","parameters":[{"description":"MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary\nproposal Content.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgSubmitProposal"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgSubmitProposalResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1.Msg/UpdateParams":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"UpdateParams defines a governance operation for updating the x/gov module\nparameters. The authority is defined in the keeper.","operationId":"UpgradeMsg_UpdateParamsMixin76","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1.Msg/Vote":{"post":{"tags":["Msg"],"summary":"Vote defines a method to add a vote on a specific proposal.","operationId":"UpgradeMsg_Vote","parameters":[{"description":"MsgVote defines a message to cast a vote.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgVote"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgVoteResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1.Msg/VoteEncrypted":{"post":{"tags":["Msg"],"summary":"VoteEncrypted defines a method to add an encrypted vote on a specific proposal.","operationId":"UpgradeMsg_VoteEncrypted","parameters":[{"description":"MsgVoteEncrypted defines a message to cast an encrypted vote.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgVoteEncrypted"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgVoteEncryptedResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1.Msg/VoteWeighted":{"post":{"tags":["Msg"],"summary":"VoteWeighted defines a method to add a weighted vote on a specific proposal.","operationId":"UpgradeMsg_VoteWeighted","parameters":[{"description":"MsgVoteWeighted defines a message to cast a vote.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgVoteWeighted"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.MsgVoteWeightedResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1beta1.Msg/Deposit":{"post":{"tags":["Msg"],"summary":"Deposit defines a method to add deposit on a specific proposal.","operationId":"UpgradeMsg_DepositMixin80","parameters":[{"description":"MsgDeposit defines a message to submit a deposit to an existing proposal.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgDeposit"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgDepositResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1beta1.Msg/SubmitProposal":{"post":{"tags":["Msg"],"summary":"SubmitProposal defines a method to create new proposal given a content.","operationId":"UpgradeMsg_SubmitProposalMixin80","parameters":[{"description":"MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary\nproposal Content.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgSubmitProposal"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgSubmitProposalResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1beta1.Msg/Vote":{"post":{"tags":["Msg"],"summary":"Vote defines a method to add a vote on a specific proposal.","operationId":"UpgradeMsg_VoteMixin80","parameters":[{"description":"MsgVote defines a message to cast a vote.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgVote"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgVoteResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1beta1.Msg/VoteEncrypted":{"post":{"tags":["Msg"],"summary":"VoteEncrypted defines a method to add an encrypted vote on a specific proposal.","operationId":"UpgradeMsg_VoteEncryptedMixin80","parameters":[{"description":"MsgVoteEncrypted defines a message to cast an encrypted vote.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgVoteEncrypted"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgVoteEncryptedResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.gov.v1beta1.Msg/VoteWeighted":{"post":{"description":"Since: cosmos-sdk 0.43","tags":["Msg"],"summary":"VoteWeighted defines a method to add a weighted vote on a specific proposal.","operationId":"UpgradeMsg_VoteWeightedMixin80","parameters":[{"description":"MsgVoteWeighted defines a message to cast a vote.\n\nSince: cosmos-sdk 0.43","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgVoteWeighted"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.MsgVoteWeightedResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/CreateGroup":{"post":{"tags":["Msg"],"summary":"CreateGroup creates a new group with an admin account address, a list of members and some optional metadata.","operationId":"UpgradeMsg_CreateGroup","parameters":[{"description":"MsgCreateGroup is the Msg/CreateGroup request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgCreateGroup"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgCreateGroupResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/CreateGroupPolicy":{"post":{"tags":["Msg"],"summary":"CreateGroupPolicy creates a new group policy using given DecisionPolicy.","operationId":"UpgradeMsg_CreateGroupPolicy","parameters":[{"description":"MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgCreateGroupPolicy"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgCreateGroupPolicyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/CreateGroupWithPolicy":{"post":{"tags":["Msg"],"summary":"CreateGroupWithPolicy creates a new group with policy.","operationId":"UpgradeMsg_CreateGroupWithPolicy","parameters":[{"description":"MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgCreateGroupWithPolicy"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgCreateGroupWithPolicyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/Exec":{"post":{"tags":["Msg"],"summary":"Exec executes a proposal.","operationId":"UpgradeMsg_ExecMixin84","parameters":[{"description":"MsgExec is the Msg/Exec request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgExec"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgExecResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/LeaveGroup":{"post":{"tags":["Msg"],"summary":"LeaveGroup allows a group member to leave the group.","operationId":"UpgradeMsg_LeaveGroup","parameters":[{"description":"MsgLeaveGroup is the Msg/LeaveGroup request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgLeaveGroup"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgLeaveGroupResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/SubmitProposal":{"post":{"tags":["Msg"],"summary":"SubmitProposal submits a new proposal.","operationId":"UpgradeMsg_SubmitProposalMixin84","parameters":[{"description":"MsgSubmitProposal is the Msg/SubmitProposal request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgSubmitProposal"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgSubmitProposalResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/UpdateGroupAdmin":{"post":{"tags":["Msg"],"summary":"UpdateGroupAdmin updates the group admin with given group id and previous admin address.","operationId":"UpgradeMsg_UpdateGroupAdmin","parameters":[{"description":"MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupAdmin"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupAdminResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/UpdateGroupMembers":{"post":{"tags":["Msg"],"summary":"UpdateGroupMembers updates the group members with given group id and admin address.","operationId":"UpgradeMsg_UpdateGroupMembers","parameters":[{"description":"MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupMembers"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupMembersResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/UpdateGroupMetadata":{"post":{"tags":["Msg"],"summary":"UpdateGroupMetadata updates the group metadata with given group id and admin address.","operationId":"UpgradeMsg_UpdateGroupMetadata","parameters":[{"description":"MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupMetadata"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupMetadataResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/UpdateGroupPolicyAdmin":{"post":{"tags":["Msg"],"summary":"UpdateGroupPolicyAdmin updates a group policy admin.","operationId":"UpgradeMsg_UpdateGroupPolicyAdmin","parameters":[{"description":"MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupPolicyAdmin"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/UpdateGroupPolicyDecisionPolicy":{"post":{"tags":["Msg"],"summary":"UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated.","operationId":"UpgradeMsg_UpdateGroupPolicyDecisionPolicy","parameters":[{"description":"MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/UpdateGroupPolicyMetadata":{"post":{"tags":["Msg"],"summary":"UpdateGroupPolicyMetadata updates a group policy metadata.","operationId":"UpgradeMsg_UpdateGroupPolicyMetadata","parameters":[{"description":"MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupPolicyMetadata"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/Vote":{"post":{"tags":["Msg"],"summary":"Vote allows a voter to vote on a proposal.","operationId":"UpgradeMsg_VoteMixin84","parameters":[{"description":"MsgVote is the Msg/Vote request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgVote"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgVoteResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.group.v1.Msg/WithdrawProposal":{"post":{"tags":["Msg"],"summary":"WithdrawProposal withdraws a proposal.","operationId":"UpgradeMsg_WithdrawProposal","parameters":[{"description":"MsgWithdrawProposal is the Msg/WithdrawProposal request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.group.v1.MsgWithdrawProposal"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.MsgWithdrawProposalResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.mint.v1beta1.Msg/UpdateParams":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"UpdateParams defines a governance operation for updating the x/mint module\nparameters. The authority is defaults to the x/gov module account.","operationId":"UpgradeMsg_UpdateParamsMixin89","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.mint.v1beta1.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.mint.v1beta1.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.nft.v1beta1.Msg/Send":{"post":{"tags":["Msg"],"summary":"Send defines a method to send a nft from one account to another account.","operationId":"UpgradeMsg_SendMixin95","parameters":[{"description":"MsgSend represents a message to send a nft from one account to another account.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.nft.v1beta1.MsgSend"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.nft.v1beta1.MsgSendResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.slashing.v1beta1.Msg/Unjail":{"post":{"tags":["Msg"],"summary":"Unjail defines a method for unjailing a jailed validator, thus returning\nthem into the bonded validator set, so they can begin receiving provisions\nand rewards again.","operationId":"UpgradeMsg_Unjail","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.slashing.v1beta1.MsgUnjail"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.slashing.v1beta1.MsgUnjailResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.slashing.v1beta1.Msg/UpdateParams":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Msg"],"summary":"UpdateParams defines a governance operation for updating the x/slashing module\nparameters. The authority defaults to the x/gov module account.","operationId":"UpgradeMsg_UpdateParamsMixin102","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.slashing.v1beta1.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.slashing.v1beta1.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.staking.v1beta1.Msg/BeginRedelegate":{"post":{"tags":["Msg"],"summary":"BeginRedelegate defines a method for performing a redelegation\nof coins from a delegator and source validator to a destination validator.","operationId":"UpgradeMsg_BeginRedelegate","parameters":[{"description":"MsgBeginRedelegate defines a SDK message for performing a redelegation\nof coins from a delegator and source validator to a destination validator.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgBeginRedelegate"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgBeginRedelegateResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.staking.v1beta1.Msg/CancelUnbondingDelegation":{"post":{"description":"Since: cosmos-sdk 0.46","tags":["Msg"],"summary":"CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation\nand delegate back to previous validator.","operationId":"UpgradeMsg_CancelUnbondingDelegation","parameters":[{"description":"Since: cosmos-sdk 0.46","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.staking.v1beta1.Msg/CreateValidator":{"post":{"tags":["Msg"],"summary":"CreateValidator defines a method for creating a new validator.","operationId":"UpgradeMsg_CreateValidator","parameters":[{"description":"MsgCreateValidator defines a SDK message for creating a new validator.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgCreateValidator"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgCreateValidatorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.staking.v1beta1.Msg/Delegate":{"post":{"tags":["Msg"],"summary":"Delegate defines a method for performing a delegation of coins\nfrom a delegator to a validator.","operationId":"UpgradeMsg_Delegate","parameters":[{"description":"MsgDelegate defines a SDK message for performing a delegation of coins\nfrom a delegator to a validator.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgDelegate"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgDelegateResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.staking.v1beta1.Msg/EditValidator":{"post":{"tags":["Msg"],"summary":"EditValidator defines a method for editing an existing validator.","operationId":"UpgradeMsg_EditValidator","parameters":[{"description":"MsgEditValidator defines a SDK message for editing an existing validator.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgEditValidator"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgEditValidatorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.staking.v1beta1.Msg/Undelegate":{"post":{"tags":["Msg"],"summary":"Undelegate defines a method for performing an undelegation from a\ndelegate and a validator.","operationId":"UpgradeMsg_Undelegate","parameters":[{"description":"MsgUndelegate defines a SDK message for performing an undelegation from a\ndelegate and a validator.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgUndelegate"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgUndelegateResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.staking.v1beta1.Msg/UpdateParams":{"post":{"tags":["Msg"],"summary":"UpdateParams defines an operation for updating the x/staking module\nparameters.\nSince: cosmos-sdk 0.47","operationId":"UpgradeMsg_UpdateParamsMixin107","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.store.streaming.abci.ABCIListenerService/ListenCommit":{"post":{"tags":["ABCIListenerService"],"summary":"ListenCommit is the corresponding endpoint for ABCIListener.ListenCommit","operationId":"UpgradeABCIListenerService_ListenCommit","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.store.streaming.abci.ListenCommitRequest"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.store.streaming.abci.ListenCommitResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.store.streaming.abci.ABCIListenerService/ListenFinalizeBlock":{"post":{"tags":["ABCIListenerService"],"summary":"ListenFinalizeBlock is the corresponding endpoint for ABCIListener.ListenEndBlock","operationId":"UpgradeABCIListenerService_ListenFinalizeBlock","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.store.streaming.abci.ListenFinalizeBlockRequest"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.store.streaming.abci.ListenFinalizeBlockResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.upgrade.v1beta1.Msg/CancelUpgrade":{"post":{"description":"Since: cosmos-sdk 0.46","tags":["Msg"],"summary":"CancelUpgrade is a governance operation for cancelling a previously\napproved software upgrade.","operationId":"UpgradeMsg_CancelUpgrade","parameters":[{"description":"MsgCancelUpgrade is the Msg/CancelUpgrade request type.\n\nSince: cosmos-sdk 0.46","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.upgrade.v1beta1.MsgCancelUpgrade"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.upgrade.v1beta1.Msg/SoftwareUpgrade":{"post":{"description":"Since: cosmos-sdk 0.46","tags":["Msg"],"summary":"SoftwareUpgrade is a governance operation for initiating a software upgrade.","operationId":"UpgradeMsg_SoftwareUpgrade","parameters":[{"description":"MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type.\n\nSince: cosmos-sdk 0.46","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.vesting.v1beta1.Msg/CreatePeriodicVestingAccount":{"post":{"description":"Since: cosmos-sdk 0.46","tags":["Msg"],"summary":"CreatePeriodicVestingAccount defines a method that enables creating a\nperiodic vesting account.","operationId":"UpgradeMsg_CreatePeriodicVestingAccount","parameters":[{"description":"MsgCreateVestingAccount defines a message that enables creating a vesting\naccount.\n\nSince: cosmos-sdk 0.46","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.vesting.v1beta1.Msg/CreatePermanentLockedAccount":{"post":{"description":"Since: cosmos-sdk 0.46","tags":["Msg"],"summary":"CreatePermanentLockedAccount defines a method that enables creating a permanent\nlocked account.","operationId":"UpgradeMsg_CreatePermanentLockedAccount","parameters":[{"description":"MsgCreatePermanentLockedAccount defines a message that enables creating a permanent\nlocked account.\n\nSince: cosmos-sdk 0.46","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos.vesting.v1beta1.Msg/CreateVestingAccount":{"post":{"tags":["Msg"],"summary":"CreateVestingAccount defines a method that enables creating a vesting\naccount.","operationId":"UpgradeMsg_CreateVestingAccount","parameters":[{"description":"MsgCreateVestingAccount defines a message that enables creating a vesting\naccount.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.vesting.v1beta1.MsgCreateVestingAccount"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/account_info/{address}":{"get":{"description":"Since: cosmos-sdk 0.47","tags":["Query"],"summary":"AccountInfo queries account info which is common to all account types.","operationId":"UpgradeQuery_AccountInfo","parameters":[{"type":"string","description":"address is the account address string.","name":"address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.QueryAccountInfoResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/accounts":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.\n\nSince: cosmos-sdk 0.43","tags":["Query"],"summary":"Accounts returns all the existing accounts.","operationId":"UpgradeQuery_Accounts","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.QueryAccountsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/accounts/{address}":{"get":{"tags":["Query"],"summary":"Account returns account details based on address.","operationId":"UpgradeQuery_Account","parameters":[{"type":"string","description":"address defines the address to query for.","name":"address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.QueryAccountResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/address_by_id/{id}":{"get":{"description":"Since: cosmos-sdk 0.46.2","tags":["Query"],"summary":"AccountAddressByID returns account address based on account number.","operationId":"UpgradeQuery_AccountAddressByID","parameters":[{"type":"string","format":"int64","description":"Deprecated, use account_id instead\n\nid is the account number of the address to be queried. This field\nshould have been an uint64 (like all account numbers), and will be\nupdated to uint64 in a future version of the auth query.","name":"id","in":"path","required":true},{"type":"string","format":"uint64","description":"account_id is the account number of the address to be queried.\n\nSince: cosmos-sdk 0.47","name":"account_id","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/bech32":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Query"],"summary":"Bech32Prefix queries bech32Prefix","operationId":"UpgradeQuery_Bech32Prefix","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.Bech32PrefixResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/bech32/{address_bytes}":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Query"],"summary":"AddressBytesToString converts Account Address bytes to string","operationId":"UpgradeQuery_AddressBytesToString","parameters":[{"type":"string","format":"byte","name":"address_bytes","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.AddressBytesToStringResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/bech32/{address_string}":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Query"],"summary":"AddressStringToBytes converts Address string to bytes","operationId":"UpgradeQuery_AddressStringToBytes","parameters":[{"type":"string","name":"address_string","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.AddressStringToBytesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/module_accounts":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Query"],"summary":"ModuleAccounts returns all the existing module accounts.","operationId":"UpgradeQuery_ModuleAccounts","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.QueryModuleAccountsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/module_accounts/{name}":{"get":{"tags":["Query"],"summary":"ModuleAccountByName returns the module account info by module name","operationId":"UpgradeQuery_ModuleAccountByName","parameters":[{"type":"string","name":"name","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/auth/v1beta1/params":{"get":{"tags":["Query"],"summary":"Params queries all parameters.","operationId":"UpgradeQuery_Params","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.auth.v1beta1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/authz/v1beta1/grants":{"get":{"tags":["Query"],"summary":"Returns list of `Authorization`, granted to the grantee by the granter.","operationId":"UpgradeQuery_Grants","parameters":[{"type":"string","name":"granter","in":"query"},{"type":"string","name":"grantee","in":"query"},{"type":"string","description":"Optional, msg_type_url, when set, will query only grants matching given msg type.","name":"msg_type_url","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.authz.v1beta1.QueryGrantsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/authz/v1beta1/grants/grantee/{grantee}":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Query"],"summary":"GranteeGrants returns a list of `GrantAuthorization` by grantee.","operationId":"UpgradeQuery_GranteeGrants","parameters":[{"type":"string","name":"grantee","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.authz.v1beta1.QueryGranteeGrantsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/authz/v1beta1/grants/granter/{granter}":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Query"],"summary":"GranterGrants returns list of `GrantAuthorization`, granted by granter.","operationId":"UpgradeQuery_GranterGrants","parameters":[{"type":"string","name":"granter","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.authz.v1beta1.QueryGranterGrantsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/balances/{address}":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"AllBalances queries the balance of all coins for a single account.","operationId":"UpgradeQuery_AllBalances","parameters":[{"type":"string","description":"address is the address to query balances for.","name":"address","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"},{"type":"boolean","description":"resolve_denom is the flag to resolve the denom into a human-readable form from the metadata.\n\nSince: cosmos-sdk 0.50","name":"resolve_denom","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QueryAllBalancesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/balances/{address}/by_denom":{"get":{"tags":["Query"],"summary":"Balance queries the balance of a single coin for a single account.","operationId":"UpgradeQuery_Balance","parameters":[{"type":"string","description":"address is the address to query balances for.","name":"address","in":"path","required":true},{"type":"string","description":"denom is the coin denom to query balances for.","name":"denom","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QueryBalanceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/denom_owners/{denom}":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.\n\nSince: cosmos-sdk 0.46","tags":["Query"],"summary":"DenomOwners queries for all account addresses that own a particular token\ndenomination.","operationId":"UpgradeQuery_DenomOwners","parameters":[{"type":"string","description":"denom defines the coin denomination to query all account holders for.","name":"denom","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QueryDenomOwnersResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/denom_owners_by_query":{"get":{"description":"Since: cosmos-sdk 0.50.3","tags":["Query"],"summary":"DenomOwnersByQuery queries for all account addresses that own a particular token\ndenomination.","operationId":"UpgradeQuery_DenomOwnersByQuery","parameters":[{"type":"string","description":"denom defines the coin denomination to query all account holders for.","name":"denom","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/denoms_metadata":{"get":{"tags":["Query"],"summary":"DenomsMetadata queries the client metadata for all registered coin\ndenominations.","operationId":"UpgradeQuery_DenomsMetadata","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QueryDenomsMetadataResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/denoms_metadata/{denom}":{"get":{"tags":["Query"],"summary":"DenomMetadata queries the client metadata of a given coin denomination.","operationId":"UpgradeQuery_DenomMetadata","parameters":[{"type":"string","description":"denom is the coin denom to query the metadata for.","name":"denom","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QueryDenomMetadataResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/denoms_metadata_by_query_string":{"get":{"tags":["Query"],"summary":"DenomMetadataByQueryString queries the client metadata of a given coin denomination.","operationId":"UpgradeQuery_DenomMetadataByQueryString","parameters":[{"type":"string","description":"denom is the coin denom to query the metadata for.","name":"denom","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/params":{"get":{"tags":["Query"],"summary":"Params queries the parameters of x/bank module.","operationId":"UpgradeQuery_ParamsMixin36","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/send_enabled":{"get":{"description":"This query only returns denominations that have specific SendEnabled settings.\nAny denomination that does not have a specific setting will use the default\nparams.default_send_enabled, and will not be returned by this query.\n\nSince: cosmos-sdk 0.47","tags":["Query"],"summary":"SendEnabled queries for SendEnabled entries.","operationId":"UpgradeQuery_SendEnabled","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"denoms is the specific denoms you want look up. Leave empty to get all entries.","name":"denoms","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QuerySendEnabledResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/spendable_balances/{address}":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.\n\nSince: cosmos-sdk 0.46","tags":["Query"],"summary":"SpendableBalances queries the spendable balance of all coins for a single\naccount.","operationId":"UpgradeQuery_SpendableBalances","parameters":[{"type":"string","description":"address is the address to query spendable balances for.","name":"address","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QuerySpendableBalancesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/spendable_balances/{address}/by_denom":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.\n\nSince: cosmos-sdk 0.47","tags":["Query"],"summary":"SpendableBalanceByDenom queries the spendable balance of a single denom for\na single account.","operationId":"UpgradeQuery_SpendableBalanceByDenom","parameters":[{"type":"string","description":"address is the address to query balances for.","name":"address","in":"path","required":true},{"type":"string","description":"denom is the coin denom to query balances for.","name":"denom","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/supply":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"TotalSupply queries the total supply of all coins.","operationId":"UpgradeQuery_TotalSupply","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QueryTotalSupplyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/bank/v1beta1/supply/by_denom":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"SupplyOf queries the supply of a single coin.","operationId":"UpgradeQuery_SupplyOf","parameters":[{"type":"string","description":"denom is the coin denom to query balances for.","name":"denom","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.bank.v1beta1.QuerySupplyOfResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/node/v1beta1/config":{"get":{"tags":["Service"],"summary":"Config queries for the operator configuration.","operationId":"UpgradeService_Config","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.node.v1beta1.ConfigResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/node/v1beta1/status":{"get":{"tags":["Service"],"summary":"Status queries for the node status.","operationId":"UpgradeService_Status","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.node.v1beta1.StatusResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/reflection/v1beta1/app_descriptor/authn":{"get":{"tags":["ReflectionService"],"summary":"GetAuthnDescriptor returns information on how to authenticate transactions in the application\nNOTE: this RPC is still experimental and might be subject to breaking changes or removal in\nfuture releases of the cosmos-sdk.","operationId":"UpgradeReflectionService_GetAuthnDescriptor","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/reflection/v1beta1/app_descriptor/chain":{"get":{"tags":["ReflectionService"],"summary":"GetChainDescriptor returns the description of the chain","operationId":"UpgradeReflectionService_GetChainDescriptor","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/reflection/v1beta1/app_descriptor/codec":{"get":{"tags":["ReflectionService"],"summary":"GetCodecDescriptor returns the descriptor of the codec of the application","operationId":"UpgradeReflectionService_GetCodecDescriptor","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/reflection/v1beta1/app_descriptor/configuration":{"get":{"tags":["ReflectionService"],"summary":"GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application","operationId":"UpgradeReflectionService_GetConfigurationDescriptor","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/reflection/v1beta1/app_descriptor/query_services":{"get":{"tags":["ReflectionService"],"summary":"GetQueryServicesDescriptor returns the available gRPC queryable services of the application","operationId":"UpgradeReflectionService_GetQueryServicesDescriptor","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/reflection/v1beta1/app_descriptor/tx_descriptor":{"get":{"tags":["ReflectionService"],"summary":"GetTxDescriptor returns information on the used transaction object and available msgs that can be used","operationId":"UpgradeReflectionService_GetTxDescriptor","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/reflection/v1beta1/interfaces":{"get":{"tags":["ReflectionService"],"summary":"ListAllInterfaces lists all the interfaces registered in the interface\nregistry.","operationId":"UpgradeReflectionService_ListAllInterfaces","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.reflection.v1beta1.ListAllInterfacesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/reflection/v1beta1/interfaces/{interface_name}/implementations":{"get":{"tags":["ReflectionService"],"summary":"ListImplementations list all the concrete types that implement a given\ninterface.","operationId":"UpgradeReflectionService_ListImplementations","parameters":[{"type":"string","description":"interface_name defines the interface to query the implementations for.","name":"interface_name","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.reflection.v1beta1.ListImplementationsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/tendermint/v1beta1/abci_query":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Service"],"summary":"ABCIQuery defines a query handler that supports ABCI queries directly to the\napplication, bypassing Tendermint completely. The ABCI query must contain\na valid and supported path, including app, custom, p2p, and store.","operationId":"UpgradeService_ABCIQuery","parameters":[{"type":"string","format":"byte","name":"data","in":"query"},{"type":"string","name":"path","in":"query"},{"type":"string","format":"int64","name":"height","in":"query"},{"type":"boolean","name":"prove","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.ABCIQueryResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/tendermint/v1beta1/blocks/latest":{"get":{"tags":["Service"],"summary":"GetLatestBlock returns the latest block.","operationId":"UpgradeService_GetLatestBlock","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/tendermint/v1beta1/blocks/{height}":{"get":{"tags":["Service"],"summary":"GetBlockByHeight queries block for given height.","operationId":"UpgradeService_GetBlockByHeight","parameters":[{"type":"string","format":"int64","name":"height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/tendermint/v1beta1/node_info":{"get":{"tags":["Service"],"summary":"GetNodeInfo queries the current node info.","operationId":"UpgradeService_GetNodeInfo","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/tendermint/v1beta1/syncing":{"get":{"tags":["Service"],"summary":"GetSyncing queries node syncing.","operationId":"UpgradeService_GetSyncing","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.GetSyncingResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/tendermint/v1beta1/validatorsets/latest":{"get":{"tags":["Service"],"summary":"GetLatestValidatorSet queries latest validator-set.","operationId":"UpgradeService_GetLatestValidatorSet","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/base/tendermint/v1beta1/validatorsets/{height}":{"get":{"tags":["Service"],"summary":"GetValidatorSetByHeight queries validator-set at a given height.","operationId":"UpgradeService_GetValidatorSetByHeight","parameters":[{"type":"string","format":"int64","name":"height","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/circuit/v1/accounts":{"get":{"tags":["Query"],"summary":"Account returns account permissions.","operationId":"UpgradeQuery_AccountsMixin46","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.circuit.v1.AccountsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/circuit/v1/accounts/{address}":{"get":{"tags":["Query"],"summary":"Account returns account permissions.","operationId":"UpgradeQuery_AccountMixin46","parameters":[{"type":"string","name":"address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.circuit.v1.AccountResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/circuit/v1/disable_list":{"get":{"tags":["Query"],"summary":"DisabledList returns a list of disabled message urls","operationId":"UpgradeQuery_DisabledList","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.circuit.v1.DisabledListResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/consensus/v1/params":{"get":{"tags":["Query"],"summary":"Params queries the parameters of x/consensus module.","operationId":"UpgradeQuery_ParamsMixin49","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.consensus.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/community_pool":{"get":{"tags":["Query"],"summary":"CommunityPool queries the community pool coins.","operationId":"UpgradeQuery_CommunityPool","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryCommunityPoolResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards":{"get":{"tags":["Query"],"summary":"DelegationTotalRewards queries the total rewards accrued by each\nvalidator.","operationId":"UpgradeQuery_DelegationTotalRewards","parameters":[{"type":"string","description":"delegator_address defines the delegator address to query for.","name":"delegator_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/{validator_address}":{"get":{"tags":["Query"],"summary":"DelegationRewards queries the total rewards accrued by a delegation.","operationId":"UpgradeQuery_DelegationRewards","parameters":[{"type":"string","description":"delegator_address defines the delegator address to query for.","name":"delegator_address","in":"path","required":true},{"type":"string","description":"validator_address defines the validator address to query for.","name":"validator_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/delegators/{delegator_address}/validators":{"get":{"tags":["Query"],"summary":"DelegatorValidators queries the validators of a delegator.","operationId":"UpgradeQuery_DelegatorValidators","parameters":[{"type":"string","description":"delegator_address defines the delegator address to query for.","name":"delegator_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/delegators/{delegator_address}/withdraw_address":{"get":{"tags":["Query"],"summary":"DelegatorWithdrawAddress queries withdraw address of a delegator.","operationId":"UpgradeQuery_DelegatorWithdrawAddress","parameters":[{"type":"string","description":"delegator_address defines the delegator address to query for.","name":"delegator_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/params":{"get":{"tags":["Query"],"summary":"Params queries params of the distribution module.","operationId":"UpgradeQuery_ParamsMixin62","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/validators/{validator_address}":{"get":{"tags":["Query"],"summary":"ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator","operationId":"UpgradeQuery_ValidatorDistributionInfo","parameters":[{"type":"string","description":"validator_address defines the validator address to query for.","name":"validator_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/validators/{validator_address}/commission":{"get":{"tags":["Query"],"summary":"ValidatorCommission queries accumulated commission for a validator.","operationId":"UpgradeQuery_ValidatorCommission","parameters":[{"type":"string","description":"validator_address defines the validator address to query for.","name":"validator_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/validators/{validator_address}/outstanding_rewards":{"get":{"tags":["Query"],"summary":"ValidatorOutstandingRewards queries rewards of a validator address.","operationId":"UpgradeQuery_ValidatorOutstandingRewards","parameters":[{"type":"string","description":"validator_address defines the validator address to query for.","name":"validator_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/distribution/v1beta1/validators/{validator_address}/slashes":{"get":{"tags":["Query"],"summary":"ValidatorSlashes queries slash events of a validator.","operationId":"UpgradeQuery_ValidatorSlashes","parameters":[{"type":"string","description":"validator_address defines the validator address to query for.","name":"validator_address","in":"path","required":true},{"type":"string","format":"uint64","description":"starting_height defines the optional starting height to query the slashes.","name":"starting_height","in":"query"},{"type":"string","format":"uint64","description":"starting_height defines the optional ending height to query the slashes.","name":"ending_height","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/evidence/v1beta1/evidence":{"get":{"tags":["Query"],"summary":"AllEvidence queries all evidence.","operationId":"UpgradeQuery_AllEvidence","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.evidence.v1beta1.QueryAllEvidenceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/evidence/v1beta1/evidence/{hash}":{"get":{"tags":["Query"],"summary":"Evidence queries evidence based on evidence hash.","operationId":"UpgradeQuery_Evidence","parameters":[{"type":"string","description":"hash defines the evidence hash of the requested evidence.\n\nSince: cosmos-sdk 0.47","name":"hash","in":"path","required":true},{"type":"string","format":"byte","description":"evidence_hash defines the hash of the requested evidence.\nDeprecated: Use hash, a HEX encoded string, instead.","name":"evidence_hash","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.evidence.v1beta1.QueryEvidenceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}":{"get":{"tags":["Query"],"summary":"Allowance returns granted allwance to the grantee by the granter.","operationId":"UpgradeQuery_Allowance","parameters":[{"type":"string","description":"granter is the address of the user granting an allowance of their funds.","name":"granter","in":"path","required":true},{"type":"string","description":"grantee is the address of the user being granted an allowance of another user's funds.","name":"grantee","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.feegrant.v1beta1.QueryAllowanceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/feegrant/v1beta1/allowances/{grantee}":{"get":{"tags":["Query"],"summary":"Allowances returns all the grants for the given grantee address.","operationId":"UpgradeQuery_Allowances","parameters":[{"type":"string","name":"grantee","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.feegrant.v1beta1.QueryAllowancesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/feegrant/v1beta1/issued/{granter}":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Query"],"summary":"AllowancesByGranter returns all the grants given by an address","operationId":"UpgradeQuery_AllowancesByGranter","parameters":[{"type":"string","name":"granter","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1/constitution":{"get":{"tags":["Query"],"summary":"Constitution queries the chain's constitution.","operationId":"UpgradeQuery_Constitution","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.QueryConstitutionResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1/params/{params_type}":{"get":{"tags":["Query"],"summary":"Params queries all parameters of the gov module.","operationId":"UpgradeQuery_ParamsMixin75","parameters":[{"type":"string","description":"params_type defines which parameters to query for, can be one of \"voting\",\n\"tallying\" or \"deposit\".","name":"params_type","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1/proposals":{"get":{"tags":["Query"],"summary":"Proposals queries all proposals based on given status.","operationId":"UpgradeQuery_Proposals","parameters":[{"enum":["PROPOSAL_STATUS_UNSPECIFIED","PROPOSAL_STATUS_DEPOSIT_PERIOD","PROPOSAL_STATUS_VOTING_PERIOD","PROPOSAL_STATUS_PASSED","PROPOSAL_STATUS_REJECTED","PROPOSAL_STATUS_FAILED","PROPOSAL_STATUS_TALLY_PERIOD"],"type":"string","default":"PROPOSAL_STATUS_UNSPECIFIED","description":"proposal_status defines the status of the proposals.\n\n - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status.\n - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit\nperiod.\n - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting\nperiod.\n - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has\npassed.\n - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has\nbeen rejected.\n - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has\nfailed.\n - PROPOSAL_STATUS_TALLY_PERIOD: PROPOSAL_STATUS_TALLY_PERIOD defines a proposal status during the tally\nperiod.","name":"proposal_status","in":"query"},{"type":"string","description":"voter defines the voter address for the proposals.","name":"voter","in":"query"},{"type":"string","description":"depositor defines the deposit addresses from the proposals.","name":"depositor","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.QueryProposalsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1/proposals/{proposal_id}":{"get":{"tags":["Query"],"summary":"Proposal queries proposal details based on ProposalID.","operationId":"UpgradeQuery_Proposal","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.QueryProposalResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1/proposals/{proposal_id}/deposits":{"get":{"tags":["Query"],"summary":"Deposits queries all deposits of a single proposal.","operationId":"UpgradeQuery_Deposits","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.QueryDepositsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor}":{"get":{"tags":["Query"],"summary":"Deposit queries single deposit information based on proposalID, depositAddr.","operationId":"UpgradeQuery_Deposit","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","description":"depositor defines the deposit addresses from the proposals.","name":"depositor","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.QueryDepositResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1/proposals/{proposal_id}/tally":{"get":{"tags":["Query"],"summary":"TallyResult queries the tally of a proposal vote.","operationId":"UpgradeQuery_TallyResult","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.QueryTallyResultResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1/proposals/{proposal_id}/votes":{"get":{"tags":["Query"],"summary":"Votes queries votes of a given proposal.","operationId":"UpgradeQuery_Votes","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.QueryVotesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1/proposals/{proposal_id}/votes/{voter}":{"get":{"tags":["Query"],"summary":"Vote queries voted information based on proposalID, voterAddr.","operationId":"UpgradeQuery_Vote","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","description":"voter defines the voter address for the proposals.","name":"voter","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1.QueryVoteResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1beta1/params/{params_type}":{"get":{"tags":["Query"],"summary":"Params queries all parameters of the gov module.","operationId":"UpgradeQuery_ParamsMixin79","parameters":[{"type":"string","description":"params_type defines which parameters to query for, can be one of \"voting\",\n\"tallying\" or \"deposit\".","name":"params_type","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1beta1/proposals":{"get":{"tags":["Query"],"summary":"Proposals queries all proposals based on given status.","operationId":"UpgradeQuery_ProposalsMixin79","parameters":[{"enum":["PROPOSAL_STATUS_UNSPECIFIED","PROPOSAL_STATUS_DEPOSIT_PERIOD","PROPOSAL_STATUS_VOTING_PERIOD","PROPOSAL_STATUS_PASSED","PROPOSAL_STATUS_REJECTED","PROPOSAL_STATUS_FAILED"],"type":"string","default":"PROPOSAL_STATUS_UNSPECIFIED","description":"proposal_status defines the status of the proposals.\n\n - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status.\n - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit\nperiod.\n - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting\nperiod.\n - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has\npassed.\n - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has\nbeen rejected.\n - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has\nfailed.","name":"proposal_status","in":"query"},{"type":"string","description":"voter defines the voter address for the proposals.","name":"voter","in":"query"},{"type":"string","description":"depositor defines the deposit addresses from the proposals.","name":"depositor","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.QueryProposalsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1beta1/proposals/{proposal_id}":{"get":{"tags":["Query"],"summary":"Proposal queries proposal details based on ProposalID.","operationId":"UpgradeQuery_ProposalMixin79","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.QueryProposalResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits":{"get":{"tags":["Query"],"summary":"Deposits queries all deposits of a single proposal.","operationId":"UpgradeQuery_DepositsMixin79","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.QueryDepositsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}":{"get":{"tags":["Query"],"summary":"Deposit queries single deposit information based on proposalID, depositor address.","operationId":"UpgradeQuery_DepositMixin79","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","description":"depositor defines the deposit addresses from the proposals.","name":"depositor","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.QueryDepositResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1beta1/proposals/{proposal_id}/tally":{"get":{"tags":["Query"],"summary":"TallyResult queries the tally of a proposal vote.","operationId":"UpgradeQuery_TallyResultMixin79","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.QueryTallyResultResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1beta1/proposals/{proposal_id}/votes":{"get":{"tags":["Query"],"summary":"Votes queries votes of a given proposal.","operationId":"UpgradeQuery_VotesMixin79","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.QueryVotesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter}":{"get":{"tags":["Query"],"summary":"Vote queries voted information based on proposalID, voterAddr.","operationId":"UpgradeQuery_VoteMixin79","parameters":[{"type":"string","format":"uint64","description":"proposal_id defines the unique id of the proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","description":"voter defines the voter address for the proposals.","name":"voter","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.gov.v1beta1.QueryVoteResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/group_info/{group_id}":{"get":{"tags":["Query"],"summary":"GroupInfo queries group info based on group id.","operationId":"UpgradeQuery_GroupInfo","parameters":[{"type":"string","format":"uint64","description":"group_id is the unique ID of the group.","name":"group_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryGroupInfoResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/group_members/{group_id}":{"get":{"tags":["Query"],"summary":"GroupMembers queries members of a group by group id.","operationId":"UpgradeQuery_GroupMembers","parameters":[{"type":"string","format":"uint64","description":"group_id is the unique ID of the group.","name":"group_id","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryGroupMembersResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/group_policies_by_admin/{admin}":{"get":{"tags":["Query"],"summary":"GroupPoliciesByAdmin queries group policies by admin address.","operationId":"UpgradeQuery_GroupPoliciesByAdmin","parameters":[{"type":"string","description":"admin is the admin address of the group policy.","name":"admin","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryGroupPoliciesByAdminResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/group_policies_by_group/{group_id}":{"get":{"tags":["Query"],"summary":"GroupPoliciesByGroup queries group policies by group id.","operationId":"UpgradeQuery_GroupPoliciesByGroup","parameters":[{"type":"string","format":"uint64","description":"group_id is the unique ID of the group policy's group.","name":"group_id","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryGroupPoliciesByGroupResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/group_policy_info/{address}":{"get":{"tags":["Query"],"summary":"GroupPolicyInfo queries group policy info based on account address of group policy.","operationId":"UpgradeQuery_GroupPolicyInfo","parameters":[{"type":"string","description":"address is the account address of the group policy.","name":"address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryGroupPolicyInfoResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/groups":{"get":{"description":"Since: cosmos-sdk 0.47.1","tags":["Query"],"summary":"Groups queries all groups in state.","operationId":"UpgradeQuery_Groups","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryGroupsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/groups_by_admin/{admin}":{"get":{"tags":["Query"],"summary":"GroupsByAdmin queries groups by admin address.","operationId":"UpgradeQuery_GroupsByAdmin","parameters":[{"type":"string","description":"admin is the account address of a group's admin.","name":"admin","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryGroupsByAdminResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/groups_by_member/{address}":{"get":{"tags":["Query"],"summary":"GroupsByMember queries groups by member address.","operationId":"UpgradeQuery_GroupsByMember","parameters":[{"type":"string","description":"address is the group member address.","name":"address","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryGroupsByMemberResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/proposal/{proposal_id}":{"get":{"tags":["Query"],"summary":"Proposal queries a proposal based on proposal id.","operationId":"UpgradeQuery_ProposalMixin83","parameters":[{"type":"string","format":"uint64","description":"proposal_id is the unique ID of a proposal.","name":"proposal_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryProposalResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/proposals/{proposal_id}/tally":{"get":{"tags":["Query"],"summary":"TallyResult returns the tally result of a proposal. If the proposal is\nstill in voting period, then this query computes the current tally state,\nwhich might not be final. On the other hand, if the proposal is final,\nthen it simply returns the `final_tally_result` state stored in the\nproposal itself.","operationId":"UpgradeQuery_TallyResultMixin83","parameters":[{"type":"string","format":"uint64","description":"proposal_id is the unique id of a proposal.","name":"proposal_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryTallyResultResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/proposals_by_group_policy/{address}":{"get":{"tags":["Query"],"summary":"ProposalsByGroupPolicy queries proposals based on account address of group policy.","operationId":"UpgradeQuery_ProposalsByGroupPolicy","parameters":[{"type":"string","description":"address is the account address of the group policy related to proposals.","name":"address","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryProposalsByGroupPolicyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/vote_by_proposal_voter/{proposal_id}/{voter}":{"get":{"tags":["Query"],"summary":"VoteByProposalVoter queries a vote by proposal id and voter.","operationId":"UpgradeQuery_VoteByProposalVoter","parameters":[{"type":"string","format":"uint64","description":"proposal_id is the unique ID of a proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","description":"voter is a proposal voter account address.","name":"voter","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryVoteByProposalVoterResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/votes_by_proposal/{proposal_id}":{"get":{"tags":["Query"],"summary":"VotesByProposal queries a vote by proposal id.","operationId":"UpgradeQuery_VotesByProposal","parameters":[{"type":"string","format":"uint64","description":"proposal_id is the unique ID of a proposal.","name":"proposal_id","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryVotesByProposalResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/group/v1/votes_by_voter/{voter}":{"get":{"tags":["Query"],"summary":"VotesByVoter queries a vote by voter.","operationId":"UpgradeQuery_VotesByVoter","parameters":[{"type":"string","description":"voter is a proposal voter account address.","name":"voter","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.group.v1.QueryVotesByVoterResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/mint/v1beta1/annual_provisions":{"get":{"tags":["Query"],"summary":"AnnualProvisions current minting annual provisions value.","operationId":"UpgradeQuery_AnnualProvisions","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/mint/v1beta1/inflation":{"get":{"tags":["Query"],"summary":"Inflation returns the current minting inflation value.","operationId":"UpgradeQuery_Inflation","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.mint.v1beta1.QueryInflationResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/mint/v1beta1/params":{"get":{"tags":["Query"],"summary":"Params returns the total set of minting parameters.","operationId":"UpgradeQuery_ParamsMixin88","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.mint.v1beta1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/nft/v1beta1/balance/{owner}/{class_id}":{"get":{"tags":["Query"],"summary":"Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721","operationId":"UpgradeQuery_BalanceMixin94","parameters":[{"type":"string","description":"owner is the owner address of the nft","name":"owner","in":"path","required":true},{"type":"string","description":"class_id associated with the nft","name":"class_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.nft.v1beta1.QueryBalanceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/nft/v1beta1/classes":{"get":{"tags":["Query"],"summary":"Classes queries all NFT classes","operationId":"UpgradeQuery_Classes","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.nft.v1beta1.QueryClassesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/nft/v1beta1/classes/{class_id}":{"get":{"tags":["Query"],"summary":"Class queries an NFT class based on its id","operationId":"UpgradeQuery_Class","parameters":[{"type":"string","description":"class_id associated with the nft","name":"class_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.nft.v1beta1.QueryClassResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/nft/v1beta1/nfts":{"get":{"tags":["Query"],"summary":"NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in\nERC721Enumerable","operationId":"UpgradeQuery_NFTs","parameters":[{"type":"string","description":"class_id associated with the nft","name":"class_id","in":"query"},{"type":"string","description":"owner is the owner address of the nft","name":"owner","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.nft.v1beta1.QueryNFTsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/nft/v1beta1/nfts/{class_id}/{id}":{"get":{"tags":["Query"],"summary":"NFT queries an NFT based on its class and id.","operationId":"UpgradeQuery_NFT","parameters":[{"type":"string","description":"class_id associated with the nft","name":"class_id","in":"path","required":true},{"type":"string","description":"id is a unique identifier of the NFT","name":"id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.nft.v1beta1.QueryNFTResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/nft/v1beta1/owner/{class_id}/{id}":{"get":{"tags":["Query"],"summary":"Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721","operationId":"UpgradeQuery_Owner","parameters":[{"type":"string","description":"class_id associated with the nft","name":"class_id","in":"path","required":true},{"type":"string","description":"id is a unique identifier of the NFT","name":"id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.nft.v1beta1.QueryOwnerResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/nft/v1beta1/supply/{class_id}":{"get":{"tags":["Query"],"summary":"Supply queries the number of NFTs from the given class, same as totalSupply of ERC721.","operationId":"UpgradeQuery_Supply","parameters":[{"type":"string","description":"class_id associated with the nft","name":"class_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.nft.v1beta1.QuerySupplyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/params/v1beta1/params":{"get":{"tags":["Query"],"summary":"Params queries a specific parameter of a module, given its subspace and\nkey.","operationId":"UpgradeQuery_ParamsMixin97","parameters":[{"type":"string","description":"subspace defines the module to query the parameter for.","name":"subspace","in":"query"},{"type":"string","description":"key defines the key of the parameter in the subspace.","name":"key","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.params.v1beta1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/params/v1beta1/subspaces":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Query"],"summary":"Subspaces queries for all registered subspaces and all keys for a subspace.","operationId":"UpgradeQuery_Subspaces","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.params.v1beta1.QuerySubspacesResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/slashing/v1beta1/params":{"get":{"tags":["Query"],"summary":"Params queries the parameters of slashing module","operationId":"UpgradeQuery_ParamsMixin100","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.slashing.v1beta1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/slashing/v1beta1/signing_infos":{"get":{"tags":["Query"],"summary":"SigningInfos queries signing info of all validators","operationId":"UpgradeQuery_SigningInfos","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.slashing.v1beta1.QuerySigningInfosResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/slashing/v1beta1/signing_infos/{cons_address}":{"get":{"tags":["Query"],"summary":"SigningInfo queries the signing info of given cons address","operationId":"UpgradeQuery_SigningInfo","parameters":[{"type":"string","description":"cons_address is the address to query signing info of","name":"cons_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.slashing.v1beta1.QuerySigningInfoResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/delegations/{delegator_addr}":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"DelegatorDelegations queries all delegations of a given delegator address.","operationId":"UpgradeQuery_DelegatorDelegations","parameters":[{"type":"string","description":"delegator_addr defines the delegator address to query for.","name":"delegator_addr","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/delegators/{delegator_addr}/redelegations":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"Redelegations queries redelegations of given address.","operationId":"UpgradeQuery_Redelegations","parameters":[{"type":"string","description":"delegator_addr defines the delegator address to query for.","name":"delegator_addr","in":"path","required":true},{"type":"string","description":"src_validator_addr defines the validator address to redelegate from.","name":"src_validator_addr","in":"query"},{"type":"string","description":"dst_validator_addr defines the validator address to redelegate to.","name":"dst_validator_addr","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryRedelegationsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/delegators/{delegator_addr}/unbonding_delegations":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"DelegatorUnbondingDelegations queries all unbonding delegations of a given\ndelegator address.","operationId":"UpgradeQuery_DelegatorUnbondingDelegations","parameters":[{"type":"string","description":"delegator_addr defines the delegator address to query for.","name":"delegator_addr","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"DelegatorValidators queries all validators info for given delegator\naddress.","operationId":"UpgradeQuery_DelegatorValidatorsMixin105","parameters":[{"type":"string","description":"delegator_addr defines the delegator address to query for.","name":"delegator_addr","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators/{validator_addr}":{"get":{"tags":["Query"],"summary":"DelegatorValidator queries validator info for given delegator validator\npair.","operationId":"UpgradeQuery_DelegatorValidator","parameters":[{"type":"string","description":"delegator_addr defines the delegator address to query for.","name":"delegator_addr","in":"path","required":true},{"type":"string","description":"validator_addr defines the validator address to query for.","name":"validator_addr","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/historical_info/{height}":{"get":{"tags":["Query"],"summary":"HistoricalInfo queries the historical info for given height.","operationId":"UpgradeQuery_HistoricalInfo","parameters":[{"type":"string","format":"int64","description":"height defines at which height to query the historical info.","name":"height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryHistoricalInfoResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the staking parameters.","operationId":"UpgradeQuery_ParamsMixin105","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/pool":{"get":{"tags":["Query"],"summary":"Pool queries the pool info.","operationId":"UpgradeQuery_Pool","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryPoolResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/validators":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"Validators queries all validators that match the given status.","operationId":"UpgradeQuery_Validators","parameters":[{"type":"string","description":"status enables to query for validators matching a given status.","name":"status","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryValidatorsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/validators/{validator_addr}":{"get":{"tags":["Query"],"summary":"Validator queries validator info for given validator address.","operationId":"UpgradeQuery_Validator","parameters":[{"type":"string","description":"validator_addr defines the validator address to query for.","name":"validator_addr","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryValidatorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/validators/{validator_addr}/delegations":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"ValidatorDelegations queries delegate info for given validator.","operationId":"UpgradeQuery_ValidatorDelegations","parameters":[{"type":"string","description":"validator_addr defines the validator address to query for.","name":"validator_addr","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}":{"get":{"tags":["Query"],"summary":"Delegation queries delegate info for given validator delegator pair.","operationId":"UpgradeQuery_Delegation","parameters":[{"type":"string","description":"validator_addr defines the validator address to query for.","name":"validator_addr","in":"path","required":true},{"type":"string","description":"delegator_addr defines the delegator address to query for.","name":"delegator_addr","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryDelegationResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}/unbonding_delegation":{"get":{"tags":["Query"],"summary":"UnbondingDelegation queries unbonding info for given validator delegator\npair.","operationId":"UpgradeQuery_UnbondingDelegation","parameters":[{"type":"string","description":"validator_addr defines the validator address to query for.","name":"validator_addr","in":"path","required":true},{"type":"string","description":"delegator_addr defines the delegator address to query for.","name":"delegator_addr","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/staking/v1beta1/validators/{validator_addr}/unbonding_delegations":{"get":{"description":"When called from another module, this query might consume a high amount of\ngas if the pagination field is incorrectly set.","tags":["Query"],"summary":"ValidatorUnbondingDelegations queries unbonding delegations of a validator.","operationId":"UpgradeQuery_ValidatorUnbondingDelegations","parameters":[{"type":"string","description":"validator_addr defines the validator address to query for.","name":"validator_addr","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/tx/v1beta1/decode":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Service"],"summary":"TxDecode decodes the transaction.","operationId":"UpgradeService_TxDecode","parameters":[{"description":"TxDecodeRequest is the request type for the Service.TxDecode\nRPC method.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.TxDecodeRequest"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.TxDecodeResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/tx/v1beta1/decode/amino":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Service"],"summary":"TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON.","operationId":"UpgradeService_TxDecodeAmino","parameters":[{"description":"TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino\nRPC method.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.TxDecodeAminoRequest"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.TxDecodeAminoResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/tx/v1beta1/encode":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Service"],"summary":"TxEncode encodes the transaction.","operationId":"UpgradeService_TxEncode","parameters":[{"description":"TxEncodeRequest is the request type for the Service.TxEncode\nRPC method.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.TxEncodeRequest"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.TxEncodeResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/tx/v1beta1/encode/amino":{"post":{"description":"Since: cosmos-sdk 0.47","tags":["Service"],"summary":"TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes.","operationId":"UpgradeService_TxEncodeAmino","parameters":[{"description":"TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino\nRPC method.\n\nSince: cosmos-sdk 0.47","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.TxEncodeAminoRequest"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.TxEncodeAminoResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/tx/v1beta1/simulate":{"post":{"tags":["Service"],"summary":"Simulate simulates executing a transaction for estimating gas usage.","operationId":"UpgradeService_Simulate","parameters":[{"description":"SimulateRequest is the request type for the Service.Simulate\nRPC method.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.SimulateRequest"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.SimulateResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/tx/v1beta1/txs":{"get":{"tags":["Service"],"summary":"GetTxsEvent fetches txs by event.","operationId":"UpgradeService_GetTxsEvent","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"events is the list of transaction event type.\nDeprecated post v0.47.x: use query instead, which should contain a valid\nevents query.","name":"events","in":"query"},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"},{"enum":["ORDER_BY_UNSPECIFIED","ORDER_BY_ASC","ORDER_BY_DESC"],"type":"string","default":"ORDER_BY_UNSPECIFIED","description":" - ORDER_BY_UNSPECIFIED: ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults\nto ASC in this case.\n - ORDER_BY_ASC: ORDER_BY_ASC defines ascending order\n - ORDER_BY_DESC: ORDER_BY_DESC defines descending order","name":"order_by","in":"query"},{"type":"string","format":"uint64","description":"page is the page number to query, starts at 1. If not provided, will\ndefault to first page.","name":"page","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"limit","in":"query"},{"type":"string","description":"query defines the transaction event query that is proxied to Tendermint's\nTxSearch RPC method. The query must be valid.\n\nSince cosmos-sdk 0.50","name":"query","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.GetTxsEventResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}},"post":{"tags":["Service"],"summary":"BroadcastTx broadcast transaction.","operationId":"UpgradeService_BroadcastTx","parameters":[{"description":"BroadcastTxRequest is the request type for the Service.BroadcastTxRequest\nRPC method.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.BroadcastTxRequest"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.BroadcastTxResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/tx/v1beta1/txs/block/{height}":{"get":{"description":"Since: cosmos-sdk 0.45.2","tags":["Service"],"summary":"GetBlockWithTxs fetches a block with decoded txs.","operationId":"UpgradeService_GetBlockWithTxs","parameters":[{"type":"string","format":"int64","description":"height is the height of the block to query.","name":"height","in":"path","required":true},{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.GetBlockWithTxsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/tx/v1beta1/txs/{hash}":{"get":{"tags":["Service"],"summary":"GetTx fetches a tx by hash.","operationId":"UpgradeService_GetTx","parameters":[{"type":"string","description":"hash is the tx hash to query, encoded as a hex string.","name":"hash","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.tx.v1beta1.GetTxResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/upgrade/v1beta1/applied_plan/{name}":{"get":{"tags":["Query"],"summary":"AppliedPlan queries a previously applied upgrade plan by its name.","operationId":"UpgradeQuery_AppliedPlan","parameters":[{"type":"string","description":"name is the name of the applied plan to query for.","name":"name","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/upgrade/v1beta1/authority":{"get":{"description":"Since: cosmos-sdk 0.46","tags":["Query"],"summary":"Returns the account with authority to conduct upgrades","operationId":"UpgradeQuery_Authority","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.upgrade.v1beta1.QueryAuthorityResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/upgrade/v1beta1/current_plan":{"get":{"tags":["Query"],"summary":"CurrentPlan queries the current upgrade plan.","operationId":"UpgradeQuery_CurrentPlan","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/upgrade/v1beta1/module_versions":{"get":{"description":"Since: cosmos-sdk 0.43","tags":["Query"],"summary":"ModuleVersions queries the list of module versions from state.","operationId":"UpgradeQuery_ModuleVersions","parameters":[{"type":"string","description":"module_name is a field to query a specific module\nconsensus version from state. Leaving this empty will\nfetch the full list of module versions from state","name":"module_name","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/cosmos/upgrade/v1beta1/upgraded_consensus_state/{last_height}":{"get":{"tags":["Query"],"summary":"UpgradedConsensusState queries the consensus state that will serve\nas a trusted kernel for the next version of this chain. It will only be\nstored at the last height of this chain.\nUpgradedConsensusState RPC not supported with legacy querier\nThis rpc is deprecated now that IBC has its own replacement\n(https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54)","operationId":"UpgradeQuery_UpgradedConsensusState","parameters":[{"type":"string","format":"int64","description":"last height of the current chain must be sent in request\nas this is the height under which next consensus state is stored","name":"last_height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/CreateAuthorizedAddress":{"post":{"tags":["Msg"],"summary":"CreateAuthorizedAddress defines an operation to mark an address\nas authorized to create and/or update pubkeys on the chain","operationId":"GithubComFairblockfairyringMsg_CreateAuthorizedAddress","parameters":[{"description":"MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateAuthorizedAddress"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateAuthorizedAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/CreateLatestPubkey":{"post":{"tags":["Msg"],"summary":"CreateLatestPubkey defines an operation to add a\npublic key to the chain (can only be done by an authorized address)","operationId":"GithubComFairblockfairyringMsg_CreateLatestPubkey","parameters":[{"description":"MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateLatestPubkey"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgCreateLatestPubkeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/DeRegisterValidator":{"post":{"tags":["Msg"],"summary":"DeRegisterValidator defines an operation to de-register\na registered validator","operationId":"GithubComFairblockfairyringMsg_DeRegisterValidator","parameters":[{"description":"MsgDeRegisterValidator is the Msg/DeRegisterValidator request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgDeRegisterValidator"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgDeRegisterValidatorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/DeleteAuthorizedAddress":{"post":{"tags":["Msg"],"summary":"DeleteAuthorizedAddress defines an operation to revoke the\nauthorization of a previously authorized address","operationId":"GithubComFairblockfairyringMsg_DeleteAuthorizedAddress","parameters":[{"description":"MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgDeleteAuthorizedAddress"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgDeleteAuthorizedAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/OverrideLatestPubkey":{"post":{"tags":["Msg"],"summary":"OverrideLatestPubkey defines an operation to override the current active pubkey","operationId":"GithubComFairblockfairyringMsg_OverrideLatestPubkey","parameters":[{"description":"MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgOverrideLatestPubkey"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgOverrideLatestPubkeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/RegisterValidator":{"post":{"tags":["Msg"],"summary":"RegisterValidator defines a operation to register validator which\nis then eligible to participate in sending keyshares","operationId":"GithubComFairblockfairyringMsg_RegisterValidator","parameters":[{"description":"MsgRegisterValidator is the Msg/RegisterValidator request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgRegisterValidator"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgRegisterValidatorResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/SendKeyshare":{"post":{"tags":["Msg"],"summary":"SendKeyshare defines an operation to submit keyshares\nevery block from registered validators","operationId":"GithubComFairblockfairyringMsg_SendKeyshare","parameters":[{"description":"MsgSendKeyshare is the Msg/SendKeyshare request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSendKeyshare"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSendKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/SubmitEncryptedKeyshare":{"post":{"tags":["Msg"],"summary":"SubmitEncryptedKeyshare defines an operation to submit\nan encrypted keyshare from a registered validator","operationId":"GithubComFairblockfairyringMsg_SubmitEncryptedKeyshare","parameters":[{"description":"MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSubmitEncryptedKeyshare"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSubmitEncryptedKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/SubmitGeneralKeyshare":{"post":{"tags":["Msg"],"summary":"SubmitGeneralKeyshare defines an operation to submit a\ngeneral keyshare from a registered validator","operationId":"GithubComFairblockfairyringMsg_SubmitGeneralKeyshare","parameters":[{"description":"MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSubmitGeneralKeyshare"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgSubmitGeneralKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/UpdateAuthorizedAddress":{"post":{"tags":["Msg"],"summary":"UpdateAuthorizedAddress defines an operation to update the\nlist of authorized addresses","operationId":"GithubComFairblockfairyringMsg_UpdateAuthorizedAddress","parameters":[{"description":"MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgUpdateAuthorizedAddress"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgUpdateAuthorizedAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.keyshare.Msg/UpdateParams":{"post":{"tags":["Msg"],"summary":"UpdateParams defines a (governance) operation for updating the module\nparameters. The authority defaults to the x/gov module account.","operationId":"GithubComFairblockfairyringMsg_UpdateParams","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.keyshare.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/RegisterContract":{"post":{"tags":["Msg"],"summary":"RegisterContract defines an operation to make an instantiated\ncontract eligible to be automatically executed when a particular\nidentity has decryption key available for it","operationId":"GithubComFairblockfairyringMsg_RegisterContract","parameters":[{"description":"MsgRegisterContract is the Msg/RegisterContract request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgRegisterContract"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgRegisterContractResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/RequestGeneralDecryptionKey":{"post":{"tags":["Msg"],"summary":"RequestGeneralDecryptionKey defines an operation to signal validators to start\nsubmitting keyshares for a particular identity","operationId":"GithubComFairblockfairyringMsg_RequestGeneralDecryptionKey","parameters":[{"description":"MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestGeneralDecryptionKey"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestGeneralDecryptionKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/RequestGeneralIdentity":{"post":{"tags":["Msg"],"summary":"RequestGeneralIdentity defines an operation to request the\ncreation of a new identity to which validators will be required\nto submit keyshares","operationId":"GithubComFairblockfairyringMsg_RequestGeneralIdentity","parameters":[{"description":"MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestGeneralIdentity"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestGeneralIdentityResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/RequestPrivateDecryptionKey":{"post":{"tags":["Msg"],"summary":"RequestPrivateDecryptionKey defines an operation to signal validators to start\nsubmitting encrypted keyshares for a particular identity","operationId":"GithubComFairblockfairyringMsg_RequestPrivateDecryptionKey","parameters":[{"description":"MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestPrivateDecryptionKey"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestPrivateDecryptionKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/RequestPrivateIdentity":{"post":{"tags":["Msg"],"summary":"RequestPrivateIdentity defines an operation to request the\ncreation of a new identity to which validators will be required\nto submit encrypted keyshares","operationId":"GithubComFairblockfairyringMsg_RequestPrivateIdentity","parameters":[{"description":"MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestPrivateIdentity"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgRequestPrivateIdentityResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/SubmitDecryptionKey":{"post":{"tags":["Msg"],"summary":"SubmitDecryptionKey defines an operation to submit a\ndecryption to a destination chain","operationId":"GithubComFairblockfairyringMsg_SubmitDecryptionKey","parameters":[{"description":"MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitDecryptionKey"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitDecryptionKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/SubmitEncryptedTx":{"post":{"tags":["Msg"],"summary":"SubmitEncryptedTx defines an operation to submit an\nencrypted transaction for a particular target block height","operationId":"GithubComFairblockfairyringMsg_SubmitEncryptedTx","parameters":[{"description":"MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitEncryptedTx"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitEncryptedTxResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/SubmitGeneralEncryptedTx":{"post":{"tags":["Msg"],"summary":"SubmitGeneralEncryptedTx defines an operation to submit an\nencrypted transaction for a particular identity","operationId":"GithubComFairblockfairyringMsg_SubmitGeneralEncryptedTx","parameters":[{"description":"MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitGeneralEncryptedTx"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgSubmitGeneralEncryptedTxResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/UnregisterContract":{"post":{"tags":["Msg"],"summary":"UnregisterContract defines an operation to remove a registered contract\nfrom the list of contracts set to be automatically executed when\ndecryption key is available for a particular identity","operationId":"GithubComFairblockfairyringMsg_UnregisterContract","parameters":[{"description":"MsgUnregisterContract is the Msg/UnregisterContract request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgUnregisterContract"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgUnregisterContractResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring.pep.Msg/UpdateParams":{"post":{"tags":["Msg"],"summary":"UpdateParams defines a (governance) operation for updating the module\nparameters. The authority defaults to the x/gov module account.","operationId":"GithubComFairblockfairyringMsg_UpdateParamsMixin20","parameters":[{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/fairyring.pep.MsgUpdateParams"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.MsgUpdateParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/authorized_address":{"get":{"tags":["Query"],"summary":"Queries a list of AuthorizedAddress items","operationId":"GithubComFairblockfairyringQuery_AuthorizedAddressAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryAuthorizedAddressAllResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/authorized_address/{target}":{"get":{"tags":["Query"],"summary":"Queries a AuthorizedAddress item by target.","operationId":"GithubComFairblockfairyringQuery_AuthorizedAddress","parameters":[{"type":"string","name":"target","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryAuthorizedAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/commitments":{"get":{"tags":["Query"],"summary":"Commitments queries the lists of active and queued commitments","operationId":"GithubComFairblockfairyringQuery_Commitments","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryCommitmentsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/decryption_key":{"get":{"tags":["Query"],"summary":"DecryptionKeyAll Queries a list of DecryptionKey items.","operationId":"GithubComFairblockfairyringQuery_DecryptionKeyAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryDecryptionKeyAllResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/decryption_key/{height}":{"get":{"tags":["Query"],"summary":"DecryptionKey queries a DecryptionKey item by height.","operationId":"GithubComFairblockfairyringQuery_DecryptionKey","parameters":[{"type":"string","format":"uint64","name":"height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryDecryptionKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/general_keyshare":{"get":{"tags":["Query"],"summary":"Queries a list of GeneralKeyshare items","operationId":"GithubComFairblockfairyringQuery_GeneralKeyshareAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryGeneralKeyshareAllResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/general_keyshare/{validator}/{id_type}/{id_value}":{"get":{"tags":["Query"],"summary":"Queries a GeneralKeyshare item by validator address and identity.","operationId":"GithubComFairblockfairyringQuery_GeneralKeyshare","parameters":[{"type":"string","name":"validator","in":"path","required":true},{"type":"string","name":"id_type","in":"path","required":true},{"type":"string","name":"id_value","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryGeneralKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/keyshare":{"get":{"tags":["Query"],"summary":"Queries a list of Keyshare items.","operationId":"GithubComFairblockfairyringQuery_KeyshareAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryKeyshareAllResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/keyshare/{validator}/{block_height}":{"get":{"tags":["Query"],"summary":"Queries a Keyshare by index.","operationId":"GithubComFairblockfairyringQuery_Keyshare","parameters":[{"type":"string","name":"validator","in":"path","required":true},{"type":"string","format":"uint64","name":"block_height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryKeyshareResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComFairblockfairyringQuery_Params","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/pubkey":{"get":{"tags":["Query"],"summary":"Queries the public keys","operationId":"GithubComFairblockfairyringQuery_Pubkey","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryPubkeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/validator_set":{"get":{"tags":["Query"],"summary":"Queries a list of ValidatorSet items.","operationId":"GithubComFairblockfairyringQuery_ValidatorSetAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryValidatorSetAllResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/validator_set/{index}":{"get":{"tags":["Query"],"summary":"Queries a ValidatorSet by index.","operationId":"GithubComFairblockfairyringQuery_ValidatorSet","parameters":[{"type":"string","name":"index","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryValidatorSetResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/keyshare/verifiable_randomness":{"get":{"tags":["Query"],"summary":"Queries verifiable randomness","operationId":"GithubComFairblockfairyringQuery_VerifiableRandomness","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.keyshare.QueryVerifiableRandomnessResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/encrypted_tx":{"get":{"tags":["Query"],"summary":"Queries a list of EncryptedTx items.","operationId":"GithubComFairblockfairyringQuery_EncryptedTxAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryEncryptedTxAllResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/encrypted_tx/{target_height}":{"get":{"tags":["Query"],"summary":"Queries a list of EncryptedTx items.","operationId":"GithubComFairblockfairyringQuery_EncryptedTxAllFromHeight","parameters":[{"type":"string","format":"uint64","name":"target_height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryEncryptedTxAllFromHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/encrypted_tx/{target_height}/{index}":{"get":{"tags":["Query"],"summary":"Queries a EncryptedTx by index.","operationId":"GithubComFairblockfairyringQuery_EncryptedTx","parameters":[{"type":"string","format":"uint64","name":"target_height","in":"path","required":true},{"type":"string","format":"uint64","name":"index","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryEncryptedTxResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/general_identity":{"get":{"tags":["Query"],"summary":"Queries a list of General Identity requests","operationId":"GithubComFairblockfairyringQuery_GeneralIdentityAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryGeneralIdentityAllResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/general_identity/{req_id}":{"get":{"tags":["Query"],"summary":"Queries a General Identity request by request id","operationId":"GithubComFairblockfairyringQuery_GeneralIdentity","parameters":[{"type":"string","name":"req_id","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryGeneralIdentityResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/latest_height":{"get":{"tags":["Query"],"summary":"Queries a list of LatestHeight items.","operationId":"GithubComFairblockfairyringQuery_LatestHeight","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryLatestHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComFairblockfairyringQuery_ParamsMixin18","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/pep_nonce":{"get":{"tags":["Query"],"summary":"Queries a list of PepNonce items.","operationId":"GithubComFairblockfairyringQuery_PepNonceAll","parameters":[{"type":"string","format":"byte","description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","name":"pagination.key","in":"query"},{"type":"string","format":"uint64","description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","name":"pagination.offset","in":"query"},{"type":"string","format":"uint64","description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","name":"pagination.limit","in":"query"},{"type":"boolean","description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","name":"pagination.count_total","in":"query"},{"type":"boolean","description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","name":"pagination.reverse","in":"query"}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryPepNonceAllResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/pep_nonce/{address}":{"get":{"tags":["Query"],"summary":"Queries a PepNonce by index.","operationId":"GithubComFairblockfairyringQuery_PepNonce","parameters":[{"type":"string","name":"address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryPepNonceResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/fairyring/pep/pubkey":{"get":{"tags":["Query"],"summary":"Queries the public keys","operationId":"GithubComFairblockfairyringQuery_PubkeyMixin18","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/fairyring.pep.QueryPubkeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/ApplySnapshotChunk":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_ApplySnapshotChunk","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestApplySnapshotChunk"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseApplySnapshotChunk"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/CheckTx":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_CheckTx","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestCheckTx"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseCheckTx"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/Commit":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_Commit","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestCommit"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseCommit"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/Echo":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_Echo","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestEcho"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseEcho"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/ExtendVote":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_ExtendVote","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestExtendVote"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseExtendVote"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/FinalizeBlock":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_FinalizeBlock","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestFinalizeBlock"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseFinalizeBlock"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/Flush":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_Flush","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestFlush"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseFlush"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/Info":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_Info","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestInfo"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseInfo"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/InitChain":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_InitChain","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestInitChain"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseInitChain"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/ListSnapshots":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_ListSnapshots","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestListSnapshots"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseListSnapshots"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/LoadSnapshotChunk":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_LoadSnapshotChunk","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestLoadSnapshotChunk"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseLoadSnapshotChunk"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/OfferSnapshot":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_OfferSnapshot","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestOfferSnapshot"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseOfferSnapshot"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/PrepareProposal":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_PrepareProposal","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestPrepareProposal"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponsePrepareProposal"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/ProcessProposal":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_ProcessProposal","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestProcessProposal"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseProcessProposal"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/Query":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_Query","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestQuery"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseQuery"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/tendermint.abci.ABCI/VerifyVoteExtension":{"post":{"tags":["ABCI"],"operationId":"UpgradeABCI_VerifyVoteExtension","parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/tendermint.abci.RequestVerifyVoteExtension"}}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/tendermint.abci.ResponseVerifyVoteExtension"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}}},"definitions":{"cosmos.auth.v1beta1.AddressBytesToStringResponse":{"description":"AddressBytesToStringResponse is the response type for AddressString rpc method.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"address_string":{"type":"string"}}},"cosmos.auth.v1beta1.AddressStringToBytesResponse":{"description":"AddressStringToBytesResponse is the response type for AddressBytes rpc method.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"address_bytes":{"type":"string","format":"byte"}}},"cosmos.auth.v1beta1.BaseAccount":{"description":"BaseAccount defines a base account type. It contains all the necessary fields\nfor basic account functionality. Any custom account type should extend this\ntype for additional functionality (e.g. vesting).","type":"object","properties":{"account_number":{"type":"string","format":"uint64"},"address":{"type":"string"},"pub_key":{"$ref":"#/definitions/google.protobuf.Any"},"sequence":{"type":"string","format":"uint64"}}},"cosmos.auth.v1beta1.Bech32PrefixResponse":{"description":"Bech32PrefixResponse is the response type for Bech32Prefix rpc method.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"bech32_prefix":{"type":"string"}}},"cosmos.auth.v1beta1.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"params defines the x/auth parameters to update.\n\nNOTE: All parameters must be supplied.","$ref":"#/definitions/cosmos.auth.v1beta1.Params"}}},"cosmos.auth.v1beta1.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.auth.v1beta1.Params":{"description":"Params defines the parameters for the auth module.","type":"object","properties":{"max_memo_characters":{"type":"string","format":"uint64"},"sig_verify_cost_ed25519":{"type":"string","format":"uint64"},"sig_verify_cost_secp256k1":{"type":"string","format":"uint64"},"tx_sig_limit":{"type":"string","format":"uint64"},"tx_size_cost_per_byte":{"type":"string","format":"uint64"}}},"cosmos.auth.v1beta1.QueryAccountAddressByIDResponse":{"description":"Since: cosmos-sdk 0.46.2","type":"object","title":"QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method","properties":{"account_address":{"type":"string"}}},"cosmos.auth.v1beta1.QueryAccountInfoResponse":{"description":"QueryAccountInfoResponse is the Query/AccountInfo response type.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"info":{"description":"info is the account info which is represented by BaseAccount.","$ref":"#/definitions/cosmos.auth.v1beta1.BaseAccount"}}},"cosmos.auth.v1beta1.QueryAccountResponse":{"description":"QueryAccountResponse is the response type for the Query/Account RPC method.","type":"object","properties":{"account":{"description":"account defines the account of the corresponding address.","$ref":"#/definitions/google.protobuf.Any"}}},"cosmos.auth.v1beta1.QueryAccountsResponse":{"description":"QueryAccountsResponse is the response type for the Query/Accounts RPC method.\n\nSince: cosmos-sdk 0.43","type":"object","properties":{"accounts":{"type":"array","title":"accounts are the existing accounts","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.auth.v1beta1.QueryModuleAccountByNameResponse":{"description":"QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method.","type":"object","properties":{"account":{"$ref":"#/definitions/google.protobuf.Any"}}},"cosmos.auth.v1beta1.QueryModuleAccountsResponse":{"description":"QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"accounts":{"type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}}}},"cosmos.auth.v1beta1.QueryParamsResponse":{"description":"QueryParamsResponse is the response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params defines the parameters of the module.","$ref":"#/definitions/cosmos.auth.v1beta1.Params"}}},"cosmos.authz.v1beta1.Grant":{"description":"Grant gives permissions to execute\nthe provide method with expiration time.","type":"object","properties":{"authorization":{"$ref":"#/definitions/google.protobuf.Any"},"expiration":{"type":"string","format":"date-time","title":"time when the grant will expire and will be pruned. If null, then the grant\ndoesn't have a time expiration (other conditions in `authorization`\nmay apply to invalidate the grant)"}}},"cosmos.authz.v1beta1.GrantAuthorization":{"type":"object","title":"GrantAuthorization extends a grant with both the addresses of the grantee and granter.\nIt is used in genesis.proto and query.proto","properties":{"authorization":{"$ref":"#/definitions/google.protobuf.Any"},"expiration":{"type":"string","format":"date-time"},"grantee":{"type":"string"},"granter":{"type":"string"}}},"cosmos.authz.v1beta1.MsgExec":{"description":"MsgExec attempts to execute the provided messages using\nauthorizations granted to the grantee. Each message should have only\none signer corresponding to the granter of the authorization.","type":"object","properties":{"grantee":{"type":"string"},"msgs":{"description":"Execute Msg.\nThe x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg))\ntriple and validate it.","type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}}}},"cosmos.authz.v1beta1.MsgExecResponse":{"description":"MsgExecResponse defines the Msg/MsgExecResponse response type.","type":"object","properties":{"results":{"type":"array","items":{"type":"string","format":"byte"}}}},"cosmos.authz.v1beta1.MsgGrant":{"description":"MsgGrant is a request type for Grant method. It declares authorization to the grantee\non behalf of the granter with the provided expiration time.","type":"object","properties":{"grant":{"$ref":"#/definitions/cosmos.authz.v1beta1.Grant"},"grantee":{"type":"string"},"granter":{"type":"string"}}},"cosmos.authz.v1beta1.MsgGrantResponse":{"description":"MsgGrantResponse defines the Msg/MsgGrant response type.","type":"object"},"cosmos.authz.v1beta1.MsgRevoke":{"description":"MsgRevoke revokes any authorization with the provided sdk.Msg type on the\ngranter's account with that has been granted to the grantee.","type":"object","properties":{"grantee":{"type":"string"},"granter":{"type":"string"},"msg_type_url":{"type":"string"}}},"cosmos.authz.v1beta1.MsgRevokeResponse":{"description":"MsgRevokeResponse defines the Msg/MsgRevokeResponse response type.","type":"object"},"cosmos.authz.v1beta1.QueryGranteeGrantsResponse":{"description":"QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method.","type":"object","properties":{"grants":{"description":"grants is a list of grants granted to the grantee.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.authz.v1beta1.GrantAuthorization"}},"pagination":{"description":"pagination defines an pagination for the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.authz.v1beta1.QueryGranterGrantsResponse":{"description":"QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method.","type":"object","properties":{"grants":{"description":"grants is a list of grants granted by the granter.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.authz.v1beta1.GrantAuthorization"}},"pagination":{"description":"pagination defines an pagination for the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.authz.v1beta1.QueryGrantsResponse":{"description":"QueryGrantsResponse is the response type for the Query/Authorizations RPC method.","type":"object","properties":{"grants":{"description":"authorizations is a list of grants granted for grantee by granter.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.authz.v1beta1.Grant"}},"pagination":{"description":"pagination defines an pagination for the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.autocli.v1.AppOptionsRequest":{"description":"AppOptionsRequest is the RemoteInfoService/AppOptions request type.","type":"object"},"cosmos.autocli.v1.AppOptionsResponse":{"description":"AppOptionsResponse is the RemoteInfoService/AppOptions response type.","type":"object","properties":{"module_options":{"description":"module_options is a map of module name to autocli module options.","type":"object","additionalProperties":{"$ref":"#/definitions/cosmos.autocli.v1.ModuleOptions"}}}},"cosmos.autocli.v1.FlagOptions":{"description":"FlagOptions are options for flags generated from rpc request fields.\nBy default, all request fields are configured as flags based on the\nkebab-case name of the field. Fields can be turned into positional arguments\ninstead by using RpcCommandOptions.positional_args.","type":"object","properties":{"default_value":{"description":"default_value is the default value as text.","type":"string"},"deprecated":{"description":"deprecated is the usage text to show if this flag is deprecated.","type":"string"},"hidden":{"type":"boolean","title":"hidden hides the flag from help/usage text"},"name":{"description":"name is an alternate name to use for the field flag.","type":"string"},"shorthand":{"description":"shorthand is a one-letter abbreviated flag.","type":"string"},"shorthand_deprecated":{"description":"shorthand_deprecated is the usage text to show if the shorthand of this flag is deprecated.","type":"string"},"usage":{"description":"usage is the help message.","type":"string"}}},"cosmos.autocli.v1.ModuleOptions":{"description":"ModuleOptions describes the CLI options for a Cosmos SDK module.","type":"object","properties":{"query":{"description":"query describes the queries commands for the module.","$ref":"#/definitions/cosmos.autocli.v1.ServiceCommandDescriptor"},"tx":{"description":"tx describes the tx commands for the module.","$ref":"#/definitions/cosmos.autocli.v1.ServiceCommandDescriptor"}}},"cosmos.autocli.v1.PositionalArgDescriptor":{"description":"PositionalArgDescriptor describes a positional argument.","type":"object","properties":{"proto_field":{"description":"proto_field specifies the proto field to use as the positional arg. Any\nfields used as positional args will not have a flag generated.","type":"string"},"varargs":{"description":"varargs makes a positional parameter a varargs parameter. This can only be\napplied to last positional parameter and the proto_field must a repeated\nfield.","type":"boolean"}}},"cosmos.autocli.v1.RpcCommandOptions":{"description":"RpcCommandOptions specifies options for commands generated from protobuf\nrpc methods.","type":"object","properties":{"alias":{"description":"alias is an array of aliases that can be used instead of the first word in Use.","type":"array","items":{"type":"string"}},"deprecated":{"description":"deprecated defines, if this command is deprecated and should print this string when used.","type":"string"},"example":{"description":"example is examples of how to use the command.","type":"string"},"flag_options":{"description":"flag_options are options for flags generated from rpc request fields.\nBy default all request fields are configured as flags. They can\nalso be configured as positional args instead using positional_args.","type":"object","additionalProperties":{"$ref":"#/definitions/cosmos.autocli.v1.FlagOptions"}},"long":{"description":"long is the long message shown in the 'help \u003cthis-command\u003e' output.","type":"string"},"positional_args":{"description":"positional_args specifies positional arguments for the command.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.autocli.v1.PositionalArgDescriptor"}},"rpc_method":{"description":"rpc_method is short name of the protobuf rpc method that this command is\ngenerated from.","type":"string"},"short":{"description":"short is the short description shown in the 'help' output.","type":"string"},"skip":{"description":"skip specifies whether to skip this rpc method when generating commands.","type":"boolean"},"suggest_for":{"description":"suggest_for is an array of command names for which this command will be suggested -\nsimilar to aliases but only suggests.","type":"array","items":{"type":"string"}},"use":{"description":"use is the one-line usage method. It also allows specifying an alternate\nname for the command as the first word of the usage text.\n\nBy default the name of an rpc command is the kebab-case short name of the\nrpc method.","type":"string"},"version":{"description":"version defines the version for this command. If this value is non-empty and the command does not\ndefine a \"version\" flag, a \"version\" boolean flag will be added to the command and, if specified,\nwill print content of the \"Version\" variable. A shorthand \"v\" flag will also be added if the\ncommand does not define one.","type":"string"}}},"cosmos.autocli.v1.ServiceCommandDescriptor":{"description":"ServiceCommandDescriptor describes a CLI command based on a protobuf service.","type":"object","properties":{"rpc_command_options":{"description":"rpc_command_options are options for commands generated from rpc methods.\nIf no options are specified for a given rpc method on the service, a\ncommand will be generated for that method with the default options.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.autocli.v1.RpcCommandOptions"}},"service":{"description":"service is the fully qualified name of the protobuf service to build\nthe command from. It can be left empty if sub_commands are used instead\nwhich may be the case if a module provides multiple tx and/or query services.","type":"string"},"sub_commands":{"description":"sub_commands is a map of optional sub-commands for this command based on\ndifferent protobuf services. The map key is used as the name of the\nsub-command.","type":"object","additionalProperties":{"$ref":"#/definitions/cosmos.autocli.v1.ServiceCommandDescriptor"}}}},"cosmos.bank.v1beta1.DenomOwner":{"description":"DenomOwner defines structure representing an account that owns or holds a\nparticular denominated token. It contains the account address and account\nbalance of the denominated token.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"address":{"description":"address defines the address that owns a particular denomination.","type":"string"},"balance":{"description":"balance is the balance of the denominated coin for an account.","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}},"cosmos.bank.v1beta1.DenomUnit":{"description":"DenomUnit represents a struct that describes a given\ndenomination unit of the basic token.","type":"object","properties":{"aliases":{"type":"array","title":"aliases is a list of string aliases for the given denom","items":{"type":"string"}},"denom":{"description":"denom represents the string name of the given denom unit (e.g uatom).","type":"string"},"exponent":{"description":"exponent represents power of 10 exponent that one must\nraise the base_denom to in order to equal the given DenomUnit's denom\n1 denom = 10^exponent base_denom\n(e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with\nexponent = 6, thus: 1 atom = 10^6 uatom).","type":"integer","format":"int64"}}},"cosmos.bank.v1beta1.Input":{"description":"Input models transaction input.","type":"object","properties":{"address":{"type":"string"},"coins":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}}},"cosmos.bank.v1beta1.Metadata":{"description":"Metadata represents a struct that describes\na basic token.","type":"object","properties":{"base":{"description":"base represents the base denom (should be the DenomUnit with exponent = 0).","type":"string"},"denom_units":{"type":"array","title":"denom_units represents the list of DenomUnit's for a given coin","items":{"type":"object","$ref":"#/definitions/cosmos.bank.v1beta1.DenomUnit"}},"description":{"type":"string"},"display":{"description":"display indicates the suggested denom that should be\ndisplayed in clients.","type":"string"},"name":{"description":"Since: cosmos-sdk 0.43","type":"string","title":"name defines the name of the token (eg: Cosmos Atom)"},"symbol":{"description":"symbol is the token symbol usually shown on exchanges (eg: ATOM). This can\nbe the same as the display.\n\nSince: cosmos-sdk 0.43","type":"string"},"uri":{"description":"URI to a document (on or off-chain) that contains additional information. Optional.\n\nSince: cosmos-sdk 0.46","type":"string"},"uri_hash":{"description":"URIHash is a sha256 hash of a document pointed by URI. It's used to verify that\nthe document didn't change. Optional.\n\nSince: cosmos-sdk 0.46","type":"string"}}},"cosmos.bank.v1beta1.MsgMultiSend":{"description":"MsgMultiSend represents an arbitrary multi-in, multi-out send message.","type":"object","properties":{"inputs":{"description":"Inputs, despite being `repeated`, only allows one sender input. This is\nchecked in MsgMultiSend's ValidateBasic.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.bank.v1beta1.Input"}},"outputs":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.bank.v1beta1.Output"}}}},"cosmos.bank.v1beta1.MsgMultiSendResponse":{"description":"MsgMultiSendResponse defines the Msg/MultiSend response type.","type":"object"},"cosmos.bank.v1beta1.MsgSend":{"description":"MsgSend represents a message to send coins from one account to another.","type":"object","properties":{"amount":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"from_address":{"type":"string"},"to_address":{"type":"string"}}},"cosmos.bank.v1beta1.MsgSendResponse":{"description":"MsgSendResponse defines the Msg/Send response type.","type":"object"},"cosmos.bank.v1beta1.MsgSetSendEnabled":{"description":"MsgSetSendEnabled is the Msg/SetSendEnabled request type.\n\nOnly entries to add/update/delete need to be included.\nExisting SendEnabled entries that are not included in this\nmessage are left unchanged.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"authority":{"description":"authority is the address that controls the module.","type":"string"},"send_enabled":{"description":"send_enabled is the list of entries to add or update.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.bank.v1beta1.SendEnabled"}},"use_default_for":{"description":"use_default_for is a list of denoms that should use the params.default_send_enabled value.\nDenoms listed here will have their SendEnabled entries deleted.\nIf a denom is included that doesn't have a SendEnabled entry,\nit will be ignored.","type":"array","items":{"type":"string"}}}},"cosmos.bank.v1beta1.MsgSetSendEnabledResponse":{"description":"MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.bank.v1beta1.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"params defines the x/bank parameters to update.\n\nNOTE: All parameters must be supplied.","$ref":"#/definitions/cosmos.bank.v1beta1.Params"}}},"cosmos.bank.v1beta1.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.bank.v1beta1.Output":{"description":"Output models transaction outputs.","type":"object","properties":{"address":{"type":"string"},"coins":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}}},"cosmos.bank.v1beta1.Params":{"description":"Params defines the parameters for the bank module.","type":"object","properties":{"default_send_enabled":{"type":"boolean"},"send_enabled":{"description":"Deprecated: Use of SendEnabled in params is deprecated.\nFor genesis, use the newly added send_enabled field in the genesis object.\nStorage, lookup, and manipulation of this information is now in the keeper.\n\nAs of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.bank.v1beta1.SendEnabled"}}}},"cosmos.bank.v1beta1.QueryAllBalancesResponse":{"description":"QueryAllBalancesResponse is the response type for the Query/AllBalances RPC\nmethod.","type":"object","properties":{"balances":{"description":"balances is the balances of all the coins.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.bank.v1beta1.QueryBalanceResponse":{"description":"QueryBalanceResponse is the response type for the Query/Balance RPC method.","type":"object","properties":{"balance":{"description":"balance is the balance of the coin.","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}},"cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse":{"description":"QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC\nmethod. Identical with QueryDenomMetadataResponse but receives denom as query string in request.","type":"object","properties":{"metadata":{"description":"metadata describes and provides all the client information for the requested token.","$ref":"#/definitions/cosmos.bank.v1beta1.Metadata"}}},"cosmos.bank.v1beta1.QueryDenomMetadataResponse":{"description":"QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC\nmethod.","type":"object","properties":{"metadata":{"description":"metadata describes and provides all the client information for the requested token.","$ref":"#/definitions/cosmos.bank.v1beta1.Metadata"}}},"cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse":{"description":"QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query.\n\nSince: cosmos-sdk 0.50.3","type":"object","properties":{"denom_owners":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.bank.v1beta1.DenomOwner"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.bank.v1beta1.QueryDenomOwnersResponse":{"description":"QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"denom_owners":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.bank.v1beta1.DenomOwner"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.bank.v1beta1.QueryDenomsMetadataResponse":{"description":"QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC\nmethod.","type":"object","properties":{"metadatas":{"description":"metadata provides the client information for all the registered tokens.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.bank.v1beta1.Metadata"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.bank.v1beta1.QueryParamsResponse":{"description":"QueryParamsResponse defines the response type for querying x/bank parameters.","type":"object","properties":{"params":{"description":"params provides the parameters of the bank module.","$ref":"#/definitions/cosmos.bank.v1beta1.Params"}}},"cosmos.bank.v1beta1.QuerySendEnabledResponse":{"description":"QuerySendEnabledResponse defines the RPC response of a SendEnable query.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response. This field is only\npopulated if the denoms field in the request is empty.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"send_enabled":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.bank.v1beta1.SendEnabled"}}}},"cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse":{"description":"QuerySpendableBalanceByDenomResponse defines the gRPC response structure for\nquerying an account's spendable balance for a specific denom.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"balance":{"description":"balance is the balance of the coin.","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}},"cosmos.bank.v1beta1.QuerySpendableBalancesResponse":{"description":"QuerySpendableBalancesResponse defines the gRPC response structure for querying\nan account's spendable balances.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"balances":{"description":"balances is the spendable balances of all the coins.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.bank.v1beta1.QuerySupplyOfResponse":{"description":"QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method.","type":"object","properties":{"amount":{"description":"amount is the supply of the coin.","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}},"cosmos.bank.v1beta1.QueryTotalSupplyResponse":{"type":"object","title":"QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC\nmethod","properties":{"pagination":{"description":"pagination defines the pagination in the response.\n\nSince: cosmos-sdk 0.43","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"supply":{"type":"array","title":"supply is the supply of the coins","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}}},"cosmos.bank.v1beta1.SendEnabled":{"description":"SendEnabled maps coin denom to a send_enabled status (whether a denom is\nsendable).","type":"object","properties":{"denom":{"type":"string"},"enabled":{"type":"boolean"}}},"cosmos.base.abci.v1beta1.ABCIMessageLog":{"description":"ABCIMessageLog defines a structure containing an indexed tx ABCI message log.","type":"object","properties":{"events":{"description":"Events contains a slice of Event objects that were emitted during some\nexecution.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.abci.v1beta1.StringEvent"}},"log":{"type":"string"},"msg_index":{"type":"integer","format":"int64"}}},"cosmos.base.abci.v1beta1.Attribute":{"description":"Attribute defines an attribute wrapper where the key and value are\nstrings instead of raw bytes.","type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}}},"cosmos.base.abci.v1beta1.GasInfo":{"description":"GasInfo defines tx execution gas context.","type":"object","properties":{"gas_used":{"description":"GasUsed is the amount of gas actually consumed.","type":"string","format":"uint64"},"gas_wanted":{"description":"GasWanted is the maximum units of work we allow this tx to perform.","type":"string","format":"uint64"}}},"cosmos.base.abci.v1beta1.Result":{"description":"Result is the union of ResponseFormat and ResponseCheckTx.","type":"object","properties":{"data":{"description":"Data is any data returned from message or handler execution. It MUST be\nlength prefixed in order to separate data from multiple message executions.\nDeprecated. This field is still populated, but prefer msg_response instead\nbecause it also contains the Msg response typeURL.","type":"string","format":"byte"},"events":{"description":"Events contains a slice of Event objects that were emitted during message\nor handler execution.","type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Event"}},"log":{"description":"Log contains the log information from message or handler execution.","type":"string"},"msg_responses":{"description":"msg_responses contains the Msg handler responses type packed in Anys.\n\nSince: cosmos-sdk 0.46","type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}}}},"cosmos.base.abci.v1beta1.StringEvent":{"description":"StringEvent defines en Event object wrapper where all the attributes\ncontain key/value pairs that are strings instead of raw bytes.","type":"object","properties":{"attributes":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.abci.v1beta1.Attribute"}},"type":{"type":"string"}}},"cosmos.base.abci.v1beta1.TxResponse":{"description":"TxResponse defines a structure containing relevant tx data and metadata. The\ntags are stringified and the log is JSON decoded.","type":"object","properties":{"code":{"description":"Response code.","type":"integer","format":"int64"},"codespace":{"type":"string","title":"Namespace for the Code"},"data":{"description":"Result bytes, if any.","type":"string"},"events":{"description":"Events defines all the events emitted by processing a transaction. Note,\nthese events include those emitted by processing all the messages and those\nemitted from the ante. Whereas Logs contains the events, with\nadditional metadata, emitted only by processing the messages.\n\nSince: cosmos-sdk 0.42.11, 0.44.5, 0.45","type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Event"}},"gas_used":{"description":"Amount of gas consumed by transaction.","type":"string","format":"int64"},"gas_wanted":{"description":"Amount of gas requested for transaction.","type":"string","format":"int64"},"height":{"type":"string","format":"int64","title":"The block height"},"info":{"description":"Additional information. May be non-deterministic.","type":"string"},"logs":{"description":"The output of the application's logger (typed). May be non-deterministic.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.abci.v1beta1.ABCIMessageLog"}},"raw_log":{"description":"The output of the application's logger (raw string). May be\nnon-deterministic.","type":"string"},"timestamp":{"description":"Time of the previous block. For heights \u003e 1, it's the weighted median of\nthe timestamps of the valid votes in the block.LastCommit. For height == 1,\nit's genesis time.","type":"string"},"tx":{"description":"The request transaction bytes.","$ref":"#/definitions/google.protobuf.Any"},"txhash":{"description":"The transaction hash.","type":"string"}}},"cosmos.base.node.v1beta1.ConfigResponse":{"description":"ConfigResponse defines the response structure for the Config gRPC query.","type":"object","properties":{"halt_height":{"type":"string","format":"uint64"},"minimum_gas_price":{"type":"string"},"pruning_interval":{"type":"string"},"pruning_keep_recent":{"type":"string"}}},"cosmos.base.node.v1beta1.StatusResponse":{"description":"StateResponse defines the response structure for the status of a node.","type":"object","properties":{"app_hash":{"type":"string","format":"byte","title":"app hash of the current block"},"earliest_store_height":{"type":"string","format":"uint64","title":"earliest block height available in the store"},"height":{"type":"string","format":"uint64","title":"current block height"},"timestamp":{"type":"string","format":"date-time","title":"block height timestamp"},"validator_hash":{"type":"string","format":"byte","title":"validator hash provided by the consensus header"}}},"cosmos.base.query.v1beta1.PageRequest":{"description":"message SomeRequest {\n Foo some_parameter = 1;\n PageRequest pagination = 2;\n }","type":"object","title":"PageRequest is to be embedded in gRPC request messages for efficient\npagination. Ex:","properties":{"count_total":{"description":"count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.","type":"boolean"},"key":{"description":"key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.","type":"string","format":"byte"},"limit":{"description":"limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.","type":"string","format":"uint64"},"offset":{"description":"offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.","type":"string","format":"uint64"},"reverse":{"description":"reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43","type":"boolean"}}},"cosmos.base.query.v1beta1.PageResponse":{"description":"PageResponse is to be embedded in gRPC response messages where the\ncorresponding request message has used PageRequest.\n\n message SomeResponse {\n repeated Bar results = 1;\n PageResponse page = 2;\n }","type":"object","properties":{"next_key":{"description":"next_key is the key to be passed to PageRequest.key to\nquery the next page most efficiently. It will be empty if\nthere are no more results.","type":"string","format":"byte"},"total":{"type":"string","format":"uint64","title":"total is total number of results available if PageRequest.count_total\nwas set, its value is undefined otherwise"}}},"cosmos.base.reflection.v1beta1.ListAllInterfacesResponse":{"description":"ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC.","type":"object","properties":{"interface_names":{"description":"interface_names is an array of all the registered interfaces.","type":"array","items":{"type":"string"}}}},"cosmos.base.reflection.v1beta1.ListImplementationsResponse":{"description":"ListImplementationsResponse is the response type of the ListImplementations\nRPC.","type":"object","properties":{"implementation_message_names":{"type":"array","items":{"type":"string"}}}},"cosmos.base.reflection.v2alpha1.AuthnDescriptor":{"type":"object","title":"AuthnDescriptor provides information on how to sign transactions without relying\non the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures","properties":{"sign_modes":{"type":"array","title":"sign_modes defines the supported signature algorithm","items":{"type":"object","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.SigningModeDescriptor"}}}},"cosmos.base.reflection.v2alpha1.ChainDescriptor":{"type":"object","title":"ChainDescriptor describes chain information of the application","properties":{"id":{"type":"string","title":"id is the chain id"}}},"cosmos.base.reflection.v2alpha1.CodecDescriptor":{"type":"object","title":"CodecDescriptor describes the registered interfaces and provides metadata information on the types","properties":{"interfaces":{"type":"array","title":"interfaces is a list of the registerted interfaces descriptors","items":{"type":"object","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.InterfaceDescriptor"}}}},"cosmos.base.reflection.v2alpha1.ConfigurationDescriptor":{"type":"object","title":"ConfigurationDescriptor contains metadata information on the sdk.Config","properties":{"bech32_account_address_prefix":{"type":"string","title":"bech32_account_address_prefix is the account address prefix"}}},"cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse":{"type":"object","title":"GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC","properties":{"authn":{"title":"authn describes how to authenticate to the application when sending transactions","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.AuthnDescriptor"}}},"cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse":{"type":"object","title":"GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC","properties":{"chain":{"title":"chain describes application chain information","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.ChainDescriptor"}}},"cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse":{"type":"object","title":"GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC","properties":{"codec":{"title":"codec describes the application codec such as registered interfaces and implementations","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.CodecDescriptor"}}},"cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse":{"type":"object","title":"GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC","properties":{"config":{"title":"config describes the application's sdk.Config","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor"}}},"cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse":{"type":"object","title":"GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC","properties":{"queries":{"title":"queries provides information on the available queryable services","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor"}}},"cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse":{"type":"object","title":"GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC","properties":{"tx":{"title":"tx provides information on msgs that can be forwarded to the application\nalongside the accepted transaction protobuf type","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.TxDescriptor"}}},"cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor":{"type":"object","title":"InterfaceAcceptingMessageDescriptor describes a protobuf message which contains\nan interface represented as a google.protobuf.Any","properties":{"field_descriptor_names":{"type":"array","title":"field_descriptor_names is a list of the protobuf name (not fullname) of the field\nwhich contains the interface as google.protobuf.Any (the interface is the same, but\nit can be in multiple fields of the same proto message)","items":{"type":"string"}},"fullname":{"type":"string","title":"fullname is the protobuf fullname of the type containing the interface"}}},"cosmos.base.reflection.v2alpha1.InterfaceDescriptor":{"type":"object","title":"InterfaceDescriptor describes the implementation of an interface","properties":{"fullname":{"type":"string","title":"fullname is the name of the interface"},"interface_accepting_messages":{"type":"array","title":"interface_accepting_messages contains information regarding the proto messages which contain the interface as\ngoogle.protobuf.Any field","items":{"type":"object","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor"}},"interface_implementers":{"type":"array","title":"interface_implementers is a list of the descriptors of the interface implementers","items":{"type":"object","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor"}}}},"cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor":{"type":"object","title":"InterfaceImplementerDescriptor describes an interface implementer","properties":{"fullname":{"type":"string","title":"fullname is the protobuf queryable name of the interface implementer"},"type_url":{"type":"string","title":"type_url defines the type URL used when marshalling the type as any\nthis is required so we can provide type safe google.protobuf.Any marshalling and\nunmarshalling, making sure that we don't accept just 'any' type\nin our interface fields"}}},"cosmos.base.reflection.v2alpha1.MsgDescriptor":{"type":"object","title":"MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction","properties":{"msg_type_url":{"description":"msg_type_url contains the TypeURL of a sdk.Msg.","type":"string"}}},"cosmos.base.reflection.v2alpha1.QueryMethodDescriptor":{"type":"object","title":"QueryMethodDescriptor describes a queryable method of a query service\nno other info is provided beside method name and tendermint queryable path\nbecause it would be redundant with the grpc reflection service","properties":{"full_query_path":{"type":"string","title":"full_query_path is the path that can be used to query\nthis method via tendermint abci.Query"},"name":{"type":"string","title":"name is the protobuf name (not fullname) of the method"}}},"cosmos.base.reflection.v2alpha1.QueryServiceDescriptor":{"type":"object","title":"QueryServiceDescriptor describes a cosmos-sdk queryable service","properties":{"fullname":{"type":"string","title":"fullname is the protobuf fullname of the service descriptor"},"is_module":{"type":"boolean","title":"is_module describes if this service is actually exposed by an application's module"},"methods":{"type":"array","title":"methods provides a list of query service methods","items":{"type":"object","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor"}}}},"cosmos.base.reflection.v2alpha1.QueryServicesDescriptor":{"type":"object","title":"QueryServicesDescriptor contains the list of cosmos-sdk queriable services","properties":{"query_services":{"type":"array","title":"query_services is a list of cosmos-sdk QueryServiceDescriptor","items":{"type":"object","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor"}}}},"cosmos.base.reflection.v2alpha1.SigningModeDescriptor":{"type":"object","title":"SigningModeDescriptor provides information on a signing flow of the application\nNOTE(fdymylja): here we could go as far as providing an entire flow on how\nto sign a message given a SigningModeDescriptor, but it's better to think about\nthis another time","properties":{"authn_info_provider_method_fullname":{"type":"string","title":"authn_info_provider_method_fullname defines the fullname of the method to call to get\nthe metadata required to authenticate using the provided sign_modes"},"name":{"type":"string","title":"name defines the unique name of the signing mode"},"number":{"type":"integer","format":"int32","title":"number is the unique int32 identifier for the sign_mode enum"}}},"cosmos.base.reflection.v2alpha1.TxDescriptor":{"type":"object","title":"TxDescriptor describes the accepted transaction type","properties":{"fullname":{"description":"fullname is the protobuf fullname of the raw transaction type (for instance the tx.Tx type)\nit is not meant to support polymorphism of transaction types, it is supposed to be used by\nreflection clients to understand if they can handle a specific transaction type in an application.","type":"string"},"msgs":{"type":"array","title":"msgs lists the accepted application messages (sdk.Msg)","items":{"type":"object","$ref":"#/definitions/cosmos.base.reflection.v2alpha1.MsgDescriptor"}}}},"cosmos.base.tendermint.v1beta1.ABCIQueryResponse":{"description":"ABCIQueryResponse defines the response structure for the ABCIQuery gRPC query.\n\nNote: This type is a duplicate of the ResponseQuery proto type defined in\nTendermint.","type":"object","properties":{"code":{"type":"integer","format":"int64"},"codespace":{"type":"string"},"height":{"type":"string","format":"int64"},"index":{"type":"string","format":"int64"},"info":{"type":"string","title":"nondeterministic"},"key":{"type":"string","format":"byte"},"log":{"type":"string","title":"nondeterministic"},"proof_ops":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.ProofOps"},"value":{"type":"string","format":"byte"}}},"cosmos.base.tendermint.v1beta1.Block":{"description":"Block is tendermint type Block, with the Header proposer address\nfield converted to bech32 string.","type":"object","properties":{"data":{"$ref":"#/definitions/tendermint.types.Data"},"evidence":{"$ref":"#/definitions/tendermint.types.EvidenceList"},"header":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.Header"},"last_commit":{"$ref":"#/definitions/tendermint.types.Commit"}}},"cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse":{"description":"GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method.","type":"object","properties":{"block":{"title":"Deprecated: please use `sdk_block` instead","$ref":"#/definitions/tendermint.types.Block"},"block_id":{"$ref":"#/definitions/tendermint.types.BlockID"},"sdk_block":{"title":"Since: cosmos-sdk 0.47","$ref":"#/definitions/cosmos.base.tendermint.v1beta1.Block"}}},"cosmos.base.tendermint.v1beta1.GetLatestBlockResponse":{"description":"GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method.","type":"object","properties":{"block":{"title":"Deprecated: please use `sdk_block` instead","$ref":"#/definitions/tendermint.types.Block"},"block_id":{"$ref":"#/definitions/tendermint.types.BlockID"},"sdk_block":{"title":"Since: cosmos-sdk 0.47","$ref":"#/definitions/cosmos.base.tendermint.v1beta1.Block"}}},"cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse":{"description":"GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method.","type":"object","properties":{"block_height":{"type":"string","format":"int64"},"pagination":{"description":"pagination defines an pagination for the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"validators":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.tendermint.v1beta1.Validator"}}}},"cosmos.base.tendermint.v1beta1.GetNodeInfoResponse":{"description":"GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC method.","type":"object","properties":{"application_version":{"$ref":"#/definitions/cosmos.base.tendermint.v1beta1.VersionInfo"},"default_node_info":{"$ref":"#/definitions/tendermint.p2p.DefaultNodeInfo"}}},"cosmos.base.tendermint.v1beta1.GetSyncingResponse":{"description":"GetSyncingResponse is the response type for the Query/GetSyncing RPC method.","type":"object","properties":{"syncing":{"type":"boolean"}}},"cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse":{"description":"GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method.","type":"object","properties":{"block_height":{"type":"string","format":"int64"},"pagination":{"description":"pagination defines an pagination for the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"validators":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.tendermint.v1beta1.Validator"}}}},"cosmos.base.tendermint.v1beta1.Header":{"description":"Header defines the structure of a Tendermint block header.","type":"object","properties":{"app_hash":{"type":"string","format":"byte","title":"state after txs from the previous block"},"chain_id":{"type":"string"},"consensus_hash":{"type":"string","format":"byte","title":"consensus params for current block"},"data_hash":{"type":"string","format":"byte","title":"transactions"},"evidence_hash":{"description":"evidence included in the block","type":"string","format":"byte","title":"consensus info"},"height":{"type":"string","format":"int64"},"last_block_id":{"title":"prev block info","$ref":"#/definitions/tendermint.types.BlockID"},"last_commit_hash":{"description":"commit from validators from the last block","type":"string","format":"byte","title":"hashes of block data"},"last_results_hash":{"type":"string","format":"byte","title":"root hash of all results from the txs from the previous block"},"next_validators_hash":{"type":"string","format":"byte","title":"validators for the next block"},"proposer_address":{"description":"proposer_address is the original block proposer address, formatted as a Bech32 string.\nIn Tendermint, this type is `bytes`, but in the SDK, we convert it to a Bech32 string\nfor better UX.\n\noriginal proposer of the block","type":"string"},"time":{"type":"string","format":"date-time"},"validators_hash":{"description":"validators for the current block","type":"string","format":"byte","title":"hashes from the app output from the prev block"},"version":{"title":"basic block info","$ref":"#/definitions/tendermint.version.Consensus"}}},"cosmos.base.tendermint.v1beta1.Module":{"type":"object","title":"Module is the type for VersionInfo","properties":{"path":{"type":"string","title":"module path"},"sum":{"type":"string","title":"checksum"},"version":{"type":"string","title":"module version"}}},"cosmos.base.tendermint.v1beta1.ProofOp":{"description":"ProofOp defines an operation used for calculating Merkle root. The data could\nbe arbitrary format, providing necessary data for example neighbouring node\nhash.\n\nNote: This type is a duplicate of the ProofOp proto type defined in Tendermint.","type":"object","properties":{"data":{"type":"string","format":"byte"},"key":{"type":"string","format":"byte"},"type":{"type":"string"}}},"cosmos.base.tendermint.v1beta1.ProofOps":{"description":"ProofOps is Merkle proof defined by the list of ProofOps.\n\nNote: This type is a duplicate of the ProofOps proto type defined in Tendermint.","type":"object","properties":{"ops":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.tendermint.v1beta1.ProofOp"}}}},"cosmos.base.tendermint.v1beta1.Validator":{"description":"Validator is the type for the validator-set.","type":"object","properties":{"address":{"type":"string"},"proposer_priority":{"type":"string","format":"int64"},"pub_key":{"$ref":"#/definitions/google.protobuf.Any"},"voting_power":{"type":"string","format":"int64"}}},"cosmos.base.tendermint.v1beta1.VersionInfo":{"description":"VersionInfo is the type for the GetNodeInfoResponse message.","type":"object","properties":{"app_name":{"type":"string"},"build_deps":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.tendermint.v1beta1.Module"}},"build_tags":{"type":"string"},"cosmos_sdk_version":{"type":"string","title":"Since: cosmos-sdk 0.43"},"git_commit":{"type":"string"},"go_version":{"type":"string"},"name":{"type":"string"},"version":{"type":"string"}}},"cosmos.base.v1beta1.Coin":{"description":"Coin defines a token with a denomination and an amount.\n\nNOTE: The amount field is an Int which implements the custom method\nsignatures required by gogoproto.","type":"object","properties":{"amount":{"type":"string"},"denom":{"type":"string"}}},"cosmos.base.v1beta1.DecCoin":{"description":"DecCoin defines a token with a denomination and a decimal amount.\n\nNOTE: The amount field is an Dec which implements the custom method\nsignatures required by gogoproto.","type":"object","properties":{"amount":{"type":"string"},"denom":{"type":"string"}}},"cosmos.circuit.v1.AccountResponse":{"description":"AccountResponse is the response type for the Query/Account RPC method.","type":"object","properties":{"permission":{"$ref":"#/definitions/cosmos.circuit.v1.Permissions"}}},"cosmos.circuit.v1.AccountsResponse":{"description":"AccountsResponse is the response type for the Query/Accounts RPC method.","type":"object","properties":{"accounts":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.circuit.v1.GenesisAccountPermissions"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.circuit.v1.DisabledListResponse":{"description":"DisabledListResponse is the response type for the Query/DisabledList RPC method.","type":"object","properties":{"disabled_list":{"type":"array","items":{"type":"string"}}}},"cosmos.circuit.v1.GenesisAccountPermissions":{"type":"object","title":"GenesisAccountPermissions is the account permissions for the circuit breaker in genesis","properties":{"address":{"type":"string"},"permissions":{"$ref":"#/definitions/cosmos.circuit.v1.Permissions"}}},"cosmos.circuit.v1.MsgAuthorizeCircuitBreaker":{"description":"MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type.","type":"object","properties":{"grantee":{"description":"grantee is the account authorized with the provided permissions.","type":"string"},"granter":{"description":"granter is the granter of the circuit breaker permissions and must have\nLEVEL_SUPER_ADMIN.","type":"string"},"permissions":{"description":"permissions are the circuit breaker permissions that the grantee receives.\nThese will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can\nbe specified to revoke all permissions.","$ref":"#/definitions/cosmos.circuit.v1.Permissions"}}},"cosmos.circuit.v1.MsgAuthorizeCircuitBreakerResponse":{"description":"MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type.","type":"object","properties":{"success":{"type":"boolean"}}},"cosmos.circuit.v1.MsgResetCircuitBreaker":{"description":"MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type.","type":"object","properties":{"authority":{"description":"authority is the account authorized to trip or reset the circuit breaker.","type":"string"},"msg_type_urls":{"description":"msg_type_urls specifies a list of Msg type URLs to resume processing. If\nit is left empty all Msg processing for type URLs that the account is\nauthorized to trip will resume.","type":"array","items":{"type":"string"}}}},"cosmos.circuit.v1.MsgResetCircuitBreakerResponse":{"description":"MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type.","type":"object","properties":{"success":{"type":"boolean"}}},"cosmos.circuit.v1.MsgTripCircuitBreaker":{"description":"MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type.","type":"object","properties":{"authority":{"description":"authority is the account authorized to trip the circuit breaker.","type":"string"},"msg_type_urls":{"description":"msg_type_urls specifies a list of type URLs to immediately stop processing.\nIF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY.\nThis value is validated against the authority's permissions and if the\nauthority does not have permissions to trip the specified msg type URLs\n(or all URLs), the operation will fail.","type":"array","items":{"type":"string"}}}},"cosmos.circuit.v1.MsgTripCircuitBreakerResponse":{"description":"MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type.","type":"object","properties":{"success":{"type":"boolean"}}},"cosmos.circuit.v1.Permissions":{"description":"Permissions are the permissions that an account has to trip\nor reset the circuit breaker.","type":"object","properties":{"level":{"description":"level is the level of permissions granted to this account.","$ref":"#/definitions/cosmos.circuit.v1.Permissions.Level"},"limit_type_urls":{"description":"limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type\nURLs that the account can trip. It is an error to use limit_type_urls with\na level other than LEVEL_SOME_MSGS.","type":"array","items":{"type":"string"}}}},"cosmos.circuit.v1.Permissions.Level":{"description":"Level is the permission level.\n\n - LEVEL_NONE_UNSPECIFIED: LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit\nbreaker permissions.\n - LEVEL_SOME_MSGS: LEVEL_SOME_MSGS indicates that the account will have permission to\ntrip or reset the circuit breaker for some Msg type URLs. If this level\nis chosen, a non-empty list of Msg type URLs must be provided in\nlimit_type_urls.\n - LEVEL_ALL_MSGS: LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit\nbreaker for Msg's of all type URLs.\n - LEVEL_SUPER_ADMIN: LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker\nactions and can grant permissions to other accounts.","type":"string","default":"LEVEL_NONE_UNSPECIFIED","enum":["LEVEL_NONE_UNSPECIFIED","LEVEL_SOME_MSGS","LEVEL_ALL_MSGS","LEVEL_SUPER_ADMIN"]},"cosmos.consensus.v1.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","type":"object","properties":{"abci":{"title":"Since: cosmos-sdk 0.50","$ref":"#/definitions/tendermint.types.ABCIParams"},"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"block":{"description":"params defines the x/consensus parameters to update.\nVersionsParams is not included in this Msg because it is tracked\nsepararately in x/upgrade.\n\nNOTE: All parameters must be supplied.","$ref":"#/definitions/tendermint.types.BlockParams"},"evidence":{"$ref":"#/definitions/tendermint.types.EvidenceParams"},"validator":{"$ref":"#/definitions/tendermint.types.ValidatorParams"}}},"cosmos.consensus.v1.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.","type":"object"},"cosmos.consensus.v1.QueryParamsResponse":{"description":"QueryParamsResponse defines the response type for querying x/consensus parameters.","type":"object","properties":{"params":{"description":"params are the tendermint consensus params stored in the consensus module.\nPlease note that `params.version` is not populated in this response, it is\ntracked separately in the x/upgrade module.","$ref":"#/definitions/tendermint.types.ConsensusParams"}}},"cosmos.crisis.v1beta1.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"constant_fee":{"description":"constant_fee defines the x/crisis parameter.","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}},"cosmos.crisis.v1beta1.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.crisis.v1beta1.MsgVerifyInvariant":{"description":"MsgVerifyInvariant represents a message to verify a particular invariance.","type":"object","properties":{"invariant_module_name":{"description":"name of the invariant module.","type":"string"},"invariant_route":{"description":"invariant_route is the msg's invariant route.","type":"string"},"sender":{"description":"sender is the account address of private key to send coins to fee collector account.","type":"string"}}},"cosmos.crisis.v1beta1.MsgVerifyInvariantResponse":{"description":"MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type.","type":"object"},"cosmos.crypto.multisig.v1beta1.CompactBitArray":{"description":"CompactBitArray is an implementation of a space efficient bit array.\nThis is used to ensure that the encoded data takes up a minimal amount of\nspace after proto encoding.\nThis is not thread safe, and is not intended for concurrent usage.","type":"object","properties":{"elems":{"type":"string","format":"byte"},"extra_bits_stored":{"type":"integer","format":"int64"}}},"cosmos.distribution.v1beta1.DelegationDelegatorReward":{"description":"DelegationDelegatorReward represents the properties\nof a delegator's delegation reward.","type":"object","properties":{"reward":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.DecCoin"}},"validator_address":{"type":"string"}}},"cosmos.distribution.v1beta1.MsgCommunityPoolSpend":{"description":"MsgCommunityPoolSpend defines a message for sending tokens from the community\npool to another account. This message is typically executed via a governance\nproposal with the governance module being the executing authority.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"amount":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"recipient":{"type":"string"}}},"cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse":{"description":"MsgCommunityPoolSpendResponse defines the response to executing a\nMsgCommunityPoolSpend message.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool":{"description":"DepositValidatorRewardsPool defines the request structure to provide\nadditional rewards to delegators from a specific validator.\n\nSince: cosmos-sdk 0.50","type":"object","properties":{"amount":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"depositor":{"type":"string"},"validator_address":{"type":"string"}}},"cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse":{"description":"MsgDepositValidatorRewardsPoolResponse defines the response to executing a\nMsgDepositValidatorRewardsPool message.\n\nSince: cosmos-sdk 0.50","type":"object"},"cosmos.distribution.v1beta1.MsgFundCommunityPool":{"description":"MsgFundCommunityPool allows an account to directly\nfund the community pool.","type":"object","properties":{"amount":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"depositor":{"type":"string"}}},"cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse":{"description":"MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type.","type":"object"},"cosmos.distribution.v1beta1.MsgSetWithdrawAddress":{"description":"MsgSetWithdrawAddress sets the withdraw address for\na delegator (or validator self-delegation).","type":"object","properties":{"delegator_address":{"type":"string"},"withdraw_address":{"type":"string"}}},"cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse":{"description":"MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response\ntype.","type":"object"},"cosmos.distribution.v1beta1.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"params defines the x/distribution parameters to update.\n\nNOTE: All parameters must be supplied.","$ref":"#/definitions/cosmos.distribution.v1beta1.Params"}}},"cosmos.distribution.v1beta1.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward":{"description":"MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator\nfrom a single validator.","type":"object","properties":{"delegator_address":{"type":"string"},"validator_address":{"type":"string"}}},"cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse":{"description":"MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward\nresponse type.","type":"object","properties":{"amount":{"type":"array","title":"Since: cosmos-sdk 0.46","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}}},"cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission":{"description":"MsgWithdrawValidatorCommission withdraws the full commission to the validator\naddress.","type":"object","properties":{"validator_address":{"type":"string"}}},"cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse":{"description":"MsgWithdrawValidatorCommissionResponse defines the\nMsg/WithdrawValidatorCommission response type.","type":"object","properties":{"amount":{"type":"array","title":"Since: cosmos-sdk 0.46","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}}},"cosmos.distribution.v1beta1.Params":{"description":"Params defines the set of params for the distribution module.","type":"object","properties":{"base_proposer_reward":{"description":"Deprecated: The base_proposer_reward field is deprecated and is no longer used\nin the x/distribution module's reward mechanism.","type":"string"},"bonus_proposer_reward":{"description":"Deprecated: The bonus_proposer_reward field is deprecated and is no longer used\nin the x/distribution module's reward mechanism.","type":"string"},"community_tax":{"type":"string"},"withdraw_addr_enabled":{"type":"boolean"}}},"cosmos.distribution.v1beta1.QueryCommunityPoolResponse":{"description":"QueryCommunityPoolResponse is the response type for the Query/CommunityPool\nRPC method.","type":"object","properties":{"pool":{"description":"pool defines community pool's coins.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.DecCoin"}}}},"cosmos.distribution.v1beta1.QueryDelegationRewardsResponse":{"description":"QueryDelegationRewardsResponse is the response type for the\nQuery/DelegationRewards RPC method.","type":"object","properties":{"rewards":{"description":"rewards defines the rewards accrued by a delegation.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.DecCoin"}}}},"cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse":{"description":"QueryDelegationTotalRewardsResponse is the response type for the\nQuery/DelegationTotalRewards RPC method.","type":"object","properties":{"rewards":{"description":"rewards defines all the rewards accrued by a delegator.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.distribution.v1beta1.DelegationDelegatorReward"}},"total":{"description":"total defines the sum of all the rewards.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.DecCoin"}}}},"cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse":{"description":"QueryDelegatorValidatorsResponse is the response type for the\nQuery/DelegatorValidators RPC method.","type":"object","properties":{"validators":{"description":"validators defines the validators a delegator is delegating for.","type":"array","items":{"type":"string"}}}},"cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse":{"description":"QueryDelegatorWithdrawAddressResponse is the response type for the\nQuery/DelegatorWithdrawAddress RPC method.","type":"object","properties":{"withdraw_address":{"description":"withdraw_address defines the delegator address to query for.","type":"string"}}},"cosmos.distribution.v1beta1.QueryParamsResponse":{"description":"QueryParamsResponse is the response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params defines the parameters of the module.","$ref":"#/definitions/cosmos.distribution.v1beta1.Params"}}},"cosmos.distribution.v1beta1.QueryValidatorCommissionResponse":{"type":"object","title":"QueryValidatorCommissionResponse is the response type for the\nQuery/ValidatorCommission RPC method","properties":{"commission":{"description":"commission defines the commission the validator received.","$ref":"#/definitions/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission"}}},"cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse":{"description":"QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method.","type":"object","properties":{"commission":{"description":"commission defines the commission the validator received.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.DecCoin"}},"operator_address":{"description":"operator_address defines the validator operator address.","type":"string"},"self_bond_rewards":{"description":"self_bond_rewards defines the self delegations rewards.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.DecCoin"}}}},"cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse":{"description":"QueryValidatorOutstandingRewardsResponse is the response type for the\nQuery/ValidatorOutstandingRewards RPC method.","type":"object","properties":{"rewards":{"$ref":"#/definitions/cosmos.distribution.v1beta1.ValidatorOutstandingRewards"}}},"cosmos.distribution.v1beta1.QueryValidatorSlashesResponse":{"description":"QueryValidatorSlashesResponse is the response type for the\nQuery/ValidatorSlashes RPC method.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"slashes":{"description":"slashes defines the slashes the validator received.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.distribution.v1beta1.ValidatorSlashEvent"}}}},"cosmos.distribution.v1beta1.ValidatorAccumulatedCommission":{"description":"ValidatorAccumulatedCommission represents accumulated commission\nfor a validator kept as a running counter, can be withdrawn at any time.","type":"object","properties":{"commission":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.DecCoin"}}}},"cosmos.distribution.v1beta1.ValidatorOutstandingRewards":{"description":"ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards\nfor a validator inexpensive to track, allows simple sanity checks.","type":"object","properties":{"rewards":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.DecCoin"}}}},"cosmos.distribution.v1beta1.ValidatorSlashEvent":{"description":"ValidatorSlashEvent represents a validator slash event.\nHeight is implicit within the store key.\nThis is needed to calculate appropriate amount of staking tokens\nfor delegations which are withdrawn after a slash has occurred.","type":"object","properties":{"fraction":{"type":"string"},"validator_period":{"type":"string","format":"uint64"}}},"cosmos.evidence.v1beta1.MsgSubmitEvidence":{"description":"MsgSubmitEvidence represents a message that supports submitting arbitrary\nEvidence of misbehavior such as equivocation or counterfactual signing.","type":"object","properties":{"evidence":{"description":"evidence defines the evidence of misbehavior.","$ref":"#/definitions/google.protobuf.Any"},"submitter":{"description":"submitter is the signer account address of evidence.","type":"string"}}},"cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse":{"description":"MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type.","type":"object","properties":{"hash":{"description":"hash defines the hash of the evidence.","type":"string","format":"byte"}}},"cosmos.evidence.v1beta1.QueryAllEvidenceResponse":{"description":"QueryAllEvidenceResponse is the response type for the Query/AllEvidence RPC\nmethod.","type":"object","properties":{"evidence":{"description":"evidence returns all evidences.","type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.evidence.v1beta1.QueryEvidenceResponse":{"description":"QueryEvidenceResponse is the response type for the Query/Evidence RPC method.","type":"object","properties":{"evidence":{"description":"evidence returns the requested evidence.","$ref":"#/definitions/google.protobuf.Any"}}},"cosmos.feegrant.v1beta1.Grant":{"type":"object","title":"Grant is stored in the KVStore to record a grant with full context","properties":{"allowance":{"description":"allowance can be any of basic, periodic, allowed fee allowance.","$ref":"#/definitions/google.protobuf.Any"},"grantee":{"description":"grantee is the address of the user being granted an allowance of another user's funds.","type":"string"},"granter":{"description":"granter is the address of the user granting an allowance of their funds.","type":"string"}}},"cosmos.feegrant.v1beta1.MsgGrantAllowance":{"description":"MsgGrantAllowance adds permission for Grantee to spend up to Allowance\nof fees from the account of Granter.","type":"object","properties":{"allowance":{"description":"allowance can be any of basic, periodic, allowed fee allowance.","$ref":"#/definitions/google.protobuf.Any"},"grantee":{"description":"grantee is the address of the user being granted an allowance of another user's funds.","type":"string"},"granter":{"description":"granter is the address of the user granting an allowance of their funds.","type":"string"}}},"cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse":{"description":"MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type.","type":"object"},"cosmos.feegrant.v1beta1.MsgPruneAllowances":{"description":"MsgPruneAllowances prunes expired fee allowances.\n\nSince cosmos-sdk 0.50","type":"object","properties":{"pruner":{"description":"pruner is the address of the user pruning expired allowances.","type":"string"}}},"cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse":{"description":"MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type.\n\nSince cosmos-sdk 0.50","type":"object"},"cosmos.feegrant.v1beta1.MsgRevokeAllowance":{"description":"MsgRevokeAllowance removes any existing Allowance from Granter to Grantee.","type":"object","properties":{"grantee":{"description":"grantee is the address of the user being granted an allowance of another user's funds.","type":"string"},"granter":{"description":"granter is the address of the user granting an allowance of their funds.","type":"string"}}},"cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse":{"description":"MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type.","type":"object"},"cosmos.feegrant.v1beta1.QueryAllowanceResponse":{"description":"QueryAllowanceResponse is the response type for the Query/Allowance RPC method.","type":"object","properties":{"allowance":{"description":"allowance is a allowance granted for grantee by granter.","$ref":"#/definitions/cosmos.feegrant.v1beta1.Grant"}}},"cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse":{"description":"QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"allowances":{"description":"allowances that have been issued by the granter.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.feegrant.v1beta1.Grant"}},"pagination":{"description":"pagination defines an pagination for the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.feegrant.v1beta1.QueryAllowancesResponse":{"description":"QueryAllowancesResponse is the response type for the Query/Allowances RPC method.","type":"object","properties":{"allowances":{"description":"allowances are allowance's granted for grantee by granter.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.feegrant.v1beta1.Grant"}},"pagination":{"description":"pagination defines an pagination for the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.gov.v1.Deposit":{"description":"Deposit defines an amount deposited by an account address to an active\nproposal.","type":"object","properties":{"amount":{"description":"amount to be deposited by depositor.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"depositor":{"description":"depositor defines the deposit addresses from the proposals.","type":"string"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"}}},"cosmos.gov.v1.DepositParams":{"description":"DepositParams defines the params for deposits on governance proposals.","type":"object","properties":{"max_deposit_period":{"description":"Maximum period for Atom holders to deposit on a proposal. Initial value: 2\nmonths.","type":"string"},"min_deposit":{"description":"Minimum deposit for a proposal to enter voting period.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}}},"cosmos.gov.v1.MsgCancelProposal":{"description":"MsgCancelProposal is the Msg/CancelProposal request type.\n\nSince: cosmos-sdk 0.50","type":"object","properties":{"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"proposer":{"description":"proposer is the account address of the proposer.","type":"string"}}},"cosmos.gov.v1.MsgCancelProposalResponse":{"description":"MsgCancelProposalResponse defines the response structure for executing a\nMsgCancelProposal message.\n\nSince: cosmos-sdk 0.50","type":"object","properties":{"canceled_height":{"description":"canceled_height defines the block height at which the proposal is canceled.","type":"string","format":"uint64"},"canceled_time":{"description":"canceled_time is the time when proposal is canceled.","type":"string","format":"date-time"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"}}},"cosmos.gov.v1.MsgDeposit":{"description":"MsgDeposit defines a message to submit a deposit to an existing proposal.","type":"object","properties":{"amount":{"description":"amount to be deposited by depositor.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"depositor":{"description":"depositor defines the deposit addresses from the proposals.","type":"string"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"}}},"cosmos.gov.v1.MsgDepositResponse":{"description":"MsgDepositResponse defines the Msg/Deposit response type.","type":"object"},"cosmos.gov.v1.MsgExecLegacyContent":{"description":"MsgExecLegacyContent is used to wrap the legacy content field into a message.\nThis ensures backwards compatibility with v1beta1.MsgSubmitProposal.","type":"object","properties":{"authority":{"description":"authority must be the gov module address.","type":"string"},"content":{"description":"content is the proposal's content.","$ref":"#/definitions/google.protobuf.Any"}}},"cosmos.gov.v1.MsgExecLegacyContentResponse":{"description":"MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type.","type":"object"},"cosmos.gov.v1.MsgSubmitProposal":{"description":"MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary\nproposal Content.","type":"object","properties":{"expedited":{"description":"Since: cosmos-sdk 0.50","type":"boolean","title":"expedited defines if the proposal is expedited or not"},"initial_deposit":{"description":"initial_deposit is the deposit value that must be paid at proposal submission.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"messages":{"description":"messages are the arbitrary messages to be executed if proposal passes.","type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"metadata":{"description":"metadata is any arbitrary metadata attached to the proposal.","type":"string"},"proposer":{"description":"proposer is the account address of the proposer.","type":"string"},"summary":{"description":"Since: cosmos-sdk 0.47","type":"string","title":"summary is the summary of the proposal"},"title":{"description":"title is the title of the proposal.\n\nSince: cosmos-sdk 0.47","type":"string"}}},"cosmos.gov.v1.MsgSubmitProposalResponse":{"description":"MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.","type":"object","properties":{"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"}}},"cosmos.gov.v1.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"params defines the x/gov parameters to update.\n\nNOTE: All parameters must be supplied.","$ref":"#/definitions/cosmos.gov.v1.Params"}}},"cosmos.gov.v1.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.gov.v1.MsgVote":{"description":"MsgVote defines a message to cast a vote.","type":"object","properties":{"metadata":{"description":"metadata is any arbitrary metadata attached to the Vote.","type":"string"},"option":{"description":"option defines the vote option.","$ref":"#/definitions/cosmos.gov.v1.VoteOption"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"voter":{"description":"voter is the voter address for the proposal.","type":"string"}}},"cosmos.gov.v1.MsgVoteEncrypted":{"description":"MsgVoteEncrypted defines a message to cast an encrypted vote.","type":"object","properties":{"encrypted_data":{"description":"encrypted_data defines the encrypted vote option.","type":"string"},"metadata":{"description":"metadata is any arbitrary metadata attached to the Vote.","type":"string"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"voter":{"description":"voter is the voter address for the proposal.","type":"string"}}},"cosmos.gov.v1.MsgVoteEncryptedResponse":{"description":"MsgVoteResponse defines the Msg/Vote response type.","type":"object"},"cosmos.gov.v1.MsgVoteResponse":{"description":"MsgVoteResponse defines the Msg/Vote response type.","type":"object"},"cosmos.gov.v1.MsgVoteWeighted":{"description":"MsgVoteWeighted defines a message to cast a vote.","type":"object","properties":{"metadata":{"description":"metadata is any arbitrary metadata attached to the VoteWeighted.","type":"string"},"options":{"description":"options defines the weighted vote options.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1.WeightedVoteOption"}},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"voter":{"description":"voter is the voter address for the proposal.","type":"string"}}},"cosmos.gov.v1.MsgVoteWeightedResponse":{"description":"MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.","type":"object"},"cosmos.gov.v1.Params":{"description":"Params defines the parameters for the x/gov module.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"burn_proposal_deposit_prevote":{"type":"boolean","title":"burn deposits if the proposal does not enter voting period"},"burn_vote_quorum":{"type":"boolean","title":"burn deposits if a proposal does not meet quorum"},"burn_vote_veto":{"type":"boolean","title":"burn deposits if quorum with vote type no_veto is met"},"channel_id":{"type":"string"},"expedited_min_deposit":{"description":"Minimum expedited deposit for a proposal to enter voting period.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"expedited_threshold":{"description":"Minimum proportion of Yes votes for proposal to pass. Default value: 0.67.\n\nSince: cosmos-sdk 0.50","type":"string"},"expedited_voting_period":{"description":"Duration of the voting period of an expedited proposal.\n\nSince: cosmos-sdk 0.50","type":"string"},"is_source_chain":{"type":"boolean"},"max_deposit_period":{"description":"Maximum period for Atom holders to deposit on a proposal. Initial value: 2\nmonths.","type":"string"},"max_tally_period":{"description":"Duration of the voting period.","type":"string"},"min_deposit":{"description":"Minimum deposit for a proposal to enter voting period.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"min_deposit_ratio":{"description":"The ratio representing the proportion of the deposit value minimum that must be met when making a deposit.\nDefault value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be\nrequired.\n\nSince: cosmos-sdk 0.50","type":"string"},"min_initial_deposit_ratio":{"description":"The ratio representing the proportion of the deposit value that must be paid at proposal submission.","type":"string"},"proposal_cancel_dest":{"description":"The address which will receive (proposal_cancel_ratio * deposit) proposal deposits.\nIf empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned.\n\nSince: cosmos-sdk 0.50","type":"string"},"proposal_cancel_ratio":{"description":"The cancel ratio which will not be returned back to the depositors when a proposal is cancelled.\n\nSince: cosmos-sdk 0.50","type":"string"},"quorum":{"description":"Minimum percentage of total stake needed to vote for a result to be\n considered valid.","type":"string"},"threshold":{"description":"Minimum proportion of Yes votes for proposal to pass. Default value: 0.5.","type":"string"},"trusted_counter_parties":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1.TrustedCounterParty"}},"veto_threshold":{"description":"Minimum value of Veto votes to Total votes ratio for proposal to be\n vetoed. Default value: 1/3.","type":"string"},"voting_period":{"description":"Duration of the voting period.","type":"string"}}},"cosmos.gov.v1.Proposal":{"description":"Proposal defines the core field members of a governance proposal.","type":"object","properties":{"decryption_key":{"type":"string","title":"decryption key is used to decrypt the encrypted votes during the tally phase"},"deposit_end_time":{"description":"deposit_end_time is the end time for deposition.","type":"string","format":"date-time"},"expedited":{"description":"Since: cosmos-sdk 0.50","type":"boolean","title":"expedited defines if the proposal is expedited"},"failed_reason":{"description":"Since: cosmos-sdk 0.50","type":"string","title":"failed_reason defines the reason why the proposal failed"},"final_tally_result":{"description":"final_tally_result is the final tally result of the proposal. When\nquerying a proposal via gRPC, this field is not populated until the\nproposal's voting period has ended.","$ref":"#/definitions/cosmos.gov.v1.TallyResult"},"has_encrypted_votes":{"type":"boolean","title":"flag to check if proposal has at least one encrypted vote"},"id":{"description":"id defines the unique id of the proposal.","type":"string","format":"uint64"},"identity":{"type":"string","title":"identity and pubkey are used to submit encrypted votes"},"messages":{"description":"messages are the arbitrary messages to be executed if the proposal passes.","type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"metadata":{"type":"string","title":"metadata is any arbitrary metadata attached to the proposal.\nthe recommended format of the metadata is to be found here:\nhttps://docs.cosmos.network/v0.47/modules/gov#proposal-3"},"proposer":{"description":"Since: cosmos-sdk 0.47","type":"string","title":"proposer is the address of the proposal sumbitter"},"pubkey":{"type":"string"},"status":{"description":"status defines the proposal status.","$ref":"#/definitions/cosmos.gov.v1.ProposalStatus"},"submit_time":{"description":"submit_time is the time of proposal submission.","type":"string","format":"date-time"},"summary":{"description":"Since: cosmos-sdk 0.47","type":"string","title":"summary is a short summary of the proposal"},"title":{"description":"Since: cosmos-sdk 0.47","type":"string","title":"title is the title of the proposal"},"total_deposit":{"description":"total_deposit is the total deposit on the proposal.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"voting_end_time":{"description":"voting_end_time is the end time of voting on a proposal.","type":"string","format":"date-time"},"voting_start_time":{"description":"voting_start_time is the starting time to vote on a proposal.","type":"string","format":"date-time"}}},"cosmos.gov.v1.ProposalStatus":{"description":"ProposalStatus enumerates the valid statuses of a proposal.\n\n - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status.\n - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit\nperiod.\n - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting\nperiod.\n - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has\npassed.\n - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has\nbeen rejected.\n - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has\nfailed.\n - PROPOSAL_STATUS_TALLY_PERIOD: PROPOSAL_STATUS_TALLY_PERIOD defines a proposal status during the tally\nperiod.","type":"string","default":"PROPOSAL_STATUS_UNSPECIFIED","enum":["PROPOSAL_STATUS_UNSPECIFIED","PROPOSAL_STATUS_DEPOSIT_PERIOD","PROPOSAL_STATUS_VOTING_PERIOD","PROPOSAL_STATUS_PASSED","PROPOSAL_STATUS_REJECTED","PROPOSAL_STATUS_FAILED","PROPOSAL_STATUS_TALLY_PERIOD"]},"cosmos.gov.v1.QueryConstitutionResponse":{"type":"object","title":"QueryConstitutionResponse is the response type for the Query/Constitution RPC method","properties":{"constitution":{"type":"string"}}},"cosmos.gov.v1.QueryDepositResponse":{"description":"QueryDepositResponse is the response type for the Query/Deposit RPC method.","type":"object","properties":{"deposit":{"description":"deposit defines the requested deposit.","$ref":"#/definitions/cosmos.gov.v1.Deposit"}}},"cosmos.gov.v1.QueryDepositsResponse":{"description":"QueryDepositsResponse is the response type for the Query/Deposits RPC method.","type":"object","properties":{"deposits":{"description":"deposits defines the requested deposits.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1.Deposit"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.gov.v1.QueryParamsResponse":{"description":"QueryParamsResponse is the response type for the Query/Params RPC method.","type":"object","properties":{"deposit_params":{"description":"Deprecated: Prefer to use `params` instead.\ndeposit_params defines the parameters related to deposit.","$ref":"#/definitions/cosmos.gov.v1.DepositParams"},"params":{"description":"params defines all the paramaters of x/gov module.\n\nSince: cosmos-sdk 0.47","$ref":"#/definitions/cosmos.gov.v1.Params"},"tally_params":{"description":"Deprecated: Prefer to use `params` instead.\ntally_params defines the parameters related to tally.","$ref":"#/definitions/cosmos.gov.v1.TallyParams"},"voting_params":{"description":"Deprecated: Prefer to use `params` instead.\nvoting_params defines the parameters related to voting.","$ref":"#/definitions/cosmos.gov.v1.VotingParams"}}},"cosmos.gov.v1.QueryProposalResponse":{"description":"QueryProposalResponse is the response type for the Query/Proposal RPC method.","type":"object","properties":{"proposal":{"description":"proposal is the requested governance proposal.","$ref":"#/definitions/cosmos.gov.v1.Proposal"}}},"cosmos.gov.v1.QueryProposalsResponse":{"description":"QueryProposalsResponse is the response type for the Query/Proposals RPC\nmethod.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"proposals":{"description":"proposals defines all the requested governance proposals.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1.Proposal"}}}},"cosmos.gov.v1.QueryTallyResultResponse":{"description":"QueryTallyResultResponse is the response type for the Query/Tally RPC method.","type":"object","properties":{"tally":{"description":"tally defines the requested tally.","$ref":"#/definitions/cosmos.gov.v1.TallyResult"}}},"cosmos.gov.v1.QueryVoteResponse":{"description":"QueryVoteResponse is the response type for the Query/Vote RPC method.","type":"object","properties":{"vote":{"description":"vote defines the queried vote.","$ref":"#/definitions/cosmos.gov.v1.Vote"}}},"cosmos.gov.v1.QueryVotesResponse":{"description":"QueryVotesResponse is the response type for the Query/Votes RPC method.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"votes":{"description":"votes defines the queried votes.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1.Vote"}}}},"cosmos.gov.v1.TallyParams":{"description":"TallyParams defines the params for tallying votes on governance proposals.","type":"object","properties":{"quorum":{"description":"Minimum percentage of total stake needed to vote for a result to be\nconsidered valid.","type":"string"},"threshold":{"description":"Minimum proportion of Yes votes for proposal to pass. Default value: 0.5.","type":"string"},"veto_threshold":{"description":"Minimum value of Veto votes to Total votes ratio for proposal to be\nvetoed. Default value: 1/3.","type":"string"}}},"cosmos.gov.v1.TallyResult":{"description":"TallyResult defines a standard tally for a governance proposal.","type":"object","properties":{"abstain_count":{"description":"abstain_count is the number of abstain votes on a proposal.","type":"string"},"encrypted_count":{"description":"encrypted_count is the number of encrypted votes on a proposal.","type":"string"},"no_count":{"description":"no_count is the number of no votes on a proposal.","type":"string"},"no_with_veto_count":{"description":"no_with_veto_count is the number of no with veto votes on a proposal.","type":"string"},"yes_count":{"description":"yes_count is the number of yes votes on a proposal.","type":"string"}}},"cosmos.gov.v1.TrustedCounterParty":{"type":"object","properties":{"channel_id":{"type":"string"},"client_id":{"type":"string"},"connection_id":{"type":"string"}}},"cosmos.gov.v1.Vote":{"description":"Vote defines a vote on a governance proposal.\nA Vote consists of a proposal ID, the voter, and the vote option.","type":"object","properties":{"encrypted_vote_data":{"type":"string"},"metadata":{"type":"string","title":"metadata is any arbitrary metadata attached to the vote.\nthe recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5"},"options":{"description":"options is the weighted vote options.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1.WeightedVoteOption"}},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"voter":{"description":"voter is the voter address of the proposal.","type":"string"}}},"cosmos.gov.v1.VoteOption":{"description":"VoteOption enumerates the valid vote options for a given governance proposal.\n\n - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option.\n - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option.\n - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option.\n - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.\n - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option.\n - VOTE_OPTION_ENCRYPTED: VOTE_OPTION_ENCRYPTED defines an encrypted vote","type":"string","default":"VOTE_OPTION_UNSPECIFIED","enum":["VOTE_OPTION_UNSPECIFIED","VOTE_OPTION_YES","VOTE_OPTION_ABSTAIN","VOTE_OPTION_NO","VOTE_OPTION_NO_WITH_VETO","VOTE_OPTION_ENCRYPTED"]},"cosmos.gov.v1.VotingParams":{"description":"VotingParams defines the params for voting on governance proposals.","type":"object","properties":{"voting_period":{"description":"Duration of the voting period.","type":"string"}}},"cosmos.gov.v1.WeightedVoteOption":{"description":"WeightedVoteOption defines a unit of vote for vote split.","type":"object","properties":{"option":{"description":"option defines the valid vote options, it must not contain duplicate vote options.","$ref":"#/definitions/cosmos.gov.v1.VoteOption"},"weight":{"description":"weight is the vote weight associated with the vote option.","type":"string"}}},"cosmos.gov.v1beta1.Deposit":{"description":"Deposit defines an amount deposited by an account address to an active\nproposal.","type":"object","properties":{"amount":{"description":"amount to be deposited by depositor.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"depositor":{"description":"depositor defines the deposit addresses from the proposals.","type":"string"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"}}},"cosmos.gov.v1beta1.DepositParams":{"description":"DepositParams defines the params for deposits on governance proposals.","type":"object","properties":{"max_deposit_period":{"description":"Maximum period for Atom holders to deposit on a proposal. Initial value: 2\nmonths.","type":"string"},"min_deposit":{"description":"Minimum deposit for a proposal to enter voting period.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}}},"cosmos.gov.v1beta1.MsgDeposit":{"description":"MsgDeposit defines a message to submit a deposit to an existing proposal.","type":"object","properties":{"amount":{"description":"amount to be deposited by depositor.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"depositor":{"description":"depositor defines the deposit addresses from the proposals.","type":"string"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"}}},"cosmos.gov.v1beta1.MsgDepositResponse":{"description":"MsgDepositResponse defines the Msg/Deposit response type.","type":"object"},"cosmos.gov.v1beta1.MsgSubmitProposal":{"description":"MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary\nproposal Content.","type":"object","properties":{"content":{"description":"content is the proposal's content.","$ref":"#/definitions/google.protobuf.Any"},"initial_deposit":{"description":"initial_deposit is the deposit value that must be paid at proposal submission.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"proposer":{"description":"proposer is the account address of the proposer.","type":"string"}}},"cosmos.gov.v1beta1.MsgSubmitProposalResponse":{"description":"MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.","type":"object","properties":{"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"}}},"cosmos.gov.v1beta1.MsgVote":{"description":"MsgVote defines a message to cast a vote.","type":"object","properties":{"option":{"description":"option defines the vote option.","$ref":"#/definitions/cosmos.gov.v1beta1.VoteOption"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"voter":{"description":"voter is the voter address for the proposal.","type":"string"}}},"cosmos.gov.v1beta1.MsgVoteEncrypted":{"description":"MsgVoteEncrypted defines a message to cast an encrypted vote.","type":"object","properties":{"encrypted_data":{"description":"encrypted_data defines the encrypted vote option.","type":"string"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"voter":{"description":"voter is the voter address for the proposal.","type":"string"}}},"cosmos.gov.v1beta1.MsgVoteEncryptedResponse":{"description":"MsgVoteResponse defines the Msg/Vote response type.","type":"object"},"cosmos.gov.v1beta1.MsgVoteResponse":{"description":"MsgVoteResponse defines the Msg/Vote response type.","type":"object"},"cosmos.gov.v1beta1.MsgVoteWeighted":{"description":"MsgVoteWeighted defines a message to cast a vote.\n\nSince: cosmos-sdk 0.43","type":"object","properties":{"options":{"description":"options defines the weighted vote options.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1beta1.WeightedVoteOption"}},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"voter":{"description":"voter is the voter address for the proposal.","type":"string"}}},"cosmos.gov.v1beta1.MsgVoteWeightedResponse":{"description":"MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.\n\nSince: cosmos-sdk 0.43","type":"object"},"cosmos.gov.v1beta1.Proposal":{"description":"Proposal defines the core field members of a governance proposal.","type":"object","properties":{"aggr_keyshare":{"type":"string","title":"aggregated keyshare is used to decrypt the encrypted votes during the tally phase"},"content":{"description":"content is the proposal's content.","$ref":"#/definitions/google.protobuf.Any"},"deposit_end_time":{"description":"deposit_end_time is the end time for deposition.","type":"string","format":"date-time"},"final_tally_result":{"description":"final_tally_result is the final tally result of the proposal. When\nquerying a proposal via gRPC, this field is not populated until the\nproposal's voting period has ended.","$ref":"#/definitions/cosmos.gov.v1beta1.TallyResult"},"has_encrypted_votes":{"type":"boolean","title":"flag to check if proposal has at least one encrypted vote"},"identity":{"type":"string","title":"identity and pubkey are used to submit encrypted votes"},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"pubkey":{"type":"string"},"status":{"description":"status defines the proposal status.","$ref":"#/definitions/cosmos.gov.v1beta1.ProposalStatus"},"submit_time":{"description":"submit_time is the time of proposal submission.","type":"string","format":"date-time"},"total_deposit":{"description":"total_deposit is the total deposit on the proposal.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"voting_end_time":{"description":"voting_end_time is the end time of voting on a proposal.","type":"string","format":"date-time"},"voting_start_time":{"description":"voting_start_time is the starting time to vote on a proposal.","type":"string","format":"date-time"}}},"cosmos.gov.v1beta1.ProposalStatus":{"description":"ProposalStatus enumerates the valid statuses of a proposal.\n\n - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status.\n - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit\nperiod.\n - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting\nperiod.\n - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has\npassed.\n - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has\nbeen rejected.\n - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has\nfailed.","type":"string","default":"PROPOSAL_STATUS_UNSPECIFIED","enum":["PROPOSAL_STATUS_UNSPECIFIED","PROPOSAL_STATUS_DEPOSIT_PERIOD","PROPOSAL_STATUS_VOTING_PERIOD","PROPOSAL_STATUS_PASSED","PROPOSAL_STATUS_REJECTED","PROPOSAL_STATUS_FAILED"]},"cosmos.gov.v1beta1.QueryDepositResponse":{"description":"QueryDepositResponse is the response type for the Query/Deposit RPC method.","type":"object","properties":{"deposit":{"description":"deposit defines the requested deposit.","$ref":"#/definitions/cosmos.gov.v1beta1.Deposit"}}},"cosmos.gov.v1beta1.QueryDepositsResponse":{"description":"QueryDepositsResponse is the response type for the Query/Deposits RPC method.","type":"object","properties":{"deposits":{"description":"deposits defines the requested deposits.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1beta1.Deposit"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.gov.v1beta1.QueryParamsResponse":{"description":"QueryParamsResponse is the response type for the Query/Params RPC method.","type":"object","properties":{"deposit_params":{"description":"deposit_params defines the parameters related to deposit.","$ref":"#/definitions/cosmos.gov.v1beta1.DepositParams"},"tally_params":{"description":"tally_params defines the parameters related to tally.","$ref":"#/definitions/cosmos.gov.v1beta1.TallyParams"},"voting_params":{"description":"voting_params defines the parameters related to voting.","$ref":"#/definitions/cosmos.gov.v1beta1.VotingParams"}}},"cosmos.gov.v1beta1.QueryProposalResponse":{"description":"QueryProposalResponse is the response type for the Query/Proposal RPC method.","type":"object","properties":{"proposal":{"$ref":"#/definitions/cosmos.gov.v1beta1.Proposal"}}},"cosmos.gov.v1beta1.QueryProposalsResponse":{"description":"QueryProposalsResponse is the response type for the Query/Proposals RPC\nmethod.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"proposals":{"description":"proposals defines all the requested governance proposals.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1beta1.Proposal"}}}},"cosmos.gov.v1beta1.QueryTallyResultResponse":{"description":"QueryTallyResultResponse is the response type for the Query/Tally RPC method.","type":"object","properties":{"tally":{"description":"tally defines the requested tally.","$ref":"#/definitions/cosmos.gov.v1beta1.TallyResult"}}},"cosmos.gov.v1beta1.QueryVoteResponse":{"description":"QueryVoteResponse is the response type for the Query/Vote RPC method.","type":"object","properties":{"vote":{"description":"vote defines the queried vote.","$ref":"#/definitions/cosmos.gov.v1beta1.Vote"}}},"cosmos.gov.v1beta1.QueryVotesResponse":{"description":"QueryVotesResponse is the response type for the Query/Votes RPC method.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"votes":{"description":"votes defines the queried votes.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1beta1.Vote"}}}},"cosmos.gov.v1beta1.TallyParams":{"description":"TallyParams defines the params for tallying votes on governance proposals.","type":"object","properties":{"quorum":{"description":"Minimum percentage of total stake needed to vote for a result to be\nconsidered valid.","type":"string","format":"byte"},"threshold":{"description":"Minimum proportion of Yes votes for proposal to pass. Default value: 0.5.","type":"string","format":"byte"},"veto_threshold":{"description":"Minimum value of Veto votes to Total votes ratio for proposal to be\nvetoed. Default value: 1/3.","type":"string","format":"byte"}}},"cosmos.gov.v1beta1.TallyResult":{"description":"TallyResult defines a standard tally for a governance proposal.","type":"object","properties":{"abstain":{"description":"abstain is the number of abstain votes on a proposal.","type":"string"},"encrypted":{"description":"encrypted is the number of encrypted votes on a proposal.","type":"string"},"no":{"description":"no is the number of no votes on a proposal.","type":"string"},"no_with_veto":{"description":"no_with_veto is the number of no with veto votes on a proposal.","type":"string"},"yes":{"description":"yes is the number of yes votes on a proposal.","type":"string"}}},"cosmos.gov.v1beta1.Vote":{"description":"Vote defines a vote on a governance proposal.\nA Vote consists of a proposal ID, the voter, and the vote option.","type":"object","properties":{"encrypted_vote_data":{"type":"string"},"option":{"description":"Deprecated: Prefer to use `options` instead. This field is set in queries\nif and only if `len(options) == 1` and that option has weight 1. In all\nother cases, this field will default to VOTE_OPTION_UNSPECIFIED.","$ref":"#/definitions/cosmos.gov.v1beta1.VoteOption"},"options":{"description":"options is the weighted vote options.\n\nSince: cosmos-sdk 0.43","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.gov.v1beta1.WeightedVoteOption"}},"proposal_id":{"description":"proposal_id defines the unique id of the proposal.","type":"string","format":"uint64"},"voter":{"description":"voter is the voter address of the proposal.","type":"string"}}},"cosmos.gov.v1beta1.VoteOption":{"description":"VoteOption enumerates the valid vote options for a given governance proposal.\n\n - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option.\n - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option.\n - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option.\n - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.\n - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option.\n - VOTE_OPTION_ENCRYPTED: VOTE_OPTION_ENCRYPTED defines a encrypted vote","type":"string","default":"VOTE_OPTION_UNSPECIFIED","enum":["VOTE_OPTION_UNSPECIFIED","VOTE_OPTION_YES","VOTE_OPTION_ABSTAIN","VOTE_OPTION_NO","VOTE_OPTION_NO_WITH_VETO","VOTE_OPTION_ENCRYPTED"]},"cosmos.gov.v1beta1.VotingParams":{"description":"VotingParams defines the params for voting on governance proposals.","type":"object","properties":{"voting_period":{"description":"Duration of the voting period.","type":"string"}}},"cosmos.gov.v1beta1.WeightedVoteOption":{"description":"WeightedVoteOption defines a unit of vote for vote split.\n\nSince: cosmos-sdk 0.43","type":"object","properties":{"option":{"description":"option defines the valid vote options, it must not contain duplicate vote options.","$ref":"#/definitions/cosmos.gov.v1beta1.VoteOption"},"weight":{"description":"weight is the vote weight associated with the vote option.","type":"string"}}},"cosmos.group.v1.Exec":{"description":"Exec defines modes of execution of a proposal on creation or on new vote.\n\n - EXEC_UNSPECIFIED: An empty value means that there should be a separate\nMsgExec request for the proposal to execute.\n - EXEC_TRY: Try to execute the proposal immediately.\nIf the proposal is not allowed per the DecisionPolicy,\nthe proposal will still be open and could\nbe executed at a later point.","type":"string","default":"EXEC_UNSPECIFIED","enum":["EXEC_UNSPECIFIED","EXEC_TRY"]},"cosmos.group.v1.GroupInfo":{"description":"GroupInfo represents the high-level on-chain information for a group.","type":"object","properties":{"admin":{"description":"admin is the account address of the group's admin.","type":"string"},"created_at":{"description":"created_at is a timestamp specifying when a group was created.","type":"string","format":"date-time"},"id":{"description":"id is the unique ID of the group.","type":"string","format":"uint64"},"metadata":{"type":"string","title":"metadata is any arbitrary metadata to attached to the group.\nthe recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1"},"total_weight":{"description":"total_weight is the sum of the group members' weights.","type":"string"},"version":{"type":"string","format":"uint64","title":"version is used to track changes to a group's membership structure that\nwould break existing proposals. Whenever any members weight is changed,\nor any member is added or removed this version is incremented and will\ncause proposals based on older versions of this group to fail"}}},"cosmos.group.v1.GroupMember":{"description":"GroupMember represents the relationship between a group and a member.","type":"object","properties":{"group_id":{"description":"group_id is the unique ID of the group.","type":"string","format":"uint64"},"member":{"description":"member is the member data.","$ref":"#/definitions/cosmos.group.v1.Member"}}},"cosmos.group.v1.GroupPolicyInfo":{"description":"GroupPolicyInfo represents the high-level on-chain information for a group policy.","type":"object","properties":{"address":{"description":"address is the account address of group policy.","type":"string"},"admin":{"description":"admin is the account address of the group admin.","type":"string"},"created_at":{"description":"created_at is a timestamp specifying when a group policy was created.","type":"string","format":"date-time"},"decision_policy":{"description":"decision_policy specifies the group policy's decision policy.","$ref":"#/definitions/google.protobuf.Any"},"group_id":{"description":"group_id is the unique ID of the group.","type":"string","format":"uint64"},"metadata":{"type":"string","title":"metadata is any arbitrary metadata attached to the group policy.\nthe recommended format of the metadata is to be found here:\nhttps://docs.cosmos.network/v0.47/modules/group#decision-policy-1"},"version":{"description":"version is used to track changes to a group's GroupPolicyInfo structure that\nwould create a different result on a running proposal.","type":"string","format":"uint64"}}},"cosmos.group.v1.Member":{"description":"Member represents a group member with an account address,\nnon-zero weight, metadata and added_at timestamp.","type":"object","properties":{"added_at":{"description":"added_at is a timestamp specifying when a member was added.","type":"string","format":"date-time"},"address":{"description":"address is the member's account address.","type":"string"},"metadata":{"description":"metadata is any arbitrary metadata attached to the member.","type":"string"},"weight":{"description":"weight is the member's voting weight that should be greater than 0.","type":"string"}}},"cosmos.group.v1.MemberRequest":{"description":"MemberRequest represents a group member to be used in Msg server requests.\nContrary to `Member`, it doesn't have any `added_at` field\nsince this field cannot be set as part of requests.","type":"object","properties":{"address":{"description":"address is the member's account address.","type":"string"},"metadata":{"description":"metadata is any arbitrary metadata attached to the member.","type":"string"},"weight":{"description":"weight is the member's voting weight that should be greater than 0.","type":"string"}}},"cosmos.group.v1.MsgCreateGroup":{"description":"MsgCreateGroup is the Msg/CreateGroup request type.","type":"object","properties":{"admin":{"description":"admin is the account address of the group admin.","type":"string"},"members":{"description":"members defines the group members.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.MemberRequest"}},"metadata":{"description":"metadata is any arbitrary metadata to attached to the group.","type":"string"}}},"cosmos.group.v1.MsgCreateGroupPolicy":{"description":"MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type.","type":"object","properties":{"admin":{"description":"admin is the account address of the group admin.","type":"string"},"decision_policy":{"description":"decision_policy specifies the group policy's decision policy.","$ref":"#/definitions/google.protobuf.Any"},"group_id":{"description":"group_id is the unique ID of the group.","type":"string","format":"uint64"},"metadata":{"description":"metadata is any arbitrary metadata attached to the group policy.","type":"string"}}},"cosmos.group.v1.MsgCreateGroupPolicyResponse":{"description":"MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type.","type":"object","properties":{"address":{"description":"address is the account address of the newly created group policy.","type":"string"}}},"cosmos.group.v1.MsgCreateGroupResponse":{"description":"MsgCreateGroupResponse is the Msg/CreateGroup response type.","type":"object","properties":{"group_id":{"description":"group_id is the unique ID of the newly created group.","type":"string","format":"uint64"}}},"cosmos.group.v1.MsgCreateGroupWithPolicy":{"description":"MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type.","type":"object","properties":{"admin":{"description":"admin is the account address of the group and group policy admin.","type":"string"},"decision_policy":{"description":"decision_policy specifies the group policy's decision policy.","$ref":"#/definitions/google.protobuf.Any"},"group_metadata":{"description":"group_metadata is any arbitrary metadata attached to the group.","type":"string"},"group_policy_as_admin":{"description":"group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group\nand group policy admin.","type":"boolean"},"group_policy_metadata":{"description":"group_policy_metadata is any arbitrary metadata attached to the group policy.","type":"string"},"members":{"description":"members defines the group members.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.MemberRequest"}}}},"cosmos.group.v1.MsgCreateGroupWithPolicyResponse":{"description":"MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type.","type":"object","properties":{"group_id":{"description":"group_id is the unique ID of the newly created group with policy.","type":"string","format":"uint64"},"group_policy_address":{"description":"group_policy_address is the account address of the newly created group policy.","type":"string"}}},"cosmos.group.v1.MsgExec":{"description":"MsgExec is the Msg/Exec request type.","type":"object","properties":{"executor":{"description":"executor is the account address used to execute the proposal.","type":"string"},"proposal_id":{"description":"proposal is the unique ID of the proposal.","type":"string","format":"uint64"}}},"cosmos.group.v1.MsgExecResponse":{"description":"MsgExecResponse is the Msg/Exec request type.","type":"object","properties":{"result":{"description":"result is the final result of the proposal execution.","$ref":"#/definitions/cosmos.group.v1.ProposalExecutorResult"}}},"cosmos.group.v1.MsgLeaveGroup":{"description":"MsgLeaveGroup is the Msg/LeaveGroup request type.","type":"object","properties":{"address":{"description":"address is the account address of the group member.","type":"string"},"group_id":{"description":"group_id is the unique ID of the group.","type":"string","format":"uint64"}}},"cosmos.group.v1.MsgLeaveGroupResponse":{"description":"MsgLeaveGroupResponse is the Msg/LeaveGroup response type.","type":"object"},"cosmos.group.v1.MsgSubmitProposal":{"description":"MsgSubmitProposal is the Msg/SubmitProposal request type.","type":"object","properties":{"exec":{"description":"exec defines the mode of execution of the proposal,\nwhether it should be executed immediately on creation or not.\nIf so, proposers signatures are considered as Yes votes.","$ref":"#/definitions/cosmos.group.v1.Exec"},"group_policy_address":{"description":"group_policy_address is the account address of group policy.","type":"string"},"messages":{"description":"messages is a list of `sdk.Msg`s that will be executed if the proposal passes.","type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"metadata":{"description":"metadata is any arbitrary metadata attached to the proposal.","type":"string"},"proposers":{"description":"proposers are the account addresses of the proposers.\nProposers signatures will be counted as yes votes.","type":"array","items":{"type":"string"}},"summary":{"description":"summary is the summary of the proposal.\n\nSince: cosmos-sdk 0.47","type":"string"},"title":{"description":"title is the title of the proposal.\n\nSince: cosmos-sdk 0.47","type":"string"}}},"cosmos.group.v1.MsgSubmitProposalResponse":{"description":"MsgSubmitProposalResponse is the Msg/SubmitProposal response type.","type":"object","properties":{"proposal_id":{"description":"proposal is the unique ID of the proposal.","type":"string","format":"uint64"}}},"cosmos.group.v1.MsgUpdateGroupAdmin":{"description":"MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type.","type":"object","properties":{"admin":{"description":"admin is the current account address of the group admin.","type":"string"},"group_id":{"description":"group_id is the unique ID of the group.","type":"string","format":"uint64"},"new_admin":{"description":"new_admin is the group new admin account address.","type":"string"}}},"cosmos.group.v1.MsgUpdateGroupAdminResponse":{"description":"MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type.","type":"object"},"cosmos.group.v1.MsgUpdateGroupMembers":{"description":"MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type.","type":"object","properties":{"admin":{"description":"admin is the account address of the group admin.","type":"string"},"group_id":{"description":"group_id is the unique ID of the group.","type":"string","format":"uint64"},"member_updates":{"description":"member_updates is the list of members to update,\nset weight to 0 to remove a member.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.MemberRequest"}}}},"cosmos.group.v1.MsgUpdateGroupMembersResponse":{"description":"MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type.","type":"object"},"cosmos.group.v1.MsgUpdateGroupMetadata":{"description":"MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type.","type":"object","properties":{"admin":{"description":"admin is the account address of the group admin.","type":"string"},"group_id":{"description":"group_id is the unique ID of the group.","type":"string","format":"uint64"},"metadata":{"description":"metadata is the updated group's metadata.","type":"string"}}},"cosmos.group.v1.MsgUpdateGroupMetadataResponse":{"description":"MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type.","type":"object"},"cosmos.group.v1.MsgUpdateGroupPolicyAdmin":{"description":"MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type.","type":"object","properties":{"admin":{"description":"admin is the account address of the group admin.","type":"string"},"group_policy_address":{"description":"group_policy_address is the account address of the group policy.","type":"string"},"new_admin":{"description":"new_admin is the new group policy admin.","type":"string"}}},"cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse":{"description":"MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type.","type":"object"},"cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy":{"description":"MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type.","type":"object","properties":{"admin":{"description":"admin is the account address of the group admin.","type":"string"},"decision_policy":{"description":"decision_policy is the updated group policy's decision policy.","$ref":"#/definitions/google.protobuf.Any"},"group_policy_address":{"description":"group_policy_address is the account address of group policy.","type":"string"}}},"cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse":{"description":"MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type.","type":"object"},"cosmos.group.v1.MsgUpdateGroupPolicyMetadata":{"description":"MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type.","type":"object","properties":{"admin":{"description":"admin is the account address of the group admin.","type":"string"},"group_policy_address":{"description":"group_policy_address is the account address of group policy.","type":"string"},"metadata":{"description":"metadata is the group policy metadata to be updated.","type":"string"}}},"cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse":{"description":"MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type.","type":"object"},"cosmos.group.v1.MsgVote":{"description":"MsgVote is the Msg/Vote request type.","type":"object","properties":{"exec":{"description":"exec defines whether the proposal should be executed\nimmediately after voting or not.","$ref":"#/definitions/cosmos.group.v1.Exec"},"metadata":{"description":"metadata is any arbitrary metadata attached to the vote.","type":"string"},"option":{"description":"option is the voter's choice on the proposal.","$ref":"#/definitions/cosmos.group.v1.VoteOption"},"proposal_id":{"description":"proposal is the unique ID of the proposal.","type":"string","format":"uint64"},"voter":{"description":"voter is the voter account address.","type":"string"}}},"cosmos.group.v1.MsgVoteResponse":{"description":"MsgVoteResponse is the Msg/Vote response type.","type":"object"},"cosmos.group.v1.MsgWithdrawProposal":{"description":"MsgWithdrawProposal is the Msg/WithdrawProposal request type.","type":"object","properties":{"address":{"description":"address is the admin of the group policy or one of the proposer of the proposal.","type":"string"},"proposal_id":{"description":"proposal is the unique ID of the proposal.","type":"string","format":"uint64"}}},"cosmos.group.v1.MsgWithdrawProposalResponse":{"description":"MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type.","type":"object"},"cosmos.group.v1.Proposal":{"description":"Proposal defines a group proposal. Any member of a group can submit a proposal\nfor a group policy to decide upon.\nA proposal consists of a set of `sdk.Msg`s that will be executed if the proposal\npasses as well as some optional metadata associated with the proposal.","type":"object","properties":{"executor_result":{"description":"executor_result is the final result of the proposal execution. Initial value is NotRun.","$ref":"#/definitions/cosmos.group.v1.ProposalExecutorResult"},"final_tally_result":{"description":"final_tally_result contains the sums of all weighted votes for this\nproposal for each vote option. It is empty at submission, and only\npopulated after tallying, at voting period end or at proposal execution,\nwhichever happens first.","$ref":"#/definitions/cosmos.group.v1.TallyResult"},"group_policy_address":{"description":"group_policy_address is the account address of group policy.","type":"string"},"group_policy_version":{"description":"group_policy_version tracks the version of the group policy at proposal submission.\nWhen a decision policy is changed, existing proposals from previous policy\nversions will become invalid with the `ABORTED` status.\nThis field is here for informational purposes only.","type":"string","format":"uint64"},"group_version":{"description":"group_version tracks the version of the group at proposal submission.\nThis field is here for informational purposes only.","type":"string","format":"uint64"},"id":{"description":"id is the unique id of the proposal.","type":"string","format":"uint64"},"messages":{"description":"messages is a list of `sdk.Msg`s that will be executed if the proposal passes.","type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"metadata":{"type":"string","title":"metadata is any arbitrary metadata attached to the proposal.\nthe recommended format of the metadata is to be found here:\nhttps://docs.cosmos.network/v0.47/modules/group#proposal-4"},"proposers":{"description":"proposers are the account addresses of the proposers.","type":"array","items":{"type":"string"}},"status":{"description":"status represents the high level position in the life cycle of the proposal. Initial value is Submitted.","$ref":"#/definitions/cosmos.group.v1.ProposalStatus"},"submit_time":{"description":"submit_time is a timestamp specifying when a proposal was submitted.","type":"string","format":"date-time"},"summary":{"description":"Since: cosmos-sdk 0.47","type":"string","title":"summary is a short summary of the proposal"},"title":{"description":"Since: cosmos-sdk 0.47","type":"string","title":"title is the title of the proposal"},"voting_period_end":{"description":"voting_period_end is the timestamp before which voting must be done.\nUnless a successful MsgExec is called before (to execute a proposal whose\ntally is successful before the voting period ends), tallying will be done\nat this point, and the `final_tally_result`and `status` fields will be\naccordingly updated.","type":"string","format":"date-time"}}},"cosmos.group.v1.ProposalExecutorResult":{"description":"ProposalExecutorResult defines types of proposal executor results.\n\n - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: An empty value is not allowed.\n - PROPOSAL_EXECUTOR_RESULT_NOT_RUN: We have not yet run the executor.\n - PROPOSAL_EXECUTOR_RESULT_SUCCESS: The executor was successful and proposed action updated state.\n - PROPOSAL_EXECUTOR_RESULT_FAILURE: The executor returned an error and proposed action didn't update state.","type":"string","default":"PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED","enum":["PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED","PROPOSAL_EXECUTOR_RESULT_NOT_RUN","PROPOSAL_EXECUTOR_RESULT_SUCCESS","PROPOSAL_EXECUTOR_RESULT_FAILURE"]},"cosmos.group.v1.ProposalStatus":{"description":"ProposalStatus defines proposal statuses.\n\n - PROPOSAL_STATUS_UNSPECIFIED: An empty value is invalid and not allowed.\n - PROPOSAL_STATUS_SUBMITTED: Initial status of a proposal when submitted.\n - PROPOSAL_STATUS_ACCEPTED: Final status of a proposal when the final tally is done and the outcome\npasses the group policy's decision policy.\n - PROPOSAL_STATUS_REJECTED: Final status of a proposal when the final tally is done and the outcome\nis rejected by the group policy's decision policy.\n - PROPOSAL_STATUS_ABORTED: Final status of a proposal when the group policy is modified before the\nfinal tally.\n - PROPOSAL_STATUS_WITHDRAWN: A proposal can be withdrawn before the voting start time by the owner.\nWhen this happens the final status is Withdrawn.","type":"string","default":"PROPOSAL_STATUS_UNSPECIFIED","enum":["PROPOSAL_STATUS_UNSPECIFIED","PROPOSAL_STATUS_SUBMITTED","PROPOSAL_STATUS_ACCEPTED","PROPOSAL_STATUS_REJECTED","PROPOSAL_STATUS_ABORTED","PROPOSAL_STATUS_WITHDRAWN"]},"cosmos.group.v1.QueryGroupInfoResponse":{"description":"QueryGroupInfoResponse is the Query/GroupInfo response type.","type":"object","properties":{"info":{"description":"info is the GroupInfo of the group.","$ref":"#/definitions/cosmos.group.v1.GroupInfo"}}},"cosmos.group.v1.QueryGroupMembersResponse":{"description":"QueryGroupMembersResponse is the Query/GroupMembersResponse response type.","type":"object","properties":{"members":{"description":"members are the members of the group with given group_id.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.GroupMember"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.group.v1.QueryGroupPoliciesByAdminResponse":{"description":"QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type.","type":"object","properties":{"group_policies":{"description":"group_policies are the group policies info with provided admin.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.GroupPolicyInfo"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.group.v1.QueryGroupPoliciesByGroupResponse":{"description":"QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type.","type":"object","properties":{"group_policies":{"description":"group_policies are the group policies info associated with the provided group.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.GroupPolicyInfo"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.group.v1.QueryGroupPolicyInfoResponse":{"description":"QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type.","type":"object","properties":{"info":{"description":"info is the GroupPolicyInfo of the group policy.","$ref":"#/definitions/cosmos.group.v1.GroupPolicyInfo"}}},"cosmos.group.v1.QueryGroupsByAdminResponse":{"description":"QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type.","type":"object","properties":{"groups":{"description":"groups are the groups info with the provided admin.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.GroupInfo"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.group.v1.QueryGroupsByMemberResponse":{"description":"QueryGroupsByMemberResponse is the Query/GroupsByMember response type.","type":"object","properties":{"groups":{"description":"groups are the groups info with the provided group member.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.GroupInfo"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.group.v1.QueryGroupsResponse":{"description":"QueryGroupsResponse is the Query/Groups response type.\n\nSince: cosmos-sdk 0.47.1","type":"object","properties":{"groups":{"description":"`groups` is all the groups present in state.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.GroupInfo"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.group.v1.QueryProposalResponse":{"description":"QueryProposalResponse is the Query/Proposal response type.","type":"object","properties":{"proposal":{"description":"proposal is the proposal info.","$ref":"#/definitions/cosmos.group.v1.Proposal"}}},"cosmos.group.v1.QueryProposalsByGroupPolicyResponse":{"description":"QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"proposals":{"description":"proposals are the proposals with given group policy.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.Proposal"}}}},"cosmos.group.v1.QueryTallyResultResponse":{"description":"QueryTallyResultResponse is the Query/TallyResult response type.","type":"object","properties":{"tally":{"description":"tally defines the requested tally.","$ref":"#/definitions/cosmos.group.v1.TallyResult"}}},"cosmos.group.v1.QueryVoteByProposalVoterResponse":{"description":"QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type.","type":"object","properties":{"vote":{"description":"vote is the vote with given proposal_id and voter.","$ref":"#/definitions/cosmos.group.v1.Vote"}}},"cosmos.group.v1.QueryVotesByProposalResponse":{"description":"QueryVotesByProposalResponse is the Query/VotesByProposal response type.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"votes":{"description":"votes are the list of votes for given proposal_id.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.Vote"}}}},"cosmos.group.v1.QueryVotesByVoterResponse":{"description":"QueryVotesByVoterResponse is the Query/VotesByVoter response type.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"votes":{"description":"votes are the list of votes by given voter.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.group.v1.Vote"}}}},"cosmos.group.v1.TallyResult":{"description":"TallyResult represents the sum of weighted votes for each vote option.","type":"object","properties":{"abstain_count":{"description":"abstain_count is the weighted sum of abstainers.","type":"string"},"no_count":{"description":"no_count is the weighted sum of no votes.","type":"string"},"no_with_veto_count":{"description":"no_with_veto_count is the weighted sum of veto.","type":"string"},"yes_count":{"description":"yes_count is the weighted sum of yes votes.","type":"string"}}},"cosmos.group.v1.Vote":{"type":"object","title":"Vote represents a vote for a proposal.string metadata","properties":{"metadata":{"type":"string","title":"metadata is any arbitrary metadata attached to the vote.\nthe recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2"},"option":{"description":"option is the voter's choice on the proposal.","$ref":"#/definitions/cosmos.group.v1.VoteOption"},"proposal_id":{"description":"proposal is the unique ID of the proposal.","type":"string","format":"uint64"},"submit_time":{"description":"submit_time is the timestamp when the vote was submitted.","type":"string","format":"date-time"},"voter":{"description":"voter is the account address of the voter.","type":"string"}}},"cosmos.group.v1.VoteOption":{"description":"VoteOption enumerates the valid vote options for a given proposal.\n\n - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will\nreturn an error.\n - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option.\n - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option.\n - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.\n - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option.","type":"string","default":"VOTE_OPTION_UNSPECIFIED","enum":["VOTE_OPTION_UNSPECIFIED","VOTE_OPTION_YES","VOTE_OPTION_ABSTAIN","VOTE_OPTION_NO","VOTE_OPTION_NO_WITH_VETO"]},"cosmos.mint.v1beta1.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"params defines the x/mint parameters to update.\n\nNOTE: All parameters must be supplied.","$ref":"#/definitions/cosmos.mint.v1beta1.Params"}}},"cosmos.mint.v1beta1.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.mint.v1beta1.Params":{"description":"Params defines the parameters for the x/mint module.","type":"object","properties":{"blocks_per_year":{"type":"string","format":"uint64","title":"expected blocks per year"},"goal_bonded":{"type":"string","title":"goal of percent bonded atoms"},"inflation_max":{"type":"string","title":"maximum inflation rate"},"inflation_min":{"type":"string","title":"minimum inflation rate"},"inflation_rate_change":{"type":"string","title":"maximum annual change in inflation rate"},"mint_denom":{"type":"string","title":"type of coin to mint"}}},"cosmos.mint.v1beta1.QueryAnnualProvisionsResponse":{"description":"QueryAnnualProvisionsResponse is the response type for the\nQuery/AnnualProvisions RPC method.","type":"object","properties":{"annual_provisions":{"description":"annual_provisions is the current minting annual provisions value.","type":"string","format":"byte"}}},"cosmos.mint.v1beta1.QueryInflationResponse":{"description":"QueryInflationResponse is the response type for the Query/Inflation RPC\nmethod.","type":"object","properties":{"inflation":{"description":"inflation is the current minting inflation value.","type":"string","format":"byte"}}},"cosmos.mint.v1beta1.QueryParamsResponse":{"description":"QueryParamsResponse is the response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params defines the parameters of the module.","$ref":"#/definitions/cosmos.mint.v1beta1.Params"}}},"cosmos.nft.v1beta1.Class":{"description":"Class defines the class of the nft type.","type":"object","properties":{"data":{"title":"data is the app specific metadata of the NFT class. Optional","$ref":"#/definitions/google.protobuf.Any"},"description":{"type":"string","title":"description is a brief description of nft classification. Optional"},"id":{"type":"string","title":"id defines the unique identifier of the NFT classification, similar to the contract address of ERC721"},"name":{"type":"string","title":"name defines the human-readable name of the NFT classification. Optional"},"symbol":{"type":"string","title":"symbol is an abbreviated name for nft classification. Optional"},"uri":{"type":"string","title":"uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional"},"uri_hash":{"type":"string","title":"uri_hash is a hash of the document pointed by uri. Optional"}}},"cosmos.nft.v1beta1.MsgSend":{"description":"MsgSend represents a message to send a nft from one account to another account.","type":"object","properties":{"class_id":{"type":"string","title":"class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721"},"id":{"type":"string","title":"id defines the unique identification of nft"},"receiver":{"type":"string","title":"receiver is the receiver address of nft"},"sender":{"type":"string","title":"sender is the address of the owner of nft"}}},"cosmos.nft.v1beta1.MsgSendResponse":{"description":"MsgSendResponse defines the Msg/Send response type.","type":"object"},"cosmos.nft.v1beta1.NFT":{"description":"NFT defines the NFT.","type":"object","properties":{"class_id":{"type":"string","title":"class_id associated with the NFT, similar to the contract address of ERC721"},"data":{"title":"data is an app specific data of the NFT. Optional","$ref":"#/definitions/google.protobuf.Any"},"id":{"type":"string","title":"id is a unique identifier of the NFT"},"uri":{"type":"string","title":"uri for the NFT metadata stored off chain"},"uri_hash":{"type":"string","title":"uri_hash is a hash of the document pointed by uri"}}},"cosmos.nft.v1beta1.QueryBalanceResponse":{"type":"object","title":"QueryBalanceResponse is the response type for the Query/Balance RPC method","properties":{"amount":{"type":"string","format":"uint64","title":"amount is the number of all NFTs of a given class owned by the owner"}}},"cosmos.nft.v1beta1.QueryClassResponse":{"type":"object","title":"QueryClassResponse is the response type for the Query/Class RPC method","properties":{"class":{"description":"class defines the class of the nft type.","$ref":"#/definitions/cosmos.nft.v1beta1.Class"}}},"cosmos.nft.v1beta1.QueryClassesResponse":{"type":"object","title":"QueryClassesResponse is the response type for the Query/Classes RPC method","properties":{"classes":{"description":"class defines the class of the nft type.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.nft.v1beta1.Class"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.nft.v1beta1.QueryNFTResponse":{"type":"object","title":"QueryNFTResponse is the response type for the Query/NFT RPC method","properties":{"nft":{"title":"owner is the owner address of the nft","$ref":"#/definitions/cosmos.nft.v1beta1.NFT"}}},"cosmos.nft.v1beta1.QueryNFTsResponse":{"type":"object","title":"QueryNFTsResponse is the response type for the Query/NFTs RPC methods","properties":{"nfts":{"type":"array","title":"NFT defines the NFT","items":{"type":"object","$ref":"#/definitions/cosmos.nft.v1beta1.NFT"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.nft.v1beta1.QueryOwnerResponse":{"type":"object","title":"QueryOwnerResponse is the response type for the Query/Owner RPC method","properties":{"owner":{"type":"string","title":"owner is the owner address of the nft"}}},"cosmos.nft.v1beta1.QuerySupplyResponse":{"type":"object","title":"QuerySupplyResponse is the response type for the Query/Supply RPC method","properties":{"amount":{"type":"string","format":"uint64","title":"amount is the number of all NFTs from the given class"}}},"cosmos.params.v1beta1.ParamChange":{"description":"ParamChange defines an individual parameter change, for use in\nParameterChangeProposal.","type":"object","properties":{"key":{"type":"string"},"subspace":{"type":"string"},"value":{"type":"string"}}},"cosmos.params.v1beta1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"param":{"description":"param defines the queried parameter.","$ref":"#/definitions/cosmos.params.v1beta1.ParamChange"}}},"cosmos.params.v1beta1.QuerySubspacesResponse":{"description":"QuerySubspacesResponse defines the response types for querying for all\nregistered subspaces and all keys for a subspace.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"subspaces":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.params.v1beta1.Subspace"}}}},"cosmos.params.v1beta1.Subspace":{"description":"Subspace defines a parameter subspace name and all the keys that exist for\nthe subspace.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"keys":{"type":"array","items":{"type":"string"}},"subspace":{"type":"string"}}},"cosmos.slashing.v1beta1.MsgUnjail":{"type":"object","title":"MsgUnjail defines the Msg/Unjail request type","properties":{"validator_addr":{"type":"string"}}},"cosmos.slashing.v1beta1.MsgUnjailResponse":{"type":"object","title":"MsgUnjailResponse defines the Msg/Unjail response type"},"cosmos.slashing.v1beta1.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"params defines the x/slashing parameters to update.\n\nNOTE: All parameters must be supplied.","$ref":"#/definitions/cosmos.slashing.v1beta1.Params"}}},"cosmos.slashing.v1beta1.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.slashing.v1beta1.Params":{"description":"Params represents the parameters used for by the slashing module.","type":"object","properties":{"downtime_jail_duration":{"type":"string"},"min_signed_per_window":{"type":"string","format":"byte"},"signed_blocks_window":{"type":"string","format":"int64"},"slash_fraction_double_sign":{"type":"string","format":"byte"},"slash_fraction_downtime":{"type":"string","format":"byte"}}},"cosmos.slashing.v1beta1.QueryParamsResponse":{"type":"object","title":"QueryParamsResponse is the response type for the Query/Params RPC method","properties":{"params":{"$ref":"#/definitions/cosmos.slashing.v1beta1.Params"}}},"cosmos.slashing.v1beta1.QuerySigningInfoResponse":{"type":"object","title":"QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC\nmethod","properties":{"val_signing_info":{"title":"val_signing_info is the signing info of requested val cons address","$ref":"#/definitions/cosmos.slashing.v1beta1.ValidatorSigningInfo"}}},"cosmos.slashing.v1beta1.QuerySigningInfosResponse":{"type":"object","title":"QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC\nmethod","properties":{"info":{"type":"array","title":"info is the signing info of all validators","items":{"type":"object","$ref":"#/definitions/cosmos.slashing.v1beta1.ValidatorSigningInfo"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.slashing.v1beta1.ValidatorSigningInfo":{"description":"ValidatorSigningInfo defines a validator's signing info for monitoring their\nliveness activity.","type":"object","properties":{"address":{"type":"string"},"index_offset":{"description":"Index which is incremented every time a validator is bonded in a block and\n_may_ have signed a pre-commit or not. This in conjunction with the\nsigned_blocks_window param determines the index in the missed block bitmap.","type":"string","format":"int64"},"jailed_until":{"description":"Timestamp until which the validator is jailed due to liveness downtime.","type":"string","format":"date-time"},"missed_blocks_counter":{"description":"A counter of missed (unsigned) blocks. It is used to avoid unnecessary\nreads in the missed block bitmap.","type":"string","format":"int64"},"start_height":{"type":"string","format":"int64","title":"Height at which validator was first a candidate OR was un-jailed"},"tombstoned":{"description":"Whether or not a validator has been tombstoned (killed out of validator\nset). It is set once the validator commits an equivocation or for any other\nconfigured misbehavior.","type":"boolean"}}},"cosmos.staking.v1beta1.BondStatus":{"description":"BondStatus is the status of a validator.\n\n - BOND_STATUS_UNSPECIFIED: UNSPECIFIED defines an invalid validator status.\n - BOND_STATUS_UNBONDED: UNBONDED defines a validator that is not bonded.\n - BOND_STATUS_UNBONDING: UNBONDING defines a validator that is unbonding.\n - BOND_STATUS_BONDED: BONDED defines a validator that is bonded.","type":"string","default":"BOND_STATUS_UNSPECIFIED","enum":["BOND_STATUS_UNSPECIFIED","BOND_STATUS_UNBONDED","BOND_STATUS_UNBONDING","BOND_STATUS_BONDED"]},"cosmos.staking.v1beta1.Commission":{"description":"Commission defines commission parameters for a given validator.","type":"object","properties":{"commission_rates":{"description":"commission_rates defines the initial commission rates to be used for creating a validator.","$ref":"#/definitions/cosmos.staking.v1beta1.CommissionRates"},"update_time":{"description":"update_time is the last time the commission rate was changed.","type":"string","format":"date-time"}}},"cosmos.staking.v1beta1.CommissionRates":{"description":"CommissionRates defines the initial commission rates to be used for creating\na validator.","type":"object","properties":{"max_change_rate":{"description":"max_change_rate defines the maximum daily increase of the validator commission, as a fraction.","type":"string"},"max_rate":{"description":"max_rate defines the maximum commission rate which validator can ever charge, as a fraction.","type":"string"},"rate":{"description":"rate is the commission rate charged to delegators, as a fraction.","type":"string"}}},"cosmos.staking.v1beta1.Delegation":{"description":"Delegation represents the bond with tokens held by an account. It is\nowned by one delegator, and is associated with the voting power of one\nvalidator.","type":"object","properties":{"delegator_address":{"description":"delegator_address is the encoded address of the delegator.","type":"string"},"shares":{"description":"shares define the delegation shares received.","type":"string"},"validator_address":{"description":"validator_address is the encoded address of the validator.","type":"string"}}},"cosmos.staking.v1beta1.DelegationResponse":{"description":"DelegationResponse is equivalent to Delegation except that it contains a\nbalance in addition to shares which is more suitable for client responses.","type":"object","properties":{"balance":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"delegation":{"$ref":"#/definitions/cosmos.staking.v1beta1.Delegation"}}},"cosmos.staking.v1beta1.Description":{"description":"Description defines a validator description.","type":"object","properties":{"details":{"description":"details define other optional details.","type":"string"},"identity":{"description":"identity defines an optional identity signature (ex. UPort or Keybase).","type":"string"},"moniker":{"description":"moniker defines a human-readable name for the validator.","type":"string"},"security_contact":{"description":"security_contact defines an optional email for security contact.","type":"string"},"website":{"description":"website defines an optional website link.","type":"string"}}},"cosmos.staking.v1beta1.HistoricalInfo":{"description":"HistoricalInfo contains header and validator information for a given block.\nIt is stored as part of staking module's state, which persists the `n` most\nrecent HistoricalInfo\n(`n` is set by the staking module's `historical_entries` parameter).","type":"object","properties":{"header":{"$ref":"#/definitions/tendermint.types.Header"},"valset":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.Validator"}}}},"cosmos.staking.v1beta1.MsgBeginRedelegate":{"description":"MsgBeginRedelegate defines a SDK message for performing a redelegation\nof coins from a delegator and source validator to a destination validator.","type":"object","properties":{"amount":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"delegator_address":{"type":"string"},"validator_dst_address":{"type":"string"},"validator_src_address":{"type":"string"}}},"cosmos.staking.v1beta1.MsgBeginRedelegateResponse":{"description":"MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type.","type":"object","properties":{"completion_time":{"type":"string","format":"date-time"}}},"cosmos.staking.v1beta1.MsgCancelUnbondingDelegation":{"description":"Since: cosmos-sdk 0.46","type":"object","title":"MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator","properties":{"amount":{"title":"amount is always less than or equal to unbonding delegation entry balance","$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"creation_height":{"description":"creation_height is the height which the unbonding took place.","type":"string","format":"int64"},"delegator_address":{"type":"string"},"validator_address":{"type":"string"}}},"cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse":{"description":"Since: cosmos-sdk 0.46","type":"object","title":"MsgCancelUnbondingDelegationResponse"},"cosmos.staking.v1beta1.MsgCreateValidator":{"description":"MsgCreateValidator defines a SDK message for creating a new validator.","type":"object","properties":{"commission":{"$ref":"#/definitions/cosmos.staking.v1beta1.CommissionRates"},"delegator_address":{"description":"Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated.\nThe validator address bytes and delegator address bytes refer to the same account while creating validator (defer\nonly in bech32 notation).","type":"string"},"description":{"$ref":"#/definitions/cosmos.staking.v1beta1.Description"},"min_self_delegation":{"type":"string"},"pubkey":{"$ref":"#/definitions/google.protobuf.Any"},"validator_address":{"type":"string"},"value":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"}}},"cosmos.staking.v1beta1.MsgCreateValidatorResponse":{"description":"MsgCreateValidatorResponse defines the Msg/CreateValidator response type.","type":"object"},"cosmos.staking.v1beta1.MsgDelegate":{"description":"MsgDelegate defines a SDK message for performing a delegation of coins\nfrom a delegator to a validator.","type":"object","properties":{"amount":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"delegator_address":{"type":"string"},"validator_address":{"type":"string"}}},"cosmos.staking.v1beta1.MsgDelegateResponse":{"description":"MsgDelegateResponse defines the Msg/Delegate response type.","type":"object"},"cosmos.staking.v1beta1.MsgEditValidator":{"description":"MsgEditValidator defines a SDK message for editing an existing validator.","type":"object","properties":{"commission_rate":{"type":"string","title":"We pass a reference to the new commission rate and min self delegation as\nit's not mandatory to update. If not updated, the deserialized rate will be\nzero with no way to distinguish if an update was intended.\nREF: #2373"},"description":{"$ref":"#/definitions/cosmos.staking.v1beta1.Description"},"min_self_delegation":{"type":"string"},"validator_address":{"type":"string"}}},"cosmos.staking.v1beta1.MsgEditValidatorResponse":{"description":"MsgEditValidatorResponse defines the Msg/EditValidator response type.","type":"object"},"cosmos.staking.v1beta1.MsgUndelegate":{"description":"MsgUndelegate defines a SDK message for performing an undelegation from a\ndelegate and a validator.","type":"object","properties":{"amount":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"delegator_address":{"type":"string"},"validator_address":{"type":"string"}}},"cosmos.staking.v1beta1.MsgUndelegateResponse":{"description":"MsgUndelegateResponse defines the Msg/Undelegate response type.","type":"object","properties":{"amount":{"description":"Since: cosmos-sdk 0.50","title":"amount returns the amount of undelegated coins","$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"completion_time":{"type":"string","format":"date-time"}}},"cosmos.staking.v1beta1.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"params defines the x/staking parameters to update.\n\nNOTE: All parameters must be supplied.","$ref":"#/definitions/cosmos.staking.v1beta1.Params"}}},"cosmos.staking.v1beta1.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.\n\nSince: cosmos-sdk 0.47","type":"object"},"cosmos.staking.v1beta1.Params":{"description":"Params defines the parameters for the x/staking module.","type":"object","properties":{"bond_denom":{"description":"bond_denom defines the bondable coin denomination.","type":"string"},"historical_entries":{"description":"historical_entries is the number of historical entries to persist.","type":"integer","format":"int64"},"max_entries":{"description":"max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio).","type":"integer","format":"int64"},"max_validators":{"description":"max_validators is the maximum number of validators.","type":"integer","format":"int64"},"min_commission_rate":{"type":"string","title":"min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators"},"unbonding_time":{"description":"unbonding_time is the time duration of unbonding.","type":"string"}}},"cosmos.staking.v1beta1.Pool":{"description":"Pool is used for tracking bonded and not-bonded token supply of the bond\ndenomination.","type":"object","properties":{"bonded_tokens":{"type":"string"},"not_bonded_tokens":{"type":"string"}}},"cosmos.staking.v1beta1.QueryDelegationResponse":{"description":"QueryDelegationResponse is response type for the Query/Delegation RPC method.","type":"object","properties":{"delegation_response":{"description":"delegation_responses defines the delegation info of a delegation.","$ref":"#/definitions/cosmos.staking.v1beta1.DelegationResponse"}}},"cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse":{"description":"QueryDelegatorDelegationsResponse is response type for the\nQuery/DelegatorDelegations RPC method.","type":"object","properties":{"delegation_responses":{"description":"delegation_responses defines all the delegations' info of a delegator.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.DelegationResponse"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse":{"description":"QueryUnbondingDelegatorDelegationsResponse is response type for the\nQuery/UnbondingDelegatorDelegations RPC method.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"unbonding_responses":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.UnbondingDelegation"}}}},"cosmos.staking.v1beta1.QueryDelegatorValidatorResponse":{"description":"QueryDelegatorValidatorResponse response type for the\nQuery/DelegatorValidator RPC method.","type":"object","properties":{"validator":{"description":"validator defines the validator info.","$ref":"#/definitions/cosmos.staking.v1beta1.Validator"}}},"cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse":{"description":"QueryDelegatorValidatorsResponse is response type for the\nQuery/DelegatorValidators RPC method.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"validators":{"description":"validators defines the validators' info of a delegator.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.Validator"}}}},"cosmos.staking.v1beta1.QueryHistoricalInfoResponse":{"description":"QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC\nmethod.","type":"object","properties":{"hist":{"description":"hist defines the historical info at the given height.","$ref":"#/definitions/cosmos.staking.v1beta1.HistoricalInfo"}}},"cosmos.staking.v1beta1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/cosmos.staking.v1beta1.Params"}}},"cosmos.staking.v1beta1.QueryPoolResponse":{"description":"QueryPoolResponse is response type for the Query/Pool RPC method.","type":"object","properties":{"pool":{"description":"pool defines the pool info.","$ref":"#/definitions/cosmos.staking.v1beta1.Pool"}}},"cosmos.staking.v1beta1.QueryRedelegationsResponse":{"description":"QueryRedelegationsResponse is response type for the Query/Redelegations RPC\nmethod.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"redelegation_responses":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.RedelegationResponse"}}}},"cosmos.staking.v1beta1.QueryUnbondingDelegationResponse":{"description":"QueryDelegationResponse is response type for the Query/UnbondingDelegation\nRPC method.","type":"object","properties":{"unbond":{"description":"unbond defines the unbonding information of a delegation.","$ref":"#/definitions/cosmos.staking.v1beta1.UnbondingDelegation"}}},"cosmos.staking.v1beta1.QueryValidatorDelegationsResponse":{"type":"object","title":"QueryValidatorDelegationsResponse is response type for the\nQuery/ValidatorDelegations RPC method","properties":{"delegation_responses":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.DelegationResponse"}},"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"cosmos.staking.v1beta1.QueryValidatorResponse":{"type":"object","title":"QueryValidatorResponse is response type for the Query/Validator RPC method","properties":{"validator":{"description":"validator defines the validator info.","$ref":"#/definitions/cosmos.staking.v1beta1.Validator"}}},"cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse":{"description":"QueryValidatorUnbondingDelegationsResponse is response type for the\nQuery/ValidatorUnbondingDelegations RPC method.","type":"object","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"unbonding_responses":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.UnbondingDelegation"}}}},"cosmos.staking.v1beta1.QueryValidatorsResponse":{"type":"object","title":"QueryValidatorsResponse is response type for the Query/Validators RPC method","properties":{"pagination":{"description":"pagination defines the pagination in the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"validators":{"description":"validators contains all the queried validators.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.Validator"}}}},"cosmos.staking.v1beta1.Redelegation":{"description":"Redelegation contains the list of a particular delegator's redelegating bonds\nfrom a particular source validator to a particular destination validator.","type":"object","properties":{"delegator_address":{"description":"delegator_address is the bech32-encoded address of the delegator.","type":"string"},"entries":{"description":"entries are the redelegation entries.\n\nredelegation entries","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.RedelegationEntry"}},"validator_dst_address":{"description":"validator_dst_address is the validator redelegation destination operator address.","type":"string"},"validator_src_address":{"description":"validator_src_address is the validator redelegation source operator address.","type":"string"}}},"cosmos.staking.v1beta1.RedelegationEntry":{"description":"RedelegationEntry defines a redelegation object with relevant metadata.","type":"object","properties":{"completion_time":{"description":"completion_time defines the unix time for redelegation completion.","type":"string","format":"date-time"},"creation_height":{"description":"creation_height defines the height which the redelegation took place.","type":"string","format":"int64"},"initial_balance":{"description":"initial_balance defines the initial balance when redelegation started.","type":"string"},"shares_dst":{"description":"shares_dst is the amount of destination-validator shares created by redelegation.","type":"string"},"unbonding_id":{"type":"string","format":"uint64","title":"Incrementing id that uniquely identifies this entry"},"unbonding_on_hold_ref_count":{"type":"string","format":"int64","title":"Strictly positive if this entry's unbonding has been stopped by external modules"}}},"cosmos.staking.v1beta1.RedelegationEntryResponse":{"description":"RedelegationEntryResponse is equivalent to a RedelegationEntry except that it\ncontains a balance in addition to shares which is more suitable for client\nresponses.","type":"object","properties":{"balance":{"type":"string"},"redelegation_entry":{"$ref":"#/definitions/cosmos.staking.v1beta1.RedelegationEntry"}}},"cosmos.staking.v1beta1.RedelegationResponse":{"description":"RedelegationResponse is equivalent to a Redelegation except that its entries\ncontain a balance in addition to shares which is more suitable for client\nresponses.","type":"object","properties":{"entries":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.RedelegationEntryResponse"}},"redelegation":{"$ref":"#/definitions/cosmos.staking.v1beta1.Redelegation"}}},"cosmos.staking.v1beta1.UnbondingDelegation":{"description":"UnbondingDelegation stores all of a single delegator's unbonding bonds\nfor a single validator in an time-ordered list.","type":"object","properties":{"delegator_address":{"description":"delegator_address is the encoded address of the delegator.","type":"string"},"entries":{"description":"entries are the unbonding delegation entries.\n\nunbonding delegation entries","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.staking.v1beta1.UnbondingDelegationEntry"}},"validator_address":{"description":"validator_address is the encoded address of the validator.","type":"string"}}},"cosmos.staking.v1beta1.UnbondingDelegationEntry":{"description":"UnbondingDelegationEntry defines an unbonding object with relevant metadata.","type":"object","properties":{"balance":{"description":"balance defines the tokens to receive at completion.","type":"string"},"completion_time":{"description":"completion_time is the unix time for unbonding completion.","type":"string","format":"date-time"},"creation_height":{"description":"creation_height is the height which the unbonding took place.","type":"string","format":"int64"},"initial_balance":{"description":"initial_balance defines the tokens initially scheduled to receive at completion.","type":"string"},"unbonding_id":{"type":"string","format":"uint64","title":"Incrementing id that uniquely identifies this entry"},"unbonding_on_hold_ref_count":{"type":"string","format":"int64","title":"Strictly positive if this entry's unbonding has been stopped by external modules"}}},"cosmos.staking.v1beta1.Validator":{"description":"Validator defines a validator, together with the total amount of the\nValidator's bond shares and their exchange rate to coins. Slashing results in\na decrease in the exchange rate, allowing correct calculation of future\nundelegations without iterating over delegators. When coins are delegated to\nthis validator, the validator is credited with a delegation whose number of\nbond shares is based on the amount of coins delegated divided by the current\nexchange rate. Voting power can be calculated as total bonded shares\nmultiplied by exchange rate.","type":"object","properties":{"commission":{"description":"commission defines the commission parameters.","$ref":"#/definitions/cosmos.staking.v1beta1.Commission"},"consensus_pubkey":{"description":"consensus_pubkey is the consensus public key of the validator, as a Protobuf Any.","$ref":"#/definitions/google.protobuf.Any"},"delegator_shares":{"description":"delegator_shares defines total shares issued to a validator's delegators.","type":"string"},"description":{"description":"description defines the description terms for the validator.","$ref":"#/definitions/cosmos.staking.v1beta1.Description"},"jailed":{"description":"jailed defined whether the validator has been jailed from bonded status or not.","type":"boolean"},"min_self_delegation":{"description":"min_self_delegation is the validator's self declared minimum self delegation.\n\nSince: cosmos-sdk 0.46","type":"string"},"operator_address":{"description":"operator_address defines the address of the validator's operator; bech encoded in JSON.","type":"string"},"status":{"description":"status is the validator status (bonded/unbonding/unbonded).","$ref":"#/definitions/cosmos.staking.v1beta1.BondStatus"},"tokens":{"description":"tokens define the delegated tokens (incl. self-delegation).","type":"string"},"unbonding_height":{"description":"unbonding_height defines, if unbonding, the height at which this validator has begun unbonding.","type":"string","format":"int64"},"unbonding_ids":{"type":"array","title":"list of unbonding ids, each uniquely identifing an unbonding of this validator","items":{"type":"string","format":"uint64"}},"unbonding_on_hold_ref_count":{"type":"string","format":"int64","title":"strictly positive if this validator's unbonding has been stopped by external modules"},"unbonding_time":{"description":"unbonding_time defines, if unbonding, the min time for the validator to complete unbonding.","type":"string","format":"date-time"}}},"cosmos.store.streaming.abci.ListenCommitRequest":{"type":"object","title":"ListenCommitRequest is the request type for the ListenCommit RPC method","properties":{"block_height":{"type":"string","format":"int64","title":"explicitly pass in block height as ResponseCommit does not contain this info"},"change_set":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.store.v1beta1.StoreKVPair"}},"res":{"$ref":"#/definitions/tendermint.abci.ResponseCommit"}}},"cosmos.store.streaming.abci.ListenCommitResponse":{"type":"object","title":"ListenCommitResponse is the response type for the ListenCommit RPC method"},"cosmos.store.streaming.abci.ListenFinalizeBlockRequest":{"type":"object","title":"ListenEndBlockRequest is the request type for the ListenEndBlock RPC method","properties":{"req":{"$ref":"#/definitions/tendermint.abci.RequestFinalizeBlock"},"res":{"$ref":"#/definitions/tendermint.abci.ResponseFinalizeBlock"}}},"cosmos.store.streaming.abci.ListenFinalizeBlockResponse":{"type":"object","title":"ListenEndBlockResponse is the response type for the ListenEndBlock RPC method"},"cosmos.store.v1beta1.StoreKVPair":{"description":"Since: cosmos-sdk 0.43","type":"object","title":"StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes)\nIt optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and\nDeletes","properties":{"delete":{"type":"boolean","title":"true indicates a delete operation, false indicates a set operation"},"key":{"type":"string","format":"byte"},"store_key":{"type":"string","title":"the store key for the KVStore this pair originates from"},"value":{"type":"string","format":"byte"}}},"cosmos.tx.signing.v1beta1.SignMode":{"description":"SignMode represents a signing mode with its own security guarantees.\n\nThis enum should be considered a registry of all known sign modes\nin the Cosmos ecosystem. Apps are not expected to support all known\nsign modes. Apps that would like to support custom sign modes are\nencouraged to open a small PR against this file to add a new case\nto this SignMode enum describing their sign mode so that different\napps have a consistent version of this enum.\n\n - SIGN_MODE_UNSPECIFIED: SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be\nrejected.\n - SIGN_MODE_DIRECT: SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is\nverified with raw bytes from Tx.\n - SIGN_MODE_TEXTUAL: SIGN_MODE_TEXTUAL is a future signing mode that will verify some\nhuman-readable textual representation on top of the binary representation\nfrom SIGN_MODE_DIRECT.\n\nSince: cosmos-sdk 0.50\n - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses\nSignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not\nrequire signers signing over other signers' `signer_info`.\n\nSince: cosmos-sdk 0.46\n - SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses\nAmino JSON and will be removed in the future.\n - SIGN_MODE_EIP_191: SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos\nSDK. Ref: https://eips.ethereum.org/EIPS/eip-191\n\nCurrently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant,\nbut is not implemented on the SDK by default. To enable EIP-191, you need\nto pass a custom `TxConfig` that has an implementation of\n`SignModeHandler` for EIP-191. The SDK may decide to fully support\nEIP-191 in the future.\n\nSince: cosmos-sdk 0.45.2","type":"string","default":"SIGN_MODE_UNSPECIFIED","enum":["SIGN_MODE_UNSPECIFIED","SIGN_MODE_DIRECT","SIGN_MODE_TEXTUAL","SIGN_MODE_DIRECT_AUX","SIGN_MODE_LEGACY_AMINO_JSON","SIGN_MODE_EIP_191"]},"cosmos.tx.v1beta1.AuthInfo":{"description":"AuthInfo describes the fee and signer modes that are used to sign a\ntransaction.","type":"object","properties":{"fee":{"description":"Fee is the fee and gas limit for the transaction. The first signer is the\nprimary signer and the one which pays the fee. The fee can be calculated\nbased on the cost of evaluating the body and doing signature verification\nof the signers. This can be estimated via simulation.","$ref":"#/definitions/cosmos.tx.v1beta1.Fee"},"signer_infos":{"description":"signer_infos defines the signing modes for the required signers. The number\nand order of elements must match the required signers from TxBody's\nmessages. The first element is the primary signer and the one which pays\nthe fee.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.tx.v1beta1.SignerInfo"}},"tip":{"description":"Tip is the optional tip used for transactions fees paid in another denom.\n\nThis field is ignored if the chain didn't enable tips, i.e. didn't add the\n`TipDecorator` in its posthandler.\n\nSince: cosmos-sdk 0.46","$ref":"#/definitions/cosmos.tx.v1beta1.Tip"}}},"cosmos.tx.v1beta1.BroadcastMode":{"description":"BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC\nmethod.\n\n - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering\n - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead,\nBROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards.\n - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits\nfor a CheckTx execution response only.\n - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client\nreturns immediately.","type":"string","default":"BROADCAST_MODE_UNSPECIFIED","enum":["BROADCAST_MODE_UNSPECIFIED","BROADCAST_MODE_BLOCK","BROADCAST_MODE_SYNC","BROADCAST_MODE_ASYNC"]},"cosmos.tx.v1beta1.BroadcastTxRequest":{"description":"BroadcastTxRequest is the request type for the Service.BroadcastTxRequest\nRPC method.","type":"object","properties":{"mode":{"$ref":"#/definitions/cosmos.tx.v1beta1.BroadcastMode"},"tx_bytes":{"description":"tx_bytes is the raw transaction.","type":"string","format":"byte"}}},"cosmos.tx.v1beta1.BroadcastTxResponse":{"description":"BroadcastTxResponse is the response type for the\nService.BroadcastTx method.","type":"object","properties":{"tx_response":{"description":"tx_response is the queried TxResponses.","$ref":"#/definitions/cosmos.base.abci.v1beta1.TxResponse"}}},"cosmos.tx.v1beta1.Fee":{"description":"Fee includes the amount of coins paid in fees and the maximum\ngas to be used by the transaction. The ratio yields an effective \"gasprice\",\nwhich must be above some miminum to be accepted into the mempool.","type":"object","properties":{"amount":{"type":"array","title":"amount is the amount of coins to be paid as a fee","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"gas_limit":{"type":"string","format":"uint64","title":"gas_limit is the maximum gas that can be used in transaction processing\nbefore an out of gas error occurs"},"granter":{"type":"string","title":"if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used\nto pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does\nnot support fee grants, this will fail"},"payer":{"description":"if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees.\nthe payer must be a tx signer (and thus have signed this field in AuthInfo).\nsetting this field does *not* change the ordering of required signers for the transaction.","type":"string"}}},"cosmos.tx.v1beta1.GetBlockWithTxsResponse":{"description":"GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs\nmethod.\n\nSince: cosmos-sdk 0.45.2","type":"object","properties":{"block":{"$ref":"#/definitions/tendermint.types.Block"},"block_id":{"$ref":"#/definitions/tendermint.types.BlockID"},"pagination":{"description":"pagination defines a pagination for the response.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"txs":{"description":"txs are the transactions in the block.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.tx.v1beta1.Tx"}}}},"cosmos.tx.v1beta1.GetTxResponse":{"description":"GetTxResponse is the response type for the Service.GetTx method.","type":"object","properties":{"tx":{"description":"tx is the queried transaction.","$ref":"#/definitions/cosmos.tx.v1beta1.Tx"},"tx_response":{"description":"tx_response is the queried TxResponses.","$ref":"#/definitions/cosmos.base.abci.v1beta1.TxResponse"}}},"cosmos.tx.v1beta1.GetTxsEventResponse":{"description":"GetTxsEventResponse is the response type for the Service.TxsByEvents\nRPC method.","type":"object","properties":{"pagination":{"description":"pagination defines a pagination for the response.\nDeprecated post v0.46.x: use total instead.","$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"total":{"type":"string","format":"uint64","title":"total is total number of results available"},"tx_responses":{"description":"tx_responses is the list of queried TxResponses.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.abci.v1beta1.TxResponse"}},"txs":{"description":"txs is the list of queried transactions.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.tx.v1beta1.Tx"}}}},"cosmos.tx.v1beta1.ModeInfo":{"description":"ModeInfo describes the signing mode of a single or nested multisig signer.","type":"object","properties":{"multi":{"title":"multi represents a nested multisig signer","$ref":"#/definitions/cosmos.tx.v1beta1.ModeInfo.Multi"},"single":{"title":"single represents a single signer","$ref":"#/definitions/cosmos.tx.v1beta1.ModeInfo.Single"}}},"cosmos.tx.v1beta1.ModeInfo.Multi":{"type":"object","title":"Multi is the mode info for a multisig public key","properties":{"bitarray":{"title":"bitarray specifies which keys within the multisig are signing","$ref":"#/definitions/cosmos.crypto.multisig.v1beta1.CompactBitArray"},"mode_infos":{"type":"array","title":"mode_infos is the corresponding modes of the signers of the multisig\nwhich could include nested multisig public keys","items":{"type":"object","$ref":"#/definitions/cosmos.tx.v1beta1.ModeInfo"}}}},"cosmos.tx.v1beta1.ModeInfo.Single":{"type":"object","title":"Single is the mode info for a single signer. It is structured as a message\nto allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the\nfuture","properties":{"mode":{"title":"mode is the signing mode of the single signer","$ref":"#/definitions/cosmos.tx.signing.v1beta1.SignMode"}}},"cosmos.tx.v1beta1.OrderBy":{"description":"- ORDER_BY_UNSPECIFIED: ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults\nto ASC in this case.\n - ORDER_BY_ASC: ORDER_BY_ASC defines ascending order\n - ORDER_BY_DESC: ORDER_BY_DESC defines descending order","type":"string","title":"OrderBy defines the sorting order","default":"ORDER_BY_UNSPECIFIED","enum":["ORDER_BY_UNSPECIFIED","ORDER_BY_ASC","ORDER_BY_DESC"]},"cosmos.tx.v1beta1.SignerInfo":{"description":"SignerInfo describes the public key and signing mode of a single top-level\nsigner.","type":"object","properties":{"mode_info":{"title":"mode_info describes the signing mode of the signer and is a nested\nstructure to support nested multisig pubkey's","$ref":"#/definitions/cosmos.tx.v1beta1.ModeInfo"},"public_key":{"description":"public_key is the public key of the signer. It is optional for accounts\nthat already exist in state. If unset, the verifier can use the required \\\nsigner address for this position and lookup the public key.","$ref":"#/definitions/google.protobuf.Any"},"sequence":{"description":"sequence is the sequence of the account, which describes the\nnumber of committed transactions signed by a given address. It is used to\nprevent replay attacks.","type":"string","format":"uint64"}}},"cosmos.tx.v1beta1.SimulateRequest":{"description":"SimulateRequest is the request type for the Service.Simulate\nRPC method.","type":"object","properties":{"tx":{"description":"tx is the transaction to simulate.\nDeprecated. Send raw tx bytes instead.","$ref":"#/definitions/cosmos.tx.v1beta1.Tx"},"tx_bytes":{"description":"tx_bytes is the raw transaction.\n\nSince: cosmos-sdk 0.43","type":"string","format":"byte"}}},"cosmos.tx.v1beta1.SimulateResponse":{"description":"SimulateResponse is the response type for the\nService.SimulateRPC method.","type":"object","properties":{"gas_info":{"description":"gas_info is the information about gas used in the simulation.","$ref":"#/definitions/cosmos.base.abci.v1beta1.GasInfo"},"result":{"description":"result is the result of the simulation.","$ref":"#/definitions/cosmos.base.abci.v1beta1.Result"}}},"cosmos.tx.v1beta1.Tip":{"description":"Tip is the tip used for meta-transactions.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"amount":{"type":"array","title":"amount is the amount of the tip","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"tipper":{"type":"string","title":"tipper is the address of the account paying for the tip"}}},"cosmos.tx.v1beta1.Tx":{"description":"Tx is the standard type used for broadcasting transactions.","type":"object","properties":{"auth_info":{"title":"auth_info is the authorization related content of the transaction,\nspecifically signers, signer modes and fee","$ref":"#/definitions/cosmos.tx.v1beta1.AuthInfo"},"body":{"title":"body is the processable content of the transaction","$ref":"#/definitions/cosmos.tx.v1beta1.TxBody"},"signatures":{"description":"signatures is a list of signatures that matches the length and order of\nAuthInfo's signer_infos to allow connecting signature meta information like\npublic key and signing mode by position.","type":"array","items":{"type":"string","format":"byte"}}}},"cosmos.tx.v1beta1.TxBody":{"description":"TxBody is the body of a transaction that all signers sign over.","type":"object","properties":{"extension_options":{"type":"array","title":"extension_options are arbitrary options that can be added by chains\nwhen the default options are not sufficient. If any of these are present\nand can't be handled, the transaction will be rejected","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"memo":{"description":"memo is any arbitrary note/comment to be added to the transaction.\nWARNING: in clients, any publicly exposed text should not be called memo,\nbut should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122).","type":"string"},"messages":{"description":"messages is a list of messages to be executed. The required signers of\nthose messages define the number and order of elements in AuthInfo's\nsigner_infos and Tx's signatures. Each required signer address is added to\nthe list only the first time it occurs.\nBy convention, the first required signer (usually from the first message)\nis referred to as the primary signer and pays the fee for the whole\ntransaction.","type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"non_critical_extension_options":{"type":"array","title":"extension_options are arbitrary options that can be added by chains\nwhen the default options are not sufficient. If any of these are present\nand can't be handled, they will be ignored","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"timeout_height":{"type":"string","format":"uint64","title":"timeout is the block height after which this transaction will not\nbe processed by the chain"}}},"cosmos.tx.v1beta1.TxDecodeAminoRequest":{"description":"TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino\nRPC method.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"amino_binary":{"type":"string","format":"byte"}}},"cosmos.tx.v1beta1.TxDecodeAminoResponse":{"description":"TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino\nRPC method.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"amino_json":{"type":"string"}}},"cosmos.tx.v1beta1.TxDecodeRequest":{"description":"TxDecodeRequest is the request type for the Service.TxDecode\nRPC method.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"tx_bytes":{"description":"tx_bytes is the raw transaction.","type":"string","format":"byte"}}},"cosmos.tx.v1beta1.TxDecodeResponse":{"description":"TxDecodeResponse is the response type for the\nService.TxDecode method.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"tx":{"description":"tx is the decoded transaction.","$ref":"#/definitions/cosmos.tx.v1beta1.Tx"}}},"cosmos.tx.v1beta1.TxEncodeAminoRequest":{"description":"TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino\nRPC method.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"amino_json":{"type":"string"}}},"cosmos.tx.v1beta1.TxEncodeAminoResponse":{"description":"TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino\nRPC method.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"amino_binary":{"type":"string","format":"byte"}}},"cosmos.tx.v1beta1.TxEncodeRequest":{"description":"TxEncodeRequest is the request type for the Service.TxEncode\nRPC method.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"tx":{"description":"tx is the transaction to encode.","$ref":"#/definitions/cosmos.tx.v1beta1.Tx"}}},"cosmos.tx.v1beta1.TxEncodeResponse":{"description":"TxEncodeResponse is the response type for the\nService.TxEncode method.\n\nSince: cosmos-sdk 0.47","type":"object","properties":{"tx_bytes":{"description":"tx_bytes is the encoded transaction bytes.","type":"string","format":"byte"}}},"cosmos.upgrade.v1beta1.ModuleVersion":{"description":"ModuleVersion specifies a module and its consensus version.\n\nSince: cosmos-sdk 0.43","type":"object","properties":{"name":{"type":"string","title":"name of the app module"},"version":{"type":"string","format":"uint64","title":"consensus version of the app module"}}},"cosmos.upgrade.v1beta1.MsgCancelUpgrade":{"description":"MsgCancelUpgrade is the Msg/CancelUpgrade request type.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"}}},"cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse":{"description":"MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type.\n\nSince: cosmos-sdk 0.46","type":"object"},"cosmos.upgrade.v1beta1.MsgSoftwareUpgrade":{"description":"MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"plan":{"description":"plan is the upgrade plan.","$ref":"#/definitions/cosmos.upgrade.v1beta1.Plan"}}},"cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse":{"description":"MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type.\n\nSince: cosmos-sdk 0.46","type":"object"},"cosmos.upgrade.v1beta1.Plan":{"description":"Plan specifies information about a planned upgrade and when it should occur.","type":"object","properties":{"height":{"description":"The height at which the upgrade must be performed.","type":"string","format":"int64"},"info":{"type":"string","title":"Any application specific upgrade info to be included on-chain\nsuch as a git commit that validators could automatically upgrade to"},"name":{"description":"Sets the name for the upgrade. This name will be used by the upgraded\nversion of the software to apply any special \"on-upgrade\" commands during\nthe first BeginBlock method after the upgrade is applied. It is also used\nto detect whether a software version can handle a given upgrade. If no\nupgrade handler with this name has been set in the software, it will be\nassumed that the software is out-of-date when the upgrade Time or Height is\nreached and the software will exit.","type":"string"},"time":{"description":"Deprecated: Time based upgrades have been deprecated. Time based upgrade logic\nhas been removed from the SDK.\nIf this field is not empty, an error will be thrown.","type":"string","format":"date-time"},"upgraded_client_state":{"description":"Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been\nmoved to the IBC module in the sub module 02-client.\nIf this field is not empty, an error will be thrown.","$ref":"#/definitions/google.protobuf.Any"}}},"cosmos.upgrade.v1beta1.QueryAppliedPlanResponse":{"description":"QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC\nmethod.","type":"object","properties":{"height":{"description":"height is the block height at which the plan was applied.","type":"string","format":"int64"}}},"cosmos.upgrade.v1beta1.QueryAuthorityResponse":{"description":"Since: cosmos-sdk 0.46","type":"object","title":"QueryAuthorityResponse is the response type for Query/Authority","properties":{"address":{"type":"string"}}},"cosmos.upgrade.v1beta1.QueryCurrentPlanResponse":{"description":"QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC\nmethod.","type":"object","properties":{"plan":{"description":"plan is the current upgrade plan.","$ref":"#/definitions/cosmos.upgrade.v1beta1.Plan"}}},"cosmos.upgrade.v1beta1.QueryModuleVersionsResponse":{"description":"QueryModuleVersionsResponse is the response type for the Query/ModuleVersions\nRPC method.\n\nSince: cosmos-sdk 0.43","type":"object","properties":{"module_versions":{"description":"module_versions is a list of module names with their consensus versions.","type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.upgrade.v1beta1.ModuleVersion"}}}},"cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse":{"description":"QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState\nRPC method.","type":"object","properties":{"upgraded_consensus_state":{"type":"string","format":"byte","title":"Since: cosmos-sdk 0.43"}}},"cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount":{"description":"MsgCreateVestingAccount defines a message that enables creating a vesting\naccount.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"from_address":{"type":"string"},"start_time":{"description":"start of vesting as unix time (in seconds).","type":"string","format":"int64"},"to_address":{"type":"string"},"vesting_periods":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.vesting.v1beta1.Period"}}}},"cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse":{"description":"MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount\nresponse type.\n\nSince: cosmos-sdk 0.46","type":"object"},"cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount":{"description":"MsgCreatePermanentLockedAccount defines a message that enables creating a permanent\nlocked account.\n\nSince: cosmos-sdk 0.46","type":"object","properties":{"amount":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"from_address":{"type":"string"},"to_address":{"type":"string"}}},"cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse":{"description":"MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type.\n\nSince: cosmos-sdk 0.46","type":"object"},"cosmos.vesting.v1beta1.MsgCreateVestingAccount":{"description":"MsgCreateVestingAccount defines a message that enables creating a vesting\naccount.","type":"object","properties":{"amount":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"delayed":{"type":"boolean"},"end_time":{"description":"end of vesting as unix time (in seconds).","type":"string","format":"int64"},"from_address":{"type":"string"},"to_address":{"type":"string"}}},"cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse":{"description":"MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type.","type":"object"},"cosmos.vesting.v1beta1.Period":{"description":"Period defines a length of time and amount of coins that will vest.","type":"object","properties":{"amount":{"type":"array","items":{"type":"object","$ref":"#/definitions/cosmos.base.v1beta1.Coin"}},"length":{"description":"Period duration in seconds.","type":"string","format":"int64"}}},"fairyring.common.ActivePublicKey":{"type":"object","title":"ActivePublicKey defines the pubkey currently in use","properties":{"creator":{"type":"string"},"expiry":{"type":"string","format":"uint64"},"public_key":{"type":"string"}}},"fairyring.common.IndexedEncryptedKeyshare":{"type":"object","title":"IndexedEncryptedKeyshare defines the storage of submitted encrypted\nkeyshares along with their indices (can be decrypted and aggregated)","properties":{"encrypted_keyshare_index":{"type":"string","format":"uint64"},"encrypted_keyshare_value":{"type":"string"}}},"fairyring.common.PrivateDecryptionKey":{"type":"object","title":"PrivateDecryptionKey defines the storage structure for\nthe list of encrypted keyshares (unaggregated)","properties":{"private_keyshares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.common.IndexedEncryptedKeyshare"}},"requester":{"type":"string"}}},"fairyring.common.QueuedPublicKey":{"type":"object","title":"QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey\nwhen it expires","properties":{"creator":{"type":"string"},"expiry":{"type":"string","format":"uint64"},"public_key":{"type":"string"}}},"fairyring.keyshare.ActivePubkey":{"type":"object","title":"ActivePubkey defines the structure of the active public key","properties":{"creator":{"type":"string"},"encrypted_keyshares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.EncryptedKeyshare"}},"expiry":{"type":"string","format":"uint64"},"number_of_validators":{"type":"string","format":"uint64"},"public_key":{"type":"string"}}},"fairyring.keyshare.AuthorizedAddress":{"type":"object","title":"AuthorizedAddress defines if an address is authorized to submit keyshares","properties":{"authorized_by":{"type":"string"},"is_authorized":{"type":"boolean"},"target":{"type":"string"}}},"fairyring.keyshare.Commitments":{"type":"object","title":"Commitments defines the list of commitments to verify the\nkeyshares submitted by validators","properties":{"commitments":{"type":"array","items":{"type":"string"}}}},"fairyring.keyshare.DecryptionKey":{"type":"object","title":"Decryption key defines the structure and height for a decryption key","properties":{"data":{"type":"string"},"height":{"type":"string","format":"uint64"}}},"fairyring.keyshare.EncryptedKeyshare":{"type":"object","title":"EncryptedKeyshare defines the structure for storing\nthe keyshare of the master secret key distributed to the validators","properties":{"data":{"type":"string"},"validator":{"type":"string"}}},"fairyring.keyshare.GeneralKeyshare":{"type":"object","title":"GeneralKeyshare defines the structure for submitting\ngeneral keyshares by validators","properties":{"id_type":{"type":"string"},"id_value":{"type":"string"},"keyshare":{"type":"string"},"keyshare_index":{"type":"string","format":"uint64"},"received_block_height":{"type":"string","format":"uint64"},"received_timestamp":{"type":"string","format":"uint64"},"validator":{"type":"string"}}},"fairyring.keyshare.Keyshare":{"type":"object","title":"Keyshare defines the structure for submitting\nblockwise keyshares by validators","properties":{"block_height":{"type":"string","format":"uint64"},"keyshare":{"type":"string"},"keyshare_index":{"type":"string","format":"uint64"},"received_block_height":{"type":"string","format":"uint64"},"received_timestamp":{"type":"string","format":"uint64"},"validator":{"type":"string"}}},"fairyring.keyshare.MsgCreateAuthorizedAddress":{"description":"MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type.","type":"object","properties":{"creator":{"type":"string"},"target":{"type":"string"}}},"fairyring.keyshare.MsgCreateAuthorizedAddressResponse":{"description":"MsgCreateAuthorizedAddressResponse defines the response structure for\nexecuting a MsgCreateAuthorizedAddress message.","type":"object"},"fairyring.keyshare.MsgCreateLatestPubkey":{"description":"MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type.","type":"object","properties":{"commitments":{"type":"array","items":{"type":"string"}},"creator":{"type":"string"},"encrypted_keyshares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.EncryptedKeyshare"}},"number_of_validators":{"type":"string","format":"uint64"},"public_key":{"type":"string"}}},"fairyring.keyshare.MsgCreateLatestPubkeyResponse":{"description":"MsgCreateLatestPubkeyResponse defines the response structure for\nexecuting a MsgCreateLatestPubkey message.","type":"object"},"fairyring.keyshare.MsgDeRegisterValidator":{"description":"MsgDeRegisterValidator is the Msg/DeRegisterValidator request type.","type":"object","properties":{"creator":{"type":"string"}}},"fairyring.keyshare.MsgDeRegisterValidatorResponse":{"description":"MsgDeRegisterValidatorResponse defines the response structure for\nexecuting a MsgDeRegisterValidator message.","type":"object","properties":{"creator":{"type":"string"}}},"fairyring.keyshare.MsgDeleteAuthorizedAddress":{"description":"MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type.","type":"object","properties":{"creator":{"type":"string"},"target":{"type":"string"}}},"fairyring.keyshare.MsgDeleteAuthorizedAddressResponse":{"description":"MsgDeleteAuthorizedAddressResponse defines the response structure for\nexecuting a MsgDeleteAuthorizedAddress message.","type":"object"},"fairyring.keyshare.MsgOverrideLatestPubkey":{"description":"MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type.","type":"object","properties":{"commitments":{"type":"array","items":{"type":"string"}},"creator":{"type":"string"},"encrypted_keyshares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.EncryptedKeyshare"}},"number_of_validators":{"type":"string","format":"uint64"},"public_key":{"type":"string"}}},"fairyring.keyshare.MsgOverrideLatestPubkeyResponse":{"description":"MsgOverrideLatestPubkeyResponse defines the response structure for\nexecuting a MsgOverrideLatestPubkey message.","type":"object"},"fairyring.keyshare.MsgRegisterValidator":{"description":"MsgRegisterValidator is the Msg/RegisterValidator request type.","type":"object","properties":{"creator":{"type":"string"}}},"fairyring.keyshare.MsgRegisterValidatorResponse":{"description":"MsgRegisterValidatorResponse defines the response structure for\nexecuting a MsgRegisterValidator message.","type":"object","properties":{"creator":{"type":"string"}}},"fairyring.keyshare.MsgSendKeyshare":{"description":"MsgSendKeyshare is the Msg/SendKeyshare request type.","type":"object","properties":{"block_height":{"type":"string","format":"uint64"},"creator":{"type":"string"},"keyshare_index":{"type":"string","format":"uint64"},"message":{"type":"string"}}},"fairyring.keyshare.MsgSendKeyshareResponse":{"description":"MsgSendKeyshareResponse defines the response structure for\nexecuting a MsgSendKeyshare message.","type":"object","properties":{"block_height":{"type":"string","format":"uint64"},"creator":{"type":"string"},"error_message":{"type":"string"},"keyshare":{"type":"string"},"keyshare_index":{"type":"string","format":"uint64"},"received_block_height":{"type":"string","format":"uint64"},"success":{"type":"boolean"}}},"fairyring.keyshare.MsgSubmitEncryptedKeyshare":{"description":"MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type.","type":"object","properties":{"creator":{"type":"string"},"encrypted_keyshare":{"type":"string"},"identity":{"type":"string"},"keyshare_index":{"type":"string","format":"uint64"},"received_block_height":{"type":"string","format":"uint64"},"received_timestamp":{"type":"string","format":"uint64"},"requester":{"type":"string"}}},"fairyring.keyshare.MsgSubmitEncryptedKeyshareResponse":{"description":"MsgSubmitEncryptedKeyshareResponse defines the response structure for\nexecuting a MsgSubmitEncryptedKeyshare message.","type":"object"},"fairyring.keyshare.MsgSubmitGeneralKeyshare":{"description":"MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type.","type":"object","properties":{"creator":{"type":"string"},"id_type":{"type":"string"},"id_value":{"type":"string"},"keyshare":{"type":"string"},"keyshare_index":{"type":"string","format":"uint64"},"received_block_height":{"type":"string","format":"uint64"},"received_timestamp":{"type":"string","format":"uint64"}}},"fairyring.keyshare.MsgSubmitGeneralKeyshareResponse":{"description":"MsgSubmitGeneralKeyshareResponse defines the response structure for\nexecuting a MsgSubmitGeneralKeyshare message.","type":"object","properties":{"creator":{"type":"string"},"error_message":{"type":"string"},"id_type":{"type":"string"},"id_value":{"type":"string"},"keyshare":{"type":"string"},"keyshare_index":{"type":"string","format":"uint64"},"received_block_height":{"type":"string","format":"uint64"},"success":{"type":"boolean"}}},"fairyring.keyshare.MsgUpdateAuthorizedAddress":{"description":"MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type.","type":"object","properties":{"creator":{"type":"string"},"is_authorized":{"type":"boolean"},"target":{"type":"string"}}},"fairyring.keyshare.MsgUpdateAuthorizedAddressResponse":{"description":"MsgUpdateAuthorizedAddressResponse defines the response structure for\nexecuting a MsgUpdateAuthorizedAddress message.","type":"object"},"fairyring.keyshare.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"NOTE: All parameters must be supplied.","$ref":"#/definitions/fairyring.keyshare.Params"}}},"fairyring.keyshare.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message.","type":"object"},"fairyring.keyshare.Params":{"description":"Params defines the parameters for the module.","type":"object","properties":{"key_expiry":{"type":"string","format":"uint64"},"max_idled_block":{"type":"string","format":"uint64"},"minimum_bonded":{"type":"string","format":"uint64"},"slash_fraction_no_keyshare":{"type":"string","format":"byte"},"slash_fraction_wrong_keyshare":{"type":"string","format":"byte"},"trusted_addresses":{"type":"array","items":{"type":"string"}}}},"fairyring.keyshare.QueryAuthorizedAddressAllResponse":{"description":"QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method.","type":"object","properties":{"authorized_address":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.AuthorizedAddress"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.keyshare.QueryAuthorizedAddressResponse":{"description":"QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method.","type":"object","properties":{"authorized_address":{"$ref":"#/definitions/fairyring.keyshare.AuthorizedAddress"}}},"fairyring.keyshare.QueryCommitmentsResponse":{"type":"object","title":"QueryCommitmentsResponse is response type for the Query/Commitments RPC method","properties":{"active_commitments":{"$ref":"#/definitions/fairyring.keyshare.Commitments"},"queued_commitments":{"$ref":"#/definitions/fairyring.keyshare.Commitments"}}},"fairyring.keyshare.QueryDecryptionKeyAllResponse":{"description":"QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method.","type":"object","properties":{"decryption_keys":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.DecryptionKey"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.keyshare.QueryDecryptionKeyResponse":{"description":"QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method.","type":"object","properties":{"decryption_key":{"$ref":"#/definitions/fairyring.keyshare.DecryptionKey"}}},"fairyring.keyshare.QueryGeneralKeyshareAllResponse":{"description":"QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method.","type":"object","properties":{"general_keyshare":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.GeneralKeyshare"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.keyshare.QueryGeneralKeyshareResponse":{"description":"QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method.","type":"object","properties":{"general_keyshare":{"$ref":"#/definitions/fairyring.keyshare.GeneralKeyshare"}}},"fairyring.keyshare.QueryKeyshareAllResponse":{"description":"QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method.","type":"object","properties":{"keyshare":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.Keyshare"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.keyshare.QueryKeyshareResponse":{"description":"QueryKeyshareResponse is response type for the Query/Keyshare RPC method.","type":"object","properties":{"keyshare":{"$ref":"#/definitions/fairyring.keyshare.Keyshare"}}},"fairyring.keyshare.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/fairyring.keyshare.Params"}}},"fairyring.keyshare.QueryPubkeyResponse":{"description":"QueryPubkeyResponse is response type for the Query/Pubkey RPC method.","type":"object","properties":{"active_pubkey":{"$ref":"#/definitions/fairyring.keyshare.ActivePubkey"},"queued_pubkey":{"$ref":"#/definitions/fairyring.keyshare.QueuedPubkey"}}},"fairyring.keyshare.QueryValidatorSetAllResponse":{"description":"QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method.","type":"object","properties":{"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"validator_set":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.ValidatorSet"}}}},"fairyring.keyshare.QueryValidatorSetResponse":{"description":"QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method.","type":"object","properties":{"validator_set":{"$ref":"#/definitions/fairyring.keyshare.ValidatorSet"}}},"fairyring.keyshare.QueryVerifiableRandomnessResponse":{"type":"object","title":"QueryVerifiableRandomnessResponse is the response type for\nthe Query/VerifiableRandomness method","properties":{"randomness":{"type":"string"},"round":{"type":"string","format":"uint64"}}},"fairyring.keyshare.QueuedPubkey":{"type":"object","title":"QueuedPubkey defines the structure of the queued public key","properties":{"creator":{"type":"string"},"encrypted_keyshares":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.keyshare.EncryptedKeyshare"}},"expiry":{"type":"string","format":"uint64"},"number_of_validators":{"type":"string","format":"uint64"},"public_key":{"type":"string"}}},"fairyring.keyshare.ValidatorSet":{"type":"object","title":"ValidatorSet defines the structure for storing the list of\nvalidators who will be eligible to send keyshares","properties":{"cons_addr":{"type":"string"},"index":{"type":"string"},"is_active":{"type":"boolean"},"validator":{"type":"string"}}},"fairyring.pep.EncryptedTx":{"type":"object","title":"EncryptedTx defines the structure to store an encrypted transaction\nby execution height","properties":{"charged_gas":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"creator":{"type":"string"},"data":{"type":"string"},"expired":{"type":"boolean"},"index":{"type":"string","format":"uint64"},"processed_at_chain_height":{"type":"string","format":"uint64"},"target_height":{"type":"string","format":"uint64"}}},"fairyring.pep.EncryptedTxArray":{"type":"object","title":"EncryptedTxArray defines a list of EncryptedTx","properties":{"encrypted_txs":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.EncryptedTx"}}}},"fairyring.pep.GeneralEncryptedTx":{"type":"object","title":"GeneralEncryptedTx defines the structure to store a\ngeneral encrypted transaction by identity","properties":{"charged_gas":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"creator":{"type":"string"},"data":{"type":"string"},"identity":{"type":"string"},"index":{"type":"string","format":"uint64"}}},"fairyring.pep.GeneralEncryptedTxArray":{"type":"object","title":"GeneralEncryptedTxArray defines a list of GeneralEncryptedTx","properties":{"encrypted_txs":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.GeneralEncryptedTx"}}}},"fairyring.pep.IdentityExecutionEntry":{"type":"object","title":"IdentityExecutionEntry defines the structure to queue up\nidentities that have decryption keys available and\nare ready to execute any associated contracts or encrypted transactions","properties":{"creator":{"type":"string"},"decryption_key":{"type":"string"},"identity":{"type":"string"},"pubkey":{"type":"string"},"request_id":{"type":"string"},"tx_list":{"$ref":"#/definitions/fairyring.pep.GeneralEncryptedTxArray"}}},"fairyring.pep.MsgRegisterContract":{"description":"MsgRegisterContract is the Msg/RegisterContract request type.","type":"object","properties":{"contract_address":{"type":"string"},"creator":{"type":"string"},"identity":{"type":"string"}}},"fairyring.pep.MsgRegisterContractResponse":{"description":"MsgRegisterContractResponse defines the response structure for executing a\nMsgRegisterContract message.","type":"object"},"fairyring.pep.MsgRequestGeneralDecryptionKey":{"description":"MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type.","type":"object","properties":{"creator":{"type":"string"},"req_id":{"type":"string"}}},"fairyring.pep.MsgRequestGeneralDecryptionKeyResponse":{"description":"MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a\nMsgRequestGeneralDecryptionKey message.","type":"object"},"fairyring.pep.MsgRequestGeneralIdentity":{"description":"MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type.","type":"object","properties":{"creator":{"type":"string"},"estimated_delay":{"type":"string"},"req_id":{"type":"string"}}},"fairyring.pep.MsgRequestGeneralIdentityResponse":{"description":"MsgRequestGeneralIdentityResponse defines the response structure for executing a\nMsgRequestGeneralIdentity message.","type":"object","properties":{"req_id":{"type":"string"}}},"fairyring.pep.MsgRequestPrivateDecryptionKey":{"description":"MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type.","type":"object","properties":{"creator":{"type":"string"},"req_id":{"type":"string"},"secp_pubkey":{"type":"string"}}},"fairyring.pep.MsgRequestPrivateDecryptionKeyResponse":{"description":"MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a\nMsgRequestPrivateDecryptionKey message.","type":"object"},"fairyring.pep.MsgRequestPrivateIdentity":{"description":"MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type.","type":"object","properties":{"creator":{"type":"string"},"req_id":{"type":"string"}}},"fairyring.pep.MsgRequestPrivateIdentityResponse":{"description":"MsgRequestPrivateIdentityResponse defines the response structure for executing a\nMsgRequestPrivateIdentity message.","type":"object","properties":{"req_id":{"type":"string"}}},"fairyring.pep.MsgSubmitDecryptionKey":{"description":"MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type.","type":"object","properties":{"creator":{"type":"string"},"data":{"type":"string"},"height":{"type":"string","format":"uint64"}}},"fairyring.pep.MsgSubmitDecryptionKeyResponse":{"description":"MsgSubmitDecryptionKeyResponse defines the response structure for executing a\nMsgSubmitDecryptionKey message.","type":"object"},"fairyring.pep.MsgSubmitEncryptedTx":{"description":"MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type.","type":"object","properties":{"creator":{"type":"string"},"data":{"type":"string"},"target_block_height":{"type":"string","format":"uint64"}}},"fairyring.pep.MsgSubmitEncryptedTxResponse":{"description":"MsgSubmitEncryptedTxResponse defines the response structure for executing a\nMsgSubmitEncryptedTx message.","type":"object"},"fairyring.pep.MsgSubmitGeneralEncryptedTx":{"description":"MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type.","type":"object","properties":{"creator":{"type":"string"},"data":{"type":"string"},"req_id":{"type":"string"}}},"fairyring.pep.MsgSubmitGeneralEncryptedTxResponse":{"description":"MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a\nMsgSubmitGeneralEncryptedTx message.","type":"object"},"fairyring.pep.MsgUnregisterContract":{"description":"MsgUnregisterContract is the Msg/UnregisterContract request type.","type":"object","properties":{"contract_address":{"type":"string"},"creator":{"type":"string"},"identity":{"type":"string"}}},"fairyring.pep.MsgUnregisterContractResponse":{"description":"MsgUnregisterContractResponse defines the response structure for executing a\nMsgUnregisterContract message.","type":"object"},"fairyring.pep.MsgUpdateParams":{"description":"MsgUpdateParams is the Msg/UpdateParams request type.","type":"object","properties":{"authority":{"description":"authority is the address that controls the module (defaults to x/gov unless overwritten).","type":"string"},"params":{"description":"NOTE: All parameters must be supplied.","$ref":"#/definitions/fairyring.pep.Params"}}},"fairyring.pep.MsgUpdateParamsResponse":{"description":"MsgUpdateParamsResponse defines the response structure for executing a\nMsgUpdateParams message.","type":"object"},"fairyring.pep.Params":{"description":"Params defines the parameters for the module.","type":"object","properties":{"is_source_chain":{"type":"boolean"},"keyshare_channel_id":{"type":"string","title":"option (gogoproto.equal) = true;"},"min_gas_price":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"private_decryption_key_price":{"$ref":"#/definitions/cosmos.base.v1beta1.Coin"},"trusted_addresses":{"type":"array","items":{"type":"string"}},"trusted_counter_parties":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.TrustedCounterParty"}}}},"fairyring.pep.PepNonce":{"type":"object","title":"PepNonce defines the nonce of an account to send encrypted transactions.\nIt is incremanted seperately from the nonce maintained by the auth module","properties":{"address":{"type":"string"},"nonce":{"type":"string","format":"uint64"}}},"fairyring.pep.QueryDecryptDataResponse":{"description":"QueryDecryptDataResponse is response type for the Query/DecryptData RPC method.","type":"object","properties":{"decrypted_data":{"type":"string"}}},"fairyring.pep.QueryEncryptedTxAllFromHeightResponse":{"description":"QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method.","type":"object","properties":{"encrypted_tx_array":{"$ref":"#/definitions/fairyring.pep.EncryptedTxArray"}}},"fairyring.pep.QueryEncryptedTxAllResponse":{"description":"QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method.","type":"object","properties":{"encrypted_tx_array":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.EncryptedTxArray"}},"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"}}},"fairyring.pep.QueryEncryptedTxResponse":{"description":"QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method.","type":"object","properties":{"encrypted_tx":{"$ref":"#/definitions/fairyring.pep.EncryptedTx"}}},"fairyring.pep.QueryGeneralIdentityAllResponse":{"description":"QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method.","type":"object","properties":{"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"request_details_list":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.IdentityExecutionEntry"}}}},"fairyring.pep.QueryGeneralIdentityResponse":{"description":"QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method.","type":"object","properties":{"request_details":{"$ref":"#/definitions/fairyring.pep.IdentityExecutionEntry"}}},"fairyring.pep.QueryLatestHeightResponse":{"description":"QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method.","type":"object","properties":{"height":{"type":"string","format":"uint64"}}},"fairyring.pep.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/fairyring.pep.Params"}}},"fairyring.pep.QueryPepNonceAllResponse":{"description":"QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method.","type":"object","properties":{"pagination":{"$ref":"#/definitions/cosmos.base.query.v1beta1.PageResponse"},"pep_nonce":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.pep.PepNonce"}}}},"fairyring.pep.QueryPepNonceResponse":{"description":"QueryPepNonceResponse is response type for the Query/PepNonce RPC method.","type":"object","properties":{"pep_nonce":{"$ref":"#/definitions/fairyring.pep.PepNonce"}}},"fairyring.pep.QueryPrivateIdentityResponse":{"description":"QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method.","type":"object","properties":{"creator":{"type":"string"},"private_decryption_keys":{"type":"array","items":{"type":"object","$ref":"#/definitions/fairyring.common.PrivateDecryptionKey"}},"pubkey":{"type":"string"},"req_id":{"type":"string"}}},"fairyring.pep.QueryPubkeyResponse":{"description":"QueryPubkeyResponse is response type for the Query/Pubkey RPC method.","type":"object","properties":{"active_pubkey":{"$ref":"#/definitions/fairyring.common.ActivePublicKey"},"queued_pubkey":{"$ref":"#/definitions/fairyring.common.QueuedPublicKey"}}},"fairyring.pep.TrustedCounterParty":{"type":"object","title":"TrustedCounterParty defines the structure to store the ibc info\nof the source chain (fairyring) to reliably fetch active keys and\ngeneral/private decryption keys","properties":{"channel_id":{"type":"string"},"client_id":{"type":"string"},"connection_id":{"type":"string"}}},"google.protobuf.Any":{"type":"object","properties":{"@type":{"type":"string"}},"additionalProperties":{}},"google.rpc.Status":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"details":{"type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"message":{"type":"string"}}},"tendermint.abci.CheckTxType":{"type":"string","default":"NEW","enum":["NEW","RECHECK"]},"tendermint.abci.CommitInfo":{"type":"object","properties":{"round":{"type":"integer","format":"int32"},"votes":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.VoteInfo"}}}},"tendermint.abci.Event":{"description":"Event allows application developers to attach additional information to\nResponseFinalizeBlock and ResponseCheckTx.\nLater, transactions may be queried using these events.","type":"object","properties":{"attributes":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.EventAttribute"}},"type":{"type":"string"}}},"tendermint.abci.EventAttribute":{"description":"EventAttribute is a single key-value pair, associated with an event.","type":"object","properties":{"index":{"type":"boolean","title":"nondeterministic"},"key":{"type":"string"},"value":{"type":"string"}}},"tendermint.abci.ExecTxResult":{"description":"ExecTxResult contains results of executing one individual transaction.\n\n* Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted","type":"object","properties":{"code":{"type":"integer","format":"int64"},"codespace":{"type":"string"},"data":{"type":"string","format":"byte"},"events":{"type":"array","title":"nondeterministic","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Event"}},"gas_used":{"type":"string","format":"int64"},"gas_wanted":{"type":"string","format":"int64"},"info":{"type":"string","title":"nondeterministic"},"log":{"type":"string","title":"nondeterministic"}}},"tendermint.abci.ExtendedCommitInfo":{"description":"ExtendedCommitInfo is similar to CommitInfo except that it is only used in\nthe PrepareProposal request such that CometBFT can provide vote extensions\nto the application.","type":"object","properties":{"round":{"description":"The round at which the block proposer decided in the previous height.","type":"integer","format":"int32"},"votes":{"description":"List of validators' addresses in the last validator set with their voting\ninformation, including vote extensions.","type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.ExtendedVoteInfo"}}}},"tendermint.abci.ExtendedVoteInfo":{"type":"object","properties":{"block_id_flag":{"title":"block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all","$ref":"#/definitions/tendermint.types.BlockIDFlag"},"extension_signature":{"type":"string","format":"byte","title":"Vote extension signature created by CometBFT"},"validator":{"description":"The validator that sent the vote.","$ref":"#/definitions/tendermint.abci.Validator"},"vote_extension":{"description":"Non-deterministic extension provided by the sending validator's application.","type":"string","format":"byte"}}},"tendermint.abci.Misbehavior":{"type":"object","properties":{"height":{"type":"string","format":"int64","title":"The height when the offense occurred"},"time":{"type":"string","format":"date-time","title":"The corresponding time where the offense occurred"},"total_voting_power":{"type":"string","format":"int64","title":"Total voting power of the validator set in case the ABCI application does\nnot store historical validators.\nhttps://github.com/tendermint/tendermint/issues/4581"},"type":{"$ref":"#/definitions/tendermint.abci.MisbehaviorType"},"validator":{"title":"The offending validator","$ref":"#/definitions/tendermint.abci.Validator"}}},"tendermint.abci.MisbehaviorType":{"type":"string","default":"UNKNOWN","enum":["UNKNOWN","DUPLICATE_VOTE","LIGHT_CLIENT_ATTACK"]},"tendermint.abci.RequestApplySnapshotChunk":{"type":"object","title":"Applies a snapshot chunk","properties":{"chunk":{"type":"string","format":"byte"},"index":{"type":"integer","format":"int64"},"sender":{"type":"string"}}},"tendermint.abci.RequestCheckTx":{"type":"object","properties":{"tx":{"type":"string","format":"byte"},"type":{"$ref":"#/definitions/tendermint.abci.CheckTxType"}}},"tendermint.abci.RequestCommit":{"type":"object"},"tendermint.abci.RequestEcho":{"type":"object","properties":{"message":{"type":"string"}}},"tendermint.abci.RequestExtendVote":{"type":"object","title":"Extends a vote with application-injected data","properties":{"hash":{"type":"string","format":"byte","title":"the hash of the block that this vote may be referring to"},"height":{"type":"string","format":"int64","title":"the height of the extended vote"},"misbehavior":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Misbehavior"}},"next_validators_hash":{"type":"string","format":"byte"},"proposed_last_commit":{"$ref":"#/definitions/tendermint.abci.CommitInfo"},"proposer_address":{"description":"address of the public key of the original proposer of the block.","type":"string","format":"byte"},"time":{"type":"string","format":"date-time","title":"info of the block that this vote may be referring to"},"txs":{"type":"array","items":{"type":"string","format":"byte"}}}},"tendermint.abci.RequestFinalizeBlock":{"type":"object","properties":{"decided_last_commit":{"$ref":"#/definitions/tendermint.abci.CommitInfo"},"hash":{"description":"hash is the merkle root hash of the fields of the decided block.","type":"string","format":"byte"},"height":{"type":"string","format":"int64"},"misbehavior":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Misbehavior"}},"next_validators_hash":{"type":"string","format":"byte"},"proposer_address":{"description":"proposer_address is the address of the public key of the original proposer of the block.","type":"string","format":"byte"},"time":{"type":"string","format":"date-time"},"txs":{"type":"array","items":{"type":"string","format":"byte"}}}},"tendermint.abci.RequestFlush":{"type":"object"},"tendermint.abci.RequestInfo":{"type":"object","properties":{"abci_version":{"type":"string"},"block_version":{"type":"string","format":"uint64"},"p2p_version":{"type":"string","format":"uint64"},"version":{"type":"string"}}},"tendermint.abci.RequestInitChain":{"type":"object","properties":{"app_state_bytes":{"type":"string","format":"byte"},"chain_id":{"type":"string"},"consensus_params":{"$ref":"#/definitions/tendermint.types.ConsensusParams"},"initial_height":{"type":"string","format":"int64"},"time":{"type":"string","format":"date-time"},"validators":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.ValidatorUpdate"}}}},"tendermint.abci.RequestListSnapshots":{"type":"object","title":"lists available snapshots"},"tendermint.abci.RequestLoadSnapshotChunk":{"type":"object","title":"loads a snapshot chunk","properties":{"chunk":{"type":"integer","format":"int64"},"format":{"type":"integer","format":"int64"},"height":{"type":"string","format":"uint64"}}},"tendermint.abci.RequestOfferSnapshot":{"type":"object","title":"offers a snapshot to the application","properties":{"app_hash":{"type":"string","format":"byte","title":"light client-verified app hash for snapshot height"},"snapshot":{"title":"snapshot offered by peers","$ref":"#/definitions/tendermint.abci.Snapshot"}}},"tendermint.abci.RequestPrepareProposal":{"type":"object","properties":{"height":{"type":"string","format":"int64"},"local_last_commit":{"$ref":"#/definitions/tendermint.abci.ExtendedCommitInfo"},"max_tx_bytes":{"description":"the modified transactions cannot exceed this size.","type":"string","format":"int64"},"misbehavior":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Misbehavior"}},"next_validators_hash":{"type":"string","format":"byte"},"proposer_address":{"description":"address of the public key of the validator proposing the block.","type":"string","format":"byte"},"time":{"type":"string","format":"date-time"},"txs":{"description":"txs is an array of transactions that will be included in a block,\nsent to the app for possible modifications.","type":"array","items":{"type":"string","format":"byte"}}}},"tendermint.abci.RequestProcessProposal":{"type":"object","properties":{"hash":{"description":"hash is the merkle root hash of the fields of the proposed block.","type":"string","format":"byte"},"height":{"type":"string","format":"int64"},"misbehavior":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Misbehavior"}},"next_validators_hash":{"type":"string","format":"byte"},"proposed_last_commit":{"$ref":"#/definitions/tendermint.abci.CommitInfo"},"proposer_address":{"description":"address of the public key of the original proposer of the block.","type":"string","format":"byte"},"time":{"type":"string","format":"date-time"},"txs":{"type":"array","items":{"type":"string","format":"byte"}}}},"tendermint.abci.RequestQuery":{"type":"object","properties":{"data":{"type":"string","format":"byte"},"height":{"type":"string","format":"int64"},"path":{"type":"string"},"prove":{"type":"boolean"}}},"tendermint.abci.RequestVerifyVoteExtension":{"type":"object","title":"Verify the vote extension","properties":{"hash":{"type":"string","format":"byte","title":"the hash of the block that this received vote corresponds to"},"height":{"type":"string","format":"int64"},"validator_address":{"type":"string","format":"byte","title":"the validator that signed the vote extension"},"vote_extension":{"type":"string","format":"byte"}}},"tendermint.abci.ResponseApplySnapshotChunk":{"type":"object","properties":{"refetch_chunks":{"type":"array","title":"Chunks to refetch and reapply","items":{"type":"integer","format":"int64"}},"reject_senders":{"type":"array","title":"Chunk senders to reject and ban","items":{"type":"string"}},"result":{"$ref":"#/definitions/tendermint.abci.ResponseApplySnapshotChunk.Result"}}},"tendermint.abci.ResponseApplySnapshotChunk.Result":{"type":"string","title":"- UNKNOWN: Unknown result, abort all snapshot restoration\n - ACCEPT: Chunk successfully accepted\n - ABORT: Abort all snapshot restoration\n - RETRY: Retry chunk (combine with refetch and reject)\n - RETRY_SNAPSHOT: Retry snapshot (combine with refetch and reject)\n - REJECT_SNAPSHOT: Reject this snapshot, try others","default":"UNKNOWN","enum":["UNKNOWN","ACCEPT","ABORT","RETRY","RETRY_SNAPSHOT","REJECT_SNAPSHOT"]},"tendermint.abci.ResponseCheckTx":{"type":"object","properties":{"code":{"type":"integer","format":"int64"},"codespace":{"type":"string"},"data":{"type":"string","format":"byte"},"events":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Event"}},"gas_used":{"type":"string","format":"int64"},"gas_wanted":{"type":"string","format":"int64"},"info":{"type":"string","title":"nondeterministic"},"log":{"type":"string","title":"nondeterministic"}}},"tendermint.abci.ResponseCommit":{"type":"object","properties":{"retain_height":{"type":"string","format":"int64"}}},"tendermint.abci.ResponseEcho":{"type":"object","properties":{"message":{"type":"string"}}},"tendermint.abci.ResponseExtendVote":{"type":"object","properties":{"vote_extension":{"type":"string","format":"byte"}}},"tendermint.abci.ResponseFinalizeBlock":{"type":"object","properties":{"app_hash":{"description":"app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was\ndeterministic. It is up to the application to decide which algorithm to use.","type":"string","format":"byte"},"consensus_param_updates":{"description":"updates to the consensus params, if any.","$ref":"#/definitions/tendermint.types.ConsensusParams"},"events":{"type":"array","title":"set of block events emmitted as part of executing the block","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Event"}},"tx_results":{"type":"array","title":"the result of executing each transaction including the events\nthe particular transction emitted. This should match the order\nof the transactions delivered in the block itself","items":{"type":"object","$ref":"#/definitions/tendermint.abci.ExecTxResult"}},"validator_updates":{"description":"a list of updates to the validator set. These will reflect the validator set at current height + 2.","type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.ValidatorUpdate"}}}},"tendermint.abci.ResponseFlush":{"type":"object"},"tendermint.abci.ResponseInfo":{"type":"object","properties":{"app_version":{"type":"string","format":"uint64"},"data":{"type":"string"},"last_block_app_hash":{"type":"string","format":"byte"},"last_block_height":{"type":"string","format":"int64"},"version":{"type":"string"}}},"tendermint.abci.ResponseInitChain":{"type":"object","properties":{"app_hash":{"type":"string","format":"byte"},"consensus_params":{"$ref":"#/definitions/tendermint.types.ConsensusParams"},"validators":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.ValidatorUpdate"}}}},"tendermint.abci.ResponseListSnapshots":{"type":"object","properties":{"snapshots":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.abci.Snapshot"}}}},"tendermint.abci.ResponseLoadSnapshotChunk":{"type":"object","properties":{"chunk":{"type":"string","format":"byte"}}},"tendermint.abci.ResponseOfferSnapshot":{"type":"object","properties":{"result":{"$ref":"#/definitions/tendermint.abci.ResponseOfferSnapshot.Result"}}},"tendermint.abci.ResponseOfferSnapshot.Result":{"type":"string","title":"- UNKNOWN: Unknown result, abort all snapshot restoration\n - ACCEPT: Snapshot accepted, apply chunks\n - ABORT: Abort all snapshot restoration\n - REJECT: Reject this specific snapshot, try others\n - REJECT_FORMAT: Reject all snapshots of this format, try others\n - REJECT_SENDER: Reject all snapshots from the sender(s), try others","default":"UNKNOWN","enum":["UNKNOWN","ACCEPT","ABORT","REJECT","REJECT_FORMAT","REJECT_SENDER"]},"tendermint.abci.ResponsePrepareProposal":{"type":"object","properties":{"txs":{"type":"array","items":{"type":"string","format":"byte"}}}},"tendermint.abci.ResponseProcessProposal":{"type":"object","properties":{"status":{"$ref":"#/definitions/tendermint.abci.ResponseProcessProposal.ProposalStatus"}}},"tendermint.abci.ResponseProcessProposal.ProposalStatus":{"type":"string","default":"UNKNOWN","enum":["UNKNOWN","ACCEPT","REJECT"]},"tendermint.abci.ResponseQuery":{"type":"object","properties":{"code":{"type":"integer","format":"int64"},"codespace":{"type":"string"},"height":{"type":"string","format":"int64"},"index":{"type":"string","format":"int64"},"info":{"type":"string","title":"nondeterministic"},"key":{"type":"string","format":"byte"},"log":{"description":"bytes data = 2; // use \"value\" instead.\n\nnondeterministic","type":"string"},"proof_ops":{"$ref":"#/definitions/tendermint.crypto.ProofOps"},"value":{"type":"string","format":"byte"}}},"tendermint.abci.ResponseVerifyVoteExtension":{"type":"object","properties":{"status":{"$ref":"#/definitions/tendermint.abci.ResponseVerifyVoteExtension.VerifyStatus"}}},"tendermint.abci.ResponseVerifyVoteExtension.VerifyStatus":{"description":" - REJECT: Rejecting the vote extension will reject the entire precommit by the sender.\nIncorrectly implementing this thus has liveness implications as it may affect\nCometBFT's ability to receive 2/3+ valid votes to finalize the block.\nHonest nodes should never be rejected.","type":"string","default":"UNKNOWN","enum":["UNKNOWN","ACCEPT","REJECT"]},"tendermint.abci.Snapshot":{"type":"object","properties":{"chunks":{"type":"integer","format":"int64","title":"Number of chunks in the snapshot"},"format":{"type":"integer","format":"int64","title":"The application-specific snapshot format"},"hash":{"type":"string","format":"byte","title":"Arbitrary snapshot hash, equal only if identical"},"height":{"type":"string","format":"uint64","title":"The height at which the snapshot was taken"},"metadata":{"type":"string","format":"byte","title":"Arbitrary application metadata"}}},"tendermint.abci.Validator":{"type":"object","properties":{"address":{"type":"string","format":"byte","title":"The first 20 bytes of SHA256(public key)"},"power":{"description":"The voting power","type":"string","format":"int64","title":"PubKey pub_key = 2 [(gogoproto.nullable)=false];"}}},"tendermint.abci.ValidatorUpdate":{"type":"object","properties":{"power":{"type":"string","format":"int64"},"pub_key":{"$ref":"#/definitions/tendermint.crypto.PublicKey"}}},"tendermint.abci.VoteInfo":{"type":"object","properties":{"block_id_flag":{"$ref":"#/definitions/tendermint.types.BlockIDFlag"},"validator":{"$ref":"#/definitions/tendermint.abci.Validator"}}},"tendermint.crypto.ProofOp":{"type":"object","title":"ProofOp defines an operation used for calculating Merkle root\nThe data could be arbitrary format, providing nessecary data\nfor example neighbouring node hash","properties":{"data":{"type":"string","format":"byte"},"key":{"type":"string","format":"byte"},"type":{"type":"string"}}},"tendermint.crypto.ProofOps":{"type":"object","title":"ProofOps is Merkle proof defined by the list of ProofOps","properties":{"ops":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.crypto.ProofOp"}}}},"tendermint.crypto.PublicKey":{"type":"object","title":"PublicKey defines the keys available for use with Validators","properties":{"ed25519":{"type":"string","format":"byte"},"secp256k1":{"type":"string","format":"byte"}}},"tendermint.p2p.DefaultNodeInfo":{"type":"object","properties":{"channels":{"type":"string","format":"byte"},"default_node_id":{"type":"string"},"listen_addr":{"type":"string"},"moniker":{"type":"string"},"network":{"type":"string"},"other":{"$ref":"#/definitions/tendermint.p2p.DefaultNodeInfoOther"},"protocol_version":{"$ref":"#/definitions/tendermint.p2p.ProtocolVersion"},"version":{"type":"string"}}},"tendermint.p2p.DefaultNodeInfoOther":{"type":"object","properties":{"rpc_address":{"type":"string"},"tx_index":{"type":"string"}}},"tendermint.p2p.ProtocolVersion":{"type":"object","properties":{"app":{"type":"string","format":"uint64"},"block":{"type":"string","format":"uint64"},"p2p":{"type":"string","format":"uint64"}}},"tendermint.types.ABCIParams":{"description":"ABCIParams configure functionality specific to the Application Blockchain Interface.","type":"object","properties":{"vote_extensions_enable_height":{"description":"vote_extensions_enable_height configures the first height during which\nvote extensions will be enabled. During this specified height, and for all\nsubsequent heights, precommit messages that do not contain valid extension data\nwill be considered invalid. Prior to this height, vote extensions will not\nbe used or accepted by validators on the network.\n\nOnce enabled, vote extensions will be created by the application in ExtendVote,\npassed to the application for validation in VerifyVoteExtension and given\nto the application to use when proposing a block during PrepareProposal.","type":"string","format":"int64"}}},"tendermint.types.Block":{"type":"object","properties":{"data":{"$ref":"#/definitions/tendermint.types.Data"},"evidence":{"$ref":"#/definitions/tendermint.types.EvidenceList"},"header":{"$ref":"#/definitions/tendermint.types.Header"},"last_commit":{"$ref":"#/definitions/tendermint.types.Commit"}}},"tendermint.types.BlockID":{"type":"object","title":"BlockID","properties":{"hash":{"type":"string","format":"byte"},"part_set_header":{"$ref":"#/definitions/tendermint.types.PartSetHeader"}}},"tendermint.types.BlockIDFlag":{"description":"- BLOCK_ID_FLAG_UNKNOWN: indicates an error condition\n - BLOCK_ID_FLAG_ABSENT: the vote was not received\n - BLOCK_ID_FLAG_COMMIT: voted for the block that received the majority\n - BLOCK_ID_FLAG_NIL: voted for nil","type":"string","title":"BlockIdFlag indicates which BlockID the signature is for","default":"BLOCK_ID_FLAG_UNKNOWN","enum":["BLOCK_ID_FLAG_UNKNOWN","BLOCK_ID_FLAG_ABSENT","BLOCK_ID_FLAG_COMMIT","BLOCK_ID_FLAG_NIL"]},"tendermint.types.BlockParams":{"description":"BlockParams contains limits on the block size.","type":"object","properties":{"max_bytes":{"type":"string","format":"int64","title":"Max block size, in bytes.\nNote: must be greater than 0"},"max_gas":{"type":"string","format":"int64","title":"Max gas per block.\nNote: must be greater or equal to -1"}}},"tendermint.types.Commit":{"description":"Commit contains the evidence that a block was committed by a set of validators.","type":"object","properties":{"block_id":{"$ref":"#/definitions/tendermint.types.BlockID"},"height":{"type":"string","format":"int64"},"round":{"type":"integer","format":"int32"},"signatures":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.types.CommitSig"}}}},"tendermint.types.CommitSig":{"description":"CommitSig is a part of the Vote included in a Commit.","type":"object","properties":{"block_id_flag":{"$ref":"#/definitions/tendermint.types.BlockIDFlag"},"signature":{"type":"string","format":"byte"},"timestamp":{"type":"string","format":"date-time"},"validator_address":{"type":"string","format":"byte"}}},"tendermint.types.ConsensusParams":{"description":"ConsensusParams contains consensus critical parameters that determine the\nvalidity of blocks.","type":"object","properties":{"abci":{"$ref":"#/definitions/tendermint.types.ABCIParams"},"block":{"$ref":"#/definitions/tendermint.types.BlockParams"},"evidence":{"$ref":"#/definitions/tendermint.types.EvidenceParams"},"validator":{"$ref":"#/definitions/tendermint.types.ValidatorParams"},"version":{"$ref":"#/definitions/tendermint.types.VersionParams"}}},"tendermint.types.Data":{"type":"object","title":"Data contains the set of transactions included in the block","properties":{"txs":{"description":"Txs that will be applied by state @ block.Height+1.\nNOTE: not all txs here are valid. We're just agreeing on the order first.\nThis means that block.AppHash does not include these txs.","type":"array","items":{"type":"string","format":"byte"}}}},"tendermint.types.DuplicateVoteEvidence":{"description":"DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes.","type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"total_voting_power":{"type":"string","format":"int64"},"validator_power":{"type":"string","format":"int64"},"vote_a":{"$ref":"#/definitions/tendermint.types.Vote"},"vote_b":{"$ref":"#/definitions/tendermint.types.Vote"}}},"tendermint.types.Evidence":{"type":"object","properties":{"duplicate_vote_evidence":{"$ref":"#/definitions/tendermint.types.DuplicateVoteEvidence"},"light_client_attack_evidence":{"$ref":"#/definitions/tendermint.types.LightClientAttackEvidence"}}},"tendermint.types.EvidenceList":{"type":"object","properties":{"evidence":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.types.Evidence"}}}},"tendermint.types.EvidenceParams":{"description":"EvidenceParams determine how we handle evidence of malfeasance.","type":"object","properties":{"max_age_duration":{"description":"Max age of evidence, in time.\n\nIt should correspond with an app's \"unbonding period\" or other similar\nmechanism for handling [Nothing-At-Stake\nattacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed).","type":"string"},"max_age_num_blocks":{"description":"Max age of evidence, in blocks.\n\nThe basic formula for calculating this is: MaxAgeDuration / {average block\ntime}.","type":"string","format":"int64"},"max_bytes":{"type":"string","format":"int64","title":"This sets the maximum size of total evidence in bytes that can be committed in a single block.\nand should fall comfortably under the max block bytes.\nDefault is 1048576 or 1MB"}}},"tendermint.types.Header":{"description":"Header defines the structure of a block header.","type":"object","properties":{"app_hash":{"type":"string","format":"byte","title":"state after txs from the previous block"},"chain_id":{"type":"string"},"consensus_hash":{"type":"string","format":"byte","title":"consensus params for current block"},"data_hash":{"type":"string","format":"byte","title":"transactions"},"evidence_hash":{"description":"evidence included in the block","type":"string","format":"byte","title":"consensus info"},"height":{"type":"string","format":"int64"},"last_block_id":{"title":"prev block info","$ref":"#/definitions/tendermint.types.BlockID"},"last_commit_hash":{"description":"commit from validators from the last block","type":"string","format":"byte","title":"hashes of block data"},"last_results_hash":{"type":"string","format":"byte","title":"root hash of all results from the txs from the previous block"},"next_validators_hash":{"type":"string","format":"byte","title":"validators for the next block"},"proposer_address":{"type":"string","format":"byte","title":"original proposer of the block"},"time":{"type":"string","format":"date-time"},"validators_hash":{"description":"validators for the current block","type":"string","format":"byte","title":"hashes from the app output from the prev block"},"version":{"title":"basic block info","$ref":"#/definitions/tendermint.version.Consensus"}}},"tendermint.types.LightBlock":{"type":"object","properties":{"signed_header":{"$ref":"#/definitions/tendermint.types.SignedHeader"},"validator_set":{"$ref":"#/definitions/tendermint.types.ValidatorSet"}}},"tendermint.types.LightClientAttackEvidence":{"description":"LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client.","type":"object","properties":{"byzantine_validators":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.types.Validator"}},"common_height":{"type":"string","format":"int64"},"conflicting_block":{"$ref":"#/definitions/tendermint.types.LightBlock"},"timestamp":{"type":"string","format":"date-time"},"total_voting_power":{"type":"string","format":"int64"}}},"tendermint.types.PartSetHeader":{"type":"object","title":"PartsetHeader","properties":{"hash":{"type":"string","format":"byte"},"total":{"type":"integer","format":"int64"}}},"tendermint.types.SignedHeader":{"type":"object","properties":{"commit":{"$ref":"#/definitions/tendermint.types.Commit"},"header":{"$ref":"#/definitions/tendermint.types.Header"}}},"tendermint.types.SignedMsgType":{"description":"SignedMsgType is a type of signed message in the consensus.\n\n - SIGNED_MSG_TYPE_PREVOTE: Votes\n - SIGNED_MSG_TYPE_PROPOSAL: Proposals","type":"string","default":"SIGNED_MSG_TYPE_UNKNOWN","enum":["SIGNED_MSG_TYPE_UNKNOWN","SIGNED_MSG_TYPE_PREVOTE","SIGNED_MSG_TYPE_PRECOMMIT","SIGNED_MSG_TYPE_PROPOSAL"]},"tendermint.types.Validator":{"type":"object","properties":{"address":{"type":"string","format":"byte"},"proposer_priority":{"type":"string","format":"int64"},"pub_key":{"$ref":"#/definitions/tendermint.crypto.PublicKey"},"voting_power":{"type":"string","format":"int64"}}},"tendermint.types.ValidatorParams":{"description":"ValidatorParams restrict the public key types validators can use.\nNOTE: uses ABCI pubkey naming, not Amino names.","type":"object","properties":{"pub_key_types":{"type":"array","items":{"type":"string"}}}},"tendermint.types.ValidatorSet":{"type":"object","properties":{"proposer":{"$ref":"#/definitions/tendermint.types.Validator"},"total_voting_power":{"type":"string","format":"int64"},"validators":{"type":"array","items":{"type":"object","$ref":"#/definitions/tendermint.types.Validator"}}}},"tendermint.types.VersionParams":{"description":"VersionParams contains the ABCI application version.","type":"object","properties":{"app":{"type":"string","format":"uint64"}}},"tendermint.types.Vote":{"description":"Vote represents a prevote or precommit vote from validators for\nconsensus.","type":"object","properties":{"block_id":{"description":"zero if vote is nil.","$ref":"#/definitions/tendermint.types.BlockID"},"extension":{"description":"Vote extension provided by the application. Only valid for precommit\nmessages.","type":"string","format":"byte"},"extension_signature":{"description":"Vote extension signature by the validator if they participated in\nconsensus for the associated block.\nOnly valid for precommit messages.","type":"string","format":"byte"},"height":{"type":"string","format":"int64"},"round":{"type":"integer","format":"int32"},"signature":{"description":"Vote signature by the validator if they participated in consensus for the\nassociated block.","type":"string","format":"byte"},"timestamp":{"type":"string","format":"date-time"},"type":{"$ref":"#/definitions/tendermint.types.SignedMsgType"},"validator_address":{"type":"string","format":"byte"},"validator_index":{"type":"integer","format":"int32"}}},"tendermint.version.Consensus":{"description":"Consensus captures the consensus rules for processing a block in the blockchain,\nincluding all blockchain data structures and the rules of the application's\nstate transition machine.","type":"object","properties":{"app":{"type":"string","format":"uint64"},"block":{"type":"string","format":"uint64"}}}},"tags":[{"name":"Query"},{"name":"Msg"},{"name":"Service"},{"name":"ReflectionService"},{"name":"ABCIListenerService"},{"name":"ABCI"}]} \ No newline at end of file diff --git a/ts-client/cosmos.auth.v1beta1/module.ts b/ts-client/cosmos.auth.v1beta1/module.ts index 03bcb325..b7e6de5f 100755 --- a/ts-client/cosmos.auth.v1beta1/module.ts +++ b/ts-client/cosmos.auth.v1beta1/module.ts @@ -6,63 +6,57 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { Bech32PrefixResponse } from "./types/cosmos/auth/v1beta1/query"; -import { MsgUpdateParams } from "./types/cosmos/auth/v1beta1/tx"; -import { GenesisState } from "./types/cosmos/auth/v1beta1/genesis"; -import { QueryAccountResponse } from "./types/cosmos/auth/v1beta1/query"; -import { QueryParamsRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryModuleAccountByNameRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountAddressByIDResponse } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountsRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryModuleAccountsRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryModuleAccountByNameResponse } from "./types/cosmos/auth/v1beta1/query"; -import { AddressBytesToStringRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountAddressByIDRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountsResponse } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountRequest } from "./types/cosmos/auth/v1beta1/query"; -import { AddressStringToBytesRequest } from "./types/cosmos/auth/v1beta1/query"; -import { AddressStringToBytesResponse } from "./types/cosmos/auth/v1beta1/query"; -import { BaseAccount } from "./types/cosmos/auth/v1beta1/auth"; -import { Bech32PrefixRequest } from "./types/cosmos/auth/v1beta1/query"; -import { AddressBytesToStringResponse } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountInfoRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountInfoResponse } from "./types/cosmos/auth/v1beta1/query"; -import { MsgUpdateParamsResponse } from "./types/cosmos/auth/v1beta1/tx"; -import { ModuleCredential } from "./types/cosmos/auth/v1beta1/auth"; -import { Params } from "./types/cosmos/auth/v1beta1/auth"; -import { QueryModuleAccountsResponse } from "./types/cosmos/auth/v1beta1/query"; -import { ModuleAccount } from "./types/cosmos/auth/v1beta1/auth"; -import { QueryParamsResponse } from "./types/cosmos/auth/v1beta1/query"; - - -export { Bech32PrefixResponse, MsgUpdateParams, GenesisState, QueryAccountResponse, QueryParamsRequest, QueryModuleAccountByNameRequest, QueryAccountAddressByIDResponse, QueryAccountsRequest, QueryModuleAccountsRequest, QueryModuleAccountByNameResponse, AddressBytesToStringRequest, QueryAccountAddressByIDRequest, QueryAccountsResponse, QueryAccountRequest, AddressStringToBytesRequest, AddressStringToBytesResponse, BaseAccount, Bech32PrefixRequest, AddressBytesToStringResponse, QueryAccountInfoRequest, QueryAccountInfoResponse, MsgUpdateParamsResponse, ModuleCredential, Params, QueryModuleAccountsResponse, ModuleAccount, QueryParamsResponse }; +import { AddressBytesToStringRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { AddressBytesToStringResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryModuleAccountsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryModuleAccountByNameRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { Bech32PrefixResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { AddressStringToBytesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/auth"; +import { ModuleAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/auth"; +import { QueryAccountsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { Bech32PrefixRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryAccountInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryModuleAccountsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryModuleAccountByNameResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { AddressStringToBytesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryAccountAddressByIDRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryAccountInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { BaseAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/auth"; +import { QueryAccountRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryAccountResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/genesis"; +import { QueryAccountAddressByIDResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { ModuleCredential } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/auth"; +import { QueryAccountsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; + + +export { AddressBytesToStringRequest, AddressBytesToStringResponse, QueryParamsResponse, QueryModuleAccountsResponse, QueryModuleAccountByNameRequest, Bech32PrefixResponse, AddressStringToBytesRequest, Params, ModuleAccount, QueryAccountsResponse, Bech32PrefixRequest, QueryAccountInfoRequest, QueryModuleAccountsRequest, QueryModuleAccountByNameResponse, AddressStringToBytesResponse, QueryAccountAddressByIDRequest, QueryAccountInfoResponse, BaseAccount, QueryAccountRequest, QueryAccountResponse, MsgUpdateParams, MsgUpdateParamsResponse, GenesisState, QueryAccountAddressByIDResponse, QueryParamsRequest, ModuleCredential, QueryAccountsRequest }; -type sendBech32PrefixResponseParams = { - value: Bech32PrefixResponse, - fee?: StdFee, - memo?: string -}; - -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendAddressBytesToStringRequestParams = { + value: AddressBytesToStringRequest, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendAddressBytesToStringResponseParams = { + value: AddressBytesToStringResponse, fee?: StdFee, memo?: string }; -type sendQueryAccountResponseParams = { - value: QueryAccountResponse, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendQueryModuleAccountsResponseParams = { + value: QueryModuleAccountsResponse, fee?: StdFee, memo?: string }; @@ -73,56 +67,56 @@ type sendQueryModuleAccountByNameRequestParams = { memo?: string }; -type sendQueryAccountAddressByIDResponseParams = { - value: QueryAccountAddressByIDResponse, +type sendBech32PrefixResponseParams = { + value: Bech32PrefixResponse, fee?: StdFee, memo?: string }; -type sendQueryAccountsRequestParams = { - value: QueryAccountsRequest, +type sendAddressStringToBytesRequestParams = { + value: AddressStringToBytesRequest, fee?: StdFee, memo?: string }; -type sendQueryModuleAccountsRequestParams = { - value: QueryModuleAccountsRequest, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendQueryModuleAccountByNameResponseParams = { - value: QueryModuleAccountByNameResponse, +type sendModuleAccountParams = { + value: ModuleAccount, fee?: StdFee, memo?: string }; -type sendAddressBytesToStringRequestParams = { - value: AddressBytesToStringRequest, +type sendQueryAccountsResponseParams = { + value: QueryAccountsResponse, fee?: StdFee, memo?: string }; -type sendQueryAccountAddressByIDRequestParams = { - value: QueryAccountAddressByIDRequest, +type sendBech32PrefixRequestParams = { + value: Bech32PrefixRequest, fee?: StdFee, memo?: string }; -type sendQueryAccountsResponseParams = { - value: QueryAccountsResponse, +type sendQueryAccountInfoRequestParams = { + value: QueryAccountInfoRequest, fee?: StdFee, memo?: string }; -type sendQueryAccountRequestParams = { - value: QueryAccountRequest, +type sendQueryModuleAccountsRequestParams = { + value: QueryModuleAccountsRequest, fee?: StdFee, memo?: string }; -type sendAddressStringToBytesRequestParams = { - value: AddressStringToBytesRequest, +type sendQueryModuleAccountByNameResponseParams = { + value: QueryModuleAccountByNameResponse, fee?: StdFee, memo?: string }; @@ -133,32 +127,38 @@ type sendAddressStringToBytesResponseParams = { memo?: string }; -type sendBaseAccountParams = { - value: BaseAccount, +type sendQueryAccountAddressByIDRequestParams = { + value: QueryAccountAddressByIDRequest, fee?: StdFee, memo?: string }; -type sendBech32PrefixRequestParams = { - value: Bech32PrefixRequest, +type sendQueryAccountInfoResponseParams = { + value: QueryAccountInfoResponse, fee?: StdFee, memo?: string }; -type sendAddressBytesToStringResponseParams = { - value: AddressBytesToStringResponse, +type sendBaseAccountParams = { + value: BaseAccount, fee?: StdFee, memo?: string }; -type sendQueryAccountInfoRequestParams = { - value: QueryAccountInfoRequest, +type sendQueryAccountRequestParams = { + value: QueryAccountRequest, fee?: StdFee, memo?: string }; -type sendQueryAccountInfoResponseParams = { - value: QueryAccountInfoResponse, +type sendQueryAccountResponseParams = { + value: QueryAccountResponse, + fee?: StdFee, + memo?: string +}; + +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; @@ -169,143 +169,143 @@ type sendMsgUpdateParamsResponseParams = { memo?: string }; -type sendModuleCredentialParams = { - value: ModuleCredential, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendQueryAccountAddressByIDResponseParams = { + value: QueryAccountAddressByIDResponse, fee?: StdFee, memo?: string }; -type sendQueryModuleAccountsResponseParams = { - value: QueryModuleAccountsResponse, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendModuleAccountParams = { - value: ModuleAccount, +type sendModuleCredentialParams = { + value: ModuleCredential, fee?: StdFee, memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendQueryAccountsRequestParams = { + value: QueryAccountsRequest, fee?: StdFee, memo?: string }; -type bech32PrefixResponseParams = { - value: Bech32PrefixResponse, -}; - -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type addressBytesToStringRequestParams = { + value: AddressBytesToStringRequest, }; -type genesisStateParams = { - value: GenesisState, +type addressBytesToStringResponseParams = { + value: AddressBytesToStringResponse, }; -type queryAccountResponseParams = { - value: QueryAccountResponse, +type queryParamsResponseParams = { + value: QueryParamsResponse, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type queryModuleAccountsResponseParams = { + value: QueryModuleAccountsResponse, }; type queryModuleAccountByNameRequestParams = { value: QueryModuleAccountByNameRequest, }; -type queryAccountAddressByIdresponseParams = { - value: QueryAccountAddressByIDResponse, +type bech32PrefixResponseParams = { + value: Bech32PrefixResponse, }; -type queryAccountsRequestParams = { - value: QueryAccountsRequest, +type addressStringToBytesRequestParams = { + value: AddressStringToBytesRequest, }; -type queryModuleAccountsRequestParams = { - value: QueryModuleAccountsRequest, +type paramsParams = { + value: Params, }; -type queryModuleAccountByNameResponseParams = { - value: QueryModuleAccountByNameResponse, +type moduleAccountParams = { + value: ModuleAccount, }; -type addressBytesToStringRequestParams = { - value: AddressBytesToStringRequest, +type queryAccountsResponseParams = { + value: QueryAccountsResponse, }; -type queryAccountAddressByIdrequestParams = { - value: QueryAccountAddressByIDRequest, +type bech32PrefixRequestParams = { + value: Bech32PrefixRequest, }; -type queryAccountsResponseParams = { - value: QueryAccountsResponse, +type queryAccountInfoRequestParams = { + value: QueryAccountInfoRequest, }; -type queryAccountRequestParams = { - value: QueryAccountRequest, +type queryModuleAccountsRequestParams = { + value: QueryModuleAccountsRequest, }; -type addressStringToBytesRequestParams = { - value: AddressStringToBytesRequest, +type queryModuleAccountByNameResponseParams = { + value: QueryModuleAccountByNameResponse, }; type addressStringToBytesResponseParams = { value: AddressStringToBytesResponse, }; -type baseAccountParams = { - value: BaseAccount, +type queryAccountAddressByIdrequestParams = { + value: QueryAccountAddressByIDRequest, }; -type bech32PrefixRequestParams = { - value: Bech32PrefixRequest, +type queryAccountInfoResponseParams = { + value: QueryAccountInfoResponse, }; -type addressBytesToStringResponseParams = { - value: AddressBytesToStringResponse, +type baseAccountParams = { + value: BaseAccount, }; -type queryAccountInfoRequestParams = { - value: QueryAccountInfoRequest, +type queryAccountRequestParams = { + value: QueryAccountRequest, }; -type queryAccountInfoResponseParams = { - value: QueryAccountInfoResponse, +type queryAccountResponseParams = { + value: QueryAccountResponse, +}; + +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; type msgUpdateParamsResponseParams = { value: MsgUpdateParamsResponse, }; -type moduleCredentialParams = { - value: ModuleCredential, +type genesisStateParams = { + value: GenesisState, }; -type paramsParams = { - value: Params, +type queryAccountAddressByIdresponseParams = { + value: QueryAccountAddressByIDResponse, }; -type queryModuleAccountsResponseParams = { - value: QueryModuleAccountsResponse, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; -type moduleAccountParams = { - value: ModuleAccount, +type moduleCredentialParams = { + value: ModuleCredential, }; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type queryAccountsRequestParams = { + value: QueryAccountsRequest, }; @@ -338,297 +338,297 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendBech32PrefixResponse({ value, fee, memo }: sendBech32PrefixResponseParams): Promise { + async sendAddressBytesToStringRequest({ value, fee, memo }: sendAddressBytesToStringRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendBech32PrefixResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAddressBytesToStringRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.bech32PrefixResponse({ value: Bech32PrefixResponse.fromPartial(value) }) + let msg = this.addressBytesToStringRequest({ value: AddressBytesToStringRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendBech32PrefixResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAddressBytesToStringRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendAddressBytesToStringResponse({ value, fee, memo }: sendAddressBytesToStringResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAddressBytesToStringResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.addressBytesToStringResponse({ value: AddressBytesToStringResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAddressBytesToStringResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountResponse({ value, fee, memo }: sendQueryAccountResponseParams): Promise { + async sendQueryModuleAccountsResponse({ value, fee, memo }: sendQueryModuleAccountsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryModuleAccountsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountResponse({ value: QueryAccountResponse.fromPartial(value) }) + let msg = this.queryModuleAccountsResponse({ value: QueryModuleAccountsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryModuleAccountsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendQueryModuleAccountByNameRequest({ value, fee, memo }: sendQueryModuleAccountByNameRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryModuleAccountByNameRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.queryModuleAccountByNameRequest({ value: QueryModuleAccountByNameRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryModuleAccountByNameRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryModuleAccountByNameRequest({ value, fee, memo }: sendQueryModuleAccountByNameRequestParams): Promise { + async sendBech32PrefixResponse({ value, fee, memo }: sendBech32PrefixResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryModuleAccountByNameRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendBech32PrefixResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryModuleAccountByNameRequest({ value: QueryModuleAccountByNameRequest.fromPartial(value) }) + let msg = this.bech32PrefixResponse({ value: Bech32PrefixResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryModuleAccountByNameRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendBech32PrefixResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountAddressByIDResponse({ value, fee, memo }: sendQueryAccountAddressByIDResponseParams): Promise { + async sendAddressStringToBytesRequest({ value, fee, memo }: sendAddressStringToBytesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountAddressByIDResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAddressStringToBytesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountAddressByIdresponse({ value: QueryAccountAddressByIDResponse.fromPartial(value) }) + let msg = this.addressStringToBytesRequest({ value: AddressStringToBytesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountAddressByIDResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAddressStringToBytesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountsRequest({ value, fee, memo }: sendQueryAccountsRequestParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountsRequest({ value: QueryAccountsRequest.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryModuleAccountsRequest({ value, fee, memo }: sendQueryModuleAccountsRequestParams): Promise { + async sendModuleAccount({ value, fee, memo }: sendModuleAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryModuleAccountsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendModuleAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryModuleAccountsRequest({ value: QueryModuleAccountsRequest.fromPartial(value) }) + let msg = this.moduleAccount({ value: ModuleAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryModuleAccountsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendModuleAccount: Could not broadcast Tx: '+ e.message) } }, - async sendQueryModuleAccountByNameResponse({ value, fee, memo }: sendQueryModuleAccountByNameResponseParams): Promise { + async sendQueryAccountsResponse({ value, fee, memo }: sendQueryAccountsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryModuleAccountByNameResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryModuleAccountByNameResponse({ value: QueryModuleAccountByNameResponse.fromPartial(value) }) + let msg = this.queryAccountsResponse({ value: QueryAccountsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryModuleAccountByNameResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAddressBytesToStringRequest({ value, fee, memo }: sendAddressBytesToStringRequestParams): Promise { + async sendBech32PrefixRequest({ value, fee, memo }: sendBech32PrefixRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendAddressBytesToStringRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendBech32PrefixRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.addressBytesToStringRequest({ value: AddressBytesToStringRequest.fromPartial(value) }) + let msg = this.bech32PrefixRequest({ value: Bech32PrefixRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAddressBytesToStringRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendBech32PrefixRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountAddressByIDRequest({ value, fee, memo }: sendQueryAccountAddressByIDRequestParams): Promise { + async sendQueryAccountInfoRequest({ value, fee, memo }: sendQueryAccountInfoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountAddressByIDRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountInfoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountAddressByIdrequest({ value: QueryAccountAddressByIDRequest.fromPartial(value) }) + let msg = this.queryAccountInfoRequest({ value: QueryAccountInfoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountAddressByIDRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountInfoRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountsResponse({ value, fee, memo }: sendQueryAccountsResponseParams): Promise { + async sendQueryModuleAccountsRequest({ value, fee, memo }: sendQueryModuleAccountsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryModuleAccountsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountsResponse({ value: QueryAccountsResponse.fromPartial(value) }) + let msg = this.queryModuleAccountsRequest({ value: QueryModuleAccountsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryModuleAccountsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountRequest({ value, fee, memo }: sendQueryAccountRequestParams): Promise { + async sendQueryModuleAccountByNameResponse({ value, fee, memo }: sendQueryModuleAccountByNameResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryModuleAccountByNameResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountRequest({ value: QueryAccountRequest.fromPartial(value) }) + let msg = this.queryModuleAccountByNameResponse({ value: QueryModuleAccountByNameResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryModuleAccountByNameResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAddressStringToBytesRequest({ value, fee, memo }: sendAddressStringToBytesRequestParams): Promise { + async sendAddressStringToBytesResponse({ value, fee, memo }: sendAddressStringToBytesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendAddressStringToBytesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAddressStringToBytesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.addressStringToBytesRequest({ value: AddressStringToBytesRequest.fromPartial(value) }) + let msg = this.addressStringToBytesResponse({ value: AddressStringToBytesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAddressStringToBytesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAddressStringToBytesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAddressStringToBytesResponse({ value, fee, memo }: sendAddressStringToBytesResponseParams): Promise { + async sendQueryAccountAddressByIDRequest({ value, fee, memo }: sendQueryAccountAddressByIDRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendAddressStringToBytesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountAddressByIDRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.addressStringToBytesResponse({ value: AddressStringToBytesResponse.fromPartial(value) }) + let msg = this.queryAccountAddressByIdrequest({ value: QueryAccountAddressByIDRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAddressStringToBytesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountAddressByIDRequest: Could not broadcast Tx: '+ e.message) } }, - async sendBaseAccount({ value, fee, memo }: sendBaseAccountParams): Promise { + async sendQueryAccountInfoResponse({ value, fee, memo }: sendQueryAccountInfoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendBaseAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountInfoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.baseAccount({ value: BaseAccount.fromPartial(value) }) + let msg = this.queryAccountInfoResponse({ value: QueryAccountInfoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendBaseAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountInfoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendBech32PrefixRequest({ value, fee, memo }: sendBech32PrefixRequestParams): Promise { + async sendBaseAccount({ value, fee, memo }: sendBaseAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendBech32PrefixRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendBaseAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.bech32PrefixRequest({ value: Bech32PrefixRequest.fromPartial(value) }) + let msg = this.baseAccount({ value: BaseAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendBech32PrefixRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendBaseAccount: Could not broadcast Tx: '+ e.message) } }, - async sendAddressBytesToStringResponse({ value, fee, memo }: sendAddressBytesToStringResponseParams): Promise { + async sendQueryAccountRequest({ value, fee, memo }: sendQueryAccountRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendAddressBytesToStringResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.addressBytesToStringResponse({ value: AddressBytesToStringResponse.fromPartial(value) }) + let msg = this.queryAccountRequest({ value: QueryAccountRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAddressBytesToStringResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountInfoRequest({ value, fee, memo }: sendQueryAccountInfoRequestParams): Promise { + async sendQueryAccountResponse({ value, fee, memo }: sendQueryAccountResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountInfoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountInfoRequest({ value: QueryAccountInfoRequest.fromPartial(value) }) + let msg = this.queryAccountResponse({ value: QueryAccountResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountInfoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountInfoResponse({ value, fee, memo }: sendQueryAccountInfoResponseParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountInfoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountInfoResponse({ value: QueryAccountInfoResponse.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountInfoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, @@ -646,114 +646,106 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendModuleCredential({ value, fee, memo }: sendModuleCredentialParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendModuleCredential: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.moduleCredential({ value: ModuleCredential.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendModuleCredential: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendQueryAccountAddressByIDResponse({ value, fee, memo }: sendQueryAccountAddressByIDResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountAddressByIDResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.queryAccountAddressByIdresponse({ value: QueryAccountAddressByIDResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountAddressByIDResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryModuleAccountsResponse({ value, fee, memo }: sendQueryModuleAccountsResponseParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryModuleAccountsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryModuleAccountsResponse({ value: QueryModuleAccountsResponse.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryModuleAccountsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendModuleAccount({ value, fee, memo }: sendModuleAccountParams): Promise { + async sendModuleCredential({ value, fee, memo }: sendModuleCredentialParams): Promise { if (!signer) { - throw new Error('TxClient:sendModuleAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendModuleCredential: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.moduleAccount({ value: ModuleAccount.fromPartial(value) }) + let msg = this.moduleCredential({ value: ModuleCredential.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendModuleAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendModuleCredential: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendQueryAccountsRequest({ value, fee, memo }: sendQueryAccountsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.queryAccountsRequest({ value: QueryAccountsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountsRequest: Could not broadcast Tx: '+ e.message) } }, - bech32PrefixResponse({ value }: bech32PrefixResponseParams): EncodeObject { - try { - return { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", value: Bech32PrefixResponse.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:Bech32PrefixResponse: Could not create message: ' + e.message) - } - }, - - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + addressBytesToStringRequest({ value }: addressBytesToStringRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", value: AddressBytesToStringRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:AddressBytesToStringRequest: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + addressBytesToStringResponse({ value }: addressBytesToStringResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", value: AddressBytesToStringResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:AddressBytesToStringResponse: Could not create message: ' + e.message) } }, - queryAccountResponse({ value }: queryAccountResponseParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", value: QueryAccountResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + queryModuleAccountsResponse({ value }: queryModuleAccountsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", value: QueryModuleAccountsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryModuleAccountsResponse: Could not create message: ' + e.message) } }, @@ -765,75 +757,75 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryAccountAddressByIdresponse({ value }: queryAccountAddressByIdresponseParams): EncodeObject { + bech32PrefixResponse({ value }: bech32PrefixResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", value: QueryAccountAddressByIDResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", value: Bech32PrefixResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountAddressByIDResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Bech32PrefixResponse: Could not create message: ' + e.message) } }, - queryAccountsRequest({ value }: queryAccountsRequestParams): EncodeObject { + addressStringToBytesRequest({ value }: addressStringToBytesRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", value: QueryAccountsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", value: AddressStringToBytesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:AddressStringToBytesRequest: Could not create message: ' + e.message) } }, - queryModuleAccountsRequest({ value }: queryModuleAccountsRequestParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", value: QueryModuleAccountsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryModuleAccountsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - queryModuleAccountByNameResponse({ value }: queryModuleAccountByNameResponseParams): EncodeObject { + moduleAccount({ value }: moduleAccountParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", value: QueryModuleAccountByNameResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", value: ModuleAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryModuleAccountByNameResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ModuleAccount: Could not create message: ' + e.message) } }, - addressBytesToStringRequest({ value }: addressBytesToStringRequestParams): EncodeObject { + queryAccountsResponse({ value }: queryAccountsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", value: AddressBytesToStringRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", value: QueryAccountsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AddressBytesToStringRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountsResponse: Could not create message: ' + e.message) } }, - queryAccountAddressByIdrequest({ value }: queryAccountAddressByIdrequestParams): EncodeObject { + bech32PrefixRequest({ value }: bech32PrefixRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", value: QueryAccountAddressByIDRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", value: Bech32PrefixRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountAddressByIDRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Bech32PrefixRequest: Could not create message: ' + e.message) } }, - queryAccountsResponse({ value }: queryAccountsResponseParams): EncodeObject { + queryAccountInfoRequest({ value }: queryAccountInfoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", value: QueryAccountsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest", value: QueryAccountInfoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountInfoRequest: Could not create message: ' + e.message) } }, - queryAccountRequest({ value }: queryAccountRequestParams): EncodeObject { + queryModuleAccountsRequest({ value }: queryModuleAccountsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", value: QueryAccountRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", value: QueryModuleAccountsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryModuleAccountsRequest: Could not create message: ' + e.message) } }, - addressStringToBytesRequest({ value }: addressStringToBytesRequestParams): EncodeObject { + queryModuleAccountByNameResponse({ value }: queryModuleAccountByNameResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", value: AddressStringToBytesRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", value: QueryModuleAccountByNameResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AddressStringToBytesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryModuleAccountByNameResponse: Could not create message: ' + e.message) } }, @@ -845,43 +837,51 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - baseAccount({ value }: baseAccountParams): EncodeObject { + queryAccountAddressByIdrequest({ value }: queryAccountAddressByIdrequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.BaseAccount", value: BaseAccount.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", value: QueryAccountAddressByIDRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:BaseAccount: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountAddressByIDRequest: Could not create message: ' + e.message) } }, - bech32PrefixRequest({ value }: bech32PrefixRequestParams): EncodeObject { + queryAccountInfoResponse({ value }: queryAccountInfoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", value: Bech32PrefixRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse", value: QueryAccountInfoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Bech32PrefixRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountInfoResponse: Could not create message: ' + e.message) } }, - addressBytesToStringResponse({ value }: addressBytesToStringResponseParams): EncodeObject { + baseAccount({ value }: baseAccountParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", value: AddressBytesToStringResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.BaseAccount", value: BaseAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AddressBytesToStringResponse: Could not create message: ' + e.message) + throw new Error('TxClient:BaseAccount: Could not create message: ' + e.message) } }, - queryAccountInfoRequest({ value }: queryAccountInfoRequestParams): EncodeObject { + queryAccountRequest({ value }: queryAccountRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest", value: QueryAccountInfoRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", value: QueryAccountRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountInfoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountRequest: Could not create message: ' + e.message) } }, - queryAccountInfoResponse({ value }: queryAccountInfoResponseParams): EncodeObject { + queryAccountResponse({ value }: queryAccountResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse", value: QueryAccountInfoResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", value: QueryAccountResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountInfoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountResponse: Could not create message: ' + e.message) + } + }, + + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + try { + return { typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, @@ -893,43 +893,43 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - moduleCredential({ value }: moduleCredentialParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.ModuleCredential", value: ModuleCredential.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ModuleCredential: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + queryAccountAddressByIdresponse({ value }: queryAccountAddressByIdresponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", value: QueryAccountAddressByIDResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountAddressByIDResponse: Could not create message: ' + e.message) } }, - queryModuleAccountsResponse({ value }: queryModuleAccountsResponseParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", value: QueryModuleAccountsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryModuleAccountsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - moduleAccount({ value }: moduleAccountParams): EncodeObject { + moduleCredential({ value }: moduleCredentialParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", value: ModuleAccount.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.ModuleCredential", value: ModuleCredential.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ModuleAccount: Could not create message: ' + e.message) + throw new Error('TxClient:ModuleCredential: Could not create message: ' + e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + queryAccountsRequest({ value }: queryAccountsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", value: QueryAccountsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountsRequest: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.auth.v1beta1/registry.ts b/ts-client/cosmos.auth.v1beta1/registry.ts index 1041d290..8727ebf2 100755 --- a/ts-client/cosmos.auth.v1beta1/registry.ts +++ b/ts-client/cosmos.auth.v1beta1/registry.ts @@ -1,60 +1,60 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { Bech32PrefixResponse } from "./types/cosmos/auth/v1beta1/query"; -import { MsgUpdateParams } from "./types/cosmos/auth/v1beta1/tx"; -import { GenesisState } from "./types/cosmos/auth/v1beta1/genesis"; -import { QueryAccountResponse } from "./types/cosmos/auth/v1beta1/query"; -import { QueryParamsRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryModuleAccountByNameRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountAddressByIDResponse } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountsRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryModuleAccountsRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryModuleAccountByNameResponse } from "./types/cosmos/auth/v1beta1/query"; -import { AddressBytesToStringRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountAddressByIDRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountsResponse } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountRequest } from "./types/cosmos/auth/v1beta1/query"; -import { AddressStringToBytesRequest } from "./types/cosmos/auth/v1beta1/query"; -import { AddressStringToBytesResponse } from "./types/cosmos/auth/v1beta1/query"; -import { BaseAccount } from "./types/cosmos/auth/v1beta1/auth"; -import { Bech32PrefixRequest } from "./types/cosmos/auth/v1beta1/query"; -import { AddressBytesToStringResponse } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountInfoRequest } from "./types/cosmos/auth/v1beta1/query"; -import { QueryAccountInfoResponse } from "./types/cosmos/auth/v1beta1/query"; -import { MsgUpdateParamsResponse } from "./types/cosmos/auth/v1beta1/tx"; -import { ModuleCredential } from "./types/cosmos/auth/v1beta1/auth"; -import { Params } from "./types/cosmos/auth/v1beta1/auth"; -import { QueryModuleAccountsResponse } from "./types/cosmos/auth/v1beta1/query"; -import { ModuleAccount } from "./types/cosmos/auth/v1beta1/auth"; -import { QueryParamsResponse } from "./types/cosmos/auth/v1beta1/query"; +import { AddressBytesToStringRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { AddressBytesToStringResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryModuleAccountsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryModuleAccountByNameRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { Bech32PrefixResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { AddressStringToBytesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/auth"; +import { ModuleAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/auth"; +import { QueryAccountsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { Bech32PrefixRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryAccountInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryModuleAccountsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryModuleAccountByNameResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { AddressStringToBytesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryAccountAddressByIDRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryAccountInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { BaseAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/auth"; +import { QueryAccountRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryAccountResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/genesis"; +import { QueryAccountAddressByIDResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; +import { ModuleCredential } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/auth"; +import { QueryAccountsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/auth/v1beta1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.auth.v1beta1.Bech32PrefixResponse", Bech32PrefixResponse], - ["/cosmos.auth.v1beta1.MsgUpdateParams", MsgUpdateParams], - ["/cosmos.auth.v1beta1.GenesisState", GenesisState], - ["/cosmos.auth.v1beta1.QueryAccountResponse", QueryAccountResponse], - ["/cosmos.auth.v1beta1.QueryParamsRequest", QueryParamsRequest], - ["/cosmos.auth.v1beta1.QueryModuleAccountByNameRequest", QueryModuleAccountByNameRequest], - ["/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", QueryAccountAddressByIDResponse], - ["/cosmos.auth.v1beta1.QueryAccountsRequest", QueryAccountsRequest], - ["/cosmos.auth.v1beta1.QueryModuleAccountsRequest", QueryModuleAccountsRequest], - ["/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", QueryModuleAccountByNameResponse], ["/cosmos.auth.v1beta1.AddressBytesToStringRequest", AddressBytesToStringRequest], - ["/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", QueryAccountAddressByIDRequest], - ["/cosmos.auth.v1beta1.QueryAccountsResponse", QueryAccountsResponse], - ["/cosmos.auth.v1beta1.QueryAccountRequest", QueryAccountRequest], + ["/cosmos.auth.v1beta1.AddressBytesToStringResponse", AddressBytesToStringResponse], + ["/cosmos.auth.v1beta1.QueryParamsResponse", QueryParamsResponse], + ["/cosmos.auth.v1beta1.QueryModuleAccountsResponse", QueryModuleAccountsResponse], + ["/cosmos.auth.v1beta1.QueryModuleAccountByNameRequest", QueryModuleAccountByNameRequest], + ["/cosmos.auth.v1beta1.Bech32PrefixResponse", Bech32PrefixResponse], ["/cosmos.auth.v1beta1.AddressStringToBytesRequest", AddressStringToBytesRequest], - ["/cosmos.auth.v1beta1.AddressStringToBytesResponse", AddressStringToBytesResponse], - ["/cosmos.auth.v1beta1.BaseAccount", BaseAccount], + ["/cosmos.auth.v1beta1.Params", Params], + ["/cosmos.auth.v1beta1.ModuleAccount", ModuleAccount], + ["/cosmos.auth.v1beta1.QueryAccountsResponse", QueryAccountsResponse], ["/cosmos.auth.v1beta1.Bech32PrefixRequest", Bech32PrefixRequest], - ["/cosmos.auth.v1beta1.AddressBytesToStringResponse", AddressBytesToStringResponse], ["/cosmos.auth.v1beta1.QueryAccountInfoRequest", QueryAccountInfoRequest], + ["/cosmos.auth.v1beta1.QueryModuleAccountsRequest", QueryModuleAccountsRequest], + ["/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", QueryModuleAccountByNameResponse], + ["/cosmos.auth.v1beta1.AddressStringToBytesResponse", AddressStringToBytesResponse], + ["/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", QueryAccountAddressByIDRequest], ["/cosmos.auth.v1beta1.QueryAccountInfoResponse", QueryAccountInfoResponse], + ["/cosmos.auth.v1beta1.BaseAccount", BaseAccount], + ["/cosmos.auth.v1beta1.QueryAccountRequest", QueryAccountRequest], + ["/cosmos.auth.v1beta1.QueryAccountResponse", QueryAccountResponse], + ["/cosmos.auth.v1beta1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.auth.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], + ["/cosmos.auth.v1beta1.GenesisState", GenesisState], + ["/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", QueryAccountAddressByIDResponse], + ["/cosmos.auth.v1beta1.QueryParamsRequest", QueryParamsRequest], ["/cosmos.auth.v1beta1.ModuleCredential", ModuleCredential], - ["/cosmos.auth.v1beta1.Params", Params], - ["/cosmos.auth.v1beta1.QueryModuleAccountsResponse", QueryModuleAccountsResponse], - ["/cosmos.auth.v1beta1.ModuleAccount", ModuleAccount], - ["/cosmos.auth.v1beta1.QueryParamsResponse", QueryParamsResponse], + ["/cosmos.auth.v1beta1.QueryAccountsRequest", QueryAccountsRequest], ]; diff --git a/ts-client/cosmos.auth.v1beta1/types/amino/amino.ts b/ts-client/cosmos.auth.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.auth.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.auth.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.auth.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.auth.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.auth.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.auth.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.auth.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.auth.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.auth.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.auth.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.auth.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.auth.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.auth.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.auth.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.auth.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.auth.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.auth.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.auth.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.auth.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.auth.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.auth.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.auth.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.auth.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.auth.v1beta1/types/google/api/http.ts b/ts-client/cosmos.auth.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.auth.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.auth.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.auth.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.auth.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.auth.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.auth.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.auth.v1beta1/types/route-name.eta b/ts-client/cosmos.auth.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.auth.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.authz.v1beta1/module.ts b/ts-client/cosmos.authz.v1beta1/module.ts index d40b0beb..d422db07 100755 --- a/ts-client/cosmos.authz.v1beta1/module.ts +++ b/ts-client/cosmos.authz.v1beta1/module.ts @@ -6,34 +6,28 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { Grant } from "./types/cosmos/authz/v1beta1/authz"; -import { GenesisState } from "./types/cosmos/authz/v1beta1/genesis"; -import { MsgExecResponse } from "./types/cosmos/authz/v1beta1/tx"; -import { QueryGranterGrantsResponse } from "./types/cosmos/authz/v1beta1/query"; -import { QueryGranteeGrantsResponse } from "./types/cosmos/authz/v1beta1/query"; -import { MsgGrantResponse } from "./types/cosmos/authz/v1beta1/tx"; -import { MsgRevoke } from "./types/cosmos/authz/v1beta1/tx"; -import { GrantAuthorization } from "./types/cosmos/authz/v1beta1/authz"; -import { QueryGranteeGrantsRequest } from "./types/cosmos/authz/v1beta1/query"; -import { MsgExec } from "./types/cosmos/authz/v1beta1/tx"; -import { EventGrant } from "./types/cosmos/authz/v1beta1/event"; -import { GenericAuthorization } from "./types/cosmos/authz/v1beta1/authz"; -import { GrantQueueItem } from "./types/cosmos/authz/v1beta1/authz"; -import { QueryGrantsRequest } from "./types/cosmos/authz/v1beta1/query"; -import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx"; -import { MsgRevokeResponse } from "./types/cosmos/authz/v1beta1/tx"; -import { EventRevoke } from "./types/cosmos/authz/v1beta1/event"; -import { QueryGrantsResponse } from "./types/cosmos/authz/v1beta1/query"; -import { QueryGranterGrantsRequest } from "./types/cosmos/authz/v1beta1/query"; - - -export { Grant, GenesisState, MsgExecResponse, QueryGranterGrantsResponse, QueryGranteeGrantsResponse, MsgGrantResponse, MsgRevoke, GrantAuthorization, QueryGranteeGrantsRequest, MsgExec, EventGrant, GenericAuthorization, GrantQueueItem, QueryGrantsRequest, MsgGrant, MsgRevokeResponse, EventRevoke, QueryGrantsResponse, QueryGranterGrantsRequest }; - -type sendGrantParams = { - value: Grant, - fee?: StdFee, - memo?: string -}; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/genesis"; +import { MsgGrant } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { MsgGrantResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { MsgRevoke } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { MsgRevokeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { EventRevoke } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/event"; +import { Grant } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/authz"; +import { MsgExec } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { QueryGrantsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { QueryGrantsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { QueryGranteeGrantsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { GrantAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/authz"; +import { EventGrant } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/event"; +import { GenericAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/authz"; +import { QueryGranterGrantsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { MsgExecResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { GrantQueueItem } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/authz"; +import { QueryGranterGrantsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { QueryGranteeGrantsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; + + +export { GenesisState, MsgGrant, MsgGrantResponse, MsgRevoke, MsgRevokeResponse, EventRevoke, Grant, MsgExec, QueryGrantsRequest, QueryGrantsResponse, QueryGranteeGrantsResponse, GrantAuthorization, EventGrant, GenericAuthorization, QueryGranterGrantsResponse, MsgExecResponse, GrantQueueItem, QueryGranterGrantsRequest, QueryGranteeGrantsRequest }; type sendGenesisStateParams = { value: GenesisState, @@ -41,98 +35,98 @@ type sendGenesisStateParams = { memo?: string }; -type sendMsgExecResponseParams = { - value: MsgExecResponse, +type sendMsgGrantParams = { + value: MsgGrant, fee?: StdFee, memo?: string }; -type sendQueryGranterGrantsResponseParams = { - value: QueryGranterGrantsResponse, +type sendMsgGrantResponseParams = { + value: MsgGrantResponse, fee?: StdFee, memo?: string }; -type sendQueryGranteeGrantsResponseParams = { - value: QueryGranteeGrantsResponse, +type sendMsgRevokeParams = { + value: MsgRevoke, fee?: StdFee, memo?: string }; -type sendMsgGrantResponseParams = { - value: MsgGrantResponse, +type sendMsgRevokeResponseParams = { + value: MsgRevokeResponse, fee?: StdFee, memo?: string }; -type sendMsgRevokeParams = { - value: MsgRevoke, +type sendEventRevokeParams = { + value: EventRevoke, fee?: StdFee, memo?: string }; -type sendGrantAuthorizationParams = { - value: GrantAuthorization, +type sendGrantParams = { + value: Grant, fee?: StdFee, memo?: string }; -type sendQueryGranteeGrantsRequestParams = { - value: QueryGranteeGrantsRequest, +type sendMsgExecParams = { + value: MsgExec, fee?: StdFee, memo?: string }; -type sendMsgExecParams = { - value: MsgExec, +type sendQueryGrantsRequestParams = { + value: QueryGrantsRequest, fee?: StdFee, memo?: string }; -type sendEventGrantParams = { - value: EventGrant, +type sendQueryGrantsResponseParams = { + value: QueryGrantsResponse, fee?: StdFee, memo?: string }; -type sendGenericAuthorizationParams = { - value: GenericAuthorization, +type sendQueryGranteeGrantsResponseParams = { + value: QueryGranteeGrantsResponse, fee?: StdFee, memo?: string }; -type sendGrantQueueItemParams = { - value: GrantQueueItem, +type sendGrantAuthorizationParams = { + value: GrantAuthorization, fee?: StdFee, memo?: string }; -type sendQueryGrantsRequestParams = { - value: QueryGrantsRequest, +type sendEventGrantParams = { + value: EventGrant, fee?: StdFee, memo?: string }; -type sendMsgGrantParams = { - value: MsgGrant, +type sendGenericAuthorizationParams = { + value: GenericAuthorization, fee?: StdFee, memo?: string }; -type sendMsgRevokeResponseParams = { - value: MsgRevokeResponse, +type sendQueryGranterGrantsResponseParams = { + value: QueryGranterGrantsResponse, fee?: StdFee, memo?: string }; -type sendEventRevokeParams = { - value: EventRevoke, +type sendMsgExecResponseParams = { + value: MsgExecResponse, fee?: StdFee, memo?: string }; -type sendQueryGrantsResponseParams = { - value: QueryGrantsResponse, +type sendGrantQueueItemParams = { + value: GrantQueueItem, fee?: StdFee, memo?: string }; @@ -143,25 +137,19 @@ type sendQueryGranterGrantsRequestParams = { memo?: string }; - -type grantParams = { - value: Grant, +type sendQueryGranteeGrantsRequestParams = { + value: QueryGranteeGrantsRequest, + fee?: StdFee, + memo?: string }; + type genesisStateParams = { value: GenesisState, }; -type msgExecResponseParams = { - value: MsgExecResponse, -}; - -type queryGranterGrantsResponseParams = { - value: QueryGranterGrantsResponse, -}; - -type queryGranteeGrantsResponseParams = { - value: QueryGranteeGrantsResponse, +type msgGrantParams = { + value: MsgGrant, }; type msgGrantResponseParams = { @@ -172,54 +160,66 @@ type msgRevokeParams = { value: MsgRevoke, }; -type grantAuthorizationParams = { - value: GrantAuthorization, +type msgRevokeResponseParams = { + value: MsgRevokeResponse, }; -type queryGranteeGrantsRequestParams = { - value: QueryGranteeGrantsRequest, +type eventRevokeParams = { + value: EventRevoke, +}; + +type grantParams = { + value: Grant, }; type msgExecParams = { value: MsgExec, }; -type eventGrantParams = { - value: EventGrant, +type queryGrantsRequestParams = { + value: QueryGrantsRequest, }; -type genericAuthorizationParams = { - value: GenericAuthorization, +type queryGrantsResponseParams = { + value: QueryGrantsResponse, }; -type grantQueueItemParams = { - value: GrantQueueItem, +type queryGranteeGrantsResponseParams = { + value: QueryGranteeGrantsResponse, }; -type queryGrantsRequestParams = { - value: QueryGrantsRequest, +type grantAuthorizationParams = { + value: GrantAuthorization, }; -type msgGrantParams = { - value: MsgGrant, +type eventGrantParams = { + value: EventGrant, }; -type msgRevokeResponseParams = { - value: MsgRevokeResponse, +type genericAuthorizationParams = { + value: GenericAuthorization, }; -type eventRevokeParams = { - value: EventRevoke, +type queryGranterGrantsResponseParams = { + value: QueryGranterGrantsResponse, }; -type queryGrantsResponseParams = { - value: QueryGrantsResponse, +type msgExecResponseParams = { + value: MsgExecResponse, +}; + +type grantQueueItemParams = { + value: GrantQueueItem, }; type queryGranterGrantsRequestParams = { value: QueryGranterGrantsRequest, }; +type queryGranteeGrantsRequestParams = { + value: QueryGranteeGrantsRequest, +}; + export const registry = new Registry(msgTypes); @@ -250,20 +250,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendGrant({ value, fee, memo }: sendGrantParams): Promise { - if (!signer) { - throw new Error('TxClient:sendGrant: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.grant({ value: Grant.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendGrant: Could not broadcast Tx: '+ e.message) - } - }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') @@ -278,227 +264,227 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgExecResponse({ value, fee, memo }: sendMsgExecResponseParams): Promise { + async sendMsgGrant({ value, fee, memo }: sendMsgGrantParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgExecResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgGrant: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgExecResponse({ value: MsgExecResponse.fromPartial(value) }) + let msg = this.msgGrant({ value: MsgGrant.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgExecResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgGrant: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGranterGrantsResponse({ value, fee, memo }: sendQueryGranterGrantsResponseParams): Promise { + async sendMsgGrantResponse({ value, fee, memo }: sendMsgGrantResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGranterGrantsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgGrantResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGranterGrantsResponse({ value: QueryGranterGrantsResponse.fromPartial(value) }) + let msg = this.msgGrantResponse({ value: MsgGrantResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGranterGrantsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgGrantResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGranteeGrantsResponse({ value, fee, memo }: sendQueryGranteeGrantsResponseParams): Promise { + async sendMsgRevoke({ value, fee, memo }: sendMsgRevokeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGranteeGrantsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRevoke: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGranteeGrantsResponse({ value: QueryGranteeGrantsResponse.fromPartial(value) }) + let msg = this.msgRevoke({ value: MsgRevoke.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGranteeGrantsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRevoke: Could not broadcast Tx: '+ e.message) } }, - async sendMsgGrantResponse({ value, fee, memo }: sendMsgGrantResponseParams): Promise { + async sendMsgRevokeResponse({ value, fee, memo }: sendMsgRevokeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgGrantResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRevokeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgGrantResponse({ value: MsgGrantResponse.fromPartial(value) }) + let msg = this.msgRevokeResponse({ value: MsgRevokeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgGrantResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRevokeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRevoke({ value, fee, memo }: sendMsgRevokeParams): Promise { + async sendEventRevoke({ value, fee, memo }: sendEventRevokeParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRevoke: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventRevoke: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRevoke({ value: MsgRevoke.fromPartial(value) }) + let msg = this.eventRevoke({ value: EventRevoke.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRevoke: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventRevoke: Could not broadcast Tx: '+ e.message) } }, - async sendGrantAuthorization({ value, fee, memo }: sendGrantAuthorizationParams): Promise { + async sendGrant({ value, fee, memo }: sendGrantParams): Promise { if (!signer) { - throw new Error('TxClient:sendGrantAuthorization: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGrant: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.grantAuthorization({ value: GrantAuthorization.fromPartial(value) }) + let msg = this.grant({ value: Grant.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGrantAuthorization: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGrant: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGranteeGrantsRequest({ value, fee, memo }: sendQueryGranteeGrantsRequestParams): Promise { + async sendMsgExec({ value, fee, memo }: sendMsgExecParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGranteeGrantsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgExec: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGranteeGrantsRequest({ value: QueryGranteeGrantsRequest.fromPartial(value) }) + let msg = this.msgExec({ value: MsgExec.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGranteeGrantsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgExec: Could not broadcast Tx: '+ e.message) } }, - async sendMsgExec({ value, fee, memo }: sendMsgExecParams): Promise { + async sendQueryGrantsRequest({ value, fee, memo }: sendQueryGrantsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgExec: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGrantsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgExec({ value: MsgExec.fromPartial(value) }) + let msg = this.queryGrantsRequest({ value: QueryGrantsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgExec: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGrantsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendEventGrant({ value, fee, memo }: sendEventGrantParams): Promise { + async sendQueryGrantsResponse({ value, fee, memo }: sendQueryGrantsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventGrant: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGrantsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventGrant({ value: EventGrant.fromPartial(value) }) + let msg = this.queryGrantsResponse({ value: QueryGrantsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventGrant: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGrantsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGenericAuthorization({ value, fee, memo }: sendGenericAuthorizationParams): Promise { + async sendQueryGranteeGrantsResponse({ value, fee, memo }: sendQueryGranteeGrantsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenericAuthorization: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGranteeGrantsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genericAuthorization({ value: GenericAuthorization.fromPartial(value) }) + let msg = this.queryGranteeGrantsResponse({ value: QueryGranteeGrantsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenericAuthorization: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGranteeGrantsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGrantQueueItem({ value, fee, memo }: sendGrantQueueItemParams): Promise { + async sendGrantAuthorization({ value, fee, memo }: sendGrantAuthorizationParams): Promise { if (!signer) { - throw new Error('TxClient:sendGrantQueueItem: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGrantAuthorization: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.grantQueueItem({ value: GrantQueueItem.fromPartial(value) }) + let msg = this.grantAuthorization({ value: GrantAuthorization.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGrantQueueItem: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGrantAuthorization: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGrantsRequest({ value, fee, memo }: sendQueryGrantsRequestParams): Promise { + async sendEventGrant({ value, fee, memo }: sendEventGrantParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGrantsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventGrant: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGrantsRequest({ value: QueryGrantsRequest.fromPartial(value) }) + let msg = this.eventGrant({ value: EventGrant.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGrantsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventGrant: Could not broadcast Tx: '+ e.message) } }, - async sendMsgGrant({ value, fee, memo }: sendMsgGrantParams): Promise { + async sendGenericAuthorization({ value, fee, memo }: sendGenericAuthorizationParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgGrant: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenericAuthorization: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgGrant({ value: MsgGrant.fromPartial(value) }) + let msg = this.genericAuthorization({ value: GenericAuthorization.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgGrant: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenericAuthorization: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRevokeResponse({ value, fee, memo }: sendMsgRevokeResponseParams): Promise { + async sendQueryGranterGrantsResponse({ value, fee, memo }: sendQueryGranterGrantsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRevokeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGranterGrantsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRevokeResponse({ value: MsgRevokeResponse.fromPartial(value) }) + let msg = this.queryGranterGrantsResponse({ value: QueryGranterGrantsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRevokeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGranterGrantsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendEventRevoke({ value, fee, memo }: sendEventRevokeParams): Promise { + async sendMsgExecResponse({ value, fee, memo }: sendMsgExecResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventRevoke: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgExecResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventRevoke({ value: EventRevoke.fromPartial(value) }) + let msg = this.msgExecResponse({ value: MsgExecResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventRevoke: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgExecResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGrantsResponse({ value, fee, memo }: sendQueryGrantsResponseParams): Promise { + async sendGrantQueueItem({ value, fee, memo }: sendGrantQueueItemParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGrantsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGrantQueueItem: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGrantsResponse({ value: QueryGrantsResponse.fromPartial(value) }) + let msg = this.grantQueueItem({ value: GrantQueueItem.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGrantsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGrantQueueItem: Could not broadcast Tx: '+ e.message) } }, @@ -516,15 +502,21 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - - grant({ value }: grantParams): EncodeObject { - try { - return { typeUrl: "/cosmos.authz.v1beta1.Grant", value: Grant.fromPartial( value ) } + async sendQueryGranteeGrantsRequest({ value, fee, memo }: sendQueryGranteeGrantsRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryGranteeGrantsRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryGranteeGrantsRequest({ value: QueryGranteeGrantsRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:Grant: Could not create message: ' + e.message) + throw new Error('TxClient:sendQueryGranteeGrantsRequest: Could not broadcast Tx: '+ e.message) } }, + genesisState({ value }: genesisStateParams): EncodeObject { try { return { typeUrl: "/cosmos.authz.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } @@ -533,131 +525,131 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgExecResponse({ value }: msgExecResponseParams): EncodeObject { + msgGrant({ value }: msgGrantParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", value: MsgExecResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", value: MsgGrant.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgExecResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgGrant: Could not create message: ' + e.message) } }, - queryGranterGrantsResponse({ value }: queryGranterGrantsResponseParams): EncodeObject { + msgGrantResponse({ value }: msgGrantResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", value: QueryGranterGrantsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", value: MsgGrantResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGranterGrantsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgGrantResponse: Could not create message: ' + e.message) } }, - queryGranteeGrantsResponse({ value }: queryGranteeGrantsResponseParams): EncodeObject { + msgRevoke({ value }: msgRevokeParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", value: QueryGranteeGrantsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: MsgRevoke.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGranteeGrantsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRevoke: Could not create message: ' + e.message) } }, - msgGrantResponse({ value }: msgGrantResponseParams): EncodeObject { + msgRevokeResponse({ value }: msgRevokeResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", value: MsgGrantResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", value: MsgRevokeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgGrantResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRevokeResponse: Could not create message: ' + e.message) } }, - msgRevoke({ value }: msgRevokeParams): EncodeObject { + eventRevoke({ value }: eventRevokeParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: MsgRevoke.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.EventRevoke", value: EventRevoke.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRevoke: Could not create message: ' + e.message) + throw new Error('TxClient:EventRevoke: Could not create message: ' + e.message) } }, - grantAuthorization({ value }: grantAuthorizationParams): EncodeObject { + grant({ value }: grantParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", value: GrantAuthorization.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.Grant", value: Grant.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GrantAuthorization: Could not create message: ' + e.message) + throw new Error('TxClient:Grant: Could not create message: ' + e.message) } }, - queryGranteeGrantsRequest({ value }: queryGranteeGrantsRequestParams): EncodeObject { + msgExec({ value }: msgExecParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", value: QueryGranteeGrantsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.MsgExec", value: MsgExec.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGranteeGrantsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgExec: Could not create message: ' + e.message) } }, - msgExec({ value }: msgExecParams): EncodeObject { + queryGrantsRequest({ value }: queryGrantsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.MsgExec", value: MsgExec.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", value: QueryGrantsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgExec: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGrantsRequest: Could not create message: ' + e.message) } }, - eventGrant({ value }: eventGrantParams): EncodeObject { + queryGrantsResponse({ value }: queryGrantsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.EventGrant", value: EventGrant.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", value: QueryGrantsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventGrant: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGrantsResponse: Could not create message: ' + e.message) } }, - genericAuthorization({ value }: genericAuthorizationParams): EncodeObject { + queryGranteeGrantsResponse({ value }: queryGranteeGrantsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", value: GenericAuthorization.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", value: QueryGranteeGrantsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenericAuthorization: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGranteeGrantsResponse: Could not create message: ' + e.message) } }, - grantQueueItem({ value }: grantQueueItemParams): EncodeObject { + grantAuthorization({ value }: grantAuthorizationParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", value: GrantQueueItem.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", value: GrantAuthorization.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GrantQueueItem: Could not create message: ' + e.message) + throw new Error('TxClient:GrantAuthorization: Could not create message: ' + e.message) } }, - queryGrantsRequest({ value }: queryGrantsRequestParams): EncodeObject { + eventGrant({ value }: eventGrantParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", value: QueryGrantsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.EventGrant", value: EventGrant.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGrantsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:EventGrant: Could not create message: ' + e.message) } }, - msgGrant({ value }: msgGrantParams): EncodeObject { + genericAuthorization({ value }: genericAuthorizationParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", value: MsgGrant.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", value: GenericAuthorization.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgGrant: Could not create message: ' + e.message) + throw new Error('TxClient:GenericAuthorization: Could not create message: ' + e.message) } }, - msgRevokeResponse({ value }: msgRevokeResponseParams): EncodeObject { + queryGranterGrantsResponse({ value }: queryGranterGrantsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", value: MsgRevokeResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", value: QueryGranterGrantsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRevokeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGranterGrantsResponse: Could not create message: ' + e.message) } }, - eventRevoke({ value }: eventRevokeParams): EncodeObject { + msgExecResponse({ value }: msgExecResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.EventRevoke", value: EventRevoke.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", value: MsgExecResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventRevoke: Could not create message: ' + e.message) + throw new Error('TxClient:MsgExecResponse: Could not create message: ' + e.message) } }, - queryGrantsResponse({ value }: queryGrantsResponseParams): EncodeObject { + grantQueueItem({ value }: grantQueueItemParams): EncodeObject { try { - return { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", value: QueryGrantsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", value: GrantQueueItem.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGrantsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GrantQueueItem: Could not create message: ' + e.message) } }, @@ -669,6 +661,14 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, + queryGranteeGrantsRequest({ value }: queryGranteeGrantsRequestParams): EncodeObject { + try { + return { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", value: QueryGranteeGrantsRequest.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryGranteeGrantsRequest: Could not create message: ' + e.message) + } + }, + } }; diff --git a/ts-client/cosmos.authz.v1beta1/registry.ts b/ts-client/cosmos.authz.v1beta1/registry.ts index 95a477ad..a17de0ac 100755 --- a/ts-client/cosmos.authz.v1beta1/registry.ts +++ b/ts-client/cosmos.authz.v1beta1/registry.ts @@ -1,44 +1,44 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { Grant } from "./types/cosmos/authz/v1beta1/authz"; -import { GenesisState } from "./types/cosmos/authz/v1beta1/genesis"; -import { MsgExecResponse } from "./types/cosmos/authz/v1beta1/tx"; -import { QueryGranterGrantsResponse } from "./types/cosmos/authz/v1beta1/query"; -import { QueryGranteeGrantsResponse } from "./types/cosmos/authz/v1beta1/query"; -import { MsgGrantResponse } from "./types/cosmos/authz/v1beta1/tx"; -import { MsgRevoke } from "./types/cosmos/authz/v1beta1/tx"; -import { GrantAuthorization } from "./types/cosmos/authz/v1beta1/authz"; -import { QueryGranteeGrantsRequest } from "./types/cosmos/authz/v1beta1/query"; -import { MsgExec } from "./types/cosmos/authz/v1beta1/tx"; -import { EventGrant } from "./types/cosmos/authz/v1beta1/event"; -import { GenericAuthorization } from "./types/cosmos/authz/v1beta1/authz"; -import { GrantQueueItem } from "./types/cosmos/authz/v1beta1/authz"; -import { QueryGrantsRequest } from "./types/cosmos/authz/v1beta1/query"; -import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx"; -import { MsgRevokeResponse } from "./types/cosmos/authz/v1beta1/tx"; -import { EventRevoke } from "./types/cosmos/authz/v1beta1/event"; -import { QueryGrantsResponse } from "./types/cosmos/authz/v1beta1/query"; -import { QueryGranterGrantsRequest } from "./types/cosmos/authz/v1beta1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/genesis"; +import { MsgGrant } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { MsgGrantResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { MsgRevoke } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { MsgRevokeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { EventRevoke } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/event"; +import { Grant } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/authz"; +import { MsgExec } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { QueryGrantsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { QueryGrantsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { QueryGranteeGrantsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { GrantAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/authz"; +import { EventGrant } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/event"; +import { GenericAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/authz"; +import { QueryGranterGrantsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { MsgExecResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/tx"; +import { GrantQueueItem } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/authz"; +import { QueryGranterGrantsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; +import { QueryGranteeGrantsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/authz/v1beta1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.authz.v1beta1.Grant", Grant], ["/cosmos.authz.v1beta1.GenesisState", GenesisState], - ["/cosmos.authz.v1beta1.MsgExecResponse", MsgExecResponse], - ["/cosmos.authz.v1beta1.QueryGranterGrantsResponse", QueryGranterGrantsResponse], - ["/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", QueryGranteeGrantsResponse], + ["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgGrantResponse", MsgGrantResponse], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke], - ["/cosmos.authz.v1beta1.GrantAuthorization", GrantAuthorization], - ["/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", QueryGranteeGrantsRequest], + ["/cosmos.authz.v1beta1.MsgRevokeResponse", MsgRevokeResponse], + ["/cosmos.authz.v1beta1.EventRevoke", EventRevoke], + ["/cosmos.authz.v1beta1.Grant", Grant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], + ["/cosmos.authz.v1beta1.QueryGrantsRequest", QueryGrantsRequest], + ["/cosmos.authz.v1beta1.QueryGrantsResponse", QueryGrantsResponse], + ["/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", QueryGranteeGrantsResponse], + ["/cosmos.authz.v1beta1.GrantAuthorization", GrantAuthorization], ["/cosmos.authz.v1beta1.EventGrant", EventGrant], ["/cosmos.authz.v1beta1.GenericAuthorization", GenericAuthorization], + ["/cosmos.authz.v1beta1.QueryGranterGrantsResponse", QueryGranterGrantsResponse], + ["/cosmos.authz.v1beta1.MsgExecResponse", MsgExecResponse], ["/cosmos.authz.v1beta1.GrantQueueItem", GrantQueueItem], - ["/cosmos.authz.v1beta1.QueryGrantsRequest", QueryGrantsRequest], - ["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], - ["/cosmos.authz.v1beta1.MsgRevokeResponse", MsgRevokeResponse], - ["/cosmos.authz.v1beta1.EventRevoke", EventRevoke], - ["/cosmos.authz.v1beta1.QueryGrantsResponse", QueryGrantsResponse], ["/cosmos.authz.v1beta1.QueryGranterGrantsRequest", QueryGranterGrantsRequest], + ["/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", QueryGranteeGrantsRequest], ]; diff --git a/ts-client/cosmos.authz.v1beta1/types/amino/amino.ts b/ts-client/cosmos.authz.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.authz.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.authz.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.authz.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.authz.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.authz.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.authz.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.authz.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.authz.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.authz.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.authz.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.authz.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.authz.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.authz.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.authz.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.authz.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.authz.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.authz.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.authz.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.authz.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.authz.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.authz.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.authz.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.authz.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.authz.v1beta1/types/google/api/http.ts b/ts-client/cosmos.authz.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.authz.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.authz.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.authz.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.authz.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.authz.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.authz.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.authz.v1beta1/types/route-name.eta b/ts-client/cosmos.authz.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.authz.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.bank.v1beta1/module.ts b/ts-client/cosmos.bank.v1beta1/module.ts index 34e68be1..d66281aa 100755 --- a/ts-client/cosmos.bank.v1beta1/module.ts +++ b/ts-client/cosmos.bank.v1beta1/module.ts @@ -6,504 +6,504 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgMultiSend } from "./types/cosmos/bank/v1beta1/tx"; -import { QuerySpendableBalanceByDenomResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryAllBalancesRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySendEnabledRequest } from "./types/cosmos/bank/v1beta1/query"; -import { Metadata } from "./types/cosmos/bank/v1beta1/bank"; -import { MsgMultiSendResponse } from "./types/cosmos/bank/v1beta1/tx"; -import { QueryDenomsMetadataResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomOwnersRequest } from "./types/cosmos/bank/v1beta1/query"; -import { DenomUnit } from "./types/cosmos/bank/v1beta1/bank"; -import { QuerySpendableBalanceByDenomRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySupplyOfRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QueryParamsResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomOwnersResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomOwnersByQueryResponse } from "./types/cosmos/bank/v1beta1/query"; -import { Supply } from "./types/cosmos/bank/v1beta1/bank"; -import { QueryTotalSupplyResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomMetadataByQueryStringRequest } from "./types/cosmos/bank/v1beta1/query"; -import { GenesisState } from "./types/cosmos/bank/v1beta1/genesis"; -import { QueryAllBalancesResponse } from "./types/cosmos/bank/v1beta1/query"; -import { MsgSetSendEnabledResponse } from "./types/cosmos/bank/v1beta1/tx"; -import { QuerySpendableBalancesRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySpendableBalancesResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomOwnersByQueryRequest } from "./types/cosmos/bank/v1beta1/query"; -import { Balance } from "./types/cosmos/bank/v1beta1/genesis"; -import { Params } from "./types/cosmos/bank/v1beta1/bank"; -import { QueryBalanceResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryTotalSupplyRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomMetadataByQueryStringResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySupplyOfResponse } from "./types/cosmos/bank/v1beta1/query"; -import { MsgUpdateParams } from "./types/cosmos/bank/v1beta1/tx"; -import { QueryParamsRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySendEnabledResponse } from "./types/cosmos/bank/v1beta1/query"; -import { Output } from "./types/cosmos/bank/v1beta1/bank"; -import { MsgUpdateParamsResponse } from "./types/cosmos/bank/v1beta1/tx"; -import { MsgSetSendEnabled } from "./types/cosmos/bank/v1beta1/tx"; -import { QueryBalanceRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomMetadataResponse } from "./types/cosmos/bank/v1beta1/query"; -import { MsgSend } from "./types/cosmos/bank/v1beta1/tx"; -import { MsgSendResponse } from "./types/cosmos/bank/v1beta1/tx"; -import { QueryDenomMetadataRequest } from "./types/cosmos/bank/v1beta1/query"; -import { DenomOwner } from "./types/cosmos/bank/v1beta1/query"; -import { SendEnabled } from "./types/cosmos/bank/v1beta1/bank"; -import { QueryDenomsMetadataRequest } from "./types/cosmos/bank/v1beta1/query"; -import { SendAuthorization } from "./types/cosmos/bank/v1beta1/authz"; -import { Input } from "./types/cosmos/bank/v1beta1/bank"; - - -export { MsgMultiSend, QuerySpendableBalanceByDenomResponse, QueryAllBalancesRequest, QuerySendEnabledRequest, Metadata, MsgMultiSendResponse, QueryDenomsMetadataResponse, QueryDenomOwnersRequest, DenomUnit, QuerySpendableBalanceByDenomRequest, QuerySupplyOfRequest, QueryParamsResponse, QueryDenomOwnersResponse, QueryDenomOwnersByQueryResponse, Supply, QueryTotalSupplyResponse, QueryDenomMetadataByQueryStringRequest, GenesisState, QueryAllBalancesResponse, MsgSetSendEnabledResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QueryDenomOwnersByQueryRequest, Balance, Params, QueryBalanceResponse, QueryTotalSupplyRequest, QueryDenomMetadataByQueryStringResponse, QuerySupplyOfResponse, MsgUpdateParams, QueryParamsRequest, QuerySendEnabledResponse, Output, MsgUpdateParamsResponse, MsgSetSendEnabled, QueryBalanceRequest, QueryDenomMetadataResponse, MsgSend, MsgSendResponse, QueryDenomMetadataRequest, DenomOwner, SendEnabled, QueryDenomsMetadataRequest, SendAuthorization, Input }; +import { QueryDenomOwnersByQueryRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySendEnabledResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { SendEnabled } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QueryDenomMetadataRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomMetadataByQueryStringResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryAllBalancesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySpendableBalanceByDenomResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomMetadataByQueryStringRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { DenomOwner } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Input } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QueryTotalSupplyRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryTotalSupplyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Balance } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/genesis"; +import { MsgMultiSend } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { MsgMultiSendResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { MsgSetSendEnabledResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { QueryDenomOwnersRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QuerySpendableBalanceByDenomRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomMetadataResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Output } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { MsgSetSendEnabled } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { SendAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/authz"; +import { QueryDenomOwnersByQueryResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Metadata } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/genesis"; +import { MsgSend } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { MsgSendResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { QueryDenomsMetadataResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomOwnersResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { DenomUnit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QueryBalanceRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryAllBalancesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySupplyOfRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySupplyOfResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySendEnabledRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryBalanceResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySpendableBalancesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomsMetadataRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Supply } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QuerySpendableBalancesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; + + +export { QueryDenomOwnersByQueryRequest, QuerySendEnabledResponse, SendEnabled, QueryDenomMetadataRequest, QueryDenomMetadataByQueryStringResponse, QueryAllBalancesResponse, QuerySpendableBalanceByDenomResponse, QueryDenomMetadataByQueryStringRequest, DenomOwner, Input, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QueryParamsRequest, Balance, MsgMultiSend, MsgMultiSendResponse, MsgSetSendEnabledResponse, QueryDenomOwnersRequest, Params, QuerySpendableBalanceByDenomRequest, QueryDenomMetadataResponse, Output, MsgSetSendEnabled, MsgUpdateParams, SendAuthorization, QueryDenomOwnersByQueryResponse, Metadata, GenesisState, MsgSend, MsgSendResponse, QueryDenomsMetadataResponse, QueryDenomOwnersResponse, DenomUnit, QueryBalanceRequest, QueryAllBalancesRequest, QuerySupplyOfRequest, QuerySupplyOfResponse, QuerySendEnabledRequest, QueryBalanceResponse, QuerySpendableBalancesRequest, QueryParamsResponse, QueryDenomsMetadataRequest, Supply, QuerySpendableBalancesResponse, MsgUpdateParamsResponse }; -type sendMsgMultiSendParams = { - value: MsgMultiSend, +type sendQueryDenomOwnersByQueryRequestParams = { + value: QueryDenomOwnersByQueryRequest, fee?: StdFee, memo?: string }; -type sendQuerySpendableBalanceByDenomResponseParams = { - value: QuerySpendableBalanceByDenomResponse, +type sendQuerySendEnabledResponseParams = { + value: QuerySendEnabledResponse, fee?: StdFee, memo?: string }; -type sendQueryAllBalancesRequestParams = { - value: QueryAllBalancesRequest, +type sendSendEnabledParams = { + value: SendEnabled, fee?: StdFee, memo?: string }; -type sendQuerySendEnabledRequestParams = { - value: QuerySendEnabledRequest, +type sendQueryDenomMetadataRequestParams = { + value: QueryDenomMetadataRequest, fee?: StdFee, memo?: string }; -type sendMetadataParams = { - value: Metadata, +type sendQueryDenomMetadataByQueryStringResponseParams = { + value: QueryDenomMetadataByQueryStringResponse, fee?: StdFee, memo?: string }; -type sendMsgMultiSendResponseParams = { - value: MsgMultiSendResponse, +type sendQueryAllBalancesResponseParams = { + value: QueryAllBalancesResponse, fee?: StdFee, memo?: string }; -type sendQueryDenomsMetadataResponseParams = { - value: QueryDenomsMetadataResponse, +type sendQuerySpendableBalanceByDenomResponseParams = { + value: QuerySpendableBalanceByDenomResponse, fee?: StdFee, memo?: string }; -type sendQueryDenomOwnersRequestParams = { - value: QueryDenomOwnersRequest, +type sendQueryDenomMetadataByQueryStringRequestParams = { + value: QueryDenomMetadataByQueryStringRequest, fee?: StdFee, memo?: string }; -type sendDenomUnitParams = { - value: DenomUnit, +type sendDenomOwnerParams = { + value: DenomOwner, fee?: StdFee, memo?: string }; -type sendQuerySpendableBalanceByDenomRequestParams = { - value: QuerySpendableBalanceByDenomRequest, +type sendInputParams = { + value: Input, fee?: StdFee, memo?: string }; -type sendQuerySupplyOfRequestParams = { - value: QuerySupplyOfRequest, +type sendQueryTotalSupplyRequestParams = { + value: QueryTotalSupplyRequest, fee?: StdFee, memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendQueryTotalSupplyResponseParams = { + value: QueryTotalSupplyResponse, fee?: StdFee, memo?: string }; -type sendQueryDenomOwnersResponseParams = { - value: QueryDenomOwnersResponse, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendQueryDenomOwnersByQueryResponseParams = { - value: QueryDenomOwnersByQueryResponse, +type sendBalanceParams = { + value: Balance, fee?: StdFee, memo?: string }; -type sendSupplyParams = { - value: Supply, +type sendMsgMultiSendParams = { + value: MsgMultiSend, fee?: StdFee, memo?: string }; -type sendQueryTotalSupplyResponseParams = { - value: QueryTotalSupplyResponse, +type sendMsgMultiSendResponseParams = { + value: MsgMultiSendResponse, fee?: StdFee, memo?: string }; -type sendQueryDenomMetadataByQueryStringRequestParams = { - value: QueryDenomMetadataByQueryStringRequest, +type sendMsgSetSendEnabledResponseParams = { + value: MsgSetSendEnabledResponse, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryDenomOwnersRequestParams = { + value: QueryDenomOwnersRequest, fee?: StdFee, memo?: string }; -type sendQueryAllBalancesResponseParams = { - value: QueryAllBalancesResponse, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendMsgSetSendEnabledResponseParams = { - value: MsgSetSendEnabledResponse, +type sendQuerySpendableBalanceByDenomRequestParams = { + value: QuerySpendableBalanceByDenomRequest, fee?: StdFee, memo?: string }; -type sendQuerySpendableBalancesRequestParams = { - value: QuerySpendableBalancesRequest, +type sendQueryDenomMetadataResponseParams = { + value: QueryDenomMetadataResponse, fee?: StdFee, memo?: string }; -type sendQuerySpendableBalancesResponseParams = { - value: QuerySpendableBalancesResponse, +type sendOutputParams = { + value: Output, fee?: StdFee, memo?: string }; -type sendQueryDenomOwnersByQueryRequestParams = { - value: QueryDenomOwnersByQueryRequest, +type sendMsgSetSendEnabledParams = { + value: MsgSetSendEnabled, fee?: StdFee, memo?: string }; -type sendBalanceParams = { - value: Balance, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendSendAuthorizationParams = { + value: SendAuthorization, fee?: StdFee, memo?: string }; -type sendQueryBalanceResponseParams = { - value: QueryBalanceResponse, +type sendQueryDenomOwnersByQueryResponseParams = { + value: QueryDenomOwnersByQueryResponse, fee?: StdFee, memo?: string }; -type sendQueryTotalSupplyRequestParams = { - value: QueryTotalSupplyRequest, +type sendMetadataParams = { + value: Metadata, fee?: StdFee, memo?: string }; -type sendQueryDenomMetadataByQueryStringResponseParams = { - value: QueryDenomMetadataByQueryStringResponse, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendQuerySupplyOfResponseParams = { - value: QuerySupplyOfResponse, +type sendMsgSendParams = { + value: MsgSend, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendMsgSendResponseParams = { + value: MsgSendResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendQueryDenomsMetadataResponseParams = { + value: QueryDenomsMetadataResponse, fee?: StdFee, memo?: string }; -type sendQuerySendEnabledResponseParams = { - value: QuerySendEnabledResponse, +type sendQueryDenomOwnersResponseParams = { + value: QueryDenomOwnersResponse, fee?: StdFee, memo?: string }; -type sendOutputParams = { - value: Output, +type sendDenomUnitParams = { + value: DenomUnit, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendQueryBalanceRequestParams = { + value: QueryBalanceRequest, fee?: StdFee, memo?: string }; -type sendMsgSetSendEnabledParams = { - value: MsgSetSendEnabled, +type sendQueryAllBalancesRequestParams = { + value: QueryAllBalancesRequest, fee?: StdFee, memo?: string }; -type sendQueryBalanceRequestParams = { - value: QueryBalanceRequest, +type sendQuerySupplyOfRequestParams = { + value: QuerySupplyOfRequest, fee?: StdFee, memo?: string }; -type sendQueryDenomMetadataResponseParams = { - value: QueryDenomMetadataResponse, +type sendQuerySupplyOfResponseParams = { + value: QuerySupplyOfResponse, fee?: StdFee, memo?: string }; -type sendMsgSendParams = { - value: MsgSend, +type sendQuerySendEnabledRequestParams = { + value: QuerySendEnabledRequest, fee?: StdFee, memo?: string }; -type sendMsgSendResponseParams = { - value: MsgSendResponse, +type sendQueryBalanceResponseParams = { + value: QueryBalanceResponse, fee?: StdFee, memo?: string }; -type sendQueryDenomMetadataRequestParams = { - value: QueryDenomMetadataRequest, +type sendQuerySpendableBalancesRequestParams = { + value: QuerySpendableBalancesRequest, fee?: StdFee, memo?: string }; -type sendDenomOwnerParams = { - value: DenomOwner, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendSendEnabledParams = { - value: SendEnabled, +type sendQueryDenomsMetadataRequestParams = { + value: QueryDenomsMetadataRequest, fee?: StdFee, memo?: string }; -type sendQueryDenomsMetadataRequestParams = { - value: QueryDenomsMetadataRequest, +type sendSupplyParams = { + value: Supply, fee?: StdFee, memo?: string }; -type sendSendAuthorizationParams = { - value: SendAuthorization, +type sendQuerySpendableBalancesResponseParams = { + value: QuerySpendableBalancesResponse, fee?: StdFee, memo?: string }; -type sendInputParams = { - value: Input, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type msgMultiSendParams = { - value: MsgMultiSend, +type queryDenomOwnersByQueryRequestParams = { + value: QueryDenomOwnersByQueryRequest, }; -type querySpendableBalanceByDenomResponseParams = { - value: QuerySpendableBalanceByDenomResponse, +type querySendEnabledResponseParams = { + value: QuerySendEnabledResponse, }; -type queryAllBalancesRequestParams = { - value: QueryAllBalancesRequest, +type sendEnabledParams = { + value: SendEnabled, }; -type querySendEnabledRequestParams = { - value: QuerySendEnabledRequest, +type queryDenomMetadataRequestParams = { + value: QueryDenomMetadataRequest, }; -type metadataParams = { - value: Metadata, +type queryDenomMetadataByQueryStringResponseParams = { + value: QueryDenomMetadataByQueryStringResponse, }; -type msgMultiSendResponseParams = { - value: MsgMultiSendResponse, +type queryAllBalancesResponseParams = { + value: QueryAllBalancesResponse, }; -type queryDenomsMetadataResponseParams = { - value: QueryDenomsMetadataResponse, +type querySpendableBalanceByDenomResponseParams = { + value: QuerySpendableBalanceByDenomResponse, }; -type queryDenomOwnersRequestParams = { - value: QueryDenomOwnersRequest, +type queryDenomMetadataByQueryStringRequestParams = { + value: QueryDenomMetadataByQueryStringRequest, }; -type denomUnitParams = { - value: DenomUnit, +type denomOwnerParams = { + value: DenomOwner, }; -type querySpendableBalanceByDenomRequestParams = { - value: QuerySpendableBalanceByDenomRequest, +type inputParams = { + value: Input, }; -type querySupplyOfRequestParams = { - value: QuerySupplyOfRequest, +type queryTotalSupplyRequestParams = { + value: QueryTotalSupplyRequest, }; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type queryTotalSupplyResponseParams = { + value: QueryTotalSupplyResponse, }; -type queryDenomOwnersResponseParams = { - value: QueryDenomOwnersResponse, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; -type queryDenomOwnersByQueryResponseParams = { - value: QueryDenomOwnersByQueryResponse, +type balanceParams = { + value: Balance, }; -type supplyParams = { - value: Supply, +type msgMultiSendParams = { + value: MsgMultiSend, }; -type queryTotalSupplyResponseParams = { - value: QueryTotalSupplyResponse, +type msgMultiSendResponseParams = { + value: MsgMultiSendResponse, }; -type queryDenomMetadataByQueryStringRequestParams = { - value: QueryDenomMetadataByQueryStringRequest, +type msgSetSendEnabledResponseParams = { + value: MsgSetSendEnabledResponse, }; -type genesisStateParams = { - value: GenesisState, +type queryDenomOwnersRequestParams = { + value: QueryDenomOwnersRequest, }; -type queryAllBalancesResponseParams = { - value: QueryAllBalancesResponse, +type paramsParams = { + value: Params, }; -type msgSetSendEnabledResponseParams = { - value: MsgSetSendEnabledResponse, -}; - -type querySpendableBalancesRequestParams = { - value: QuerySpendableBalancesRequest, -}; - -type querySpendableBalancesResponseParams = { - value: QuerySpendableBalancesResponse, +type querySpendableBalanceByDenomRequestParams = { + value: QuerySpendableBalanceByDenomRequest, }; -type queryDenomOwnersByQueryRequestParams = { - value: QueryDenomOwnersByQueryRequest, +type queryDenomMetadataResponseParams = { + value: QueryDenomMetadataResponse, }; -type balanceParams = { - value: Balance, +type outputParams = { + value: Output, }; -type paramsParams = { - value: Params, +type msgSetSendEnabledParams = { + value: MsgSetSendEnabled, }; -type queryBalanceResponseParams = { - value: QueryBalanceResponse, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type queryTotalSupplyRequestParams = { - value: QueryTotalSupplyRequest, +type sendAuthorizationParams = { + value: SendAuthorization, }; -type queryDenomMetadataByQueryStringResponseParams = { - value: QueryDenomMetadataByQueryStringResponse, +type queryDenomOwnersByQueryResponseParams = { + value: QueryDenomOwnersByQueryResponse, }; -type querySupplyOfResponseParams = { - value: QuerySupplyOfResponse, +type metadataParams = { + value: Metadata, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type genesisStateParams = { + value: GenesisState, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type msgSendParams = { + value: MsgSend, }; -type querySendEnabledResponseParams = { - value: QuerySendEnabledResponse, +type msgSendResponseParams = { + value: MsgSendResponse, }; -type outputParams = { - value: Output, +type queryDenomsMetadataResponseParams = { + value: QueryDenomsMetadataResponse, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type queryDenomOwnersResponseParams = { + value: QueryDenomOwnersResponse, }; -type msgSetSendEnabledParams = { - value: MsgSetSendEnabled, +type denomUnitParams = { + value: DenomUnit, }; type queryBalanceRequestParams = { value: QueryBalanceRequest, }; -type queryDenomMetadataResponseParams = { - value: QueryDenomMetadataResponse, +type queryAllBalancesRequestParams = { + value: QueryAllBalancesRequest, }; -type msgSendParams = { - value: MsgSend, +type querySupplyOfRequestParams = { + value: QuerySupplyOfRequest, }; -type msgSendResponseParams = { - value: MsgSendResponse, +type querySupplyOfResponseParams = { + value: QuerySupplyOfResponse, }; -type queryDenomMetadataRequestParams = { - value: QueryDenomMetadataRequest, +type querySendEnabledRequestParams = { + value: QuerySendEnabledRequest, }; -type denomOwnerParams = { - value: DenomOwner, +type queryBalanceResponseParams = { + value: QueryBalanceResponse, }; -type sendEnabledParams = { - value: SendEnabled, +type querySpendableBalancesRequestParams = { + value: QuerySpendableBalancesRequest, +}; + +type queryParamsResponseParams = { + value: QueryParamsResponse, }; type queryDenomsMetadataRequestParams = { value: QueryDenomsMetadataRequest, }; -type sendAuthorizationParams = { - value: SendAuthorization, +type supplyParams = { + value: Supply, }; -type inputParams = { - value: Input, +type querySpendableBalancesResponseParams = { + value: QuerySpendableBalancesResponse, +}; + +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; @@ -536,994 +536,994 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgMultiSend({ value, fee, memo }: sendMsgMultiSendParams): Promise { + async sendQueryDenomOwnersByQueryRequest({ value, fee, memo }: sendQueryDenomOwnersByQueryRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgMultiSend: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomOwnersByQueryRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgMultiSend({ value: MsgMultiSend.fromPartial(value) }) + let msg = this.queryDenomOwnersByQueryRequest({ value: QueryDenomOwnersByQueryRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgMultiSend: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomOwnersByQueryRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySpendableBalanceByDenomResponse({ value, fee, memo }: sendQuerySpendableBalanceByDenomResponseParams): Promise { + async sendQuerySendEnabledResponse({ value, fee, memo }: sendQuerySendEnabledResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySpendableBalanceByDenomResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySendEnabledResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySpendableBalanceByDenomResponse({ value: QuerySpendableBalanceByDenomResponse.fromPartial(value) }) + let msg = this.querySendEnabledResponse({ value: QuerySendEnabledResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySpendableBalanceByDenomResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySendEnabledResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllBalancesRequest({ value, fee, memo }: sendQueryAllBalancesRequestParams): Promise { + async sendSendEnabled({ value, fee, memo }: sendSendEnabledParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllBalancesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSendEnabled: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllBalancesRequest({ value: QueryAllBalancesRequest.fromPartial(value) }) + let msg = this.sendEnabled({ value: SendEnabled.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllBalancesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSendEnabled: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySendEnabledRequest({ value, fee, memo }: sendQuerySendEnabledRequestParams): Promise { + async sendQueryDenomMetadataRequest({ value, fee, memo }: sendQueryDenomMetadataRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySendEnabledRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomMetadataRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySendEnabledRequest({ value: QuerySendEnabledRequest.fromPartial(value) }) + let msg = this.queryDenomMetadataRequest({ value: QueryDenomMetadataRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySendEnabledRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomMetadataRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMetadata({ value, fee, memo }: sendMetadataParams): Promise { + async sendQueryDenomMetadataByQueryStringResponse({ value, fee, memo }: sendQueryDenomMetadataByQueryStringResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMetadata: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomMetadataByQueryStringResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.metadata({ value: Metadata.fromPartial(value) }) + let msg = this.queryDenomMetadataByQueryStringResponse({ value: QueryDenomMetadataByQueryStringResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMetadata: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomMetadataByQueryStringResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgMultiSendResponse({ value, fee, memo }: sendMsgMultiSendResponseParams): Promise { + async sendQueryAllBalancesResponse({ value, fee, memo }: sendQueryAllBalancesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgMultiSendResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllBalancesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgMultiSendResponse({ value: MsgMultiSendResponse.fromPartial(value) }) + let msg = this.queryAllBalancesResponse({ value: QueryAllBalancesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgMultiSendResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllBalancesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomsMetadataResponse({ value, fee, memo }: sendQueryDenomsMetadataResponseParams): Promise { + async sendQuerySpendableBalanceByDenomResponse({ value, fee, memo }: sendQuerySpendableBalanceByDenomResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomsMetadataResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySpendableBalanceByDenomResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomsMetadataResponse({ value: QueryDenomsMetadataResponse.fromPartial(value) }) + let msg = this.querySpendableBalanceByDenomResponse({ value: QuerySpendableBalanceByDenomResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomsMetadataResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySpendableBalanceByDenomResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomOwnersRequest({ value, fee, memo }: sendQueryDenomOwnersRequestParams): Promise { + async sendQueryDenomMetadataByQueryStringRequest({ value, fee, memo }: sendQueryDenomMetadataByQueryStringRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomOwnersRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomMetadataByQueryStringRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomOwnersRequest({ value: QueryDenomOwnersRequest.fromPartial(value) }) + let msg = this.queryDenomMetadataByQueryStringRequest({ value: QueryDenomMetadataByQueryStringRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomOwnersRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomMetadataByQueryStringRequest: Could not broadcast Tx: '+ e.message) } }, - async sendDenomUnit({ value, fee, memo }: sendDenomUnitParams): Promise { + async sendDenomOwner({ value, fee, memo }: sendDenomOwnerParams): Promise { if (!signer) { - throw new Error('TxClient:sendDenomUnit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDenomOwner: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.denomUnit({ value: DenomUnit.fromPartial(value) }) + let msg = this.denomOwner({ value: DenomOwner.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDenomUnit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDenomOwner: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySpendableBalanceByDenomRequest({ value, fee, memo }: sendQuerySpendableBalanceByDenomRequestParams): Promise { + async sendInput({ value, fee, memo }: sendInputParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySpendableBalanceByDenomRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendInput: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySpendableBalanceByDenomRequest({ value: QuerySpendableBalanceByDenomRequest.fromPartial(value) }) + let msg = this.input({ value: Input.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySpendableBalanceByDenomRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendInput: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySupplyOfRequest({ value, fee, memo }: sendQuerySupplyOfRequestParams): Promise { + async sendQueryTotalSupplyRequest({ value, fee, memo }: sendQueryTotalSupplyRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySupplyOfRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalSupplyRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySupplyOfRequest({ value: QuerySupplyOfRequest.fromPartial(value) }) + let msg = this.queryTotalSupplyRequest({ value: QueryTotalSupplyRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySupplyOfRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalSupplyRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendQueryTotalSupplyResponse({ value, fee, memo }: sendQueryTotalSupplyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalSupplyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.queryTotalSupplyResponse({ value: QueryTotalSupplyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalSupplyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomOwnersResponse({ value, fee, memo }: sendQueryDenomOwnersResponseParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomOwnersResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomOwnersResponse({ value: QueryDenomOwnersResponse.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomOwnersResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomOwnersByQueryResponse({ value, fee, memo }: sendQueryDenomOwnersByQueryResponseParams): Promise { + async sendBalance({ value, fee, memo }: sendBalanceParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomOwnersByQueryResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendBalance: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomOwnersByQueryResponse({ value: QueryDenomOwnersByQueryResponse.fromPartial(value) }) + let msg = this.balance({ value: Balance.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomOwnersByQueryResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendBalance: Could not broadcast Tx: '+ e.message) } }, - async sendSupply({ value, fee, memo }: sendSupplyParams): Promise { + async sendMsgMultiSend({ value, fee, memo }: sendMsgMultiSendParams): Promise { if (!signer) { - throw new Error('TxClient:sendSupply: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgMultiSend: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.supply({ value: Supply.fromPartial(value) }) + let msg = this.msgMultiSend({ value: MsgMultiSend.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSupply: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgMultiSend: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalSupplyResponse({ value, fee, memo }: sendQueryTotalSupplyResponseParams): Promise { + async sendMsgMultiSendResponse({ value, fee, memo }: sendMsgMultiSendResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalSupplyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgMultiSendResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalSupplyResponse({ value: QueryTotalSupplyResponse.fromPartial(value) }) + let msg = this.msgMultiSendResponse({ value: MsgMultiSendResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalSupplyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgMultiSendResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomMetadataByQueryStringRequest({ value, fee, memo }: sendQueryDenomMetadataByQueryStringRequestParams): Promise { + async sendMsgSetSendEnabledResponse({ value, fee, memo }: sendMsgSetSendEnabledResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomMetadataByQueryStringRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSetSendEnabledResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomMetadataByQueryStringRequest({ value: QueryDenomMetadataByQueryStringRequest.fromPartial(value) }) + let msg = this.msgSetSendEnabledResponse({ value: MsgSetSendEnabledResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomMetadataByQueryStringRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSetSendEnabledResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryDenomOwnersRequest({ value, fee, memo }: sendQueryDenomOwnersRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomOwnersRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryDenomOwnersRequest({ value: QueryDenomOwnersRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomOwnersRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllBalancesResponse({ value, fee, memo }: sendQueryAllBalancesResponseParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllBalancesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllBalancesResponse({ value: QueryAllBalancesResponse.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllBalancesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSetSendEnabledResponse({ value, fee, memo }: sendMsgSetSendEnabledResponseParams): Promise { + async sendQuerySpendableBalanceByDenomRequest({ value, fee, memo }: sendQuerySpendableBalanceByDenomRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSetSendEnabledResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySpendableBalanceByDenomRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSetSendEnabledResponse({ value: MsgSetSendEnabledResponse.fromPartial(value) }) + let msg = this.querySpendableBalanceByDenomRequest({ value: QuerySpendableBalanceByDenomRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSetSendEnabledResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySpendableBalanceByDenomRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySpendableBalancesRequest({ value, fee, memo }: sendQuerySpendableBalancesRequestParams): Promise { + async sendQueryDenomMetadataResponse({ value, fee, memo }: sendQueryDenomMetadataResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySpendableBalancesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomMetadataResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySpendableBalancesRequest({ value: QuerySpendableBalancesRequest.fromPartial(value) }) + let msg = this.queryDenomMetadataResponse({ value: QueryDenomMetadataResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySpendableBalancesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomMetadataResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySpendableBalancesResponse({ value, fee, memo }: sendQuerySpendableBalancesResponseParams): Promise { + async sendOutput({ value, fee, memo }: sendOutputParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySpendableBalancesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendOutput: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySpendableBalancesResponse({ value: QuerySpendableBalancesResponse.fromPartial(value) }) + let msg = this.output({ value: Output.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySpendableBalancesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendOutput: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomOwnersByQueryRequest({ value, fee, memo }: sendQueryDenomOwnersByQueryRequestParams): Promise { + async sendMsgSetSendEnabled({ value, fee, memo }: sendMsgSetSendEnabledParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomOwnersByQueryRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSetSendEnabled: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomOwnersByQueryRequest({ value: QueryDenomOwnersByQueryRequest.fromPartial(value) }) + let msg = this.msgSetSendEnabled({ value: MsgSetSendEnabled.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomOwnersByQueryRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSetSendEnabled: Could not broadcast Tx: '+ e.message) } }, - async sendBalance({ value, fee, memo }: sendBalanceParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendBalance: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.balance({ value: Balance.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendBalance: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendSendAuthorization({ value, fee, memo }: sendSendAuthorizationParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSendAuthorization: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.sendAuthorization({ value: SendAuthorization.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSendAuthorization: Could not broadcast Tx: '+ e.message) } }, - async sendQueryBalanceResponse({ value, fee, memo }: sendQueryBalanceResponseParams): Promise { + async sendQueryDenomOwnersByQueryResponse({ value, fee, memo }: sendQueryDenomOwnersByQueryResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryBalanceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomOwnersByQueryResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryBalanceResponse({ value: QueryBalanceResponse.fromPartial(value) }) + let msg = this.queryDenomOwnersByQueryResponse({ value: QueryDenomOwnersByQueryResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryBalanceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomOwnersByQueryResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalSupplyRequest({ value, fee, memo }: sendQueryTotalSupplyRequestParams): Promise { + async sendMetadata({ value, fee, memo }: sendMetadataParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalSupplyRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMetadata: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalSupplyRequest({ value: QueryTotalSupplyRequest.fromPartial(value) }) + let msg = this.metadata({ value: Metadata.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalSupplyRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMetadata: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomMetadataByQueryStringResponse({ value, fee, memo }: sendQueryDenomMetadataByQueryStringResponseParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomMetadataByQueryStringResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomMetadataByQueryStringResponse({ value: QueryDenomMetadataByQueryStringResponse.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomMetadataByQueryStringResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySupplyOfResponse({ value, fee, memo }: sendQuerySupplyOfResponseParams): Promise { + async sendMsgSend({ value, fee, memo }: sendMsgSendParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySupplyOfResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSend: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySupplyOfResponse({ value: QuerySupplyOfResponse.fromPartial(value) }) + let msg = this.msgSend({ value: MsgSend.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySupplyOfResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSend: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendMsgSendResponse({ value, fee, memo }: sendMsgSendResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSendResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.msgSendResponse({ value: MsgSendResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSendResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendQueryDenomsMetadataResponse({ value, fee, memo }: sendQueryDenomsMetadataResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomsMetadataResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.queryDenomsMetadataResponse({ value: QueryDenomsMetadataResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomsMetadataResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySendEnabledResponse({ value, fee, memo }: sendQuerySendEnabledResponseParams): Promise { + async sendQueryDenomOwnersResponse({ value, fee, memo }: sendQueryDenomOwnersResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySendEnabledResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomOwnersResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySendEnabledResponse({ value: QuerySendEnabledResponse.fromPartial(value) }) + let msg = this.queryDenomOwnersResponse({ value: QueryDenomOwnersResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySendEnabledResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomOwnersResponse: Could not broadcast Tx: '+ e.message) } }, - async sendOutput({ value, fee, memo }: sendOutputParams): Promise { + async sendDenomUnit({ value, fee, memo }: sendDenomUnitParams): Promise { if (!signer) { - throw new Error('TxClient:sendOutput: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDenomUnit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.output({ value: Output.fromPartial(value) }) + let msg = this.denomUnit({ value: DenomUnit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendOutput: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDenomUnit: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendQueryBalanceRequest({ value, fee, memo }: sendQueryBalanceRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryBalanceRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.queryBalanceRequest({ value: QueryBalanceRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryBalanceRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSetSendEnabled({ value, fee, memo }: sendMsgSetSendEnabledParams): Promise { + async sendQueryAllBalancesRequest({ value, fee, memo }: sendQueryAllBalancesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSetSendEnabled: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllBalancesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSetSendEnabled({ value: MsgSetSendEnabled.fromPartial(value) }) + let msg = this.queryAllBalancesRequest({ value: QueryAllBalancesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSetSendEnabled: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllBalancesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryBalanceRequest({ value, fee, memo }: sendQueryBalanceRequestParams): Promise { + async sendQuerySupplyOfRequest({ value, fee, memo }: sendQuerySupplyOfRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryBalanceRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySupplyOfRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryBalanceRequest({ value: QueryBalanceRequest.fromPartial(value) }) + let msg = this.querySupplyOfRequest({ value: QuerySupplyOfRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryBalanceRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySupplyOfRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomMetadataResponse({ value, fee, memo }: sendQueryDenomMetadataResponseParams): Promise { + async sendQuerySupplyOfResponse({ value, fee, memo }: sendQuerySupplyOfResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomMetadataResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySupplyOfResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomMetadataResponse({ value: QueryDenomMetadataResponse.fromPartial(value) }) + let msg = this.querySupplyOfResponse({ value: QuerySupplyOfResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomMetadataResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySupplyOfResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSend({ value, fee, memo }: sendMsgSendParams): Promise { + async sendQuerySendEnabledRequest({ value, fee, memo }: sendQuerySendEnabledRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSend: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySendEnabledRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSend({ value: MsgSend.fromPartial(value) }) + let msg = this.querySendEnabledRequest({ value: QuerySendEnabledRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSend: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySendEnabledRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSendResponse({ value, fee, memo }: sendMsgSendResponseParams): Promise { + async sendQueryBalanceResponse({ value, fee, memo }: sendQueryBalanceResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSendResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryBalanceResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSendResponse({ value: MsgSendResponse.fromPartial(value) }) + let msg = this.queryBalanceResponse({ value: QueryBalanceResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSendResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryBalanceResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomMetadataRequest({ value, fee, memo }: sendQueryDenomMetadataRequestParams): Promise { + async sendQuerySpendableBalancesRequest({ value, fee, memo }: sendQuerySpendableBalancesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomMetadataRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySpendableBalancesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomMetadataRequest({ value: QueryDenomMetadataRequest.fromPartial(value) }) + let msg = this.querySpendableBalancesRequest({ value: QuerySpendableBalancesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomMetadataRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySpendableBalancesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendDenomOwner({ value, fee, memo }: sendDenomOwnerParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendDenomOwner: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.denomOwner({ value: DenomOwner.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDenomOwner: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendSendEnabled({ value, fee, memo }: sendSendEnabledParams): Promise { + async sendQueryDenomsMetadataRequest({ value, fee, memo }: sendQueryDenomsMetadataRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendSendEnabled: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomsMetadataRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.sendEnabled({ value: SendEnabled.fromPartial(value) }) + let msg = this.queryDenomsMetadataRequest({ value: QueryDenomsMetadataRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSendEnabled: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomsMetadataRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomsMetadataRequest({ value, fee, memo }: sendQueryDenomsMetadataRequestParams): Promise { + async sendSupply({ value, fee, memo }: sendSupplyParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomsMetadataRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSupply: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomsMetadataRequest({ value: QueryDenomsMetadataRequest.fromPartial(value) }) + let msg = this.supply({ value: Supply.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomsMetadataRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSupply: Could not broadcast Tx: '+ e.message) } }, - async sendSendAuthorization({ value, fee, memo }: sendSendAuthorizationParams): Promise { + async sendQuerySpendableBalancesResponse({ value, fee, memo }: sendQuerySpendableBalancesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendSendAuthorization: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySpendableBalancesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.sendAuthorization({ value: SendAuthorization.fromPartial(value) }) + let msg = this.querySpendableBalancesResponse({ value: QuerySpendableBalancesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSendAuthorization: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySpendableBalancesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendInput({ value, fee, memo }: sendInputParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendInput: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.input({ value: Input.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendInput: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - msgMultiSend({ value }: msgMultiSendParams): EncodeObject { + queryDenomOwnersByQueryRequest({ value }: queryDenomOwnersByQueryRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: MsgMultiSend.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest", value: QueryDenomOwnersByQueryRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgMultiSend: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomOwnersByQueryRequest: Could not create message: ' + e.message) } }, - querySpendableBalanceByDenomResponse({ value }: querySpendableBalanceByDenomResponseParams): EncodeObject { + querySendEnabledResponse({ value }: querySendEnabledResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse", value: QuerySpendableBalanceByDenomResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse", value: QuerySendEnabledResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySpendableBalanceByDenomResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySendEnabledResponse: Could not create message: ' + e.message) } }, - queryAllBalancesRequest({ value }: queryAllBalancesRequestParams): EncodeObject { + sendEnabled({ value }: sendEnabledParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", value: QueryAllBalancesRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.SendEnabled", value: SendEnabled.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllBalancesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:SendEnabled: Could not create message: ' + e.message) } }, - querySendEnabledRequest({ value }: querySendEnabledRequestParams): EncodeObject { + queryDenomMetadataRequest({ value }: queryDenomMetadataRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest", value: QuerySendEnabledRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", value: QueryDenomMetadataRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySendEnabledRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomMetadataRequest: Could not create message: ' + e.message) } }, - metadata({ value }: metadataParams): EncodeObject { + queryDenomMetadataByQueryStringResponse({ value }: queryDenomMetadataByQueryStringResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.Metadata", value: Metadata.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse", value: QueryDenomMetadataByQueryStringResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Metadata: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomMetadataByQueryStringResponse: Could not create message: ' + e.message) } }, - msgMultiSendResponse({ value }: msgMultiSendResponseParams): EncodeObject { + queryAllBalancesResponse({ value }: queryAllBalancesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", value: MsgMultiSendResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", value: QueryAllBalancesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgMultiSendResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAllBalancesResponse: Could not create message: ' + e.message) } }, - queryDenomsMetadataResponse({ value }: queryDenomsMetadataResponseParams): EncodeObject { + querySpendableBalanceByDenomResponse({ value }: querySpendableBalanceByDenomResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", value: QueryDenomsMetadataResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse", value: QuerySpendableBalanceByDenomResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomsMetadataResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySpendableBalanceByDenomResponse: Could not create message: ' + e.message) } }, - queryDenomOwnersRequest({ value }: queryDenomOwnersRequestParams): EncodeObject { + queryDenomMetadataByQueryStringRequest({ value }: queryDenomMetadataByQueryStringRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", value: QueryDenomOwnersRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest", value: QueryDenomMetadataByQueryStringRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomOwnersRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomMetadataByQueryStringRequest: Could not create message: ' + e.message) } }, - denomUnit({ value }: denomUnitParams): EncodeObject { + denomOwner({ value }: denomOwnerParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.DenomUnit", value: DenomUnit.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.DenomOwner", value: DenomOwner.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DenomUnit: Could not create message: ' + e.message) + throw new Error('TxClient:DenomOwner: Could not create message: ' + e.message) } }, - querySpendableBalanceByDenomRequest({ value }: querySpendableBalanceByDenomRequestParams): EncodeObject { + input({ value }: inputParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", value: QuerySpendableBalanceByDenomRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.Input", value: Input.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySpendableBalanceByDenomRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Input: Could not create message: ' + e.message) } }, - querySupplyOfRequest({ value }: querySupplyOfRequestParams): EncodeObject { + queryTotalSupplyRequest({ value }: queryTotalSupplyRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", value: QuerySupplyOfRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", value: QueryTotalSupplyRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySupplyOfRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalSupplyRequest: Could not create message: ' + e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + queryTotalSupplyResponse({ value }: queryTotalSupplyResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", value: QueryTotalSupplyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalSupplyResponse: Could not create message: ' + e.message) } }, - queryDenomOwnersResponse({ value }: queryDenomOwnersResponseParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", value: QueryDenomOwnersResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomOwnersResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - queryDenomOwnersByQueryResponse({ value }: queryDenomOwnersByQueryResponseParams): EncodeObject { + balance({ value }: balanceParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse", value: QueryDenomOwnersByQueryResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.Balance", value: Balance.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomOwnersByQueryResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Balance: Could not create message: ' + e.message) } }, - supply({ value }: supplyParams): EncodeObject { + msgMultiSend({ value }: msgMultiSendParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.Supply", value: Supply.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: MsgMultiSend.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Supply: Could not create message: ' + e.message) + throw new Error('TxClient:MsgMultiSend: Could not create message: ' + e.message) } }, - queryTotalSupplyResponse({ value }: queryTotalSupplyResponseParams): EncodeObject { + msgMultiSendResponse({ value }: msgMultiSendResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", value: QueryTotalSupplyResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", value: MsgMultiSendResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalSupplyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgMultiSendResponse: Could not create message: ' + e.message) } }, - queryDenomMetadataByQueryStringRequest({ value }: queryDenomMetadataByQueryStringRequestParams): EncodeObject { + msgSetSendEnabledResponse({ value }: msgSetSendEnabledResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest", value: QueryDenomMetadataByQueryStringRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", value: MsgSetSendEnabledResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomMetadataByQueryStringRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSetSendEnabledResponse: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryDenomOwnersRequest({ value }: queryDenomOwnersRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", value: QueryDenomOwnersRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomOwnersRequest: Could not create message: ' + e.message) } }, - queryAllBalancesResponse({ value }: queryAllBalancesResponseParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", value: QueryAllBalancesResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllBalancesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - msgSetSendEnabledResponse({ value }: msgSetSendEnabledResponseParams): EncodeObject { + querySpendableBalanceByDenomRequest({ value }: querySpendableBalanceByDenomRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", value: MsgSetSendEnabledResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", value: QuerySpendableBalanceByDenomRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSetSendEnabledResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySpendableBalanceByDenomRequest: Could not create message: ' + e.message) } }, - querySpendableBalancesRequest({ value }: querySpendableBalancesRequestParams): EncodeObject { + queryDenomMetadataResponse({ value }: queryDenomMetadataResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", value: QuerySpendableBalancesRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", value: QueryDenomMetadataResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySpendableBalancesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomMetadataResponse: Could not create message: ' + e.message) } }, - querySpendableBalancesResponse({ value }: querySpendableBalancesResponseParams): EncodeObject { + output({ value }: outputParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", value: QuerySpendableBalancesResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.Output", value: Output.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySpendableBalancesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Output: Could not create message: ' + e.message) } }, - queryDenomOwnersByQueryRequest({ value }: queryDenomOwnersByQueryRequestParams): EncodeObject { + msgSetSendEnabled({ value }: msgSetSendEnabledParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest", value: QueryDenomOwnersByQueryRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", value: MsgSetSendEnabled.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomOwnersByQueryRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSetSendEnabled: Could not create message: ' + e.message) } }, - balance({ value }: balanceParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.Balance", value: Balance.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Balance: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + sendAuthorization({ value }: sendAuthorizationParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", value: SendAuthorization.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:SendAuthorization: Could not create message: ' + e.message) } }, - queryBalanceResponse({ value }: queryBalanceResponseParams): EncodeObject { + queryDenomOwnersByQueryResponse({ value }: queryDenomOwnersByQueryResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", value: QueryBalanceResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse", value: QueryDenomOwnersByQueryResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryBalanceResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomOwnersByQueryResponse: Could not create message: ' + e.message) } }, - queryTotalSupplyRequest({ value }: queryTotalSupplyRequestParams): EncodeObject { + metadata({ value }: metadataParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", value: QueryTotalSupplyRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.Metadata", value: Metadata.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalSupplyRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Metadata: Could not create message: ' + e.message) } }, - queryDenomMetadataByQueryStringResponse({ value }: queryDenomMetadataByQueryStringResponseParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse", value: QueryDenomMetadataByQueryStringResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomMetadataByQueryStringResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - querySupplyOfResponse({ value }: querySupplyOfResponseParams): EncodeObject { + msgSend({ value }: msgSendParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", value: QuerySupplyOfResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.MsgSend", value: MsgSend.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySupplyOfResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSend: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + msgSendResponse({ value }: msgSendResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", value: MsgSendResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSendResponse: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + queryDenomsMetadataResponse({ value }: queryDenomsMetadataResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", value: QueryDenomsMetadataResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomsMetadataResponse: Could not create message: ' + e.message) } }, - querySendEnabledResponse({ value }: querySendEnabledResponseParams): EncodeObject { + queryDenomOwnersResponse({ value }: queryDenomOwnersResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse", value: QuerySendEnabledResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", value: QueryDenomOwnersResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySendEnabledResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomOwnersResponse: Could not create message: ' + e.message) } }, - output({ value }: outputParams): EncodeObject { + denomUnit({ value }: denomUnitParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.Output", value: Output.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.DenomUnit", value: DenomUnit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Output: Could not create message: ' + e.message) + throw new Error('TxClient:DenomUnit: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + queryBalanceRequest({ value }: queryBalanceRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", value: QueryBalanceRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryBalanceRequest: Could not create message: ' + e.message) } }, - msgSetSendEnabled({ value }: msgSetSendEnabledParams): EncodeObject { + queryAllBalancesRequest({ value }: queryAllBalancesRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", value: MsgSetSendEnabled.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", value: QueryAllBalancesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSetSendEnabled: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAllBalancesRequest: Could not create message: ' + e.message) } }, - queryBalanceRequest({ value }: queryBalanceRequestParams): EncodeObject { + querySupplyOfRequest({ value }: querySupplyOfRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", value: QueryBalanceRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", value: QuerySupplyOfRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryBalanceRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySupplyOfRequest: Could not create message: ' + e.message) } }, - queryDenomMetadataResponse({ value }: queryDenomMetadataResponseParams): EncodeObject { + querySupplyOfResponse({ value }: querySupplyOfResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", value: QueryDenomMetadataResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", value: QuerySupplyOfResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomMetadataResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySupplyOfResponse: Could not create message: ' + e.message) } }, - msgSend({ value }: msgSendParams): EncodeObject { + querySendEnabledRequest({ value }: querySendEnabledRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.MsgSend", value: MsgSend.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest", value: QuerySendEnabledRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSend: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySendEnabledRequest: Could not create message: ' + e.message) } }, - msgSendResponse({ value }: msgSendResponseParams): EncodeObject { + queryBalanceResponse({ value }: queryBalanceResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", value: MsgSendResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", value: QueryBalanceResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSendResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryBalanceResponse: Could not create message: ' + e.message) } }, - queryDenomMetadataRequest({ value }: queryDenomMetadataRequestParams): EncodeObject { + querySpendableBalancesRequest({ value }: querySpendableBalancesRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", value: QueryDenomMetadataRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", value: QuerySpendableBalancesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomMetadataRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySpendableBalancesRequest: Could not create message: ' + e.message) } }, - denomOwner({ value }: denomOwnerParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.DenomOwner", value: DenomOwner.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DenomOwner: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - sendEnabled({ value }: sendEnabledParams): EncodeObject { + queryDenomsMetadataRequest({ value }: queryDenomsMetadataRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.SendEnabled", value: SendEnabled.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", value: QueryDenomsMetadataRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SendEnabled: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomsMetadataRequest: Could not create message: ' + e.message) } }, - queryDenomsMetadataRequest({ value }: queryDenomsMetadataRequestParams): EncodeObject { + supply({ value }: supplyParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", value: QueryDenomsMetadataRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.Supply", value: Supply.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomsMetadataRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Supply: Could not create message: ' + e.message) } }, - sendAuthorization({ value }: sendAuthorizationParams): EncodeObject { + querySpendableBalancesResponse({ value }: querySpendableBalancesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", value: SendAuthorization.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", value: QuerySpendableBalancesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SendAuthorization: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySpendableBalancesResponse: Could not create message: ' + e.message) } }, - input({ value }: inputParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.bank.v1beta1.Input", value: Input.fromPartial( value ) } + return { typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Input: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.bank.v1beta1/registry.ts b/ts-client/cosmos.bank.v1beta1/registry.ts index dfd5c22c..04dc916c 100755 --- a/ts-client/cosmos.bank.v1beta1/registry.ts +++ b/ts-client/cosmos.bank.v1beta1/registry.ts @@ -1,96 +1,96 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgMultiSend } from "./types/cosmos/bank/v1beta1/tx"; -import { QuerySpendableBalanceByDenomResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryAllBalancesRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySendEnabledRequest } from "./types/cosmos/bank/v1beta1/query"; -import { Metadata } from "./types/cosmos/bank/v1beta1/bank"; -import { MsgMultiSendResponse } from "./types/cosmos/bank/v1beta1/tx"; -import { QueryDenomsMetadataResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomOwnersRequest } from "./types/cosmos/bank/v1beta1/query"; -import { DenomUnit } from "./types/cosmos/bank/v1beta1/bank"; -import { QuerySpendableBalanceByDenomRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySupplyOfRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QueryParamsResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomOwnersResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomOwnersByQueryResponse } from "./types/cosmos/bank/v1beta1/query"; -import { Supply } from "./types/cosmos/bank/v1beta1/bank"; -import { QueryTotalSupplyResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomMetadataByQueryStringRequest } from "./types/cosmos/bank/v1beta1/query"; -import { GenesisState } from "./types/cosmos/bank/v1beta1/genesis"; -import { QueryAllBalancesResponse } from "./types/cosmos/bank/v1beta1/query"; -import { MsgSetSendEnabledResponse } from "./types/cosmos/bank/v1beta1/tx"; -import { QuerySpendableBalancesRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySpendableBalancesResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomOwnersByQueryRequest } from "./types/cosmos/bank/v1beta1/query"; -import { Balance } from "./types/cosmos/bank/v1beta1/genesis"; -import { Params } from "./types/cosmos/bank/v1beta1/bank"; -import { QueryBalanceResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QueryTotalSupplyRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomMetadataByQueryStringResponse } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySupplyOfResponse } from "./types/cosmos/bank/v1beta1/query"; -import { MsgUpdateParams } from "./types/cosmos/bank/v1beta1/tx"; -import { QueryParamsRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QuerySendEnabledResponse } from "./types/cosmos/bank/v1beta1/query"; -import { Output } from "./types/cosmos/bank/v1beta1/bank"; -import { MsgUpdateParamsResponse } from "./types/cosmos/bank/v1beta1/tx"; -import { MsgSetSendEnabled } from "./types/cosmos/bank/v1beta1/tx"; -import { QueryBalanceRequest } from "./types/cosmos/bank/v1beta1/query"; -import { QueryDenomMetadataResponse } from "./types/cosmos/bank/v1beta1/query"; -import { MsgSend } from "./types/cosmos/bank/v1beta1/tx"; -import { MsgSendResponse } from "./types/cosmos/bank/v1beta1/tx"; -import { QueryDenomMetadataRequest } from "./types/cosmos/bank/v1beta1/query"; -import { DenomOwner } from "./types/cosmos/bank/v1beta1/query"; -import { SendEnabled } from "./types/cosmos/bank/v1beta1/bank"; -import { QueryDenomsMetadataRequest } from "./types/cosmos/bank/v1beta1/query"; -import { SendAuthorization } from "./types/cosmos/bank/v1beta1/authz"; -import { Input } from "./types/cosmos/bank/v1beta1/bank"; +import { QueryDenomOwnersByQueryRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySendEnabledResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { SendEnabled } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QueryDenomMetadataRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomMetadataByQueryStringResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryAllBalancesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySpendableBalanceByDenomResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomMetadataByQueryStringRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { DenomOwner } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Input } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QueryTotalSupplyRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryTotalSupplyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Balance } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/genesis"; +import { MsgMultiSend } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { MsgMultiSendResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { MsgSetSendEnabledResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { QueryDenomOwnersRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QuerySpendableBalanceByDenomRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomMetadataResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Output } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { MsgSetSendEnabled } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { SendAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/authz"; +import { QueryDenomOwnersByQueryResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Metadata } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/genesis"; +import { MsgSend } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { MsgSendResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; +import { QueryDenomsMetadataResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomOwnersResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { DenomUnit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QueryBalanceRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryAllBalancesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySupplyOfRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySupplyOfResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySendEnabledRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryBalanceResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QuerySpendableBalancesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { QueryDenomsMetadataRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { Supply } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/bank"; +import { QuerySpendableBalancesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/bank/v1beta1/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend], + ["/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest", QueryDenomOwnersByQueryRequest], + ["/cosmos.bank.v1beta1.QuerySendEnabledResponse", QuerySendEnabledResponse], + ["/cosmos.bank.v1beta1.SendEnabled", SendEnabled], + ["/cosmos.bank.v1beta1.QueryDenomMetadataRequest", QueryDenomMetadataRequest], + ["/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse", QueryDenomMetadataByQueryStringResponse], + ["/cosmos.bank.v1beta1.QueryAllBalancesResponse", QueryAllBalancesResponse], ["/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse", QuerySpendableBalanceByDenomResponse], - ["/cosmos.bank.v1beta1.QueryAllBalancesRequest", QueryAllBalancesRequest], - ["/cosmos.bank.v1beta1.QuerySendEnabledRequest", QuerySendEnabledRequest], - ["/cosmos.bank.v1beta1.Metadata", Metadata], - ["/cosmos.bank.v1beta1.MsgMultiSendResponse", MsgMultiSendResponse], - ["/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", QueryDenomsMetadataResponse], - ["/cosmos.bank.v1beta1.QueryDenomOwnersRequest", QueryDenomOwnersRequest], - ["/cosmos.bank.v1beta1.DenomUnit", DenomUnit], - ["/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", QuerySpendableBalanceByDenomRequest], - ["/cosmos.bank.v1beta1.QuerySupplyOfRequest", QuerySupplyOfRequest], - ["/cosmos.bank.v1beta1.QueryParamsResponse", QueryParamsResponse], - ["/cosmos.bank.v1beta1.QueryDenomOwnersResponse", QueryDenomOwnersResponse], - ["/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse", QueryDenomOwnersByQueryResponse], - ["/cosmos.bank.v1beta1.Supply", Supply], - ["/cosmos.bank.v1beta1.QueryTotalSupplyResponse", QueryTotalSupplyResponse], ["/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest", QueryDenomMetadataByQueryStringRequest], - ["/cosmos.bank.v1beta1.GenesisState", GenesisState], - ["/cosmos.bank.v1beta1.QueryAllBalancesResponse", QueryAllBalancesResponse], - ["/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", MsgSetSendEnabledResponse], - ["/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", QuerySpendableBalancesRequest], - ["/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", QuerySpendableBalancesResponse], - ["/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest", QueryDenomOwnersByQueryRequest], - ["/cosmos.bank.v1beta1.Balance", Balance], - ["/cosmos.bank.v1beta1.Params", Params], - ["/cosmos.bank.v1beta1.QueryBalanceResponse", QueryBalanceResponse], + ["/cosmos.bank.v1beta1.DenomOwner", DenomOwner], + ["/cosmos.bank.v1beta1.Input", Input], ["/cosmos.bank.v1beta1.QueryTotalSupplyRequest", QueryTotalSupplyRequest], - ["/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse", QueryDenomMetadataByQueryStringResponse], - ["/cosmos.bank.v1beta1.QuerySupplyOfResponse", QuerySupplyOfResponse], - ["/cosmos.bank.v1beta1.MsgUpdateParams", MsgUpdateParams], + ["/cosmos.bank.v1beta1.QueryTotalSupplyResponse", QueryTotalSupplyResponse], ["/cosmos.bank.v1beta1.QueryParamsRequest", QueryParamsRequest], - ["/cosmos.bank.v1beta1.QuerySendEnabledResponse", QuerySendEnabledResponse], + ["/cosmos.bank.v1beta1.Balance", Balance], + ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend], + ["/cosmos.bank.v1beta1.MsgMultiSendResponse", MsgMultiSendResponse], + ["/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", MsgSetSendEnabledResponse], + ["/cosmos.bank.v1beta1.QueryDenomOwnersRequest", QueryDenomOwnersRequest], + ["/cosmos.bank.v1beta1.Params", Params], + ["/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", QuerySpendableBalanceByDenomRequest], + ["/cosmos.bank.v1beta1.QueryDenomMetadataResponse", QueryDenomMetadataResponse], ["/cosmos.bank.v1beta1.Output", Output], - ["/cosmos.bank.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], ["/cosmos.bank.v1beta1.MsgSetSendEnabled", MsgSetSendEnabled], - ["/cosmos.bank.v1beta1.QueryBalanceRequest", QueryBalanceRequest], - ["/cosmos.bank.v1beta1.QueryDenomMetadataResponse", QueryDenomMetadataResponse], + ["/cosmos.bank.v1beta1.MsgUpdateParams", MsgUpdateParams], + ["/cosmos.bank.v1beta1.SendAuthorization", SendAuthorization], + ["/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse", QueryDenomOwnersByQueryResponse], + ["/cosmos.bank.v1beta1.Metadata", Metadata], + ["/cosmos.bank.v1beta1.GenesisState", GenesisState], ["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgSendResponse", MsgSendResponse], - ["/cosmos.bank.v1beta1.QueryDenomMetadataRequest", QueryDenomMetadataRequest], - ["/cosmos.bank.v1beta1.DenomOwner", DenomOwner], - ["/cosmos.bank.v1beta1.SendEnabled", SendEnabled], + ["/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", QueryDenomsMetadataResponse], + ["/cosmos.bank.v1beta1.QueryDenomOwnersResponse", QueryDenomOwnersResponse], + ["/cosmos.bank.v1beta1.DenomUnit", DenomUnit], + ["/cosmos.bank.v1beta1.QueryBalanceRequest", QueryBalanceRequest], + ["/cosmos.bank.v1beta1.QueryAllBalancesRequest", QueryAllBalancesRequest], + ["/cosmos.bank.v1beta1.QuerySupplyOfRequest", QuerySupplyOfRequest], + ["/cosmos.bank.v1beta1.QuerySupplyOfResponse", QuerySupplyOfResponse], + ["/cosmos.bank.v1beta1.QuerySendEnabledRequest", QuerySendEnabledRequest], + ["/cosmos.bank.v1beta1.QueryBalanceResponse", QueryBalanceResponse], + ["/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", QuerySpendableBalancesRequest], + ["/cosmos.bank.v1beta1.QueryParamsResponse", QueryParamsResponse], ["/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", QueryDenomsMetadataRequest], - ["/cosmos.bank.v1beta1.SendAuthorization", SendAuthorization], - ["/cosmos.bank.v1beta1.Input", Input], + ["/cosmos.bank.v1beta1.Supply", Supply], + ["/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", QuerySpendableBalancesResponse], + ["/cosmos.bank.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], ]; diff --git a/ts-client/cosmos.bank.v1beta1/types/amino/amino.ts b/ts-client/cosmos.bank.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.bank.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.bank.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.bank.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.bank.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.bank.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.bank.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.bank.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.bank.v1beta1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/cosmos.bank.v1beta1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmos.bank.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.bank.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.bank.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.bank.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.bank.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.bank.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.bank.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.bank.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.bank.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.bank.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.bank.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.bank.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.bank.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.bank.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.bank.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.bank.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.bank.v1beta1/types/google/api/http.ts b/ts-client/cosmos.bank.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.bank.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.bank.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.bank.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.bank.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.bank.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.bank.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.bank.v1beta1/types/route-name.eta b/ts-client/cosmos.bank.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.bank.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.base.node.v1beta1/module.ts b/ts-client/cosmos.base.node.v1beta1/module.ts index cfb346a0..075ef0b7 100755 --- a/ts-client/cosmos.base.node.v1beta1/module.ts +++ b/ts-client/cosmos.base.node.v1beta1/module.ts @@ -6,10 +6,10 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { ConfigRequest } from "./types/cosmos/base/node/v1beta1/query"; -import { ConfigResponse } from "./types/cosmos/base/node/v1beta1/query"; -import { StatusRequest } from "./types/cosmos/base/node/v1beta1/query"; -import { StatusResponse } from "./types/cosmos/base/node/v1beta1/query"; +import { ConfigRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/node/v1beta1/query"; +import { ConfigResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/node/v1beta1/query"; +import { StatusRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/node/v1beta1/query"; +import { StatusResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/node/v1beta1/query"; export { ConfigRequest, ConfigResponse, StatusRequest, StatusResponse }; diff --git a/ts-client/cosmos.base.node.v1beta1/registry.ts b/ts-client/cosmos.base.node.v1beta1/registry.ts index 4e74339f..7f8d9285 100755 --- a/ts-client/cosmos.base.node.v1beta1/registry.ts +++ b/ts-client/cosmos.base.node.v1beta1/registry.ts @@ -1,8 +1,8 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { ConfigRequest } from "./types/cosmos/base/node/v1beta1/query"; -import { ConfigResponse } from "./types/cosmos/base/node/v1beta1/query"; -import { StatusRequest } from "./types/cosmos/base/node/v1beta1/query"; -import { StatusResponse } from "./types/cosmos/base/node/v1beta1/query"; +import { ConfigRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/node/v1beta1/query"; +import { ConfigResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/node/v1beta1/query"; +import { StatusRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/node/v1beta1/query"; +import { StatusResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/node/v1beta1/query"; const msgTypes: Array<[string, GeneratedType]> = [ ["/cosmos.base.node.v1beta1.ConfigRequest", ConfigRequest], diff --git a/ts-client/cosmos.base.node.v1beta1/types/amino/amino.ts b/ts-client/cosmos.base.node.v1beta1/types/amino/amino.ts new file mode 100644 index 00000000..4a505674 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/amino/amino.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + +/* eslint-disable */ + +export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.base.node.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.base.node.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.base.node.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..effd5449 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} + +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + 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(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: 0 }; +} + +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.base.node.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.base.node.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.base.node.v1beta1/types/cosmos/msg/v1/msg.ts new file mode 100644 index 00000000..7a993ec3 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/cosmos/msg/v1/msg.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.base.node.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.base.node.v1beta1/types/cosmos_proto/cosmos.ts new file mode 100644 index 00000000..d95b944f --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/cosmos_proto/cosmos.ts @@ -0,0 +1,302 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos_proto"; + +export enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1, +} + +export function scalarTypeFromJSON(object: any): ScalarType { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} + +export function scalarTypeToJSON(object: ScalarType): string { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} + +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { name: "", description: "" }; +} + +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + 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 ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseScalarDescriptor(): ScalarDescriptor { + return { name: "", description: "", fieldType: [] }; +} + +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag === 24) { + message.fieldType.push(reader.int32() as any); + + continue; + } + + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push(reader.int32() as any); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ScalarDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], + }; + }, + + toJSON(message: ScalarDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.fieldType?.length) { + obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e)); + } + 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 ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.base.node.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.base.node.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.base.node.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.base.node.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.base.node.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.base.node.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.base.node.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.base.node.v1beta1/types/google/api/http.ts b/ts-client/cosmos.base.node.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.base.node.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.base.node.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.base.node.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.base.node.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.base.node.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.base.node.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.node.v1beta1/types/route-name.eta b/ts-client/cosmos.base.node.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.base.node.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.base.tendermint.v1beta1/module.ts b/ts-client/cosmos.base.tendermint.v1beta1/module.ts index 77ffac84..fbcbb75e 100755 --- a/ts-client/cosmos.base.tendermint.v1beta1/module.ts +++ b/ts-client/cosmos.base.tendermint.v1beta1/module.ts @@ -6,45 +6,45 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { GetSyncingRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetNodeInfoRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { Header } from "./types/cosmos/base/tendermint/v1beta1/types"; -import { GetBlockByHeightResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetBlockByHeightRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetSyncingResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { Module } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { ABCIQueryResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetValidatorSetByHeightRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { Block } from "./types/cosmos/base/tendermint/v1beta1/types"; -import { GetLatestBlockRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { ProofOps } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetLatestValidatorSetRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetLatestBlockResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { VersionInfo } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetValidatorSetByHeightResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { Validator } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { ABCIQueryRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetLatestValidatorSetResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetNodeInfoResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { ProofOp } from "./types/cosmos/base/tendermint/v1beta1/query"; - - -export { GetSyncingRequest, GetNodeInfoRequest, Header, GetBlockByHeightResponse, GetBlockByHeightRequest, GetSyncingResponse, Module, ABCIQueryResponse, GetValidatorSetByHeightRequest, Block, GetLatestBlockRequest, ProofOps, GetLatestValidatorSetRequest, GetLatestBlockResponse, VersionInfo, GetValidatorSetByHeightResponse, Validator, ABCIQueryRequest, GetLatestValidatorSetResponse, GetNodeInfoResponse, ProofOp }; +import { ABCIQueryResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { ProofOps } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetBlockByHeightRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetBlockByHeightResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetNodeInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { ABCIQueryRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { Header } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/types"; +import { GetLatestValidatorSetRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetLatestBlockResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetSyncingRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetNodeInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { VersionInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { Module } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetValidatorSetByHeightRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetValidatorSetByHeightResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetLatestValidatorSetResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { Validator } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { Block } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/types"; +import { GetLatestBlockRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetSyncingResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { ProofOp } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; + + +export { ABCIQueryResponse, ProofOps, GetBlockByHeightRequest, GetBlockByHeightResponse, GetNodeInfoResponse, ABCIQueryRequest, Header, GetLatestValidatorSetRequest, GetLatestBlockResponse, GetSyncingRequest, GetNodeInfoRequest, VersionInfo, Module, GetValidatorSetByHeightRequest, GetValidatorSetByHeightResponse, GetLatestValidatorSetResponse, Validator, Block, GetLatestBlockRequest, GetSyncingResponse, ProofOp }; -type sendGetSyncingRequestParams = { - value: GetSyncingRequest, +type sendABCIQueryResponseParams = { + value: ABCIQueryResponse, fee?: StdFee, memo?: string }; -type sendGetNodeInfoRequestParams = { - value: GetNodeInfoRequest, +type sendProofOpsParams = { + value: ProofOps, fee?: StdFee, memo?: string }; -type sendHeaderParams = { - value: Header, +type sendGetBlockByHeightRequestParams = { + value: GetBlockByHeightRequest, fee?: StdFee, memo?: string }; @@ -55,74 +55,74 @@ type sendGetBlockByHeightResponseParams = { memo?: string }; -type sendGetBlockByHeightRequestParams = { - value: GetBlockByHeightRequest, +type sendGetNodeInfoResponseParams = { + value: GetNodeInfoResponse, fee?: StdFee, memo?: string }; -type sendGetSyncingResponseParams = { - value: GetSyncingResponse, +type sendABCIQueryRequestParams = { + value: ABCIQueryRequest, fee?: StdFee, memo?: string }; -type sendModuleParams = { - value: Module, +type sendHeaderParams = { + value: Header, fee?: StdFee, memo?: string }; -type sendABCIQueryResponseParams = { - value: ABCIQueryResponse, +type sendGetLatestValidatorSetRequestParams = { + value: GetLatestValidatorSetRequest, fee?: StdFee, memo?: string }; -type sendGetValidatorSetByHeightRequestParams = { - value: GetValidatorSetByHeightRequest, +type sendGetLatestBlockResponseParams = { + value: GetLatestBlockResponse, fee?: StdFee, memo?: string }; -type sendBlockParams = { - value: Block, +type sendGetSyncingRequestParams = { + value: GetSyncingRequest, fee?: StdFee, memo?: string }; -type sendGetLatestBlockRequestParams = { - value: GetLatestBlockRequest, +type sendGetNodeInfoRequestParams = { + value: GetNodeInfoRequest, fee?: StdFee, memo?: string }; -type sendProofOpsParams = { - value: ProofOps, +type sendVersionInfoParams = { + value: VersionInfo, fee?: StdFee, memo?: string }; -type sendGetLatestValidatorSetRequestParams = { - value: GetLatestValidatorSetRequest, +type sendModuleParams = { + value: Module, fee?: StdFee, memo?: string }; -type sendGetLatestBlockResponseParams = { - value: GetLatestBlockResponse, +type sendGetValidatorSetByHeightRequestParams = { + value: GetValidatorSetByHeightRequest, fee?: StdFee, memo?: string }; -type sendVersionInfoParams = { - value: VersionInfo, +type sendGetValidatorSetByHeightResponseParams = { + value: GetValidatorSetByHeightResponse, fee?: StdFee, memo?: string }; -type sendGetValidatorSetByHeightResponseParams = { - value: GetValidatorSetByHeightResponse, +type sendGetLatestValidatorSetResponseParams = { + value: GetLatestValidatorSetResponse, fee?: StdFee, memo?: string }; @@ -133,20 +133,20 @@ type sendValidatorParams = { memo?: string }; -type sendABCIQueryRequestParams = { - value: ABCIQueryRequest, +type sendBlockParams = { + value: Block, fee?: StdFee, memo?: string }; -type sendGetLatestValidatorSetResponseParams = { - value: GetLatestValidatorSetResponse, +type sendGetLatestBlockRequestParams = { + value: GetLatestBlockRequest, fee?: StdFee, memo?: string }; -type sendGetNodeInfoResponseParams = { - value: GetNodeInfoResponse, +type sendGetSyncingResponseParams = { + value: GetSyncingResponse, fee?: StdFee, memo?: string }; @@ -158,84 +158,84 @@ type sendProofOpParams = { }; -type getSyncingRequestParams = { - value: GetSyncingRequest, +type abciqueryResponseParams = { + value: ABCIQueryResponse, }; -type getNodeInfoRequestParams = { - value: GetNodeInfoRequest, +type proofOpsParams = { + value: ProofOps, }; -type headerParams = { - value: Header, +type getBlockByHeightRequestParams = { + value: GetBlockByHeightRequest, }; type getBlockByHeightResponseParams = { value: GetBlockByHeightResponse, }; -type getBlockByHeightRequestParams = { - value: GetBlockByHeightRequest, -}; - -type getSyncingResponseParams = { - value: GetSyncingResponse, +type getNodeInfoResponseParams = { + value: GetNodeInfoResponse, }; -type moduleParams = { - value: Module, +type abciqueryRequestParams = { + value: ABCIQueryRequest, }; -type abciqueryResponseParams = { - value: ABCIQueryResponse, +type headerParams = { + value: Header, }; -type getValidatorSetByHeightRequestParams = { - value: GetValidatorSetByHeightRequest, +type getLatestValidatorSetRequestParams = { + value: GetLatestValidatorSetRequest, }; -type blockParams = { - value: Block, +type getLatestBlockResponseParams = { + value: GetLatestBlockResponse, }; -type getLatestBlockRequestParams = { - value: GetLatestBlockRequest, +type getSyncingRequestParams = { + value: GetSyncingRequest, }; -type proofOpsParams = { - value: ProofOps, +type getNodeInfoRequestParams = { + value: GetNodeInfoRequest, }; -type getLatestValidatorSetRequestParams = { - value: GetLatestValidatorSetRequest, +type versionInfoParams = { + value: VersionInfo, }; -type getLatestBlockResponseParams = { - value: GetLatestBlockResponse, +type moduleParams = { + value: Module, }; -type versionInfoParams = { - value: VersionInfo, +type getValidatorSetByHeightRequestParams = { + value: GetValidatorSetByHeightRequest, }; type getValidatorSetByHeightResponseParams = { value: GetValidatorSetByHeightResponse, }; +type getLatestValidatorSetResponseParams = { + value: GetLatestValidatorSetResponse, +}; + type validatorParams = { value: Validator, }; -type abciqueryRequestParams = { - value: ABCIQueryRequest, +type blockParams = { + value: Block, }; -type getLatestValidatorSetResponseParams = { - value: GetLatestValidatorSetResponse, +type getLatestBlockRequestParams = { + value: GetLatestBlockRequest, }; -type getNodeInfoResponseParams = { - value: GetNodeInfoResponse, +type getSyncingResponseParams = { + value: GetSyncingResponse, }; type proofOpParams = { @@ -272,45 +272,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendGetSyncingRequest({ value, fee, memo }: sendGetSyncingRequestParams): Promise { + async sendABCIQueryResponse({ value, fee, memo }: sendABCIQueryResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetSyncingRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendABCIQueryResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getSyncingRequest({ value: GetSyncingRequest.fromPartial(value) }) + let msg = this.abciqueryResponse({ value: ABCIQueryResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetSyncingRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendABCIQueryResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGetNodeInfoRequest({ value, fee, memo }: sendGetNodeInfoRequestParams): Promise { + async sendProofOps({ value, fee, memo }: sendProofOpsParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetNodeInfoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendProofOps: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getNodeInfoRequest({ value: GetNodeInfoRequest.fromPartial(value) }) + let msg = this.proofOps({ value: ProofOps.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetNodeInfoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendProofOps: Could not broadcast Tx: '+ e.message) } }, - async sendHeader({ value, fee, memo }: sendHeaderParams): Promise { + async sendGetBlockByHeightRequest({ value, fee, memo }: sendGetBlockByHeightRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendHeader: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetBlockByHeightRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.header({ value: Header.fromPartial(value) }) + let msg = this.getBlockByHeightRequest({ value: GetBlockByHeightRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendHeader: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetBlockByHeightRequest: Could not broadcast Tx: '+ e.message) } }, @@ -328,171 +328,171 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendGetBlockByHeightRequest({ value, fee, memo }: sendGetBlockByHeightRequestParams): Promise { + async sendGetNodeInfoResponse({ value, fee, memo }: sendGetNodeInfoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetBlockByHeightRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetNodeInfoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getBlockByHeightRequest({ value: GetBlockByHeightRequest.fromPartial(value) }) + let msg = this.getNodeInfoResponse({ value: GetNodeInfoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetBlockByHeightRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetNodeInfoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGetSyncingResponse({ value, fee, memo }: sendGetSyncingResponseParams): Promise { + async sendABCIQueryRequest({ value, fee, memo }: sendABCIQueryRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetSyncingResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendABCIQueryRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getSyncingResponse({ value: GetSyncingResponse.fromPartial(value) }) + let msg = this.abciqueryRequest({ value: ABCIQueryRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetSyncingResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendABCIQueryRequest: Could not broadcast Tx: '+ e.message) } }, - async sendModule({ value, fee, memo }: sendModuleParams): Promise { + async sendHeader({ value, fee, memo }: sendHeaderParams): Promise { if (!signer) { - throw new Error('TxClient:sendModule: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendHeader: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.module({ value: Module.fromPartial(value) }) + let msg = this.header({ value: Header.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendModule: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendHeader: Could not broadcast Tx: '+ e.message) } }, - async sendABCIQueryResponse({ value, fee, memo }: sendABCIQueryResponseParams): Promise { + async sendGetLatestValidatorSetRequest({ value, fee, memo }: sendGetLatestValidatorSetRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendABCIQueryResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetLatestValidatorSetRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.abciqueryResponse({ value: ABCIQueryResponse.fromPartial(value) }) + let msg = this.getLatestValidatorSetRequest({ value: GetLatestValidatorSetRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendABCIQueryResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetLatestValidatorSetRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGetValidatorSetByHeightRequest({ value, fee, memo }: sendGetValidatorSetByHeightRequestParams): Promise { + async sendGetLatestBlockResponse({ value, fee, memo }: sendGetLatestBlockResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetValidatorSetByHeightRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetLatestBlockResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getValidatorSetByHeightRequest({ value: GetValidatorSetByHeightRequest.fromPartial(value) }) + let msg = this.getLatestBlockResponse({ value: GetLatestBlockResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetValidatorSetByHeightRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetLatestBlockResponse: Could not broadcast Tx: '+ e.message) } }, - async sendBlock({ value, fee, memo }: sendBlockParams): Promise { + async sendGetSyncingRequest({ value, fee, memo }: sendGetSyncingRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendBlock: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetSyncingRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.block({ value: Block.fromPartial(value) }) + let msg = this.getSyncingRequest({ value: GetSyncingRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendBlock: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetSyncingRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGetLatestBlockRequest({ value, fee, memo }: sendGetLatestBlockRequestParams): Promise { + async sendGetNodeInfoRequest({ value, fee, memo }: sendGetNodeInfoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetLatestBlockRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetNodeInfoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getLatestBlockRequest({ value: GetLatestBlockRequest.fromPartial(value) }) + let msg = this.getNodeInfoRequest({ value: GetNodeInfoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetLatestBlockRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetNodeInfoRequest: Could not broadcast Tx: '+ e.message) } }, - async sendProofOps({ value, fee, memo }: sendProofOpsParams): Promise { + async sendVersionInfo({ value, fee, memo }: sendVersionInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendProofOps: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendVersionInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.proofOps({ value: ProofOps.fromPartial(value) }) + let msg = this.versionInfo({ value: VersionInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendProofOps: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendVersionInfo: Could not broadcast Tx: '+ e.message) } }, - async sendGetLatestValidatorSetRequest({ value, fee, memo }: sendGetLatestValidatorSetRequestParams): Promise { + async sendModule({ value, fee, memo }: sendModuleParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetLatestValidatorSetRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendModule: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getLatestValidatorSetRequest({ value: GetLatestValidatorSetRequest.fromPartial(value) }) + let msg = this.module({ value: Module.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetLatestValidatorSetRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendModule: Could not broadcast Tx: '+ e.message) } }, - async sendGetLatestBlockResponse({ value, fee, memo }: sendGetLatestBlockResponseParams): Promise { + async sendGetValidatorSetByHeightRequest({ value, fee, memo }: sendGetValidatorSetByHeightRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetLatestBlockResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetValidatorSetByHeightRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getLatestBlockResponse({ value: GetLatestBlockResponse.fromPartial(value) }) + let msg = this.getValidatorSetByHeightRequest({ value: GetValidatorSetByHeightRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetLatestBlockResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetValidatorSetByHeightRequest: Could not broadcast Tx: '+ e.message) } }, - async sendVersionInfo({ value, fee, memo }: sendVersionInfoParams): Promise { + async sendGetValidatorSetByHeightResponse({ value, fee, memo }: sendGetValidatorSetByHeightResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendVersionInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetValidatorSetByHeightResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.versionInfo({ value: VersionInfo.fromPartial(value) }) + let msg = this.getValidatorSetByHeightResponse({ value: GetValidatorSetByHeightResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendVersionInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetValidatorSetByHeightResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGetValidatorSetByHeightResponse({ value, fee, memo }: sendGetValidatorSetByHeightResponseParams): Promise { + async sendGetLatestValidatorSetResponse({ value, fee, memo }: sendGetLatestValidatorSetResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetValidatorSetByHeightResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetLatestValidatorSetResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getValidatorSetByHeightResponse({ value: GetValidatorSetByHeightResponse.fromPartial(value) }) + let msg = this.getLatestValidatorSetResponse({ value: GetLatestValidatorSetResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetValidatorSetByHeightResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetLatestValidatorSetResponse: Could not broadcast Tx: '+ e.message) } }, @@ -510,45 +510,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendABCIQueryRequest({ value, fee, memo }: sendABCIQueryRequestParams): Promise { + async sendBlock({ value, fee, memo }: sendBlockParams): Promise { if (!signer) { - throw new Error('TxClient:sendABCIQueryRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendBlock: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.abciqueryRequest({ value: ABCIQueryRequest.fromPartial(value) }) + let msg = this.block({ value: Block.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendABCIQueryRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendBlock: Could not broadcast Tx: '+ e.message) } }, - async sendGetLatestValidatorSetResponse({ value, fee, memo }: sendGetLatestValidatorSetResponseParams): Promise { + async sendGetLatestBlockRequest({ value, fee, memo }: sendGetLatestBlockRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetLatestValidatorSetResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetLatestBlockRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getLatestValidatorSetResponse({ value: GetLatestValidatorSetResponse.fromPartial(value) }) + let msg = this.getLatestBlockRequest({ value: GetLatestBlockRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetLatestValidatorSetResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetLatestBlockRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGetNodeInfoResponse({ value, fee, memo }: sendGetNodeInfoResponseParams): Promise { + async sendGetSyncingResponse({ value, fee, memo }: sendGetSyncingResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetNodeInfoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetSyncingResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getNodeInfoResponse({ value: GetNodeInfoResponse.fromPartial(value) }) + let msg = this.getSyncingResponse({ value: GetSyncingResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetNodeInfoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetSyncingResponse: Could not broadcast Tx: '+ e.message) } }, @@ -567,27 +567,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht }, - getSyncingRequest({ value }: getSyncingRequestParams): EncodeObject { + abciqueryResponse({ value }: abciqueryResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingRequest", value: GetSyncingRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.ABCIQueryResponse", value: ABCIQueryResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetSyncingRequest: Could not create message: ' + e.message) + throw new Error('TxClient:ABCIQueryResponse: Could not create message: ' + e.message) } }, - getNodeInfoRequest({ value }: getNodeInfoRequestParams): EncodeObject { + proofOps({ value }: proofOpsParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", value: GetNodeInfoRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.ProofOps", value: ProofOps.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetNodeInfoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:ProofOps: Could not create message: ' + e.message) } }, - header({ value }: headerParams): EncodeObject { + getBlockByHeightRequest({ value }: getBlockByHeightRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.Header", value: Header.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", value: GetBlockByHeightRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Header: Could not create message: ' + e.message) + throw new Error('TxClient:GetBlockByHeightRequest: Could not create message: ' + e.message) } }, @@ -599,99 +599,99 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - getBlockByHeightRequest({ value }: getBlockByHeightRequestParams): EncodeObject { + getNodeInfoResponse({ value }: getNodeInfoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", value: GetBlockByHeightRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", value: GetNodeInfoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetBlockByHeightRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GetNodeInfoResponse: Could not create message: ' + e.message) } }, - getSyncingResponse({ value }: getSyncingResponseParams): EncodeObject { + abciqueryRequest({ value }: abciqueryRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingResponse", value: GetSyncingResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.ABCIQueryRequest", value: ABCIQueryRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetSyncingResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ABCIQueryRequest: Could not create message: ' + e.message) } }, - module({ value }: moduleParams): EncodeObject { + header({ value }: headerParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.Module", value: Module.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.Header", value: Header.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Module: Could not create message: ' + e.message) + throw new Error('TxClient:Header: Could not create message: ' + e.message) } }, - abciqueryResponse({ value }: abciqueryResponseParams): EncodeObject { + getLatestValidatorSetRequest({ value }: getLatestValidatorSetRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.ABCIQueryResponse", value: ABCIQueryResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", value: GetLatestValidatorSetRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ABCIQueryResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GetLatestValidatorSetRequest: Could not create message: ' + e.message) } }, - getValidatorSetByHeightRequest({ value }: getValidatorSetByHeightRequestParams): EncodeObject { + getLatestBlockResponse({ value }: getLatestBlockResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", value: GetValidatorSetByHeightRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", value: GetLatestBlockResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetValidatorSetByHeightRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GetLatestBlockResponse: Could not create message: ' + e.message) } }, - block({ value }: blockParams): EncodeObject { + getSyncingRequest({ value }: getSyncingRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.Block", value: Block.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingRequest", value: GetSyncingRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Block: Could not create message: ' + e.message) + throw new Error('TxClient:GetSyncingRequest: Could not create message: ' + e.message) } }, - getLatestBlockRequest({ value }: getLatestBlockRequestParams): EncodeObject { + getNodeInfoRequest({ value }: getNodeInfoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", value: GetLatestBlockRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", value: GetNodeInfoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetLatestBlockRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GetNodeInfoRequest: Could not create message: ' + e.message) } }, - proofOps({ value }: proofOpsParams): EncodeObject { + versionInfo({ value }: versionInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.ProofOps", value: ProofOps.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.VersionInfo", value: VersionInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ProofOps: Could not create message: ' + e.message) + throw new Error('TxClient:VersionInfo: Could not create message: ' + e.message) } }, - getLatestValidatorSetRequest({ value }: getLatestValidatorSetRequestParams): EncodeObject { + module({ value }: moduleParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", value: GetLatestValidatorSetRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.Module", value: Module.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetLatestValidatorSetRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Module: Could not create message: ' + e.message) } }, - getLatestBlockResponse({ value }: getLatestBlockResponseParams): EncodeObject { + getValidatorSetByHeightRequest({ value }: getValidatorSetByHeightRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", value: GetLatestBlockResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", value: GetValidatorSetByHeightRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetLatestBlockResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GetValidatorSetByHeightRequest: Could not create message: ' + e.message) } }, - versionInfo({ value }: versionInfoParams): EncodeObject { + getValidatorSetByHeightResponse({ value }: getValidatorSetByHeightResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.VersionInfo", value: VersionInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", value: GetValidatorSetByHeightResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:VersionInfo: Could not create message: ' + e.message) + throw new Error('TxClient:GetValidatorSetByHeightResponse: Could not create message: ' + e.message) } }, - getValidatorSetByHeightResponse({ value }: getValidatorSetByHeightResponseParams): EncodeObject { + getLatestValidatorSetResponse({ value }: getLatestValidatorSetResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", value: GetValidatorSetByHeightResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", value: GetLatestValidatorSetResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetValidatorSetByHeightResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GetLatestValidatorSetResponse: Could not create message: ' + e.message) } }, @@ -703,27 +703,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - abciqueryRequest({ value }: abciqueryRequestParams): EncodeObject { + block({ value }: blockParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.ABCIQueryRequest", value: ABCIQueryRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.Block", value: Block.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ABCIQueryRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Block: Could not create message: ' + e.message) } }, - getLatestValidatorSetResponse({ value }: getLatestValidatorSetResponseParams): EncodeObject { + getLatestBlockRequest({ value }: getLatestBlockRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", value: GetLatestValidatorSetResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", value: GetLatestBlockRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetLatestValidatorSetResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GetLatestBlockRequest: Could not create message: ' + e.message) } }, - getNodeInfoResponse({ value }: getNodeInfoResponseParams): EncodeObject { + getSyncingResponse({ value }: getSyncingResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", value: GetNodeInfoResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingResponse", value: GetSyncingResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetNodeInfoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GetSyncingResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.base.tendermint.v1beta1/registry.ts b/ts-client/cosmos.base.tendermint.v1beta1/registry.ts index ffbe178c..46b42f7f 100755 --- a/ts-client/cosmos.base.tendermint.v1beta1/registry.ts +++ b/ts-client/cosmos.base.tendermint.v1beta1/registry.ts @@ -1,47 +1,47 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { GetSyncingRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetNodeInfoRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { Header } from "./types/cosmos/base/tendermint/v1beta1/types"; -import { GetBlockByHeightResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetBlockByHeightRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetSyncingResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { Module } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { ABCIQueryResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetValidatorSetByHeightRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { Block } from "./types/cosmos/base/tendermint/v1beta1/types"; -import { GetLatestBlockRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { ProofOps } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetLatestValidatorSetRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetLatestBlockResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { VersionInfo } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetValidatorSetByHeightResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { Validator } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { ABCIQueryRequest } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetLatestValidatorSetResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { GetNodeInfoResponse } from "./types/cosmos/base/tendermint/v1beta1/query"; -import { ProofOp } from "./types/cosmos/base/tendermint/v1beta1/query"; +import { ABCIQueryResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { ProofOps } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetBlockByHeightRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetBlockByHeightResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetNodeInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { ABCIQueryRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { Header } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/types"; +import { GetLatestValidatorSetRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetLatestBlockResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetSyncingRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetNodeInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { VersionInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { Module } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetValidatorSetByHeightRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetValidatorSetByHeightResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetLatestValidatorSetResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { Validator } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { Block } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/types"; +import { GetLatestBlockRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { GetSyncingResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; +import { ProofOp } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/base/tendermint/v1beta1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.base.tendermint.v1beta1.GetSyncingRequest", GetSyncingRequest], - ["/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", GetNodeInfoRequest], - ["/cosmos.base.tendermint.v1beta1.Header", Header], - ["/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", GetBlockByHeightResponse], - ["/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", GetBlockByHeightRequest], - ["/cosmos.base.tendermint.v1beta1.GetSyncingResponse", GetSyncingResponse], - ["/cosmos.base.tendermint.v1beta1.Module", Module], ["/cosmos.base.tendermint.v1beta1.ABCIQueryResponse", ABCIQueryResponse], - ["/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", GetValidatorSetByHeightRequest], - ["/cosmos.base.tendermint.v1beta1.Block", Block], - ["/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", GetLatestBlockRequest], ["/cosmos.base.tendermint.v1beta1.ProofOps", ProofOps], + ["/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", GetBlockByHeightRequest], + ["/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", GetBlockByHeightResponse], + ["/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", GetNodeInfoResponse], + ["/cosmos.base.tendermint.v1beta1.ABCIQueryRequest", ABCIQueryRequest], + ["/cosmos.base.tendermint.v1beta1.Header", Header], ["/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", GetLatestValidatorSetRequest], ["/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", GetLatestBlockResponse], + ["/cosmos.base.tendermint.v1beta1.GetSyncingRequest", GetSyncingRequest], + ["/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", GetNodeInfoRequest], ["/cosmos.base.tendermint.v1beta1.VersionInfo", VersionInfo], + ["/cosmos.base.tendermint.v1beta1.Module", Module], + ["/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", GetValidatorSetByHeightRequest], ["/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", GetValidatorSetByHeightResponse], - ["/cosmos.base.tendermint.v1beta1.Validator", Validator], - ["/cosmos.base.tendermint.v1beta1.ABCIQueryRequest", ABCIQueryRequest], ["/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", GetLatestValidatorSetResponse], - ["/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", GetNodeInfoResponse], + ["/cosmos.base.tendermint.v1beta1.Validator", Validator], + ["/cosmos.base.tendermint.v1beta1.Block", Block], + ["/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", GetLatestBlockRequest], + ["/cosmos.base.tendermint.v1beta1.GetSyncingResponse", GetSyncingResponse], ["/cosmos.base.tendermint.v1beta1.ProofOp", ProofOp], ]; diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/amino/amino.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.base.tendermint.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/msg/v1/msg.ts new file mode 100644 index 00000000..7a993ec3 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos/msg/v1/msg.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.base.tendermint.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.base.tendermint.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/google/api/http.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.base.tendermint.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.base.tendermint.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.base.tendermint.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.base.tendermint.v1beta1/types/route-name.eta b/ts-client/cosmos.base.tendermint.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.base.tendermint.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.circuit.v1/module.ts b/ts-client/cosmos.circuit.v1/module.ts index cbbd9c46..f06bf064 100755 --- a/ts-client/cosmos.circuit.v1/module.ts +++ b/ts-client/cosmos.circuit.v1/module.ts @@ -6,51 +6,51 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { DisabledListResponse } from "./types/cosmos/circuit/v1/query"; -import { MsgAuthorizeCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; import { MsgAuthorizeCircuitBreakerResponse } from "./types/cosmos/circuit/v1/tx"; -import { GenesisAccountPermissions } from "./types/cosmos/circuit/v1/types"; -import { QueryDisabledListRequest } from "./types/cosmos/circuit/v1/query"; +import { AccountsResponse } from "./types/cosmos/circuit/v1/query"; +import { MsgAuthorizeCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; +import { Permissions } from "./types/cosmos/circuit/v1/types"; +import { QueryAccountRequest } from "./types/cosmos/circuit/v1/query"; import { AccountResponse } from "./types/cosmos/circuit/v1/query"; +import { QueryDisabledListRequest } from "./types/cosmos/circuit/v1/query"; +import { DisabledListResponse } from "./types/cosmos/circuit/v1/query"; +import { MsgTripCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; +import { MsgResetCircuitBreakerResponse } from "./types/cosmos/circuit/v1/tx"; import { GenesisState } from "./types/cosmos/circuit/v1/types"; import { QueryAccountsRequest } from "./types/cosmos/circuit/v1/query"; -import { AccountsResponse } from "./types/cosmos/circuit/v1/query"; -import { MsgTripCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; import { MsgTripCircuitBreakerResponse } from "./types/cosmos/circuit/v1/tx"; import { MsgResetCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; -import { QueryAccountRequest } from "./types/cosmos/circuit/v1/query"; -import { MsgResetCircuitBreakerResponse } from "./types/cosmos/circuit/v1/tx"; -import { Permissions } from "./types/cosmos/circuit/v1/types"; +import { GenesisAccountPermissions } from "./types/cosmos/circuit/v1/types"; -export { DisabledListResponse, MsgAuthorizeCircuitBreaker, MsgAuthorizeCircuitBreakerResponse, GenesisAccountPermissions, QueryDisabledListRequest, AccountResponse, GenesisState, QueryAccountsRequest, AccountsResponse, MsgTripCircuitBreaker, MsgTripCircuitBreakerResponse, MsgResetCircuitBreaker, QueryAccountRequest, MsgResetCircuitBreakerResponse, Permissions }; +export { MsgAuthorizeCircuitBreakerResponse, AccountsResponse, MsgAuthorizeCircuitBreaker, Permissions, QueryAccountRequest, AccountResponse, QueryDisabledListRequest, DisabledListResponse, MsgTripCircuitBreaker, MsgResetCircuitBreakerResponse, GenesisState, QueryAccountsRequest, MsgTripCircuitBreakerResponse, MsgResetCircuitBreaker, GenesisAccountPermissions }; -type sendDisabledListResponseParams = { - value: DisabledListResponse, +type sendMsgAuthorizeCircuitBreakerResponseParams = { + value: MsgAuthorizeCircuitBreakerResponse, fee?: StdFee, memo?: string }; -type sendMsgAuthorizeCircuitBreakerParams = { - value: MsgAuthorizeCircuitBreaker, +type sendAccountsResponseParams = { + value: AccountsResponse, fee?: StdFee, memo?: string }; -type sendMsgAuthorizeCircuitBreakerResponseParams = { - value: MsgAuthorizeCircuitBreakerResponse, +type sendMsgAuthorizeCircuitBreakerParams = { + value: MsgAuthorizeCircuitBreaker, fee?: StdFee, memo?: string }; -type sendGenesisAccountPermissionsParams = { - value: GenesisAccountPermissions, +type sendPermissionsParams = { + value: Permissions, fee?: StdFee, memo?: string }; -type sendQueryDisabledListRequestParams = { - value: QueryDisabledListRequest, +type sendQueryAccountRequestParams = { + value: QueryAccountRequest, fee?: StdFee, memo?: string }; @@ -61,99 +61,107 @@ type sendAccountResponseParams = { memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryDisabledListRequestParams = { + value: QueryDisabledListRequest, fee?: StdFee, memo?: string }; -type sendQueryAccountsRequestParams = { - value: QueryAccountsRequest, +type sendDisabledListResponseParams = { + value: DisabledListResponse, fee?: StdFee, memo?: string }; -type sendAccountsResponseParams = { - value: AccountsResponse, +type sendMsgTripCircuitBreakerParams = { + value: MsgTripCircuitBreaker, fee?: StdFee, memo?: string }; -type sendMsgTripCircuitBreakerParams = { - value: MsgTripCircuitBreaker, +type sendMsgResetCircuitBreakerResponseParams = { + value: MsgResetCircuitBreakerResponse, fee?: StdFee, memo?: string }; -type sendMsgTripCircuitBreakerResponseParams = { - value: MsgTripCircuitBreakerResponse, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendMsgResetCircuitBreakerParams = { - value: MsgResetCircuitBreaker, +type sendQueryAccountsRequestParams = { + value: QueryAccountsRequest, fee?: StdFee, memo?: string }; -type sendQueryAccountRequestParams = { - value: QueryAccountRequest, +type sendMsgTripCircuitBreakerResponseParams = { + value: MsgTripCircuitBreakerResponse, fee?: StdFee, memo?: string }; -type sendMsgResetCircuitBreakerResponseParams = { - value: MsgResetCircuitBreakerResponse, +type sendMsgResetCircuitBreakerParams = { + value: MsgResetCircuitBreaker, fee?: StdFee, memo?: string }; -type sendPermissionsParams = { - value: Permissions, +type sendGenesisAccountPermissionsParams = { + value: GenesisAccountPermissions, fee?: StdFee, memo?: string }; -type disabledListResponseParams = { - value: DisabledListResponse, +type msgAuthorizeCircuitBreakerResponseParams = { + value: MsgAuthorizeCircuitBreakerResponse, +}; + +type accountsResponseParams = { + value: AccountsResponse, }; type msgAuthorizeCircuitBreakerParams = { value: MsgAuthorizeCircuitBreaker, }; -type msgAuthorizeCircuitBreakerResponseParams = { - value: MsgAuthorizeCircuitBreakerResponse, +type permissionsParams = { + value: Permissions, }; -type genesisAccountPermissionsParams = { - value: GenesisAccountPermissions, +type queryAccountRequestParams = { + value: QueryAccountRequest, +}; + +type accountResponseParams = { + value: AccountResponse, }; type queryDisabledListRequestParams = { value: QueryDisabledListRequest, }; -type accountResponseParams = { - value: AccountResponse, +type disabledListResponseParams = { + value: DisabledListResponse, }; -type genesisStateParams = { - value: GenesisState, +type msgTripCircuitBreakerParams = { + value: MsgTripCircuitBreaker, }; -type queryAccountsRequestParams = { - value: QueryAccountsRequest, +type msgResetCircuitBreakerResponseParams = { + value: MsgResetCircuitBreakerResponse, }; -type accountsResponseParams = { - value: AccountsResponse, +type genesisStateParams = { + value: GenesisState, }; -type msgTripCircuitBreakerParams = { - value: MsgTripCircuitBreaker, +type queryAccountsRequestParams = { + value: QueryAccountsRequest, }; type msgTripCircuitBreakerResponseParams = { @@ -164,16 +172,8 @@ type msgResetCircuitBreakerParams = { value: MsgResetCircuitBreaker, }; -type queryAccountRequestParams = { - value: QueryAccountRequest, -}; - -type msgResetCircuitBreakerResponseParams = { - value: MsgResetCircuitBreakerResponse, -}; - -type permissionsParams = { - value: Permissions, +type genesisAccountPermissionsParams = { + value: GenesisAccountPermissions, }; @@ -206,73 +206,73 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendDisabledListResponse({ value, fee, memo }: sendDisabledListResponseParams): Promise { + async sendMsgAuthorizeCircuitBreakerResponse({ value, fee, memo }: sendMsgAuthorizeCircuitBreakerResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendDisabledListResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAuthorizeCircuitBreakerResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.disabledListResponse({ value: DisabledListResponse.fromPartial(value) }) + let msg = this.msgAuthorizeCircuitBreakerResponse({ value: MsgAuthorizeCircuitBreakerResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDisabledListResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAuthorizeCircuitBreakerResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAuthorizeCircuitBreaker({ value, fee, memo }: sendMsgAuthorizeCircuitBreakerParams): Promise { + async sendAccountsResponse({ value, fee, memo }: sendAccountsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAuthorizeCircuitBreaker: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAccountsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgAuthorizeCircuitBreaker({ value: MsgAuthorizeCircuitBreaker.fromPartial(value) }) + let msg = this.accountsResponse({ value: AccountsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAuthorizeCircuitBreaker: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAccountsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAuthorizeCircuitBreakerResponse({ value, fee, memo }: sendMsgAuthorizeCircuitBreakerResponseParams): Promise { + async sendMsgAuthorizeCircuitBreaker({ value, fee, memo }: sendMsgAuthorizeCircuitBreakerParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAuthorizeCircuitBreakerResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAuthorizeCircuitBreaker: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgAuthorizeCircuitBreakerResponse({ value: MsgAuthorizeCircuitBreakerResponse.fromPartial(value) }) + let msg = this.msgAuthorizeCircuitBreaker({ value: MsgAuthorizeCircuitBreaker.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAuthorizeCircuitBreakerResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAuthorizeCircuitBreaker: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisAccountPermissions({ value, fee, memo }: sendGenesisAccountPermissionsParams): Promise { + async sendPermissions({ value, fee, memo }: sendPermissionsParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisAccountPermissions: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPermissions: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisAccountPermissions({ value: GenesisAccountPermissions.fromPartial(value) }) + let msg = this.permissions({ value: Permissions.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisAccountPermissions: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPermissions: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDisabledListRequest({ value, fee, memo }: sendQueryDisabledListRequestParams): Promise { + async sendQueryAccountRequest({ value, fee, memo }: sendQueryAccountRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDisabledListRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDisabledListRequest({ value: QueryDisabledListRequest.fromPartial(value) }) + let msg = this.queryAccountRequest({ value: QueryAccountRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDisabledListRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountRequest: Could not broadcast Tx: '+ e.message) } }, @@ -290,170 +290,170 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryDisabledListRequest({ value, fee, memo }: sendQueryDisabledListRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDisabledListRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryDisabledListRequest({ value: QueryDisabledListRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDisabledListRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountsRequest({ value, fee, memo }: sendQueryAccountsRequestParams): Promise { + async sendDisabledListResponse({ value, fee, memo }: sendDisabledListResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDisabledListResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountsRequest({ value: QueryAccountsRequest.fromPartial(value) }) + let msg = this.disabledListResponse({ value: DisabledListResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDisabledListResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAccountsResponse({ value, fee, memo }: sendAccountsResponseParams): Promise { + async sendMsgTripCircuitBreaker({ value, fee, memo }: sendMsgTripCircuitBreakerParams): Promise { if (!signer) { - throw new Error('TxClient:sendAccountsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgTripCircuitBreaker: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.accountsResponse({ value: AccountsResponse.fromPartial(value) }) + let msg = this.msgTripCircuitBreaker({ value: MsgTripCircuitBreaker.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAccountsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgTripCircuitBreaker: Could not broadcast Tx: '+ e.message) } }, - async sendMsgTripCircuitBreaker({ value, fee, memo }: sendMsgTripCircuitBreakerParams): Promise { + async sendMsgResetCircuitBreakerResponse({ value, fee, memo }: sendMsgResetCircuitBreakerResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgTripCircuitBreaker: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgResetCircuitBreakerResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgTripCircuitBreaker({ value: MsgTripCircuitBreaker.fromPartial(value) }) + let msg = this.msgResetCircuitBreakerResponse({ value: MsgResetCircuitBreakerResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgTripCircuitBreaker: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgResetCircuitBreakerResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgTripCircuitBreakerResponse({ value, fee, memo }: sendMsgTripCircuitBreakerResponseParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgTripCircuitBreakerResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgTripCircuitBreakerResponse({ value: MsgTripCircuitBreakerResponse.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgTripCircuitBreakerResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendMsgResetCircuitBreaker({ value, fee, memo }: sendMsgResetCircuitBreakerParams): Promise { + async sendQueryAccountsRequest({ value, fee, memo }: sendQueryAccountsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgResetCircuitBreaker: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAccountsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgResetCircuitBreaker({ value: MsgResetCircuitBreaker.fromPartial(value) }) + let msg = this.queryAccountsRequest({ value: QueryAccountsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgResetCircuitBreaker: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAccountsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAccountRequest({ value, fee, memo }: sendQueryAccountRequestParams): Promise { + async sendMsgTripCircuitBreakerResponse({ value, fee, memo }: sendMsgTripCircuitBreakerResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAccountRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgTripCircuitBreakerResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAccountRequest({ value: QueryAccountRequest.fromPartial(value) }) + let msg = this.msgTripCircuitBreakerResponse({ value: MsgTripCircuitBreakerResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAccountRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgTripCircuitBreakerResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgResetCircuitBreakerResponse({ value, fee, memo }: sendMsgResetCircuitBreakerResponseParams): Promise { + async sendMsgResetCircuitBreaker({ value, fee, memo }: sendMsgResetCircuitBreakerParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgResetCircuitBreakerResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgResetCircuitBreaker: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgResetCircuitBreakerResponse({ value: MsgResetCircuitBreakerResponse.fromPartial(value) }) + let msg = this.msgResetCircuitBreaker({ value: MsgResetCircuitBreaker.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgResetCircuitBreakerResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgResetCircuitBreaker: Could not broadcast Tx: '+ e.message) } }, - async sendPermissions({ value, fee, memo }: sendPermissionsParams): Promise { + async sendGenesisAccountPermissions({ value, fee, memo }: sendGenesisAccountPermissionsParams): Promise { if (!signer) { - throw new Error('TxClient:sendPermissions: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisAccountPermissions: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.permissions({ value: Permissions.fromPartial(value) }) + let msg = this.genesisAccountPermissions({ value: GenesisAccountPermissions.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPermissions: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisAccountPermissions: Could not broadcast Tx: '+ e.message) } }, - disabledListResponse({ value }: disabledListResponseParams): EncodeObject { + msgAuthorizeCircuitBreakerResponse({ value }: msgAuthorizeCircuitBreakerResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.DisabledListResponse", value: DisabledListResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreakerResponse", value: MsgAuthorizeCircuitBreakerResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DisabledListResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAuthorizeCircuitBreakerResponse: Could not create message: ' + e.message) } }, - msgAuthorizeCircuitBreaker({ value }: msgAuthorizeCircuitBreakerParams): EncodeObject { + accountsResponse({ value }: accountsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", value: MsgAuthorizeCircuitBreaker.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.AccountsResponse", value: AccountsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAuthorizeCircuitBreaker: Could not create message: ' + e.message) + throw new Error('TxClient:AccountsResponse: Could not create message: ' + e.message) } }, - msgAuthorizeCircuitBreakerResponse({ value }: msgAuthorizeCircuitBreakerResponseParams): EncodeObject { + msgAuthorizeCircuitBreaker({ value }: msgAuthorizeCircuitBreakerParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreakerResponse", value: MsgAuthorizeCircuitBreakerResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", value: MsgAuthorizeCircuitBreaker.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAuthorizeCircuitBreakerResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAuthorizeCircuitBreaker: Could not create message: ' + e.message) } }, - genesisAccountPermissions({ value }: genesisAccountPermissionsParams): EncodeObject { + permissions({ value }: permissionsParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.GenesisAccountPermissions", value: GenesisAccountPermissions.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.Permissions", value: Permissions.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisAccountPermissions: Could not create message: ' + e.message) + throw new Error('TxClient:Permissions: Could not create message: ' + e.message) } }, - queryDisabledListRequest({ value }: queryDisabledListRequestParams): EncodeObject { + queryAccountRequest({ value }: queryAccountRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.QueryDisabledListRequest", value: QueryDisabledListRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.QueryAccountRequest", value: QueryAccountRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDisabledListRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountRequest: Could not create message: ' + e.message) } }, @@ -465,75 +465,75 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryDisabledListRequest({ value }: queryDisabledListRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.QueryDisabledListRequest", value: QueryDisabledListRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDisabledListRequest: Could not create message: ' + e.message) } }, - queryAccountsRequest({ value }: queryAccountsRequestParams): EncodeObject { + disabledListResponse({ value }: disabledListResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.QueryAccountsRequest", value: QueryAccountsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.DisabledListResponse", value: DisabledListResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:DisabledListResponse: Could not create message: ' + e.message) } }, - accountsResponse({ value }: accountsResponseParams): EncodeObject { + msgTripCircuitBreaker({ value }: msgTripCircuitBreakerParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.AccountsResponse", value: AccountsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreaker", value: MsgTripCircuitBreaker.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AccountsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgTripCircuitBreaker: Could not create message: ' + e.message) } }, - msgTripCircuitBreaker({ value }: msgTripCircuitBreakerParams): EncodeObject { + msgResetCircuitBreakerResponse({ value }: msgResetCircuitBreakerResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreaker", value: MsgTripCircuitBreaker.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreakerResponse", value: MsgResetCircuitBreakerResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgTripCircuitBreaker: Could not create message: ' + e.message) + throw new Error('TxClient:MsgResetCircuitBreakerResponse: Could not create message: ' + e.message) } }, - msgTripCircuitBreakerResponse({ value }: msgTripCircuitBreakerResponseParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreakerResponse", value: MsgTripCircuitBreakerResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgTripCircuitBreakerResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - msgResetCircuitBreaker({ value }: msgResetCircuitBreakerParams): EncodeObject { + queryAccountsRequest({ value }: queryAccountsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreaker", value: MsgResetCircuitBreaker.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.QueryAccountsRequest", value: QueryAccountsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgResetCircuitBreaker: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAccountsRequest: Could not create message: ' + e.message) } }, - queryAccountRequest({ value }: queryAccountRequestParams): EncodeObject { + msgTripCircuitBreakerResponse({ value }: msgTripCircuitBreakerResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.QueryAccountRequest", value: QueryAccountRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreakerResponse", value: MsgTripCircuitBreakerResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAccountRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgTripCircuitBreakerResponse: Could not create message: ' + e.message) } }, - msgResetCircuitBreakerResponse({ value }: msgResetCircuitBreakerResponseParams): EncodeObject { + msgResetCircuitBreaker({ value }: msgResetCircuitBreakerParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreakerResponse", value: MsgResetCircuitBreakerResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreaker", value: MsgResetCircuitBreaker.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgResetCircuitBreakerResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgResetCircuitBreaker: Could not create message: ' + e.message) } }, - permissions({ value }: permissionsParams): EncodeObject { + genesisAccountPermissions({ value }: genesisAccountPermissionsParams): EncodeObject { try { - return { typeUrl: "/cosmos.circuit.v1.Permissions", value: Permissions.fromPartial( value ) } + return { typeUrl: "/cosmos.circuit.v1.GenesisAccountPermissions", value: GenesisAccountPermissions.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Permissions: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisAccountPermissions: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.circuit.v1/registry.ts b/ts-client/cosmos.circuit.v1/registry.ts index 990a684d..7f1c4cd1 100755 --- a/ts-client/cosmos.circuit.v1/registry.ts +++ b/ts-client/cosmos.circuit.v1/registry.ts @@ -1,36 +1,36 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { DisabledListResponse } from "./types/cosmos/circuit/v1/query"; -import { MsgAuthorizeCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; import { MsgAuthorizeCircuitBreakerResponse } from "./types/cosmos/circuit/v1/tx"; -import { GenesisAccountPermissions } from "./types/cosmos/circuit/v1/types"; -import { QueryDisabledListRequest } from "./types/cosmos/circuit/v1/query"; +import { AccountsResponse } from "./types/cosmos/circuit/v1/query"; +import { MsgAuthorizeCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; +import { Permissions } from "./types/cosmos/circuit/v1/types"; +import { QueryAccountRequest } from "./types/cosmos/circuit/v1/query"; import { AccountResponse } from "./types/cosmos/circuit/v1/query"; +import { QueryDisabledListRequest } from "./types/cosmos/circuit/v1/query"; +import { DisabledListResponse } from "./types/cosmos/circuit/v1/query"; +import { MsgTripCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; +import { MsgResetCircuitBreakerResponse } from "./types/cosmos/circuit/v1/tx"; import { GenesisState } from "./types/cosmos/circuit/v1/types"; import { QueryAccountsRequest } from "./types/cosmos/circuit/v1/query"; -import { AccountsResponse } from "./types/cosmos/circuit/v1/query"; -import { MsgTripCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; import { MsgTripCircuitBreakerResponse } from "./types/cosmos/circuit/v1/tx"; import { MsgResetCircuitBreaker } from "./types/cosmos/circuit/v1/tx"; -import { QueryAccountRequest } from "./types/cosmos/circuit/v1/query"; -import { MsgResetCircuitBreakerResponse } from "./types/cosmos/circuit/v1/tx"; -import { Permissions } from "./types/cosmos/circuit/v1/types"; +import { GenesisAccountPermissions } from "./types/cosmos/circuit/v1/types"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.circuit.v1.DisabledListResponse", DisabledListResponse], - ["/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", MsgAuthorizeCircuitBreaker], ["/cosmos.circuit.v1.MsgAuthorizeCircuitBreakerResponse", MsgAuthorizeCircuitBreakerResponse], - ["/cosmos.circuit.v1.GenesisAccountPermissions", GenesisAccountPermissions], - ["/cosmos.circuit.v1.QueryDisabledListRequest", QueryDisabledListRequest], + ["/cosmos.circuit.v1.AccountsResponse", AccountsResponse], + ["/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", MsgAuthorizeCircuitBreaker], + ["/cosmos.circuit.v1.Permissions", Permissions], + ["/cosmos.circuit.v1.QueryAccountRequest", QueryAccountRequest], ["/cosmos.circuit.v1.AccountResponse", AccountResponse], + ["/cosmos.circuit.v1.QueryDisabledListRequest", QueryDisabledListRequest], + ["/cosmos.circuit.v1.DisabledListResponse", DisabledListResponse], + ["/cosmos.circuit.v1.MsgTripCircuitBreaker", MsgTripCircuitBreaker], + ["/cosmos.circuit.v1.MsgResetCircuitBreakerResponse", MsgResetCircuitBreakerResponse], ["/cosmos.circuit.v1.GenesisState", GenesisState], ["/cosmos.circuit.v1.QueryAccountsRequest", QueryAccountsRequest], - ["/cosmos.circuit.v1.AccountsResponse", AccountsResponse], - ["/cosmos.circuit.v1.MsgTripCircuitBreaker", MsgTripCircuitBreaker], ["/cosmos.circuit.v1.MsgTripCircuitBreakerResponse", MsgTripCircuitBreakerResponse], ["/cosmos.circuit.v1.MsgResetCircuitBreaker", MsgResetCircuitBreaker], - ["/cosmos.circuit.v1.QueryAccountRequest", QueryAccountRequest], - ["/cosmos.circuit.v1.MsgResetCircuitBreakerResponse", MsgResetCircuitBreakerResponse], - ["/cosmos.circuit.v1.Permissions", Permissions], + ["/cosmos.circuit.v1.GenesisAccountPermissions", GenesisAccountPermissions], ]; diff --git a/ts-client/cosmos.circuit.v1/types/amino/amino.ts b/ts-client/cosmos.circuit.v1/types/amino/amino.ts new file mode 100644 index 00000000..4a505674 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/amino/amino.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + +/* eslint-disable */ + +export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/app/runtime/v1alpha1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/app/runtime/v1alpha1/module.ts new file mode 100644 index 00000000..0dddf30c --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/app/runtime/v1alpha1/module.ts @@ -0,0 +1,378 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/runtime/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.app.runtime.v1alpha1"; + +/** Module is the config object for the runtime module. */ +export interface Module { + /** app_name is the name of the app. */ + appName: string; + /** + * begin_blockers specifies the module names of begin blockers + * to call in the order in which they should be called. If this is left empty + * no begin blocker will be registered. + */ + beginBlockers: string[]; + /** + * end_blockers specifies the module names of the end blockers + * to call in the order in which they should be called. If this is left empty + * no end blocker will be registered. + */ + endBlockers: string[]; + /** + * init_genesis specifies the module names of init genesis functions + * to call in the order in which they should be called. If this is left empty + * no init genesis function will be registered. + */ + initGenesis: string[]; + /** + * export_genesis specifies the order in which to export module genesis data. + * If this is left empty, the init_genesis order will be used for export genesis + * if it is specified. + */ + exportGenesis: string[]; + /** + * override_store_keys is an optional list of overrides for the module store keys + * to be used in keeper construction. + */ + overrideStoreKeys: StoreKeyConfig[]; + /** + * order_migrations defines the order in which module migrations are performed. + * If this is left empty, it uses the default migration order. + * https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.0-alpha2/types/module#DefaultMigrationsOrder + */ + orderMigrations: string[]; + /** + * precommiters specifies the module names of the precommiters + * to call in the order in which they should be called. If this is left empty + * no precommit function will be registered. + */ + precommiters: string[]; + /** + * prepare_check_staters specifies the module names of the prepare_check_staters + * to call in the order in which they should be called. If this is left empty + * no preparecheckstate function will be registered. + */ + prepareCheckStaters: string[]; +} + +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfig { + /** name of the module to override the store key of */ + moduleName: string; + /** the kv store key to use instead of the module name. */ + kvStoreKey: string; +} + +function createBaseModule(): Module { + return { + appName: "", + beginBlockers: [], + endBlockers: [], + initGenesis: [], + exportGenesis: [], + overrideStoreKeys: [], + orderMigrations: [], + precommiters: [], + prepareCheckStaters: [], + }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + for (const v of message.beginBlockers) { + writer.uint32(18).string(v!); + } + for (const v of message.endBlockers) { + writer.uint32(26).string(v!); + } + for (const v of message.initGenesis) { + writer.uint32(34).string(v!); + } + for (const v of message.exportGenesis) { + writer.uint32(42).string(v!); + } + for (const v of message.overrideStoreKeys) { + StoreKeyConfig.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.orderMigrations) { + writer.uint32(58).string(v!); + } + for (const v of message.precommiters) { + writer.uint32(66).string(v!); + } + for (const v of message.prepareCheckStaters) { + writer.uint32(74).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.appName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.beginBlockers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.endBlockers.push(reader.string()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.initGenesis.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.exportGenesis.push(reader.string()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.overrideStoreKeys.push(StoreKeyConfig.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.orderMigrations.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.precommiters.push(reader.string()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.prepareCheckStaters.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + beginBlockers: globalThis.Array.isArray(object?.beginBlockers) + ? object.beginBlockers.map((e: any) => globalThis.String(e)) + : [], + endBlockers: globalThis.Array.isArray(object?.endBlockers) + ? object.endBlockers.map((e: any) => globalThis.String(e)) + : [], + initGenesis: globalThis.Array.isArray(object?.initGenesis) + ? object.initGenesis.map((e: any) => globalThis.String(e)) + : [], + exportGenesis: globalThis.Array.isArray(object?.exportGenesis) + ? object.exportGenesis.map((e: any) => globalThis.String(e)) + : [], + overrideStoreKeys: globalThis.Array.isArray(object?.overrideStoreKeys) + ? object.overrideStoreKeys.map((e: any) => StoreKeyConfig.fromJSON(e)) + : [], + orderMigrations: globalThis.Array.isArray(object?.orderMigrations) + ? object.orderMigrations.map((e: any) => globalThis.String(e)) + : [], + precommiters: globalThis.Array.isArray(object?.precommiters) + ? object.precommiters.map((e: any) => globalThis.String(e)) + : [], + prepareCheckStaters: globalThis.Array.isArray(object?.prepareCheckStaters) + ? object.prepareCheckStaters.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.beginBlockers?.length) { + obj.beginBlockers = message.beginBlockers; + } + if (message.endBlockers?.length) { + obj.endBlockers = message.endBlockers; + } + if (message.initGenesis?.length) { + obj.initGenesis = message.initGenesis; + } + if (message.exportGenesis?.length) { + obj.exportGenesis = message.exportGenesis; + } + if (message.overrideStoreKeys?.length) { + obj.overrideStoreKeys = message.overrideStoreKeys.map((e) => StoreKeyConfig.toJSON(e)); + } + if (message.orderMigrations?.length) { + obj.orderMigrations = message.orderMigrations; + } + if (message.precommiters?.length) { + obj.precommiters = message.precommiters; + } + if (message.prepareCheckStaters?.length) { + obj.prepareCheckStaters = message.prepareCheckStaters; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.appName = object.appName ?? ""; + message.beginBlockers = object.beginBlockers?.map((e) => e) || []; + message.endBlockers = object.endBlockers?.map((e) => e) || []; + message.initGenesis = object.initGenesis?.map((e) => e) || []; + message.exportGenesis = object.exportGenesis?.map((e) => e) || []; + message.overrideStoreKeys = object.overrideStoreKeys?.map((e) => StoreKeyConfig.fromPartial(e)) || []; + message.orderMigrations = object.orderMigrations?.map((e) => e) || []; + message.precommiters = object.precommiters?.map((e) => e) || []; + message.prepareCheckStaters = object.prepareCheckStaters?.map((e) => e) || []; + return message; + }, +}; + +function createBaseStoreKeyConfig(): StoreKeyConfig { + return { moduleName: "", kvStoreKey: "" }; +} + +export const StoreKeyConfig: MessageFns = { + encode(message: StoreKeyConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.kvStoreKey !== "") { + writer.uint32(18).string(message.kvStoreKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreKeyConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKeyConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.kvStoreKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKeyConfig { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + kvStoreKey: isSet(object.kvStoreKey) ? globalThis.String(object.kvStoreKey) : "", + }; + }, + + toJSON(message: StoreKeyConfig): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.kvStoreKey !== "") { + obj.kvStoreKey = message.kvStoreKey; + } + return obj; + }, + + create, I>>(base?: I): StoreKeyConfig { + return StoreKeyConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKeyConfig { + const message = createBaseStoreKeyConfig(); + message.moduleName = object.moduleName ?? ""; + message.kvStoreKey = object.kvStoreKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/config.ts b/ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/config.ts new file mode 100644 index 00000000..da9f2893 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/config.ts @@ -0,0 +1,339 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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[]; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is global (not module specific). + */ + golangBindings: GolangBinding[]; +} + +/** 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 + | undefined; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is module specific. + */ + golangBindings: GolangBinding[]; +} + +/** GolangBinding is an explicit interface type to implementing type binding for dependency injection. */ +export interface GolangBinding { + /** interface_type is the interface type which will be bound to a specific implementation type */ + interfaceType: string; + /** implementation is the implementing type which will be supplied when an input of type interface is requested */ + implementation: string; +} + +function createBaseConfig(): Config { + return { modules: [], golangBindings: [] }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.modules) { + ModuleConfig.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.modules.push(ModuleConfig.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + modules: globalThis.Array.isArray(object?.modules) + ? object.modules.map((e: any) => ModuleConfig.fromJSON(e)) + : [], + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.modules?.length) { + obj.modules = message.modules.map((e) => ModuleConfig.toJSON(e)); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.modules = object.modules?.map((e) => ModuleConfig.fromPartial(e)) || []; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseModuleConfig(): ModuleConfig { + return { name: "", config: undefined, golangBindings: [] }; +} + +export const ModuleConfig: MessageFns = { + encode(message: ModuleConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.config !== undefined) { + Any.encode(message.config, writer.uint32(18).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.config = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleConfig { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + config: isSet(object.config) ? Any.fromJSON(object.config) : undefined, + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleConfig): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.config !== undefined) { + obj.config = Any.toJSON(message.config); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleConfig { + return ModuleConfig.fromPartial(base ?? ({} as any)); + }, + 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; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGolangBinding(): GolangBinding { + return { interfaceType: "", implementation: "" }; +} + +export const GolangBinding: MessageFns = { + encode(message: GolangBinding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceType !== "") { + writer.uint32(10).string(message.interfaceType); + } + if (message.implementation !== "") { + writer.uint32(18).string(message.implementation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GolangBinding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGolangBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.interfaceType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.implementation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GolangBinding { + return { + interfaceType: isSet(object.interfaceType) ? globalThis.String(object.interfaceType) : "", + implementation: isSet(object.implementation) ? globalThis.String(object.implementation) : "", + }; + }, + + toJSON(message: GolangBinding): unknown { + const obj: any = {}; + if (message.interfaceType !== "") { + obj.interfaceType = message.interfaceType; + } + if (message.implementation !== "") { + obj.implementation = message.implementation; + } + return obj; + }, + + create, I>>(base?: I): GolangBinding { + return GolangBinding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GolangBinding { + const message = createBaseGolangBinding(); + message.interfaceType = object.interfaceType ?? ""; + message.implementation = object.implementation ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/query.ts new file mode 100644 index 00000000..3a172979 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/app/v1alpha1/query.ts @@ -0,0 +1,174 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +function createBaseQueryConfigRequest(): QueryConfigRequest { + return {}; +} + +export const QueryConfigRequest: MessageFns = { + encode(_: QueryConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConfigRequest { + return {}; + }, + + toJSON(_: QueryConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConfigRequest { + return QueryConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConfigRequest { + const message = createBaseQueryConfigRequest(); + return message; + }, +}; + +function createBaseQueryConfigResponse(): QueryConfigResponse { + return { config: undefined }; +} + +export const QueryConfigResponse: MessageFns = { + encode(message: QueryConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + Config.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = Config.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConfigResponse { + return { config: isSet(object.config) ? Config.fromJSON(object.config) : undefined }; + }, + + toJSON(message: QueryConfigResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = Config.toJSON(message.config); + } + return obj; + }, + + create, I>>(base?: I): QueryConfigResponse { + return QueryConfigResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.app.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/auth/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/auth/module/v1/module.ts new file mode 100644 index 00000000..c426dc68 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/auth/module/v1/module.ts @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.auth.module.v1"; + +/** Module is the config object for the auth module. */ +export interface Module { + /** bech32_prefix is the bech32 account prefix for the app. */ + bech32Prefix: string; + /** module_account_permissions are module account permissions. */ + moduleAccountPermissions: ModuleAccountPermission[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermission { + /** account is the name of the module. */ + account: string; + /** + * permissions are the permissions this module has. Currently recognized + * values are minter, burner and staking. + */ + permissions: string[]; +} + +function createBaseModule(): Module { + return { bech32Prefix: "", moduleAccountPermissions: [], authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + for (const v of message.moduleAccountPermissions) { + ModuleAccountPermission.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(26).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.moduleAccountPermissions.push(ModuleAccountPermission.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "", + moduleAccountPermissions: globalThis.Array.isArray(object?.moduleAccountPermissions) + ? object.moduleAccountPermissions.map((e: any) => ModuleAccountPermission.fromJSON(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + if (message.moduleAccountPermissions?.length) { + obj.moduleAccountPermissions = message.moduleAccountPermissions.map((e) => ModuleAccountPermission.toJSON(e)); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.bech32Prefix = object.bech32Prefix ?? ""; + message.moduleAccountPermissions = + object.moduleAccountPermissions?.map((e) => ModuleAccountPermission.fromPartial(e)) || []; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseModuleAccountPermission(): ModuleAccountPermission { + return { account: "", permissions: [] }; +} + +export const ModuleAccountPermission: MessageFns = { + encode(message: ModuleAccountPermission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + for (const v of message.permissions) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccountPermission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccountPermission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccountPermission { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccountPermission): unknown { + const obj: any = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccountPermission { + return ModuleAccountPermission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccountPermission { + const message = createBaseModuleAccountPermission(); + message.account = object.account ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/auth.ts b/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..4dd78b9e --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,517 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/auth.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + pubKey: Any | undefined; + accountNumber: number; + sequence: number; +} + +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + baseAccount: BaseAccount | undefined; + name: string; + permissions: string[]; +} + +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredential { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + moduleName: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivationKeys: Uint8Array[]; +} + +/** Params defines the parameters for the auth module. */ +export interface Params { + maxMemoCharacters: number; + txSigLimit: number; + txSizeCostPerByte: number; + sigVerifyCostEd25519: number; + sigVerifyCostSecp256k1: number; +} + +function createBaseBaseAccount(): BaseAccount { + return { address: "", pubKey: undefined, accountNumber: 0, sequence: 0 }; +} + +export const BaseAccount: MessageFns = { + encode(message: BaseAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.accountNumber !== 0) { + writer.uint32(24).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseAccount { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): BaseAccount { + return BaseAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.accountNumber = object.accountNumber ?? 0; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModuleAccount(): ModuleAccount { + return { baseAccount: undefined, name: "", permissions: [] }; +} + +export const ModuleAccount: MessageFns = { + encode(message: ModuleAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + for (const v of message.permissions) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + name: isSet(object.name) ? globalThis.String(object.name) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccount { + return ModuleAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccount { + const message = createBaseModuleAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseModuleCredential(): ModuleCredential { + return { moduleName: "", derivationKeys: [] }; +} + +export const ModuleCredential: MessageFns = { + encode(message: ModuleCredential, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + for (const v of message.derivationKeys) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleCredential { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.derivationKeys.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleCredential { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + derivationKeys: globalThis.Array.isArray(object?.derivationKeys) + ? object.derivationKeys.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: ModuleCredential): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.derivationKeys?.length) { + obj.derivationKeys = message.derivationKeys.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleCredential { + return ModuleCredential.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleCredential { + const message = createBaseModuleCredential(); + message.moduleName = object.moduleName ?? ""; + message.derivationKeys = object.derivationKeys?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + maxMemoCharacters: 0, + txSigLimit: 0, + txSizeCostPerByte: 0, + sigVerifyCostEd25519: 0, + sigVerifyCostSecp256k1: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMemoCharacters !== 0) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxMemoCharacters = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.txSigLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.txSizeCostPerByte = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sigVerifyCostEd25519 = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sigVerifyCostSecp256k1 = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + maxMemoCharacters: isSet(object.maxMemoCharacters) ? globalThis.Number(object.maxMemoCharacters) : 0, + txSigLimit: isSet(object.txSigLimit) ? globalThis.Number(object.txSigLimit) : 0, + txSizeCostPerByte: isSet(object.txSizeCostPerByte) ? globalThis.Number(object.txSizeCostPerByte) : 0, + sigVerifyCostEd25519: isSet(object.sigVerifyCostEd25519) ? globalThis.Number(object.sigVerifyCostEd25519) : 0, + sigVerifyCostSecp256k1: isSet(object.sigVerifyCostSecp256k1) + ? globalThis.Number(object.sigVerifyCostSecp256k1) + : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.maxMemoCharacters !== 0) { + obj.maxMemoCharacters = Math.round(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + obj.txSigLimit = Math.round(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + obj.txSizeCostPerByte = Math.round(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + obj.sigVerifyCostEd25519 = Math.round(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + obj.sigVerifyCostSecp256k1 = Math.round(message.sigVerifyCostSecp256k1); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.maxMemoCharacters = object.maxMemoCharacters ?? 0; + message.txSigLimit = object.txSigLimit ?? 0; + message.txSizeCostPerByte = object.txSizeCostPerByte ?? 0; + message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 ?? 0; + message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 00000000..d165dd08 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** accounts are the accounts present at genesis. */ + accounts: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, accounts: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.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) + ? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/query.ts new file mode 100644 index 00000000..e187ff09 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,1545 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { BaseAccount, 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} + +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account: Any | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequest { +} + +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponse { + accounts: Any[]; +} + +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequest { + name: string; +} + +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponse { + account: Any | undefined; +} + +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequest { +} + +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponse { + bech32Prefix: string; +} + +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequest { + addressBytes: Uint8Array; +} + +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponse { + addressString: string; +} + +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequest { + addressString: string; +} + +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponse { + addressBytes: Uint8Array; +} + +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequest { + /** + * Deprecated, use account_id instead + * + * id is the account number of the address to be queried. This field + * should have been an uint64 (like all account numbers), and will be + * updated to uint64 in a future version of the auth query. + * + * @deprecated + */ + id: number; + /** + * account_id is the account number of the address to be queried. + * + * Since: cosmos-sdk 0.47 + */ + accountId: number; +} + +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponse { + accountAddress: string; +} + +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequest { + /** address is the account address string. */ + address: string; +} + +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponse { + /** info is the account info which is represented by BaseAccount. */ + info: BaseAccount | undefined; +} + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsResponse { + return { + accounts: globalThis.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?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsResponse { + return QueryAccountsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { account: undefined }; +} + +export const QueryAccountResponse: MessageFns = { + encode(message: QueryAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryAccountResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountResponse { + return QueryAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { + return {}; +} + +export const QueryModuleAccountsRequest: MessageFns = { + encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryModuleAccountsRequest { + return {}; + }, + + toJSON(_: QueryModuleAccountsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, +}; + +function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { + return { accounts: [] }; +} + +export const QueryModuleAccountsResponse: MessageFns = { + encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryModuleAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameRequest(): QueryModuleAccountByNameRequest { + return { name: "" }; +} + +export const QueryModuleAccountByNameRequest: MessageFns = { + encode(message: QueryModuleAccountByNameRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryModuleAccountByNameRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountByNameRequest { + return QueryModuleAccountByNameRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameRequest { + const message = createBaseQueryModuleAccountByNameRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameResponse(): QueryModuleAccountByNameResponse { + return { account: undefined }; +} + +export const QueryModuleAccountByNameResponse: MessageFns = { + encode(message: QueryModuleAccountByNameResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryModuleAccountByNameResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryModuleAccountByNameResponse { + return QueryModuleAccountByNameResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameResponse { + const message = createBaseQueryModuleAccountByNameResponse(); + message.account = (object.account !== undefined && object.account !== null) + ? Any.fromPartial(object.account) + : undefined; + return message; + }, +}; + +function createBaseBech32PrefixRequest(): Bech32PrefixRequest { + return {}; +} + +export const Bech32PrefixRequest: MessageFns = { + encode(_: Bech32PrefixRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Bech32PrefixRequest { + return {}; + }, + + toJSON(_: Bech32PrefixRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Bech32PrefixRequest { + return Bech32PrefixRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, +}; + +function createBaseBech32PrefixResponse(): Bech32PrefixResponse { + return { bech32Prefix: "" }; +} + +export const Bech32PrefixResponse: MessageFns = { + encode(message: Bech32PrefixResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Bech32PrefixResponse { + return { bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "" }; + }, + + toJSON(message: Bech32PrefixResponse): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + return obj; + }, + + create, I>>(base?: I): Bech32PrefixResponse { + return Bech32PrefixResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + message.bech32Prefix = object.bech32Prefix ?? ""; + return message; + }, +}; + +function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressBytesToStringRequest: MessageFns = { + encode(message: AddressBytesToStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringRequest { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressBytesToStringRequest): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringRequest { + return AddressBytesToStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { + return { addressString: "" }; +} + +export const AddressBytesToStringResponse: MessageFns = { + encode(message: AddressBytesToStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringResponse { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressBytesToStringResponse): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringResponse { + return AddressBytesToStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { + return { addressString: "" }; +} + +export const AddressStringToBytesRequest: MessageFns = { + encode(message: AddressStringToBytesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesRequest { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressStringToBytesRequest): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesRequest { + return AddressStringToBytesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressStringToBytesResponse: MessageFns = { + encode(message: AddressStringToBytesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesResponse { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressStringToBytesResponse): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesResponse { + return AddressStringToBytesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAccountAddressByIDRequest(): QueryAccountAddressByIDRequest { + return { id: 0, accountId: 0 }; +} + +export const QueryAccountAddressByIDRequest: MessageFns = { + encode(message: QueryAccountAddressByIDRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int64(message.id); + } + if (message.accountId !== 0) { + writer.uint32(16).uint64(message.accountId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.accountId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDRequest { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0, + }; + }, + + toJSON(message: QueryAccountAddressByIDRequest): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.accountId !== 0) { + obj.accountId = Math.round(message.accountId); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDRequest { + return QueryAccountAddressByIDRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDRequest { + const message = createBaseQueryAccountAddressByIDRequest(); + message.id = object.id ?? 0; + message.accountId = object.accountId ?? 0; + return message; + }, +}; + +function createBaseQueryAccountAddressByIDResponse(): QueryAccountAddressByIDResponse { + return { accountAddress: "" }; +} + +export const QueryAccountAddressByIDResponse: MessageFns = { + encode(message: QueryAccountAddressByIDResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.accountAddress !== "") { + writer.uint32(10).string(message.accountAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accountAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDResponse { + return { accountAddress: isSet(object.accountAddress) ? globalThis.String(object.accountAddress) : "" }; + }, + + toJSON(message: QueryAccountAddressByIDResponse): unknown { + const obj: any = {}; + if (message.accountAddress !== "") { + obj.accountAddress = message.accountAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDResponse { + return QueryAccountAddressByIDResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDResponse { + const message = createBaseQueryAccountAddressByIDResponse(); + message.accountAddress = object.accountAddress ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoRequest(): QueryAccountInfoRequest { + return { address: "" }; +} + +export const QueryAccountInfoRequest: MessageFns = { + encode(message: QueryAccountInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoRequest { + return QueryAccountInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoResponse(): QueryAccountInfoResponse { + return { info: undefined }; +} + +export const QueryAccountInfoResponse: MessageFns = { + encode(message: QueryAccountInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + BaseAccount.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.info = BaseAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoResponse { + return { info: isSet(object.info) ? BaseAccount.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryAccountInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = BaseAccount.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoResponse { + return QueryAccountInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + message.info = (object.info !== undefined && object.info !== null) + ? BaseAccount.fromPartial(object.info) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Accounts returns all the existing accounts. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.43 + */ + Accounts(request: QueryAccountsRequest): Promise; + /** Account returns account details based on address. */ + Account(request: QueryAccountRequest): Promise; + /** + * AccountAddressByID returns account address based on account number. + * + * Since: cosmos-sdk 0.46.2 + */ + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise; + /** Params queries all parameters. */ + Params(request: QueryParamsRequest): Promise; + /** + * ModuleAccounts returns all the existing module accounts. + * + * Since: cosmos-sdk 0.46 + */ + ModuleAccounts(request: QueryModuleAccountsRequest): Promise; + /** ModuleAccountByName returns the module account info by module name */ + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise; + /** + * Bech32Prefix queries bech32Prefix + * + * Since: cosmos-sdk 0.46 + */ + Bech32Prefix(request: Bech32PrefixRequest): Promise; + /** + * AddressBytesToString converts Account Address bytes to string + * + * Since: cosmos-sdk 0.46 + */ + AddressBytesToString(request: AddressBytesToStringRequest): Promise; + /** + * AddressStringToBytes converts Address string to bytes + * + * Since: cosmos-sdk 0.46 + */ + AddressStringToBytes(request: AddressStringToBytesRequest): Promise; + /** + * AccountInfo queries account info which is common to all account types. + * + * Since: cosmos-sdk 0.47 + */ + AccountInfo(request: QueryAccountInfoRequest): Promise; +} + +export const QueryServiceName = "cosmos.auth.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 || QueryServiceName; + this.rpc = rpc; + this.Accounts = this.Accounts.bind(this); + this.Account = this.Account.bind(this); + this.AccountAddressByID = this.AccountAddressByID.bind(this); + this.Params = this.Params.bind(this); + this.ModuleAccounts = this.ModuleAccounts.bind(this); + this.ModuleAccountByName = this.ModuleAccountByName.bind(this); + this.Bech32Prefix = this.Bech32Prefix.bind(this); + this.AddressBytesToString = this.AddressBytesToString.bind(this); + this.AddressStringToBytes = this.AddressStringToBytes.bind(this); + this.AccountInfo = this.AccountInfo.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 BinaryReader(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 BinaryReader(data))); + } + + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise { + const data = QueryAccountAddressByIDRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountAddressByID", data); + return promise.then((data) => QueryAccountAddressByIDResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise { + const data = QueryModuleAccountByNameRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ModuleAccountByName", data); + return promise.then((data) => QueryModuleAccountByNameResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + AccountInfo(request: QueryAccountInfoRequest): Promise { + const data = QueryAccountInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountInfo", data); + return promise.then((data) => QueryAccountInfoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/tx.ts new file mode 100644 index 00000000..535a19af --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/auth/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./auth"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/auth parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/auth Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the x/auth module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.auth.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/authz/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/authz/module/v1/module.ts new file mode 100644 index 00000000..053622ff --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/authz/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.authz.module.v1"; + +/** Module is the config object of the authz module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/authz.ts b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 00000000..a3685068 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * time when the grant will expire and will be pruned. If null, then the grant + * doesn't have a time expiration (other conditions in `authorization` + * may apply to invalidate the grant) + */ + expiration: Date | undefined; +} + +/** + * GrantAuthorization extends a grant with both the addresses of the grantee and granter. + * It is used in genesis.proto and query.proto + */ +export interface GrantAuthorization { + granter: string; + grantee: string; + authorization: Any | undefined; + expiration: Date | undefined; +} + +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItem { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msgTypeUrls: string[]; +} + +function createBaseGenericAuthorization(): GenericAuthorization { + return { msg: "" }; +} + +export const GenericAuthorization: MessageFns = { + encode(message: GenericAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msg = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenericAuthorization { + return { msg: isSet(object.msg) ? globalThis.String(object.msg) : "" }; + }, + + toJSON(message: GenericAuthorization): unknown { + const obj: any = {}; + if (message.msg !== "") { + obj.msg = message.msg; + } + return obj; + }, + + create, I>>(base?: I): GenericAuthorization { + return GenericAuthorization.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: GrantAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(26).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantAuthorization { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.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 = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GrantAuthorization { + return GrantAuthorization.fromPartial(base ?? ({} as any)); + }, + 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 { msgTypeUrls: [] }; +} + +export const GrantQueueItem: MessageFns = { + encode(message: GrantQueueItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.msgTypeUrls) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantQueueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantQueueItem { + return { + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: GrantQueueItem): unknown { + const obj: any = {}; + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): GrantQueueItem { + return GrantQueueItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/event.ts b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/event.ts new file mode 100644 index 00000000..42e74923 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,235 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 */ + msgTypeUrl: 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 */ + msgTypeUrl: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} + +function createBaseEventGrant(): EventGrant { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventGrant: MessageFns = { + encode(message: EventGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventGrant { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventGrant): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventGrant { + return EventGrant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventGrant { + const message = createBaseEventGrant(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseEventRevoke(): EventRevoke { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventRevoke: MessageFns = { + encode(message: EventRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventRevoke { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventRevoke): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventRevoke { + return EventRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventRevoke { + const message = createBaseEventRevoke(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 00000000..96e4d5bf --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorization) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.authorization.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + authorization: globalThis.Array.isArray(object?.authorization) + ? object.authorization.map((e: any) => GrantAuthorization.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.authorization?.length) { + obj.authorization = message.authorization.map((e) => GrantAuthorization.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/query.ts new file mode 100644 index 00000000..ef3cc0e5 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,629 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + msgTypeUrl: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryGrantsRequest(): QueryGrantsRequest { + return { granter: "", grantee: "", msgTypeUrl: "", pagination: undefined }; +} + +export const QueryGrantsRequest: MessageFns = { + encode(message: QueryGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsRequest { + return QueryGrantsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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: MessageFns = { + encode(message: QueryGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsResponse { + return QueryGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.authz.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 00000000..10bc628d --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,565 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse { +} + +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExec { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; +} + +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} + +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevoke { + granter: string; + grantee: string; + msgTypeUrl: string; +} + +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponse { +} + +function createBaseMsgGrant(): MsgGrant { + return { granter: "", grantee: "", grant: undefined }; +} + +export const MsgGrant: MessageFns = { + encode(message: MsgGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + Grant.encode(message.grant, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.grant = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined, + }; + }, + + toJSON(message: MsgGrant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.grant !== undefined) { + obj.grant = Grant.toJSON(message.grant); + } + return obj; + }, + + create, I>>(base?: I): MsgGrant { + return MsgGrant.fromPartial(base ?? ({} as any)); + }, + 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 createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} + +export const MsgGrantResponse: MessageFns = { + encode(_: MsgGrantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantResponse { + return {}; + }, + + toJSON(_: MsgGrantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantResponse { + return MsgGrantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { grantee: "", msgs: [] }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { results: [] }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgRevoke(): MsgRevoke { + return { granter: "", grantee: "", msgTypeUrl: "" }; +} + +export const MsgRevoke: MessageFns = { + encode(message: MsgRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevoke { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + }; + }, + + toJSON(message: MsgRevoke): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgRevoke { + return MsgRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} + +export const MsgRevokeResponse: MessageFns = { + encode(_: MsgRevokeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeResponse { + return {}; + }, + + toJSON(_: MsgRevokeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeResponse { + return MsgRevokeResponse.fromPartial(base ?? ({} as any)); + }, + 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 const MsgServiceName = "cosmos.authz.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/autocli/v1/options.ts b/ts-client/cosmos.circuit.v1/types/cosmos/autocli/v1/options.ts new file mode 100644 index 00000000..4ad6ac83 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/autocli/v1/options.ts @@ -0,0 +1,1019 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/options.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** ModuleOptions describes the CLI options for a Cosmos SDK module. */ +export interface ModuleOptions { + /** tx describes the tx commands for the module. */ + tx: + | ServiceCommandDescriptor + | undefined; + /** query describes the queries commands for the module. */ + query: ServiceCommandDescriptor | undefined; +} + +/** ServiceCommandDescriptor describes a CLI command based on a protobuf service. */ +export interface ServiceCommandDescriptor { + /** + * service is the fully qualified name of the protobuf service to build + * the command from. It can be left empty if sub_commands are used instead + * which may be the case if a module provides multiple tx and/or query services. + */ + service: string; + /** + * rpc_command_options are options for commands generated from rpc methods. + * If no options are specified for a given rpc method on the service, a + * command will be generated for that method with the default options. + */ + rpcCommandOptions: RpcCommandOptions[]; + /** + * sub_commands is a map of optional sub-commands for this command based on + * different protobuf services. The map key is used as the name of the + * sub-command. + */ + subCommands: { [key: string]: ServiceCommandDescriptor }; +} + +export interface ServiceCommandDescriptor_SubCommandsEntry { + key: string; + value: ServiceCommandDescriptor | undefined; +} + +/** + * RpcCommandOptions specifies options for commands generated from protobuf + * rpc methods. + */ +export interface RpcCommandOptions { + /** + * rpc_method is short name of the protobuf rpc method that this command is + * generated from. + */ + rpcMethod: string; + /** + * use is the one-line usage method. It also allows specifying an alternate + * name for the command as the first word of the usage text. + * + * By default the name of an rpc command is the kebab-case short name of the + * rpc method. + */ + use: string; + /** long is the long message shown in the 'help ' output. */ + long: string; + /** short is the short description shown in the 'help' output. */ + short: string; + /** example is examples of how to use the command. */ + example: string; + /** alias is an array of aliases that can be used instead of the first word in Use. */ + alias: string[]; + /** + * suggest_for is an array of command names for which this command will be suggested - + * similar to aliases but only suggests. + */ + suggestFor: string[]; + /** deprecated defines, if this command is deprecated and should print this string when used. */ + deprecated: string; + /** + * version defines the version for this command. If this value is non-empty and the command does not + * define a "version" flag, a "version" boolean flag will be added to the command and, if specified, + * will print content of the "Version" variable. A shorthand "v" flag will also be added if the + * command does not define one. + */ + version: string; + /** + * flag_options are options for flags generated from rpc request fields. + * By default all request fields are configured as flags. They can + * also be configured as positional args instead using positional_args. + */ + flagOptions: { [key: string]: FlagOptions }; + /** positional_args specifies positional arguments for the command. */ + positionalArgs: PositionalArgDescriptor[]; + /** skip specifies whether to skip this rpc method when generating commands. */ + skip: boolean; +} + +export interface RpcCommandOptions_FlagOptionsEntry { + key: string; + value: FlagOptions | undefined; +} + +/** + * FlagOptions are options for flags generated from rpc request fields. + * By default, all request fields are configured as flags based on the + * kebab-case name of the field. Fields can be turned into positional arguments + * instead by using RpcCommandOptions.positional_args. + */ +export interface FlagOptions { + /** name is an alternate name to use for the field flag. */ + name: string; + /** shorthand is a one-letter abbreviated flag. */ + shorthand: string; + /** usage is the help message. */ + usage: string; + /** default_value is the default value as text. */ + defaultValue: string; + /** deprecated is the usage text to show if this flag is deprecated. */ + deprecated: string; + /** shorthand_deprecated is the usage text to show if the shorthand of this flag is deprecated. */ + shorthandDeprecated: string; + /** hidden hides the flag from help/usage text */ + hidden: boolean; +} + +/** PositionalArgDescriptor describes a positional argument. */ +export interface PositionalArgDescriptor { + /** + * proto_field specifies the proto field to use as the positional arg. Any + * fields used as positional args will not have a flag generated. + */ + protoField: string; + /** + * varargs makes a positional parameter a varargs parameter. This can only be + * applied to last positional parameter and the proto_field must a repeated + * field. + */ + varargs: boolean; +} + +function createBaseModuleOptions(): ModuleOptions { + return { tx: undefined, query: undefined }; +} + +export const ModuleOptions: MessageFns = { + encode(message: ModuleOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + ServiceCommandDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.query !== undefined) { + ServiceCommandDescriptor.encode(message.query, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.query = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleOptions { + return { + tx: isSet(object.tx) ? ServiceCommandDescriptor.fromJSON(object.tx) : undefined, + query: isSet(object.query) ? ServiceCommandDescriptor.fromJSON(object.query) : undefined, + }; + }, + + toJSON(message: ModuleOptions): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = ServiceCommandDescriptor.toJSON(message.tx); + } + if (message.query !== undefined) { + obj.query = ServiceCommandDescriptor.toJSON(message.query); + } + return obj; + }, + + create, I>>(base?: I): ModuleOptions { + return ModuleOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleOptions { + const message = createBaseModuleOptions(); + message.tx = (object.tx !== undefined && object.tx !== null) + ? ServiceCommandDescriptor.fromPartial(object.tx) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ServiceCommandDescriptor.fromPartial(object.query) + : undefined; + return message; + }, +}; + +function createBaseServiceCommandDescriptor(): ServiceCommandDescriptor { + return { service: "", rpcCommandOptions: [], subCommands: {} }; +} + +export const ServiceCommandDescriptor: MessageFns = { + encode(message: ServiceCommandDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.service !== "") { + writer.uint32(10).string(message.service); + } + for (const v of message.rpcCommandOptions) { + RpcCommandOptions.encode(v!, writer.uint32(18).fork()).join(); + } + Object.entries(message.subCommands).forEach(([key, value]) => { + ServiceCommandDescriptor_SubCommandsEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.service = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcCommandOptions.push(RpcCommandOptions.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + const entry3 = ServiceCommandDescriptor_SubCommandsEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.subCommands[entry3.key] = entry3.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor { + return { + service: isSet(object.service) ? globalThis.String(object.service) : "", + rpcCommandOptions: globalThis.Array.isArray(object?.rpcCommandOptions) + ? object.rpcCommandOptions.map((e: any) => RpcCommandOptions.fromJSON(e)) + : [], + subCommands: isObject(object.subCommands) + ? Object.entries(object.subCommands).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + acc[key] = ServiceCommandDescriptor.fromJSON(value); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: ServiceCommandDescriptor): unknown { + const obj: any = {}; + if (message.service !== "") { + obj.service = message.service; + } + if (message.rpcCommandOptions?.length) { + obj.rpcCommandOptions = message.rpcCommandOptions.map((e) => RpcCommandOptions.toJSON(e)); + } + if (message.subCommands) { + const entries = Object.entries(message.subCommands); + if (entries.length > 0) { + obj.subCommands = {}; + entries.forEach(([k, v]) => { + obj.subCommands[k] = ServiceCommandDescriptor.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): ServiceCommandDescriptor { + return ServiceCommandDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceCommandDescriptor { + const message = createBaseServiceCommandDescriptor(); + message.service = object.service ?? ""; + message.rpcCommandOptions = object.rpcCommandOptions?.map((e) => RpcCommandOptions.fromPartial(e)) || []; + message.subCommands = Object.entries(object.subCommands ?? {}).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ServiceCommandDescriptor.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseServiceCommandDescriptor_SubCommandsEntry(): ServiceCommandDescriptor_SubCommandsEntry { + return { key: "", value: undefined }; +} + +export const ServiceCommandDescriptor_SubCommandsEntry: MessageFns = { + encode(message: ServiceCommandDescriptor_SubCommandsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ServiceCommandDescriptor.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor_SubCommandsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor_SubCommandsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ServiceCommandDescriptor.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ServiceCommandDescriptor_SubCommandsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ServiceCommandDescriptor.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + return ServiceCommandDescriptor_SubCommandsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ServiceCommandDescriptor.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseRpcCommandOptions(): RpcCommandOptions { + return { + rpcMethod: "", + use: "", + long: "", + short: "", + example: "", + alias: [], + suggestFor: [], + deprecated: "", + version: "", + flagOptions: {}, + positionalArgs: [], + skip: false, + }; +} + +export const RpcCommandOptions: MessageFns = { + encode(message: RpcCommandOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rpcMethod !== "") { + writer.uint32(10).string(message.rpcMethod); + } + if (message.use !== "") { + writer.uint32(18).string(message.use); + } + if (message.long !== "") { + writer.uint32(26).string(message.long); + } + if (message.short !== "") { + writer.uint32(34).string(message.short); + } + if (message.example !== "") { + writer.uint32(42).string(message.example); + } + for (const v of message.alias) { + writer.uint32(50).string(v!); + } + for (const v of message.suggestFor) { + writer.uint32(58).string(v!); + } + if (message.deprecated !== "") { + writer.uint32(66).string(message.deprecated); + } + if (message.version !== "") { + writer.uint32(74).string(message.version); + } + Object.entries(message.flagOptions).forEach(([key, value]) => { + RpcCommandOptions_FlagOptionsEntry.encode({ key: key as any, value }, writer.uint32(82).fork()).join(); + }); + for (const v of message.positionalArgs) { + PositionalArgDescriptor.encode(v!, writer.uint32(90).fork()).join(); + } + if (message.skip !== false) { + writer.uint32(96).bool(message.skip); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rpcMethod = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.use = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.long = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.short = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.example = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.alias.push(reader.string()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.suggestFor.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.deprecated = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.version = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + const entry10 = RpcCommandOptions_FlagOptionsEntry.decode(reader, reader.uint32()); + if (entry10.value !== undefined) { + message.flagOptions[entry10.key] = entry10.value; + } + continue; + case 11: + if (tag !== 90) { + break; + } + + message.positionalArgs.push(PositionalArgDescriptor.decode(reader, reader.uint32())); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.skip = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions { + return { + rpcMethod: isSet(object.rpcMethod) ? globalThis.String(object.rpcMethod) : "", + use: isSet(object.use) ? globalThis.String(object.use) : "", + long: isSet(object.long) ? globalThis.String(object.long) : "", + short: isSet(object.short) ? globalThis.String(object.short) : "", + example: isSet(object.example) ? globalThis.String(object.example) : "", + alias: globalThis.Array.isArray(object?.alias) ? object.alias.map((e: any) => globalThis.String(e)) : [], + suggestFor: globalThis.Array.isArray(object?.suggestFor) + ? object.suggestFor.map((e: any) => globalThis.String(e)) + : [], + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + flagOptions: isObject(object.flagOptions) + ? Object.entries(object.flagOptions).reduce<{ [key: string]: FlagOptions }>((acc, [key, value]) => { + acc[key] = FlagOptions.fromJSON(value); + return acc; + }, {}) + : {}, + positionalArgs: globalThis.Array.isArray(object?.positionalArgs) + ? object.positionalArgs.map((e: any) => PositionalArgDescriptor.fromJSON(e)) + : [], + skip: isSet(object.skip) ? globalThis.Boolean(object.skip) : false, + }; + }, + + toJSON(message: RpcCommandOptions): unknown { + const obj: any = {}; + if (message.rpcMethod !== "") { + obj.rpcMethod = message.rpcMethod; + } + if (message.use !== "") { + obj.use = message.use; + } + if (message.long !== "") { + obj.long = message.long; + } + if (message.short !== "") { + obj.short = message.short; + } + if (message.example !== "") { + obj.example = message.example; + } + if (message.alias?.length) { + obj.alias = message.alias; + } + if (message.suggestFor?.length) { + obj.suggestFor = message.suggestFor; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.flagOptions) { + const entries = Object.entries(message.flagOptions); + if (entries.length > 0) { + obj.flagOptions = {}; + entries.forEach(([k, v]) => { + obj.flagOptions[k] = FlagOptions.toJSON(v); + }); + } + } + if (message.positionalArgs?.length) { + obj.positionalArgs = message.positionalArgs.map((e) => PositionalArgDescriptor.toJSON(e)); + } + if (message.skip !== false) { + obj.skip = message.skip; + } + return obj; + }, + + create, I>>(base?: I): RpcCommandOptions { + return RpcCommandOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RpcCommandOptions { + const message = createBaseRpcCommandOptions(); + message.rpcMethod = object.rpcMethod ?? ""; + message.use = object.use ?? ""; + message.long = object.long ?? ""; + message.short = object.short ?? ""; + message.example = object.example ?? ""; + message.alias = object.alias?.map((e) => e) || []; + message.suggestFor = object.suggestFor?.map((e) => e) || []; + message.deprecated = object.deprecated ?? ""; + message.version = object.version ?? ""; + message.flagOptions = Object.entries(object.flagOptions ?? {}).reduce<{ [key: string]: FlagOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = FlagOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + message.positionalArgs = object.positionalArgs?.map((e) => PositionalArgDescriptor.fromPartial(e)) || []; + message.skip = object.skip ?? false; + return message; + }, +}; + +function createBaseRpcCommandOptions_FlagOptionsEntry(): RpcCommandOptions_FlagOptionsEntry { + return { key: "", value: undefined }; +} + +export const RpcCommandOptions_FlagOptionsEntry: MessageFns = { + encode(message: RpcCommandOptions_FlagOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + FlagOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions_FlagOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = FlagOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions_FlagOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? FlagOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: RpcCommandOptions_FlagOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = FlagOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): RpcCommandOptions_FlagOptionsEntry { + return RpcCommandOptions_FlagOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RpcCommandOptions_FlagOptionsEntry { + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? FlagOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseFlagOptions(): FlagOptions { + return { + name: "", + shorthand: "", + usage: "", + defaultValue: "", + deprecated: "", + shorthandDeprecated: "", + hidden: false, + }; +} + +export const FlagOptions: MessageFns = { + encode(message: FlagOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.shorthand !== "") { + writer.uint32(18).string(message.shorthand); + } + if (message.usage !== "") { + writer.uint32(26).string(message.usage); + } + if (message.defaultValue !== "") { + writer.uint32(34).string(message.defaultValue); + } + if (message.deprecated !== "") { + writer.uint32(50).string(message.deprecated); + } + if (message.shorthandDeprecated !== "") { + writer.uint32(58).string(message.shorthandDeprecated); + } + if (message.hidden !== false) { + writer.uint32(64).bool(message.hidden); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlagOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlagOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.shorthand = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.usage = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.defaultValue = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.deprecated = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.shorthandDeprecated = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.hidden = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FlagOptions { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + shorthand: isSet(object.shorthand) ? globalThis.String(object.shorthand) : "", + usage: isSet(object.usage) ? globalThis.String(object.usage) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + shorthandDeprecated: isSet(object.shorthandDeprecated) ? globalThis.String(object.shorthandDeprecated) : "", + hidden: isSet(object.hidden) ? globalThis.Boolean(object.hidden) : false, + }; + }, + + toJSON(message: FlagOptions): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.shorthand !== "") { + obj.shorthand = message.shorthand; + } + if (message.usage !== "") { + obj.usage = message.usage; + } + if (message.defaultValue !== "") { + obj.defaultValue = message.defaultValue; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.shorthandDeprecated !== "") { + obj.shorthandDeprecated = message.shorthandDeprecated; + } + if (message.hidden !== false) { + obj.hidden = message.hidden; + } + return obj; + }, + + create, I>>(base?: I): FlagOptions { + return FlagOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlagOptions { + const message = createBaseFlagOptions(); + message.name = object.name ?? ""; + message.shorthand = object.shorthand ?? ""; + message.usage = object.usage ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.deprecated = object.deprecated ?? ""; + message.shorthandDeprecated = object.shorthandDeprecated ?? ""; + message.hidden = object.hidden ?? false; + return message; + }, +}; + +function createBasePositionalArgDescriptor(): PositionalArgDescriptor { + return { protoField: "", varargs: false }; +} + +export const PositionalArgDescriptor: MessageFns = { + encode(message: PositionalArgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protoField !== "") { + writer.uint32(10).string(message.protoField); + } + if (message.varargs !== false) { + writer.uint32(16).bool(message.varargs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PositionalArgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePositionalArgDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protoField = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.varargs = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PositionalArgDescriptor { + return { + protoField: isSet(object.protoField) ? globalThis.String(object.protoField) : "", + varargs: isSet(object.varargs) ? globalThis.Boolean(object.varargs) : false, + }; + }, + + toJSON(message: PositionalArgDescriptor): unknown { + const obj: any = {}; + if (message.protoField !== "") { + obj.protoField = message.protoField; + } + if (message.varargs !== false) { + obj.varargs = message.varargs; + } + return obj; + }, + + create, I>>(base?: I): PositionalArgDescriptor { + return PositionalArgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PositionalArgDescriptor { + const message = createBasePositionalArgDescriptor(); + message.protoField = object.protoField ?? ""; + message.varargs = object.varargs ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/autocli/v1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/autocli/v1/query.ts new file mode 100644 index 00000000..5fcd821c --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/autocli/v1/query.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ModuleOptions } from "./options"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** AppOptionsRequest is the RemoteInfoService/AppOptions request type. */ +export interface AppOptionsRequest { +} + +/** AppOptionsResponse is the RemoteInfoService/AppOptions response type. */ +export interface AppOptionsResponse { + /** module_options is a map of module name to autocli module options. */ + moduleOptions: { [key: string]: ModuleOptions }; +} + +export interface AppOptionsResponse_ModuleOptionsEntry { + key: string; + value: ModuleOptions | undefined; +} + +function createBaseAppOptionsRequest(): AppOptionsRequest { + return {}; +} + +export const AppOptionsRequest: MessageFns = { + encode(_: AppOptionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): AppOptionsRequest { + return {}; + }, + + toJSON(_: AppOptionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): AppOptionsRequest { + return AppOptionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): AppOptionsRequest { + const message = createBaseAppOptionsRequest(); + return message; + }, +}; + +function createBaseAppOptionsResponse(): AppOptionsResponse { + return { moduleOptions: {} }; +} + +export const AppOptionsResponse: MessageFns = { + encode(message: AppOptionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.moduleOptions).forEach(([key, value]) => { + AppOptionsResponse_ModuleOptionsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = AppOptionsResponse_ModuleOptionsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.moduleOptions[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse { + return { + moduleOptions: isObject(object.moduleOptions) + ? Object.entries(object.moduleOptions).reduce<{ [key: string]: ModuleOptions }>((acc, [key, value]) => { + acc[key] = ModuleOptions.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: AppOptionsResponse): unknown { + const obj: any = {}; + if (message.moduleOptions) { + const entries = Object.entries(message.moduleOptions); + if (entries.length > 0) { + obj.moduleOptions = {}; + entries.forEach(([k, v]) => { + obj.moduleOptions[k] = ModuleOptions.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): AppOptionsResponse { + return AppOptionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AppOptionsResponse { + const message = createBaseAppOptionsResponse(); + message.moduleOptions = Object.entries(object.moduleOptions ?? {}).reduce<{ [key: string]: ModuleOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ModuleOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseAppOptionsResponse_ModuleOptionsEntry(): AppOptionsResponse_ModuleOptionsEntry { + return { key: "", value: undefined }; +} + +export const AppOptionsResponse_ModuleOptionsEntry: MessageFns = { + encode(message: AppOptionsResponse_ModuleOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ModuleOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse_ModuleOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ModuleOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse_ModuleOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ModuleOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: AppOptionsResponse_ModuleOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ModuleOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): AppOptionsResponse_ModuleOptionsEntry { + return AppOptionsResponse_ModuleOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): AppOptionsResponse_ModuleOptionsEntry { + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ModuleOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +/** + * RemoteInfoService provides clients with the information they need + * to build dynamically CLI clients for remote chains. + */ +export interface Query { + /** AppOptions returns the autocli options for all of the modules in an app. */ + AppOptions(request: AppOptionsRequest): Promise; +} + +export const QueryServiceName = "cosmos.autocli.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 || QueryServiceName; + this.rpc = rpc; + this.AppOptions = this.AppOptions.bind(this); + } + AppOptions(request: AppOptionsRequest): Promise { + const data = AppOptionsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AppOptions", data); + return promise.then((data) => AppOptionsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/bank/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/bank/module/v1/module.ts new file mode 100644 index 00000000..18dd6917 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/bank/module/v1/module.ts @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.bank.module.v1"; + +/** Module is the config object of the bank module. */ +export interface Module { + /** + * blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving + * funds. If left empty it defaults to the list of account names supplied in the auth module configuration as + * module_account_permissions + */ + blockedModuleAccountsOverride: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** + * restrictions_order specifies the order of send restrictions and should be + * a list of module names which provide a send restriction instance. If no + * order is provided, then restrictions will be applied in alphabetical order + * of module names. + */ + restrictionsOrder: string[]; +} + +function createBaseModule(): Module { + return { blockedModuleAccountsOverride: [], authority: "", restrictionsOrder: [] }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.blockedModuleAccountsOverride) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + for (const v of message.restrictionsOrder) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockedModuleAccountsOverride.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.restrictionsOrder.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + blockedModuleAccountsOverride: globalThis.Array.isArray(object?.blockedModuleAccountsOverride) + ? object.blockedModuleAccountsOverride.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + restrictionsOrder: globalThis.Array.isArray(object?.restrictionsOrder) + ? object.restrictionsOrder.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.blockedModuleAccountsOverride?.length) { + obj.blockedModuleAccountsOverride = message.blockedModuleAccountsOverride; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.restrictionsOrder?.length) { + obj.restrictionsOrder = message.restrictionsOrder; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.blockedModuleAccountsOverride = object.blockedModuleAccountsOverride?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.restrictionsOrder = object.restrictionsOrder?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/authz.ts b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 00000000..3437ed53 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,127 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + spendLimit: Coin[]; + /** + * allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + * granter. If omitted, any recipient is allowed. + * + * Since: cosmos-sdk 0.47 + */ + allowList: string[]; +} + +function createBaseSendAuthorization(): SendAuthorization { + return { spendLimit: [], allowList: [] }; +} + +export const SendAuthorization: MessageFns = { + encode(message: SendAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.allowList) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendAuthorization { + return { + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + allowList: globalThis.Array.isArray(object?.allowList) + ? object.allowList.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: SendAuthorization): unknown { + const obj: any = {}; + if (message.spendLimit?.length) { + obj.spendLimit = message.spendLimit.map((e) => Coin.toJSON(e)); + } + if (message.allowList?.length) { + obj.allowList = message.allowList; + } + return obj; + }, + + create, I>>(base?: I): SendAuthorization { + return SendAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.allowList = object.allowList?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/bank.ts b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..92e997fb --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,755 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/bank.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** Params defines the parameters for the bank module. */ +export interface Params { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + * + * @deprecated + */ + sendEnabled: SendEnabled[]; + defaultSendEnabled: boolean; +} + +/** + * 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 */ + denomUnits: DenomUnit[]; + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ + base: string; + /** + * display indicates the suggested denom that should be + * displayed in clients. + */ + display: string; + /** + * name defines the name of the token (eg: Cosmos Atom) + * + * Since: cosmos-sdk 0.43 + */ + name: string; + /** + * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + * be the same as the display. + * + * Since: cosmos-sdk 0.43 + */ + symbol: string; + /** + * URI to a document (on or off-chain) that contains additional information. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uri: string; + /** + * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + * the document didn't change. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uriHash: string; +} + +function createBaseParams(): Params { + return { sendEnabled: [], defaultSendEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.defaultSendEnabled !== false) { + writer.uint32(16).bool(message.defaultSendEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.defaultSendEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + defaultSendEnabled: isSet(object.defaultSendEnabled) ? globalThis.Boolean(object.defaultSendEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.defaultSendEnabled !== false) { + obj.defaultSendEnabled = message.defaultSendEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.defaultSendEnabled = object.defaultSendEnabled ?? false; + return message; + }, +}; + +function createBaseSendEnabled(): SendEnabled { + return { denom: "", enabled: false }; +} + +export const SendEnabled: MessageFns = { + encode(message: SendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled !== false) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendEnabled { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false, + }; + }, + + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.enabled !== false) { + obj.enabled = message.enabled; + } + return obj; + }, + + create, I>>(base?: I): SendEnabled { + return SendEnabled.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Input, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Input { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Input { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Input): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Input { + return Input.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Output, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Output { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Output { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Output): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Output { + return Output.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Supply, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Supply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSupply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.total.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Supply { + return { total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: Supply): unknown { + const obj: any = {}; + if (message.total?.length) { + obj.total = message.total.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Supply { + return Supply.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomUnit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } + for (const v of message.aliases) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomUnit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.exponent = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.aliases.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomUnit { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + exponent: isSet(object.exponent) ? globalThis.Number(object.exponent) : 0, + aliases: globalThis.Array.isArray(object?.aliases) ? object.aliases.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.exponent !== 0) { + obj.exponent = Math.round(message.exponent); + } + if (message.aliases?.length) { + obj.aliases = message.aliases; + } + return obj; + }, + + create, I>>(base?: I): DenomUnit { + return DenomUnit.fromPartial(base ?? ({} as any)); + }, + 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: "", denomUnits: [], base: "", display: "", name: "", symbol: "", uri: "", uriHash: "" }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denomUnits) { + DenomUnit.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } + if (message.name !== "") { + writer.uint32(42).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(50).string(message.symbol); + } + if (message.uri !== "") { + writer.uint32(58).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(66).string(message.uriHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denomUnits.push(DenomUnit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.base = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.display = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.symbol = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.uri = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.uriHash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + description: isSet(object.description) ? globalThis.String(object.description) : "", + denomUnits: globalThis.Array.isArray(object?.denomUnits) + ? object.denomUnits.map((e: any) => DenomUnit.fromJSON(e)) + : [], + base: isSet(object.base) ? globalThis.String(object.base) : "", + display: isSet(object.display) ? globalThis.String(object.display) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.description !== "") { + obj.description = message.description; + } + if (message.denomUnits?.length) { + obj.denomUnits = message.denomUnits.map((e) => DenomUnit.toJSON(e)); + } + if (message.base !== "") { + obj.base = message.base; + } + if (message.display !== "") { + obj.display = message.display; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denomUnits = object.denomUnits?.map((e) => DenomUnit.fromPartial(e)) || []; + message.base = object.base ?? ""; + message.display = object.display ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 00000000..b9d9a434 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,270 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** 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 different coins. */ + denomMetadata: Metadata[]; + /** + * send_enabled defines the denoms where send is enabled or disabled. + * + * Since: cosmos-sdk 0.47 + */ + sendEnabled: SendEnabled[]; +} + +/** + * 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: [], denomMetadata: [], sendEnabled: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.balances) { + Balance.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.denomMetadata) { + Metadata.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balances.push(Balance.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.denomMetadata.push(Metadata.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + balances: globalThis.Array.isArray(object?.balances) ? object.balances.map((e: any) => Balance.fromJSON(e)) : [], + supply: globalThis.Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + denomMetadata: globalThis.Array.isArray(object?.denomMetadata) + ? object.denomMetadata.map((e: any) => Metadata.fromJSON(e)) + : [], + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Balance.toJSON(e)); + } + if (message.supply?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.denomMetadata?.length) { + obj.denomMetadata = message.denomMetadata.map((e) => Metadata.toJSON(e)); + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.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) + ? Params.fromPartial(object.params) + : undefined; + message.balances = object.balances?.map((e) => Balance.fromPartial(e)) || []; + message.supply = object.supply?.map((e) => Coin.fromPartial(e)) || []; + message.denomMetadata = object.denomMetadata?.map((e) => Metadata.fromPartial(e)) || []; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBalance(): Balance { + return { address: "", coins: [] }; +} + +export const Balance: MessageFns = { + encode(message: Balance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Balance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Balance { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Balance): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Balance { + return Balance.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/query.ts new file mode 100644 index 00000000..67edba9b --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,2382 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } 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 | undefined; +} + +/** 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 + | undefined; + /** + * resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. + * + * Since: cosmos-sdk 0.50 + */ + resolveDenom: boolean; +} + +/** + * 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 | undefined; +} + +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} + +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponse { + /** balance is the balance of the coin. */ + balance: Coin | undefined; +} + +/** + * 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 provides the parameters of the bank module. */ + params: Params | undefined; +} + +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} + +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata: Metadata | undefined; +} + +/** + * 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 | undefined; +} + +/** + * DenomOwner defines structure representing an account that owns or holds a + * particular denominated token. It contains the account address and account + * balance of the denominated token. + * + * Since: cosmos-sdk 0.46 + */ +export interface DenomOwner { + /** address defines the address that owns a particular denomination. */ + address: string; + /** balance is the balance of the denominated coin for an account. */ + balance: Coin | undefined; +} + +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryRequest { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequest { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination: PageRequest | undefined; +} + +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponse { + sendEnabled: SendEnabled[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination: PageResponse | undefined; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { address: "", denom: "" }; +} + +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + 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, resolveDenom: false }; +} + +export const QueryAllBalancesRequest: MessageFns = { + encode(message: QueryAllBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.resolveDenom !== false) { + writer.uint32(24).bool(message.resolveDenom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.resolveDenom = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + resolveDenom: isSet(object.resolveDenom) ? globalThis.Boolean(object.resolveDenom) : false, + }; + }, + + toJSON(message: QueryAllBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.resolveDenom !== false) { + obj.resolveDenom = message.resolveDenom; + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesRequest { + return QueryAllBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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; + message.resolveDenom = object.resolveDenom ?? false; + return message; + }, +}; + +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { balances: [], pagination: undefined }; +} + +export const QueryAllBalancesResponse: MessageFns = { + encode(message: QueryAllBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesResponse { + return QueryAllBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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 createBaseQuerySpendableBalanceByDenomRequest(): QuerySpendableBalanceByDenomRequest { + return { address: "", denom: "" }; +} + +export const QuerySpendableBalanceByDenomRequest: MessageFns = { + encode(message: QuerySpendableBalanceByDenomRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QuerySpendableBalanceByDenomRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySpendableBalanceByDenomResponse(): QuerySpendableBalanceByDenomResponse { + return { balance: undefined }; +} + +export const QuerySpendableBalanceByDenomResponse: MessageFns = { + encode(message: QuerySpendableBalanceByDenomResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QuerySpendableBalanceByDenomResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + message.balance = (object.balance !== undefined && object.balance !== null) + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; + +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { pagination: undefined }; +} + +export const QueryTotalSupplyRequest: MessageFns = { + encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryTotalSupplyRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyResponse { + return { + supply: globalThis.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?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySupplyOfRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QuerySupplyOfRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfRequest { + return QuerySupplyOfRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { amount: undefined }; +} + +export const QuerySupplyOfResponse: MessageFns = { + encode(message: QuerySupplyOfResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfResponse { + return { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; + }, + + toJSON(message: QuerySupplyOfResponse): unknown { + const obj: any = {}; + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfResponse { + return QuerySupplyOfResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { pagination: undefined }; +} + +export const QueryDenomsMetadataRequest: MessageFns = { + encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDenomsMetadataRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.metadatas) { + Metadata.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadatas.push(Metadata.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataResponse { + return { + metadatas: globalThis.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?.length) { + obj.metadatas = message.metadatas.map((e) => Metadata.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataResponse: MessageFns = { + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringRequest(): QueryDenomMetadataByQueryStringRequest { + return { denom: "" }; +} + +export const QueryDenomMetadataByQueryStringRequest: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringRequest { + return QueryDenomMetadataByQueryStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringRequest { + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringResponse(): QueryDenomMetadataByQueryStringResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataByQueryStringResponse: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringResponse { + return QueryDenomMetadataByQueryStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringResponse { + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + 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: MessageFns = { + encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomOwner, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomOwner(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomOwner { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DenomOwner): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DenomOwner { + return DenomOwner.fromPartial(base ?? ({} as any)); + }, + 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 { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersResponse: MessageFns = { + encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryRequest(): QueryDenomOwnersByQueryRequest { + return { denom: "", pagination: undefined }; +} + +export const QueryDenomOwnersByQueryRequest: MessageFns = { + encode(message: QueryDenomOwnersByQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryRequest { + return QueryDenomOwnersByQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryRequest { + const message = createBaseQueryDenomOwnersByQueryRequest(); + message.denom = object.denom ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryResponse(): QueryDenomOwnersByQueryResponse { + return { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersByQueryResponse: MessageFns = { + encode(message: QueryDenomOwnersByQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryResponse { + return QueryDenomOwnersByQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryResponse { + const message = createBaseQueryDenomOwnersByQueryResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledRequest(): QuerySendEnabledRequest { + return { denoms: [], pagination: undefined }; +} + +export const QuerySendEnabledRequest: MessageFns = { + encode(message: QuerySendEnabledRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denoms.push(reader.string()); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledRequest { + return { + denoms: globalThis.Array.isArray(object?.denoms) ? object.denoms.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledRequest): unknown { + const obj: any = {}; + if (message.denoms?.length) { + obj.denoms = message.denoms; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledRequest { + return QuerySendEnabledRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map((e) => e) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledResponse(): QuerySendEnabledResponse { + return { sendEnabled: [], pagination: undefined }; +} + +export const QuerySendEnabledResponse: MessageFns = { + encode(message: QuerySendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledResponse { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledResponse): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledResponse { + return QuerySendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + AllBalances(request: QueryAllBalancesRequest): Promise; + /** + * SpendableBalances queries the spendable balance of all coins for a single + * account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + SpendableBalances(request: QuerySpendableBalancesRequest): Promise; + /** + * SpendableBalanceByDenom queries the spendable balance of a single denom for + * a single account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.47 + */ + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise; + /** + * TotalSupply queries the total supply of all coins. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + TotalSupply(request: QueryTotalSupplyRequest): Promise; + /** + * SupplyOf queries the supply of a single coin. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + SupplyOf(request: QuerySupplyOfRequest): Promise; + /** Params queries the parameters of x/bank module. */ + Params(request: QueryParamsRequest): Promise; + /** DenomMetadata queries the client metadata of a given coin denomination. */ + DenomMetadata(request: QueryDenomMetadataRequest): Promise; + /** DenomMetadataByQueryString queries the client metadata of a given coin denomination. */ + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + DenomOwners(request: QueryDenomOwnersRequest): Promise; + /** + * DenomOwnersByQuery queries for all account addresses that own a particular token + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise; + /** + * SendEnabled queries for SendEnabled entries. + * + * This query only returns denominations that have specific SendEnabled settings. + * Any denomination that does not have a specific setting will use the default + * params.default_send_enabled, and will not be returned by this query. + * + * Since: cosmos-sdk 0.47 + */ + SendEnabled(request: QuerySendEnabledRequest): Promise; +} + +export const QueryServiceName = "cosmos.bank.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 || QueryServiceName; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.AllBalances = this.AllBalances.bind(this); + this.SpendableBalances = this.SpendableBalances.bind(this); + this.SpendableBalanceByDenom = this.SpendableBalanceByDenom.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.DenomMetadataByQueryString = this.DenomMetadataByQueryString.bind(this); + this.DenomsMetadata = this.DenomsMetadata.bind(this); + this.DenomOwners = this.DenomOwners.bind(this); + this.DenomOwnersByQuery = this.DenomOwnersByQuery.bind(this); + this.SendEnabled = this.SendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise { + const data = QuerySpendableBalanceByDenomRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SpendableBalanceByDenom", data); + return promise.then((data) => QuerySpendableBalanceByDenomResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): Promise { + const data = QueryDenomMetadataByQueryStringRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomMetadataByQueryString", data); + return promise.then((data) => QueryDenomMetadataByQueryStringResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise { + const data = QueryDenomOwnersByQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomOwnersByQuery", data); + return promise.then((data) => QueryDenomOwnersByQueryResponse.decode(new BinaryReader(data))); + } + + SendEnabled(request: QuerySendEnabledRequest): Promise { + const data = QuerySendEnabledRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendEnabled", data); + return promise.then((data) => QuerySendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 00000000..1f1637f5 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,687 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Input, Output, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSend { + fromAddress: string; + toAddress: 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, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: Input[]; + outputs: Output[]; +} + +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabled { + /** authority is the address that controls the module. */ + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; +} + +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponse { +} + +function createBaseMsgSend(): MsgSend { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +function createBaseMsgMultiSend(): MsgMultiSend { + return { inputs: [], outputs: [] }; +} + +export const MsgMultiSend: MessageFns = { + encode(message: MsgMultiSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.inputs) { + Input.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.outputs) { + Output.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inputs.push(Input.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outputs.push(Output.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgMultiSend { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e: any) => Input.fromJSON(e)) : [], + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e: any) => Output.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgMultiSend): unknown { + const obj: any = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => Input.toJSON(e)); + } + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => Output.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgMultiSend { + return MsgMultiSend.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgMultiSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgMultiSendResponse { + return {}; + }, + + toJSON(_: MsgMultiSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgMultiSendResponse { + return MsgMultiSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSetSendEnabled(): MsgSetSendEnabled { + return { authority: "", sendEnabled: [], useDefaultFor: [] }; +} + +export const MsgSetSendEnabled: MessageFns = { + encode(message: MsgSetSendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.useDefaultFor) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.useDefaultFor.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetSendEnabled { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + useDefaultFor: globalThis.Array.isArray(object?.useDefaultFor) + ? object.useDefaultFor.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgSetSendEnabled): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.useDefaultFor?.length) { + obj.useDefaultFor = message.useDefaultFor; + } + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabled { + return MsgSetSendEnabled.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + message.authority = object.authority ?? ""; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.useDefaultFor = object.useDefaultFor?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgSetSendEnabledResponse(): MsgSetSendEnabledResponse { + return {}; +} + +export const MsgSetSendEnabledResponse: MessageFns = { + encode(_: MsgSetSendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetSendEnabledResponse { + return {}; + }, + + toJSON(_: MsgSetSendEnabledResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/bank module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SetSendEnabled is a governance operation for setting the SendEnabled flag + * on any number of Denoms. Only the entries to add or update should be + * included. Entries that already exist in the store, but that aren't + * included in this message, will be left unchanged. + * + * Since: cosmos-sdk 0.47 + */ + SetSendEnabled(request: MsgSetSendEnabled): Promise; +} + +export const MsgServiceName = "cosmos.bank.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 || MsgServiceName; + this.rpc = rpc; + this.Send = this.Send.bind(this); + this.MultiSend = this.MultiSend.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.SetSendEnabled = this.SetSendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SetSendEnabled(request: MsgSetSendEnabled): Promise { + const data = MsgSetSendEnabled.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetSendEnabled", data); + return promise.then((data) => MsgSetSendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/base/abci/v1beta1/abci.ts b/ts-client/cosmos.circuit.v1/types/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 00000000..6da88804 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1425 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/abci/v1beta1/abci.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Event } from "../../../../tendermint/abci/types"; +import { Block } from "../../../../tendermint/types/block"; + +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: number; + /** The transaction hash. */ + txhash: string; + /** Namespace for the Code */ + codespace: string; + /** Response code. */ + code: number; + /** Result bytes, if any. */ + data: string; + /** + * The output of the application's logger (raw string). May be + * non-deterministic. + */ + rawLog: string; + /** The output of the application's logger (typed). May be non-deterministic. */ + logs: ABCIMessageLog[]; + /** Additional information. May be non-deterministic. */ + info: string; + /** Amount of gas requested for transaction. */ + gasWanted: number; + /** Amount of gas consumed by transaction. */ + gasUsed: number; + /** The request transaction bytes. */ + tx: + | Any + | undefined; + /** + * Time of the previous block. For heights > 1, it's the weighted median of + * the timestamps of the valid votes in the block.LastCommit. For height == 1, + * it's genesis time. + */ + timestamp: string; + /** + * Events defines all the events emitted by processing a transaction. Note, + * these events include those emitted by processing all the messages and those + * emitted from the ante. Whereas Logs contains the events, with + * additional metadata, emitted only by processing the messages. + * + * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + */ + events: Event[]; +} + +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLog { + msgIndex: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEvent[]; +} + +/** + * 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. */ + gasWanted: number; + /** GasUsed is the amount of gas actually consumed. */ + gasUsed: number; +} + +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface Result { + /** + * Data is any data returned from message or handler execution. It MUST be + * length prefixed in order to separate data from multiple message executions. + * Deprecated. This field is still populated, but prefer msg_response instead + * because it also contains the Msg response typeURL. + * + * @deprecated + */ + data: Uint8Array; + /** Log contains the log information from message or handler execution. */ + log: string; + /** + * Events contains a slice of Event objects that were emitted during message + * or handler execution. + */ + events: Event[]; + /** + * msg_responses contains the Msg handler responses type packed in Anys. + * + * Since: cosmos-sdk 0.46 + */ + msgResponses: Any[]; +} + +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponse { + gasInfo: GasInfo | undefined; + result: Result | undefined; +} + +/** + * MsgData defines the data returned in a Result object during message + * execution. + * + * @deprecated + */ +export interface MsgData { + msgType: 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 + */ + msgResponses: Any[]; +} + +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResult { + /** Count of all txs */ + totalCount: number; + /** Count of txs in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count txs per page */ + limit: number; + /** List of txs in current page */ + txs: TxResponse[]; +} + +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResult { + /** Count of all blocks */ + totalCount: number; + /** Count of blocks in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count blocks per page */ + limit: number; + /** List of blocks in current page */ + blocks: Block[]; +} + +function createBaseTxResponse(): TxResponse { + return { + height: 0, + txhash: "", + codespace: "", + code: 0, + data: "", + rawLog: "", + logs: [], + info: "", + gasWanted: 0, + gasUsed: 0, + tx: undefined, + timestamp: "", + events: [], + }; +} + +export const TxResponse: MessageFns = { + encode(message: TxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.rawLog !== "") { + writer.uint32(50).string(message.rawLog); + } + for (const v of message.logs) { + ABCIMessageLog.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.info !== "") { + writer.uint32(66).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(72).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(80).int64(message.gasUsed); + } + if (message.tx !== undefined) { + Any.encode(message.tx, writer.uint32(90).fork()).join(); + } + if (message.timestamp !== "") { + writer.uint32(98).string(message.timestamp); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(106).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txhash = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codespace = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.code = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.data = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.rawLog = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.info = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.tx = Any.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.timestamp = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResponse { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + txhash: isSet(object.txhash) ? globalThis.String(object.txhash) : "", + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + rawLog: isSet(object.rawLog) ? globalThis.String(object.rawLog) : "", + logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => ABCIMessageLog.fromJSON(e)) : [], + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + tx: isSet(object.tx) ? Any.fromJSON(object.tx) : undefined, + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.txhash !== "") { + obj.txhash = message.txhash; + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.rawLog !== "") { + obj.rawLog = message.rawLog; + } + if (message.logs?.length) { + obj.logs = message.logs.map((e) => ABCIMessageLog.toJSON(e)); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + if (message.tx !== undefined) { + obj.tx = Any.toJSON(message.tx); + } + if (message.timestamp !== "") { + obj.timestamp = message.timestamp; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxResponse { + return TxResponse.fromPartial(base ?? ({} as any)); + }, + 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.rawLog = object.rawLog ?? ""; + message.logs = object.logs?.map((e) => ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 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 { msgIndex: 0, log: "", events: [] }; +} + +export const ABCIMessageLog: MessageFns = { + encode(message: ABCIMessageLog, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgIndex !== 0) { + writer.uint32(8).uint32(message.msgIndex); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + StringEvent.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIMessageLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.msgIndex = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(StringEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIMessageLog { + return { + msgIndex: isSet(object.msgIndex) ? globalThis.Number(object.msgIndex) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => StringEvent.fromJSON(e)) : [], + }; + }, + + toJSON(message: ABCIMessageLog): unknown { + const obj: any = {}; + if (message.msgIndex !== 0) { + obj.msgIndex = Math.round(message.msgIndex); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => StringEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ABCIMessageLog { + return ABCIMessageLog.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msgIndex = object.msgIndex ?? 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: MessageFns = { + encode(message: StringEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + Attribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(Attribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StringEvent { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => Attribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: StringEvent): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => Attribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): StringEvent { + return StringEvent.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Attribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Attribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Attribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: Attribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Attribute { + return Attribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseGasInfo(): GasInfo { + return { gasWanted: 0, gasUsed: 0 }; +} + +export const GasInfo: MessageFns = { + encode(message: GasInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasWanted !== 0) { + writer.uint32(8).uint64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(16).uint64(message.gasUsed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.gasWanted = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasUsed = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GasInfo { + return { + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + }; + }, + + toJSON(message: GasInfo): unknown { + const obj: any = {}; + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + return obj; + }, + + create, I>>(base?: I): GasInfo { + return GasInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GasInfo { + const message = createBaseGasInfo(); + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + return message; + }, +}; + +function createBaseResult(): Result { + return { data: new Uint8Array(0), log: "", events: [], msgResponses: [] }; +} + +export const Result: MessageFns = { + encode(message: Result, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Result { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Result { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Result): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Result { + return Result.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Result { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSimulationResponse(): SimulationResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulationResponse: MessageFns = { + encode(message: SimulationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulationResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulationResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulationResponse { + return SimulationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulationResponse { + const message = createBaseSimulationResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseMsgData(): MsgData { + return { msgType: "", data: new Uint8Array(0) }; +} + +export const MsgData: MessageFns = { + encode(message: MsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgType !== "") { + writer.uint32(10).string(message.msgType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgData { + return { + msgType: isSet(object.msgType) ? globalThis.String(object.msgType) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: MsgData): unknown { + const obj: any = {}; + if (message.msgType !== "") { + obj.msgType = message.msgType; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): MsgData { + return MsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgData { + const message = createBaseMsgData(); + message.msgType = object.msgType ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxMsgData(): TxMsgData { + return { data: [], msgResponses: [] }; +} + +export const TxMsgData: MessageFns = { + encode(message: TxMsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.data) { + MsgData.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data.push(MsgData.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxMsgData { + return { + data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => MsgData.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxMsgData): unknown { + const obj: any = {}; + if (message.data?.length) { + obj.data = message.data.map((e) => MsgData.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxMsgData { + return TxMsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map((e) => MsgData.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchTxsResult(): SearchTxsResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, txs: [] }; +} + +export const SearchTxsResult: MessageFns = { + encode(message: SearchTxsResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).uint64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).uint64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).uint64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).uint64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + for (const v of message.txs) { + TxResponse.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchTxsResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.txs.push(TxResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchTxsResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => TxResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchTxsResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => TxResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchTxsResult { + return SearchTxsResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.txs = object.txs?.map((e) => TxResponse.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchBlocksResult(): SearchBlocksResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, blocks: [] }; +} + +export const SearchBlocksResult: MessageFns = { + encode(message: SearchBlocksResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).int64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).int64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).int64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).int64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).int64(message.limit); + } + for (const v of message.blocks) { + Block.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchBlocksResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchBlocksResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.blocks.push(Block.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchBlocksResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e: any) => Block.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchBlocksResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.blocks?.length) { + obj.blocks = message.blocks.map((e) => Block.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchBlocksResult { + return SearchBlocksResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchBlocksResult { + const message = createBaseSearchBlocksResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.blocks = object.blocks?.map((e) => Block.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/base/node/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/base/node/v1beta1/query.ts new file mode 100644 index 00000000..ee56c0a8 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/base/node/v1beta1/query.ts @@ -0,0 +1,476 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/node/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.base.node.v1beta1"; + +/** ConfigRequest defines the request structure for the Config gRPC query. */ +export interface ConfigRequest { +} + +/** ConfigResponse defines the response structure for the Config gRPC query. */ +export interface ConfigResponse { + minimumGasPrice: string; + pruningKeepRecent: string; + pruningInterval: string; + haltHeight: number; +} + +/** StateRequest defines the request structure for the status of a node. */ +export interface StatusRequest { +} + +/** StateResponse defines the response structure for the status of a node. */ +export interface StatusResponse { + /** earliest block height available in the store */ + earliestStoreHeight: number; + /** current block height */ + height: number; + /** block height timestamp */ + timestamp: + | Date + | undefined; + /** app hash of the current block */ + appHash: Uint8Array; + /** validator hash provided by the consensus header */ + validatorHash: Uint8Array; +} + +function createBaseConfigRequest(): ConfigRequest { + return {}; +} + +export const ConfigRequest: MessageFns = { + encode(_: ConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ConfigRequest { + return {}; + }, + + toJSON(_: ConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ConfigRequest { + return ConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ConfigRequest { + const message = createBaseConfigRequest(); + return message; + }, +}; + +function createBaseConfigResponse(): ConfigResponse { + return { minimumGasPrice: "", pruningKeepRecent: "", pruningInterval: "", haltHeight: 0 }; +} + +export const ConfigResponse: MessageFns = { + encode(message: ConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minimumGasPrice !== "") { + writer.uint32(10).string(message.minimumGasPrice); + } + if (message.pruningKeepRecent !== "") { + writer.uint32(18).string(message.pruningKeepRecent); + } + if (message.pruningInterval !== "") { + writer.uint32(26).string(message.pruningInterval); + } + if (message.haltHeight !== 0) { + writer.uint32(32).uint64(message.haltHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minimumGasPrice = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pruningKeepRecent = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pruningInterval = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.haltHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigResponse { + return { + minimumGasPrice: isSet(object.minimumGasPrice) ? globalThis.String(object.minimumGasPrice) : "", + pruningKeepRecent: isSet(object.pruningKeepRecent) ? globalThis.String(object.pruningKeepRecent) : "", + pruningInterval: isSet(object.pruningInterval) ? globalThis.String(object.pruningInterval) : "", + haltHeight: isSet(object.haltHeight) ? globalThis.Number(object.haltHeight) : 0, + }; + }, + + toJSON(message: ConfigResponse): unknown { + const obj: any = {}; + if (message.minimumGasPrice !== "") { + obj.minimumGasPrice = message.minimumGasPrice; + } + if (message.pruningKeepRecent !== "") { + obj.pruningKeepRecent = message.pruningKeepRecent; + } + if (message.pruningInterval !== "") { + obj.pruningInterval = message.pruningInterval; + } + if (message.haltHeight !== 0) { + obj.haltHeight = Math.round(message.haltHeight); + } + return obj; + }, + + create, I>>(base?: I): ConfigResponse { + return ConfigResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigResponse { + const message = createBaseConfigResponse(); + message.minimumGasPrice = object.minimumGasPrice ?? ""; + message.pruningKeepRecent = object.pruningKeepRecent ?? ""; + message.pruningInterval = object.pruningInterval ?? ""; + message.haltHeight = object.haltHeight ?? 0; + return message; + }, +}; + +function createBaseStatusRequest(): StatusRequest { + return {}; +} + +export const StatusRequest: MessageFns = { + encode(_: StatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): StatusRequest { + return {}; + }, + + toJSON(_: StatusRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): StatusRequest { + return StatusRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): StatusRequest { + const message = createBaseStatusRequest(); + return message; + }, +}; + +function createBaseStatusResponse(): StatusResponse { + return { + earliestStoreHeight: 0, + height: 0, + timestamp: undefined, + appHash: new Uint8Array(0), + validatorHash: new Uint8Array(0), + }; +} + +export const StatusResponse: MessageFns = { + encode(message: StatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.earliestStoreHeight !== 0) { + writer.uint32(8).uint64(message.earliestStoreHeight); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(34).bytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + writer.uint32(42).bytes(message.validatorHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.earliestStoreHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StatusResponse { + return { + earliestStoreHeight: isSet(object.earliestStoreHeight) ? globalThis.Number(object.earliestStoreHeight) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + validatorHash: isSet(object.validatorHash) ? bytesFromBase64(object.validatorHash) : new Uint8Array(0), + }; + }, + + toJSON(message: StatusResponse): unknown { + const obj: any = {}; + if (message.earliestStoreHeight !== 0) { + obj.earliestStoreHeight = Math.round(message.earliestStoreHeight); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + obj.validatorHash = base64FromBytes(message.validatorHash); + } + return obj; + }, + + create, I>>(base?: I): StatusResponse { + return StatusResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatusResponse { + const message = createBaseStatusResponse(); + message.earliestStoreHeight = object.earliestStoreHeight ?? 0; + message.height = object.height ?? 0; + message.timestamp = object.timestamp ?? undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + message.validatorHash = object.validatorHash ?? new Uint8Array(0); + return message; + }, +}; + +/** Service defines the gRPC querier service for node related queries. */ +export interface Service { + /** Config queries for the operator configuration. */ + Config(request: ConfigRequest): Promise; + /** Status queries for the node status. */ + Status(request: StatusRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.node.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + this.rpc = rpc; + this.Config = this.Config.bind(this); + this.Status = this.Status.bind(this); + } + Config(request: ConfigRequest): Promise { + const data = ConfigRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Config", data); + return promise.then((data) => ConfigResponse.decode(new BinaryReader(data))); + } + + Status(request: StatusRequest): Promise { + const data = StatusRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Status", data); + return promise.then((data) => StatusResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.circuit.v1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.circuit.v1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.circuit.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/base/reflection/v1beta1/reflection.ts b/ts-client/cosmos.circuit.v1/types/cosmos/base/reflection/v1beta1/reflection.ts new file mode 100644 index 00000000..ebb67be4 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/base/reflection/v1beta1/reflection.ts @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v1beta1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. */ + interfaceNames: string[]; +} + +/** + * ListImplementationsRequest is the request type of the ListImplementations + * RPC. + */ +export interface ListImplementationsRequest { + /** interface_name defines the interface to query the implementations for. */ + interfaceName: string; +} + +/** + * ListImplementationsResponse is the response type of the ListImplementations + * RPC. + */ +export interface ListImplementationsResponse { + implementationMessageNames: string[]; +} + +function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { + return {}; +} + +export const ListAllInterfacesRequest: MessageFns = { + encode(_: ListAllInterfacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListAllInterfacesRequest { + return {}; + }, + + toJSON(_: ListAllInterfacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesRequest { + return ListAllInterfacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListAllInterfacesRequest { + const message = createBaseListAllInterfacesRequest(); + return message; + }, +}; + +function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { + return { interfaceNames: [] }; +} + +export const ListAllInterfacesResponse: MessageFns = { + encode(message: ListAllInterfacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaceNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAllInterfacesResponse { + return { + interfaceNames: globalThis.Array.isArray(object?.interfaceNames) + ? object.interfaceNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListAllInterfacesResponse): unknown { + const obj: any = {}; + if (message.interfaceNames?.length) { + obj.interfaceNames = message.interfaceNames; + } + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesResponse { + return ListAllInterfacesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListAllInterfacesResponse { + const message = createBaseListAllInterfacesResponse(); + message.interfaceNames = object.interfaceNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListImplementationsRequest(): ListImplementationsRequest { + return { interfaceName: "" }; +} + +export const ListImplementationsRequest: MessageFns = { + encode(message: ListImplementationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceName !== "") { + writer.uint32(10).string(message.interfaceName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsRequest { + return { interfaceName: isSet(object.interfaceName) ? globalThis.String(object.interfaceName) : "" }; + }, + + toJSON(message: ListImplementationsRequest): unknown { + const obj: any = {}; + if (message.interfaceName !== "") { + obj.interfaceName = message.interfaceName; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsRequest { + return ListImplementationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsRequest { + const message = createBaseListImplementationsRequest(); + message.interfaceName = object.interfaceName ?? ""; + return message; + }, +}; + +function createBaseListImplementationsResponse(): ListImplementationsResponse { + return { implementationMessageNames: [] }; +} + +export const ListImplementationsResponse: MessageFns = { + encode(message: ListImplementationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.implementationMessageNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.implementationMessageNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsResponse { + return { + implementationMessageNames: globalThis.Array.isArray(object?.implementationMessageNames) + ? object.implementationMessageNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListImplementationsResponse): unknown { + const obj: any = {}; + if (message.implementationMessageNames?.length) { + obj.implementationMessageNames = message.implementationMessageNames; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsResponse { + return ListImplementationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsResponse { + const message = createBaseListImplementationsResponse(); + message.implementationMessageNames = object.implementationMessageNames?.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 const ReflectionServiceServiceName = "cosmos.base.reflection.v1beta1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/base/reflection/v2alpha1/reflection.ts b/ts-client/cosmos.circuit.v1/types/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 00000000..23a7ca89 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,2057 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v2alpha1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 + | undefined; + /** chain provides the chain descriptor */ + chain: + | ChainDescriptor + | undefined; + /** codec provides metadata information regarding codec related types */ + codec: + | CodecDescriptor + | undefined; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration: + | ConfigurationDescriptor + | undefined; + /** query_services provides metadata information regarding the available queriable endpoints */ + queryServices: + | QueryServicesDescriptor + | undefined; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx: TxDescriptor | undefined; +} + +/** 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 */ + signModes: 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 + */ + authnInfoProviderMethodFullname: 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 + */ + interfaceAcceptingMessages: InterfaceAcceptingMessageDescriptor[]; + /** interface_implementers is a list of the descriptors of the interface implementers */ + interfaceImplementers: 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 + */ + typeUrl: 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) + */ + fieldDescriptorNames: string[]; +} + +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptor { + /** bech32_account_address_prefix is the account address prefix */ + bech32AccountAddressPrefix: 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. */ + msgTypeUrl: 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptor { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + queryServices: 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 */ + isModule: 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 + */ + fullQueryPath: string; +} + +function createBaseAppDescriptor(): AppDescriptor { + return { + authn: undefined, + chain: undefined, + codec: undefined, + configuration: undefined, + queryServices: undefined, + tx: undefined, + }; +} + +export const AppDescriptor: MessageFns = { + encode(message: AppDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).join(); + } + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).join(); + } + if (message.configuration !== undefined) { + ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).join(); + } + if (message.queryServices !== undefined) { + QueryServicesDescriptor.encode(message.queryServices, writer.uint32(42).fork()).join(); + } + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.queryServices = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + queryServices: isSet(object.queryServices) ? QueryServicesDescriptor.fromJSON(object.queryServices) : undefined, + tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined, + }; + }, + + toJSON(message: AppDescriptor): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + if (message.configuration !== undefined) { + obj.configuration = ConfigurationDescriptor.toJSON(message.configuration); + } + if (message.queryServices !== undefined) { + obj.queryServices = QueryServicesDescriptor.toJSON(message.queryServices); + } + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): AppDescriptor { + return AppDescriptor.fromPartial(base ?? ({} as any)); + }, + 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.queryServices = (object.queryServices !== undefined && object.queryServices !== null) + ? QueryServicesDescriptor.fromPartial(object.queryServices) + : 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: MessageFns = { + encode(message: TxDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.msgs) { + MsgDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(MsgDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => MsgDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => MsgDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxDescriptor { + return TxDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 { signModes: [] }; +} + +export const AuthnDescriptor: MessageFns = { + encode(message: AuthnDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signModes) { + SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthnDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.signModes.push(SigningModeDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthnDescriptor { + return { + signModes: globalThis.Array.isArray(object?.signModes) + ? object.signModes.map((e: any) => SigningModeDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AuthnDescriptor): unknown { + const obj: any = {}; + if (message.signModes?.length) { + obj.signModes = message.signModes.map((e) => SigningModeDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): AuthnDescriptor { + return AuthnDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.signModes = object.signModes?.map((e) => SigningModeDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningModeDescriptor(): SigningModeDescriptor { + return { name: "", number: 0, authnInfoProviderMethodFullname: "" }; +} + +export const SigningModeDescriptor: MessageFns = { + encode(message: SigningModeDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + writer.uint32(26).string(message.authnInfoProviderMethodFullname); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningModeDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authnInfoProviderMethodFullname = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningModeDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + authnInfoProviderMethodFullname: isSet(object.authnInfoProviderMethodFullname) + ? globalThis.String(object.authnInfoProviderMethodFullname) + : "", + }; + }, + + toJSON(message: SigningModeDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + obj.authnInfoProviderMethodFullname = message.authnInfoProviderMethodFullname; + } + return obj; + }, + + create, I>>(base?: I): SigningModeDescriptor { + return SigningModeDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.authnInfoProviderMethodFullname = object.authnInfoProviderMethodFullname ?? ""; + return message; + }, +}; + +function createBaseChainDescriptor(): ChainDescriptor { + return { id: "" }; +} + +export const ChainDescriptor: MessageFns = { + encode(message: ChainDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChainDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChainDescriptor { + return { id: isSet(object.id) ? globalThis.String(object.id) : "" }; + }, + + toJSON(message: ChainDescriptor): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): ChainDescriptor { + return ChainDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ChainDescriptor { + const message = createBaseChainDescriptor(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseCodecDescriptor(): CodecDescriptor { + return { interfaces: [] }; +} + +export const CodecDescriptor: MessageFns = { + encode(message: CodecDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaces) { + InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CodecDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CodecDescriptor { + return { + interfaces: globalThis.Array.isArray(object?.interfaces) + ? object.interfaces.map((e: any) => InterfaceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: CodecDescriptor): unknown { + const obj: any = {}; + if (message.interfaces?.length) { + obj.interfaces = message.interfaces.map((e) => InterfaceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CodecDescriptor { + return CodecDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map((e) => InterfaceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { fullname: "", interfaceAcceptingMessages: [], interfaceImplementers: [] }; +} + +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.interfaceAcceptingMessages) { + InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.interfaceImplementers) { + InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.interfaceAcceptingMessages.push(InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.interfaceImplementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + interfaceAcceptingMessages: globalThis.Array.isArray(object?.interfaceAcceptingMessages) + ? object.interfaceAcceptingMessages.map((e: any) => InterfaceAcceptingMessageDescriptor.fromJSON(e)) + : [], + interfaceImplementers: globalThis.Array.isArray(object?.interfaceImplementers) + ? object.interfaceImplementers.map((e: any) => InterfaceImplementerDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.interfaceAcceptingMessages?.length) { + obj.interfaceAcceptingMessages = message.interfaceAcceptingMessages.map((e) => + InterfaceAcceptingMessageDescriptor.toJSON(e) + ); + } + if (message.interfaceImplementers?.length) { + obj.interfaceImplementers = message.interfaceImplementers.map((e) => InterfaceImplementerDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): InterfaceDescriptor { + return InterfaceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.fullname = object.fullname ?? ""; + message.interfaceAcceptingMessages = + object.interfaceAcceptingMessages?.map((e) => InterfaceAcceptingMessageDescriptor.fromPartial(e)) || []; + message.interfaceImplementers = + object.interfaceImplementers?.map((e) => InterfaceImplementerDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { + return { fullname: "", typeUrl: "" }; +} + +export const InterfaceImplementerDescriptor: MessageFns = { + encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.typeUrl !== "") { + writer.uint32(18).string(message.typeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceImplementerDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.typeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceImplementerDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", + }; + }, + + toJSON(message: InterfaceImplementerDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.typeUrl !== "") { + obj.typeUrl = message.typeUrl; + } + return obj; + }, + + create, I>>(base?: I): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + message.fullname = object.fullname ?? ""; + message.typeUrl = object.typeUrl ?? ""; + return message; + }, +}; + +function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { + return { fullname: "", fieldDescriptorNames: [] }; +} + +export const InterfaceAcceptingMessageDescriptor: MessageFns = { + encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.fieldDescriptorNames) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fieldDescriptorNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceAcceptingMessageDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + fieldDescriptorNames: globalThis.Array.isArray(object?.fieldDescriptorNames) + ? object.fieldDescriptorNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: InterfaceAcceptingMessageDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.fieldDescriptorNames?.length) { + obj.fieldDescriptorNames = message.fieldDescriptorNames; + } + return obj; + }, + + create, I>>( + base?: I, + ): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + message.fullname = object.fullname ?? ""; + message.fieldDescriptorNames = object.fieldDescriptorNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseConfigurationDescriptor(): ConfigurationDescriptor { + return { bech32AccountAddressPrefix: "" }; +} + +export const ConfigurationDescriptor: MessageFns = { + encode(message: ConfigurationDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32AccountAddressPrefix !== "") { + writer.uint32(10).string(message.bech32AccountAddressPrefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigurationDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32AccountAddressPrefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigurationDescriptor { + return { + bech32AccountAddressPrefix: isSet(object.bech32AccountAddressPrefix) + ? globalThis.String(object.bech32AccountAddressPrefix) + : "", + }; + }, + + toJSON(message: ConfigurationDescriptor): unknown { + const obj: any = {}; + if (message.bech32AccountAddressPrefix !== "") { + obj.bech32AccountAddressPrefix = message.bech32AccountAddressPrefix; + } + return obj; + }, + + create, I>>(base?: I): ConfigurationDescriptor { + return ConfigurationDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + message.bech32AccountAddressPrefix = object.bech32AccountAddressPrefix ?? ""; + return message; + }, +}; + +function createBaseMsgDescriptor(): MsgDescriptor { + return { msgTypeUrl: "" }; +} + +export const MsgDescriptor: MessageFns = { + encode(message: MsgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(10).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDescriptor { + return { msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "" }; + }, + + toJSON(message: MsgDescriptor): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgDescriptor { + return MsgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDescriptor { + const message = createBaseMsgDescriptor(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { + return {}; +} + +export const GetAuthnDescriptorRequest: MessageFns = { + encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetAuthnDescriptorRequest { + return {}; + }, + + toJSON(_: GetAuthnDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, +}; + +function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { + return { authn: undefined }; +} + +export const GetAuthnDescriptorResponse: MessageFns = { + encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetAuthnDescriptorResponse { + return { authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined }; + }, + + toJSON(message: GetAuthnDescriptorResponse): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetChainDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetChainDescriptorRequest { + return {}; + }, + + toJSON(_: GetChainDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorRequest { + return GetChainDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, +}; + +function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { + return { chain: undefined }; +} + +export const GetChainDescriptorResponse: MessageFns = { + encode(message: GetChainDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetChainDescriptorResponse { + return { chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined }; + }, + + toJSON(message: GetChainDescriptorResponse): unknown { + const obj: any = {}; + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorResponse { + return GetChainDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetCodecDescriptorRequest { + return {}; + }, + + toJSON(_: GetCodecDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, +}; + +function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { + return { codec: undefined }; +} + +export const GetCodecDescriptorResponse: MessageFns = { + encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCodecDescriptorResponse { + return { codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined }; + }, + + toJSON(message: GetCodecDescriptorResponse): unknown { + const obj: any = {}; + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetConfigurationDescriptorRequest { + return {}; + }, + + toJSON(_: GetConfigurationDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, +}; + +function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { + return { config: undefined }; +} + +export const GetConfigurationDescriptorResponse: MessageFns = { + encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetConfigurationDescriptorResponse { + return { config: isSet(object.config) ? ConfigurationDescriptor.fromJSON(object.config) : undefined }; + }, + + toJSON(message: GetConfigurationDescriptorResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = ConfigurationDescriptor.toJSON(message.config); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetQueryServicesDescriptorRequest { + return {}; + }, + + toJSON(_: GetQueryServicesDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, +}; + +function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { + return { queries: undefined }; +} + +export const GetQueryServicesDescriptorResponse: MessageFns = { + encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.queries !== undefined) { + QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetQueryServicesDescriptorResponse { + return { queries: isSet(object.queries) ? QueryServicesDescriptor.fromJSON(object.queries) : undefined }; + }, + + toJSON(message: GetQueryServicesDescriptorResponse): unknown { + const obj: any = {}; + if (message.queries !== undefined) { + obj.queries = QueryServicesDescriptor.toJSON(message.queries); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetTxDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetTxDescriptorRequest { + return {}; + }, + + toJSON(_: GetTxDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorRequest { + return GetTxDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, +}; + +function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { + return { tx: undefined }; +} + +export const GetTxDescriptorResponse: MessageFns = { + encode(message: GetTxDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxDescriptorResponse { + return { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: GetTxDescriptorResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorResponse { + return GetTxDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { queryServices: [] }; +} + +export const QueryServicesDescriptor: MessageFns = { + encode(message: QueryServicesDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.queryServices) { + QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServicesDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queryServices.push(QueryServiceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServicesDescriptor { + return { + queryServices: globalThis.Array.isArray(object?.queryServices) + ? object.queryServices.map((e: any) => QueryServiceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServicesDescriptor): unknown { + const obj: any = {}; + if (message.queryServices?.length) { + obj.queryServices = message.queryServices.map((e) => QueryServiceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServicesDescriptor { + return QueryServicesDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.queryServices = object.queryServices?.map((e) => QueryServiceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { + return { fullname: "", isModule: false, methods: [] }; +} + +export const QueryServiceDescriptor: MessageFns = { + encode(message: QueryServiceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.isModule !== false) { + writer.uint32(16).bool(message.isModule); + } + for (const v of message.methods) { + QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServiceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isModule = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServiceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + isModule: isSet(object.isModule) ? globalThis.Boolean(object.isModule) : false, + methods: globalThis.Array.isArray(object?.methods) + ? object.methods.map((e: any) => QueryMethodDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServiceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.isModule !== false) { + obj.isModule = message.isModule; + } + if (message.methods?.length) { + obj.methods = message.methods.map((e) => QueryMethodDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServiceDescriptor { + return QueryServiceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + message.fullname = object.fullname ?? ""; + message.isModule = object.isModule ?? false; + message.methods = object.methods?.map((e) => QueryMethodDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { + return { name: "", fullQueryPath: "" }; +} + +export const QueryMethodDescriptor: MessageFns = { + encode(message: QueryMethodDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.fullQueryPath !== "") { + writer.uint32(18).string(message.fullQueryPath); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryMethodDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullQueryPath = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryMethodDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + fullQueryPath: isSet(object.fullQueryPath) ? globalThis.String(object.fullQueryPath) : "", + }; + }, + + toJSON(message: QueryMethodDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.fullQueryPath !== "") { + obj.fullQueryPath = message.fullQueryPath; + } + return obj; + }, + + create, I>>(base?: I): QueryMethodDescriptor { + return QueryMethodDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + message.name = object.name ?? ""; + message.fullQueryPath = object.fullQueryPath ?? ""; + 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 const ReflectionServiceServiceName = "cosmos.base.reflection.v2alpha1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/base/tendermint/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/base/tendermint/v1beta1/query.ts new file mode 100644 index 00000000..f58dfb17 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/base/tendermint/v1beta1/query.ts @@ -0,0 +1,1974 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { DefaultNodeInfo } from "../../../../tendermint/p2p/types"; +import { Block } from "../../../../tendermint/types/block"; +import { BlockID } from "../../../../tendermint/types/types"; +import { PageRequest, PageResponse } from "../../query/v1beta1/pagination"; +import { Block as Block1 } from "./types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightRequest { + height: number; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetRequest { + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** Validator is the type for the validator-set. */ +export interface Validator { + address: string; + pubKey: Any | undefined; + votingPower: number; + proposerPriority: number; +} + +/** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightRequest { + height: number; +} + +/** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightResponse { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + defaultNodeInfo: DefaultNodeInfo | undefined; + applicationVersion: VersionInfo | undefined; +} + +/** VersionInfo is the type for the GetNodeInfoResponse message. */ +export interface VersionInfo { + name: string; + appName: string; + version: string; + gitCommit: string; + buildTags: string; + goVersion: string; + buildDeps: Module[]; + /** Since: cosmos-sdk 0.43 */ + cosmosSdkVersion: string; +} + +/** Module is the type for VersionInfo */ +export interface Module { + /** module path */ + path: string; + /** module version */ + version: string; + /** checksum */ + sum: string; +} + +/** ABCIQueryRequest defines the request structure for the ABCIQuery gRPC query. */ +export interface ABCIQueryRequest { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +/** + * ABCIQueryResponse defines the response structure for the ABCIQuery gRPC query. + * + * Note: This type is a duplicate of the ResponseQuery proto type defined in + * Tendermint. + */ +export interface ABCIQueryResponse { + code: number; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +/** + * ProofOp defines an operation used for calculating Merkle root. The data could + * be arbitrary format, providing necessary data for example neighbouring node + * hash. + * + * Note: This type is a duplicate of the ProofOp proto type defined in Tendermint. + */ +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} + +/** + * ProofOps is Merkle proof defined by the list of ProofOps. + * + * Note: This type is a duplicate of the ProofOps proto type defined in Tendermint. + */ +export interface ProofOps { + ops: ProofOp[]; +} + +function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequest { + return { height: 0, pagination: undefined }; +} + +export const GetValidatorSetByHeightRequest: MessageFns = { + encode(message: GetValidatorSetByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightRequest { + return GetValidatorSetByHeightRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetValidatorSetByHeightResponse: MessageFns = { + encode(message: GetValidatorSetByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightResponse { + return GetValidatorSetByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetValidatorSetByHeightResponse { + const message = createBaseGetValidatorSetByHeightResponse(); + message.blockHeight = object.blockHeight ?? 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: MessageFns = { + encode(message: GetLatestValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: GetLatestValidatorSetRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetRequest { + return GetLatestValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetLatestValidatorSetResponse: MessageFns = { + encode(message: GetLatestValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetResponse { + return GetLatestValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetLatestValidatorSetResponse { + const message = createBaseGetLatestValidatorSetResponse(); + message.blockHeight = object.blockHeight ?? 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: "", pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { + return { height: 0 }; +} + +export const GetBlockByHeightRequest: MessageFns = { + encode(message: GetBlockByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: GetBlockByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightRequest { + return GetBlockByHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightRequest { + const message = createBaseGetBlockByHeightRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetBlockByHeightResponse: MessageFns = { + encode(message: GetBlockByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetBlockByHeightResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightResponse { + return GetBlockByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightResponse { + const message = createBaseGetBlockByHeightResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { + return {}; +} + +export const GetLatestBlockRequest: MessageFns = { + encode(_: GetLatestBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetLatestBlockRequest { + return {}; + }, + + toJSON(_: GetLatestBlockRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetLatestBlockRequest { + return GetLatestBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetLatestBlockRequest { + const message = createBaseGetLatestBlockRequest(); + return message; + }, +}; + +function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetLatestBlockResponse: MessageFns = { + encode(message: GetLatestBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestBlockResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetLatestBlockResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetLatestBlockResponse { + return GetLatestBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetLatestBlockResponse { + const message = createBaseGetLatestBlockResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetSyncingRequest(): GetSyncingRequest { + return {}; +} + +export const GetSyncingRequest: MessageFns = { + encode(_: GetSyncingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetSyncingRequest { + return {}; + }, + + toJSON(_: GetSyncingRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetSyncingRequest { + return GetSyncingRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetSyncingRequest { + const message = createBaseGetSyncingRequest(); + return message; + }, +}; + +function createBaseGetSyncingResponse(): GetSyncingResponse { + return { syncing: false }; +} + +export const GetSyncingResponse: MessageFns = { + encode(message: GetSyncingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.syncing !== false) { + writer.uint32(8).bool(message.syncing); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.syncing = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetSyncingResponse { + return { syncing: isSet(object.syncing) ? globalThis.Boolean(object.syncing) : false }; + }, + + toJSON(message: GetSyncingResponse): unknown { + const obj: any = {}; + if (message.syncing !== false) { + obj.syncing = message.syncing; + } + return obj; + }, + + create, I>>(base?: I): GetSyncingResponse { + return GetSyncingResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetSyncingResponse { + const message = createBaseGetSyncingResponse(); + message.syncing = object.syncing ?? false; + return message; + }, +}; + +function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { + return {}; +} + +export const GetNodeInfoRequest: MessageFns = { + encode(_: GetNodeInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetNodeInfoRequest { + return {}; + }, + + toJSON(_: GetNodeInfoRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetNodeInfoRequest { + return GetNodeInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetNodeInfoRequest { + const message = createBaseGetNodeInfoRequest(); + return message; + }, +}; + +function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { + return { defaultNodeInfo: undefined, applicationVersion: undefined }; +} + +export const GetNodeInfoResponse: MessageFns = { + encode(message: GetNodeInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.defaultNodeInfo !== undefined) { + DefaultNodeInfo.encode(message.defaultNodeInfo, writer.uint32(10).fork()).join(); + } + if (message.applicationVersion !== undefined) { + VersionInfo.encode(message.applicationVersion, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.defaultNodeInfo = DefaultNodeInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.applicationVersion = VersionInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetNodeInfoResponse { + return { + defaultNodeInfo: isSet(object.defaultNodeInfo) ? DefaultNodeInfo.fromJSON(object.defaultNodeInfo) : undefined, + applicationVersion: isSet(object.applicationVersion) + ? VersionInfo.fromJSON(object.applicationVersion) + : undefined, + }; + }, + + toJSON(message: GetNodeInfoResponse): unknown { + const obj: any = {}; + if (message.defaultNodeInfo !== undefined) { + obj.defaultNodeInfo = DefaultNodeInfo.toJSON(message.defaultNodeInfo); + } + if (message.applicationVersion !== undefined) { + obj.applicationVersion = VersionInfo.toJSON(message.applicationVersion); + } + return obj; + }, + + create, I>>(base?: I): GetNodeInfoResponse { + return GetNodeInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetNodeInfoResponse { + const message = createBaseGetNodeInfoResponse(); + message.defaultNodeInfo = (object.defaultNodeInfo !== undefined && object.defaultNodeInfo !== null) + ? DefaultNodeInfo.fromPartial(object.defaultNodeInfo) + : undefined; + message.applicationVersion = (object.applicationVersion !== undefined && object.applicationVersion !== null) + ? VersionInfo.fromPartial(object.applicationVersion) + : undefined; + return message; + }, +}; + +function createBaseVersionInfo(): VersionInfo { + return { + name: "", + appName: "", + version: "", + gitCommit: "", + buildTags: "", + goVersion: "", + buildDeps: [], + cosmosSdkVersion: "", + }; +} + +export const VersionInfo: MessageFns = { + encode(message: VersionInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.appName !== "") { + writer.uint32(18).string(message.appName); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.gitCommit !== "") { + writer.uint32(34).string(message.gitCommit); + } + if (message.buildTags !== "") { + writer.uint32(42).string(message.buildTags); + } + if (message.goVersion !== "") { + writer.uint32(50).string(message.goVersion); + } + for (const v of message.buildDeps) { + Module.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.cosmosSdkVersion !== "") { + writer.uint32(66).string(message.cosmosSdkVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.version = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gitCommit = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.buildTags = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.goVersion = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.buildDeps.push(Module.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.cosmosSdkVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + gitCommit: isSet(object.gitCommit) ? globalThis.String(object.gitCommit) : "", + buildTags: isSet(object.buildTags) ? globalThis.String(object.buildTags) : "", + goVersion: isSet(object.goVersion) ? globalThis.String(object.goVersion) : "", + buildDeps: globalThis.Array.isArray(object?.buildDeps) + ? object.buildDeps.map((e: any) => Module.fromJSON(e)) + : [], + cosmosSdkVersion: isSet(object.cosmosSdkVersion) ? globalThis.String(object.cosmosSdkVersion) : "", + }; + }, + + toJSON(message: VersionInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.gitCommit !== "") { + obj.gitCommit = message.gitCommit; + } + if (message.buildTags !== "") { + obj.buildTags = message.buildTags; + } + if (message.goVersion !== "") { + obj.goVersion = message.goVersion; + } + if (message.buildDeps?.length) { + obj.buildDeps = message.buildDeps.map((e) => Module.toJSON(e)); + } + if (message.cosmosSdkVersion !== "") { + obj.cosmosSdkVersion = message.cosmosSdkVersion; + } + return obj; + }, + + create, I>>(base?: I): VersionInfo { + return VersionInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionInfo { + const message = createBaseVersionInfo(); + message.name = object.name ?? ""; + message.appName = object.appName ?? ""; + message.version = object.version ?? ""; + message.gitCommit = object.gitCommit ?? ""; + message.buildTags = object.buildTags ?? ""; + message.goVersion = object.goVersion ?? ""; + message.buildDeps = object.buildDeps?.map((e) => Module.fromPartial(e)) || []; + message.cosmosSdkVersion = object.cosmosSdkVersion ?? ""; + return message; + }, +}; + +function createBaseModule(): Module { + return { path: "", version: "", sum: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sum = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + path: isSet(object.path) ? globalThis.String(object.path) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + sum: isSet(object.sum) ? globalThis.String(object.sum) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.sum !== "") { + obj.sum = message.sum; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.path = object.path ?? ""; + message.version = object.version ?? ""; + message.sum = object.sum ?? ""; + return message; + }, +}; + +function createBaseABCIQueryRequest(): ABCIQueryRequest { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const ABCIQueryRequest: MessageFns = { + encode(message: ABCIQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryRequest { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: ABCIQueryRequest): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryRequest { + return ABCIQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryRequest { + const message = createBaseABCIQueryRequest(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseABCIQueryResponse(): ABCIQueryResponse { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ABCIQueryResponse: MessageFns = { + encode(message: ABCIQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryResponse { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ABCIQueryResponse): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryResponse { + return ABCIQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryResponse { + const message = createBaseABCIQueryResponse(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? 0; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseProofOp(): ProofOp { + return { type: "", key: new Uint8Array(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + 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; + /** + * ABCIQuery defines a query handler that supports ABCI queries directly to the + * application, bypassing Tendermint completely. The ABCI query must contain + * a valid and supported path, including app, custom, p2p, and store. + * + * Since: cosmos-sdk 0.46 + */ + ABCIQuery(request: ABCIQueryRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.tendermint.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.ABCIQuery = this.ABCIQuery.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ABCIQuery(request: ABCIQueryRequest): Promise { + const data = ABCIQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ABCIQuery", data); + return promise.then((data) => ABCIQueryResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/base/tendermint/v1beta1/types.ts b/ts-client/cosmos.circuit.v1/types/cosmos/base/tendermint/v1beta1/types.ts new file mode 100644 index 00000000..2d229c81 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/base/tendermint/v1beta1/types.ts @@ -0,0 +1,530 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { EvidenceList } from "../../../../tendermint/types/evidence"; +import { BlockID, Commit, Data } from "../../../../tendermint/types/types"; +import { Consensus } from "../../../../tendermint/version/types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** + * Block is tendermint type Block, with the Header proposer address + * field converted to bech32 string. + */ +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +/** Header defines the structure of a Tendermint block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** + * proposer_address is the original block proposer address, formatted as a Bech32 string. + * In Tendermint, this type is `bytes`, but in the SDK, we convert it to a Bech32 string + * for better UX. + */ + proposerAddress: string; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: "", + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + writer.uint32(114).string(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? globalThis.String(object.proposerAddress) : "", + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + obj.proposerAddress = message.proposerAddress; + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.circuit.v1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..72eff8cb --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,335 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ +export interface IntProto { + int: string; +} + +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ +export interface DecProto { + dec: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +export const IntProto: MessageFns = { + encode(message: IntProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IntProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.int = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IntProto { + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + 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 ?? ""; + return message; + }, +}; + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +export const DecProto: MessageFns = { + encode(message: DecProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dec = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecProto { + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + 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 ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/circuit/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/circuit/module/v1/module.ts new file mode 100644 index 00000000..733fcc4e --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/circuit/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.circuit.module.v1"; + +/** Module is the config object of the circuit module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/query.ts index 269993b9..7d1037ab 100644 --- a/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/query.ts +++ b/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/query.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/query.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; import { GenesisAccountPermissions, Permissions } from "./types"; @@ -41,16 +47,16 @@ function createBaseQueryAccountRequest(): QueryAccountRequest { return { address: "" }; } -export const QueryAccountRequest = { - encode(message: QueryAccountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAccountRequest: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAccountRequest(); while (reader.pos < end) { @@ -67,13 +73,13 @@ export const QueryAccountRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAccountRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryAccountRequest): unknown { @@ -98,16 +104,16 @@ function createBaseAccountResponse(): AccountResponse { return { permission: undefined }; } -export const AccountResponse = { - encode(message: AccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const AccountResponse: MessageFns = { + encode(message: AccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.permission !== undefined) { - Permissions.encode(message.permission, writer.uint32(10).fork()).ldelim(); + Permissions.encode(message.permission, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): AccountResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): AccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAccountResponse(); while (reader.pos < end) { @@ -124,7 +130,7 @@ export const AccountResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -157,16 +163,16 @@ function createBaseQueryAccountsRequest(): QueryAccountsRequest { return { pagination: undefined }; } -export const QueryAccountsRequest = { - encode(message: QueryAccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountsRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAccountsRequest(); while (reader.pos < end) { @@ -183,7 +189,7 @@ export const QueryAccountsRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -216,19 +222,19 @@ function createBaseAccountsResponse(): AccountsResponse { return { accounts: [], pagination: undefined }; } -export const AccountsResponse = { - encode(message: AccountsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const AccountsResponse: MessageFns = { + encode(message: AccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.accounts) { - GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).ldelim(); + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): AccountsResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): AccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAccountsResponse(); while (reader.pos < end) { @@ -252,14 +258,14 @@ export const AccountsResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): AccountsResponse { return { - accounts: Array.isArray(object?.accounts) + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => GenesisAccountPermissions.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, @@ -294,13 +300,13 @@ function createBaseQueryDisabledListRequest(): QueryDisabledListRequest { return {}; } -export const QueryDisabledListRequest = { - encode(_: QueryDisabledListRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryDisabledListRequest: MessageFns = { + encode(_: QueryDisabledListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDisabledListRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDisabledListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDisabledListRequest(); while (reader.pos < end) { @@ -310,7 +316,7 @@ export const QueryDisabledListRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -337,16 +343,16 @@ function createBaseDisabledListResponse(): DisabledListResponse { return { disabledList: [] }; } -export const DisabledListResponse = { - encode(message: DisabledListResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DisabledListResponse: MessageFns = { + encode(message: DisabledListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.disabledList) { writer.uint32(10).string(v!); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DisabledListResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DisabledListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDisabledListResponse(); while (reader.pos < end) { @@ -363,13 +369,17 @@ export const DisabledListResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DisabledListResponse { - return { disabledList: Array.isArray(object?.disabledList) ? object.disabledList.map((e: any) => String(e)) : [] }; + return { + disabledList: globalThis.Array.isArray(object?.disabledList) + ? object.disabledList.map((e: any) => globalThis.String(e)) + : [], + }; }, toJSON(message: DisabledListResponse): unknown { @@ -414,19 +424,19 @@ export class QueryClientImpl implements Query { Account(request: QueryAccountRequest): Promise { const data = QueryAccountRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "Account", data); - return promise.then((data) => AccountResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => AccountResponse.decode(new BinaryReader(data))); } Accounts(request: QueryAccountsRequest): Promise { const data = QueryAccountsRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "Accounts", data); - return promise.then((data) => AccountsResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => AccountsResponse.decode(new BinaryReader(data))); } DisabledList(request: QueryDisabledListRequest): Promise { const data = QueryDisabledListRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "DisabledList", data); - return promise.then((data) => DisabledListResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => DisabledListResponse.decode(new BinaryReader(data))); } } @@ -437,7 +447,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; @@ -448,3 +459,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/tx.ts index 9b4cfd01..1cc16218 100644 --- a/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/tx.ts +++ b/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/tx.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/tx.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Permissions } from "./types"; export const protobufPackage = "cosmos.circuit.v1"; @@ -66,8 +72,8 @@ function createBaseMsgAuthorizeCircuitBreaker(): MsgAuthorizeCircuitBreaker { return { granter: "", grantee: "", permissions: undefined }; } -export const MsgAuthorizeCircuitBreaker = { - encode(message: MsgAuthorizeCircuitBreaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgAuthorizeCircuitBreaker: MessageFns = { + encode(message: MsgAuthorizeCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } @@ -75,13 +81,13 @@ export const MsgAuthorizeCircuitBreaker = { writer.uint32(18).string(message.grantee); } if (message.permissions !== undefined) { - Permissions.encode(message.permissions, writer.uint32(26).fork()).ldelim(); + Permissions.encode(message.permissions, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgAuthorizeCircuitBreaker { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgAuthorizeCircuitBreaker(); while (reader.pos < end) { @@ -112,15 +118,15 @@ export const MsgAuthorizeCircuitBreaker = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgAuthorizeCircuitBreaker { return { - granter: isSet(object.granter) ? String(object.granter) : "", - grantee: isSet(object.grantee) ? String(object.grantee) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, }; }, @@ -157,16 +163,16 @@ function createBaseMsgAuthorizeCircuitBreakerResponse(): MsgAuthorizeCircuitBrea return { success: false }; } -export const MsgAuthorizeCircuitBreakerResponse = { - encode(message: MsgAuthorizeCircuitBreakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.success === true) { +export const MsgAuthorizeCircuitBreakerResponse: MessageFns = { + encode(message: MsgAuthorizeCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { writer.uint32(8).bool(message.success); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgAuthorizeCircuitBreakerResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgAuthorizeCircuitBreakerResponse(); while (reader.pos < end) { @@ -183,18 +189,18 @@ export const MsgAuthorizeCircuitBreakerResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgAuthorizeCircuitBreakerResponse { - return { success: isSet(object.success) ? Boolean(object.success) : false }; + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; }, toJSON(message: MsgAuthorizeCircuitBreakerResponse): unknown { const obj: any = {}; - if (message.success === true) { + if (message.success !== false) { obj.success = message.success; } return obj; @@ -218,8 +224,8 @@ function createBaseMsgTripCircuitBreaker(): MsgTripCircuitBreaker { return { authority: "", msgTypeUrls: [] }; } -export const MsgTripCircuitBreaker = { - encode(message: MsgTripCircuitBreaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgTripCircuitBreaker: MessageFns = { + encode(message: MsgTripCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); } @@ -229,8 +235,8 @@ export const MsgTripCircuitBreaker = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgTripCircuitBreaker { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTripCircuitBreaker(); while (reader.pos < end) { @@ -254,15 +260,17 @@ export const MsgTripCircuitBreaker = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgTripCircuitBreaker { return { - authority: isSet(object.authority) ? String(object.authority) : "", - msgTypeUrls: Array.isArray(object?.msgTypeUrls) ? object.msgTypeUrls.map((e: any) => String(e)) : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], }; }, @@ -292,16 +300,16 @@ function createBaseMsgTripCircuitBreakerResponse(): MsgTripCircuitBreakerRespons return { success: false }; } -export const MsgTripCircuitBreakerResponse = { - encode(message: MsgTripCircuitBreakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.success === true) { +export const MsgTripCircuitBreakerResponse: MessageFns = { + encode(message: MsgTripCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { writer.uint32(8).bool(message.success); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgTripCircuitBreakerResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTripCircuitBreakerResponse(); while (reader.pos < end) { @@ -318,18 +326,18 @@ export const MsgTripCircuitBreakerResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgTripCircuitBreakerResponse { - return { success: isSet(object.success) ? Boolean(object.success) : false }; + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; }, toJSON(message: MsgTripCircuitBreakerResponse): unknown { const obj: any = {}; - if (message.success === true) { + if (message.success !== false) { obj.success = message.success; } return obj; @@ -351,8 +359,8 @@ function createBaseMsgResetCircuitBreaker(): MsgResetCircuitBreaker { return { authority: "", msgTypeUrls: [] }; } -export const MsgResetCircuitBreaker = { - encode(message: MsgResetCircuitBreaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgResetCircuitBreaker: MessageFns = { + encode(message: MsgResetCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); } @@ -362,8 +370,8 @@ export const MsgResetCircuitBreaker = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgResetCircuitBreaker { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgResetCircuitBreaker(); while (reader.pos < end) { @@ -387,15 +395,17 @@ export const MsgResetCircuitBreaker = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgResetCircuitBreaker { return { - authority: isSet(object.authority) ? String(object.authority) : "", - msgTypeUrls: Array.isArray(object?.msgTypeUrls) ? object.msgTypeUrls.map((e: any) => String(e)) : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], }; }, @@ -425,16 +435,16 @@ function createBaseMsgResetCircuitBreakerResponse(): MsgResetCircuitBreakerRespo return { success: false }; } -export const MsgResetCircuitBreakerResponse = { - encode(message: MsgResetCircuitBreakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.success === true) { +export const MsgResetCircuitBreakerResponse: MessageFns = { + encode(message: MsgResetCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { writer.uint32(8).bool(message.success); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgResetCircuitBreakerResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgResetCircuitBreakerResponse(); while (reader.pos < end) { @@ -451,18 +461,18 @@ export const MsgResetCircuitBreakerResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgResetCircuitBreakerResponse { - return { success: isSet(object.success) ? Boolean(object.success) : false }; + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; }, toJSON(message: MsgResetCircuitBreakerResponse): unknown { const obj: any = {}; - if (message.success === true) { + if (message.success !== false) { obj.success = message.success; } return obj; @@ -510,19 +520,19 @@ export class MsgClientImpl implements Msg { AuthorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise { const data = MsgAuthorizeCircuitBreaker.encode(request).finish(); const promise = this.rpc.request(this.service, "AuthorizeCircuitBreaker", data); - return promise.then((data) => MsgAuthorizeCircuitBreakerResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgAuthorizeCircuitBreakerResponse.decode(new BinaryReader(data))); } TripCircuitBreaker(request: MsgTripCircuitBreaker): Promise { const data = MsgTripCircuitBreaker.encode(request).finish(); const promise = this.rpc.request(this.service, "TripCircuitBreaker", data); - return promise.then((data) => MsgTripCircuitBreakerResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgTripCircuitBreakerResponse.decode(new BinaryReader(data))); } ResetCircuitBreaker(request: MsgResetCircuitBreaker): Promise { const data = MsgResetCircuitBreaker.encode(request).finish(); const promise = this.rpc.request(this.service, "ResetCircuitBreaker", data); - return promise.then((data) => MsgResetCircuitBreakerResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgResetCircuitBreakerResponse.decode(new BinaryReader(data))); } } @@ -533,7 +543,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; @@ -544,3 +555,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/types.ts b/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/types.ts index caae7326..6810f76c 100644 --- a/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/types.ts +++ b/ts-client/cosmos.circuit.v1/types/cosmos/circuit/v1/types.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/types.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.circuit.v1"; @@ -98,8 +104,8 @@ function createBasePermissions(): Permissions { return { level: 0, limitTypeUrls: [] }; } -export const Permissions = { - encode(message: Permissions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Permissions: MessageFns = { + encode(message: Permissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.level !== 0) { writer.uint32(8).int32(message.level); } @@ -109,8 +115,8 @@ export const Permissions = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Permissions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Permissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePermissions(); while (reader.pos < end) { @@ -134,7 +140,7 @@ export const Permissions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -142,7 +148,9 @@ export const Permissions = { fromJSON(object: any): Permissions { return { level: isSet(object.level) ? permissions_LevelFromJSON(object.level) : 0, - limitTypeUrls: Array.isArray(object?.limitTypeUrls) ? object.limitTypeUrls.map((e: any) => String(e)) : [], + limitTypeUrls: globalThis.Array.isArray(object?.limitTypeUrls) + ? object.limitTypeUrls.map((e: any) => globalThis.String(e)) + : [], }; }, @@ -172,19 +180,19 @@ function createBaseGenesisAccountPermissions(): GenesisAccountPermissions { return { address: "", permissions: undefined }; } -export const GenesisAccountPermissions = { - encode(message: GenesisAccountPermissions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GenesisAccountPermissions: MessageFns = { + encode(message: GenesisAccountPermissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.permissions !== undefined) { - Permissions.encode(message.permissions, writer.uint32(18).fork()).ldelim(); + Permissions.encode(message.permissions, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisAccountPermissions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenesisAccountPermissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisAccountPermissions(); while (reader.pos < end) { @@ -208,14 +216,14 @@ export const GenesisAccountPermissions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GenesisAccountPermissions { return { - address: isSet(object.address) ? String(object.address) : "", + address: isSet(object.address) ? globalThis.String(object.address) : "", permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, }; }, @@ -248,10 +256,10 @@ function createBaseGenesisState(): GenesisState { return { accountPermissions: [], disabledTypeUrls: [] }; } -export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.accountPermissions) { - GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).ldelim(); + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); } for (const v of message.disabledTypeUrls) { writer.uint32(18).string(v!); @@ -259,8 +267,8 @@ export const GenesisState = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisState(); while (reader.pos < end) { @@ -284,18 +292,18 @@ export const GenesisState = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GenesisState { return { - accountPermissions: Array.isArray(object?.accountPermissions) + accountPermissions: globalThis.Array.isArray(object?.accountPermissions) ? object.accountPermissions.map((e: any) => GenesisAccountPermissions.fromJSON(e)) : [], - disabledTypeUrls: Array.isArray(object?.disabledTypeUrls) - ? object.disabledTypeUrls.map((e: any) => String(e)) + disabledTypeUrls: globalThis.Array.isArray(object?.disabledTypeUrls) + ? object.disabledTypeUrls.map((e: any) => globalThis.String(e)) : [], }; }, @@ -325,7 +333,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; @@ -336,3 +345,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/consensus/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/consensus/module/v1/module.ts new file mode 100644 index 00000000..97a0d394 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/consensus/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.consensus.module.v1"; + +/** Module is the config object of the consensus module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/consensus/v1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/consensus/v1/query.ts new file mode 100644 index 00000000..3fe04bb9 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/consensus/v1/query.ts @@ -0,0 +1,180 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ConsensusParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponse { + /** + * params are the tendermint consensus params stored in the consensus module. + * Please note that `params.version` is not populated in this response, it is + * tracked separately in the x/upgrade module. + */ + params: ConsensusParams | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + ConsensusParams.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = ConsensusParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? ConsensusParams.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = ConsensusParams.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) + ? ConsensusParams.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/consensus module. */ + Params(request: QueryParamsRequest): Promise; +} + +export const QueryServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/consensus/v1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/consensus/v1/tx.ts new file mode 100644 index 00000000..c95b67fe --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/consensus/v1/tx.ts @@ -0,0 +1,266 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ABCIParams, BlockParams, EvidenceParams, ValidatorParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/consensus parameters to update. + * VersionsParams is not included in this Msg because it is tracked + * separarately in x/upgrade. + * + * NOTE: All parameters must be supplied. + */ + block: BlockParams | undefined; + evidence: EvidenceParams | undefined; + validator: + | ValidatorParams + | undefined; + /** Since: cosmos-sdk 0.50 */ + abci: ABCIParams | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", block: undefined, evidence: undefined, validator: undefined, abci: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + 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 ?? ""; + 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.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the consensus Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/consensus module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crisis/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crisis/module/v1/module.ts new file mode 100644 index 00000000..3ae9a625 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crisis/module/v1/module.ts @@ -0,0 +1,117 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crisis.module.v1"; + +/** Module is the config object of the crisis module. */ +export interface Module { + /** fee_collector_name is the name of the FeeCollector ModuleAccount. */ + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crisis/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crisis/v1beta1/genesis.ts new file mode 100644 index 00000000..4ebe6590 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crisis/v1beta1/genesis.ts @@ -0,0 +1,104 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + */ + constantFee: Coin | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { constantFee: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 26) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crisis/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crisis/v1beta1/tx.ts new file mode 100644 index 00000000..90d17bf8 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crisis/v1beta1/tx.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.crisis.v1beta1"; + +/** MsgVerifyInvariant represents a message to verify a particular invariance. */ +export interface MsgVerifyInvariant { + /** sender is the account address of private key to send coins to fee collector account. */ + sender: string; + /** name of the invariant module. */ + invariantModuleName: string; + /** invariant_route is the msg's invariant route. */ + invariantRoute: string; +} + +/** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ +export interface MsgVerifyInvariantResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** constant_fee defines the x/crisis parameter. */ + constantFee: Coin | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { + return { sender: "", invariantModuleName: "", invariantRoute: "" }; +} + +export const MsgVerifyInvariant: MessageFns = { + encode(message: MsgVerifyInvariant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.invariantModuleName !== "") { + writer.uint32(18).string(message.invariantModuleName); + } + if (message.invariantRoute !== "") { + writer.uint32(26).string(message.invariantRoute); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.invariantModuleName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.invariantRoute = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVerifyInvariant { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + invariantModuleName: isSet(object.invariantModuleName) ? globalThis.String(object.invariantModuleName) : "", + invariantRoute: isSet(object.invariantRoute) ? globalThis.String(object.invariantRoute) : "", + }; + }, + + toJSON(message: MsgVerifyInvariant): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.invariantModuleName !== "") { + obj.invariantModuleName = message.invariantModuleName; + } + if (message.invariantRoute !== "") { + obj.invariantRoute = message.invariantRoute; + } + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariant { + return MsgVerifyInvariant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVerifyInvariant { + const message = createBaseMsgVerifyInvariant(); + message.sender = object.sender ?? ""; + message.invariantModuleName = object.invariantModuleName ?? ""; + message.invariantRoute = object.invariantRoute ?? ""; + return message; + }, +}; + +function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { + return {}; +} + +export const MsgVerifyInvariantResponse: MessageFns = { + encode(_: MsgVerifyInvariantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVerifyInvariantResponse { + return {}; + }, + + toJSON(_: MsgVerifyInvariantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariantResponse { + return MsgVerifyInvariantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVerifyInvariantResponse { + const message = createBaseMsgVerifyInvariantResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", constantFee: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + 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 ?? ""; + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** VerifyInvariant defines a method to verify a particular invariant. */ + VerifyInvariant(request: MsgVerifyInvariant): Promise; + /** + * UpdateParams defines a governance operation for updating the x/crisis module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.crisis.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 || MsgServiceName; + this.rpc = rpc; + this.VerifyInvariant = this.VerifyInvariant.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crypto/ed25519/keys.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 00000000..59fab7e6 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,193 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/ed25519/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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; +} + +/** + * 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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crypto/hd/v1/hd.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/hd/v1/hd.ts new file mode 100644 index 00000000..55be1b9c --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/hd/v1/hd.ts @@ -0,0 +1,173 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/hd/v1/hd.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crypto.hd.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + coinType: 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 */ + addressIndex: number; +} + +function createBaseBIP44Params(): BIP44Params { + return { purpose: 0, coinType: 0, account: 0, change: false, addressIndex: 0 }; +} + +export const BIP44Params: MessageFns = { + encode(message: BIP44Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.purpose !== 0) { + writer.uint32(8).uint32(message.purpose); + } + if (message.coinType !== 0) { + writer.uint32(16).uint32(message.coinType); + } + if (message.account !== 0) { + writer.uint32(24).uint32(message.account); + } + if (message.change !== false) { + writer.uint32(32).bool(message.change); + } + if (message.addressIndex !== 0) { + writer.uint32(40).uint32(message.addressIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BIP44Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.purpose = reader.uint32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.coinType = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.account = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.change = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.addressIndex = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BIP44Params { + return { + purpose: isSet(object.purpose) ? globalThis.Number(object.purpose) : 0, + coinType: isSet(object.coinType) ? globalThis.Number(object.coinType) : 0, + account: isSet(object.account) ? globalThis.Number(object.account) : 0, + change: isSet(object.change) ? globalThis.Boolean(object.change) : false, + addressIndex: isSet(object.addressIndex) ? globalThis.Number(object.addressIndex) : 0, + }; + }, + + toJSON(message: BIP44Params): unknown { + const obj: any = {}; + if (message.purpose !== 0) { + obj.purpose = Math.round(message.purpose); + } + if (message.coinType !== 0) { + obj.coinType = Math.round(message.coinType); + } + if (message.account !== 0) { + obj.account = Math.round(message.account); + } + if (message.change !== false) { + obj.change = message.change; + } + if (message.addressIndex !== 0) { + obj.addressIndex = Math.round(message.addressIndex); + } + return obj; + }, + + create, I>>(base?: I): BIP44Params { + return BIP44Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BIP44Params { + const message = createBaseBIP44Params(); + message.purpose = object.purpose ?? 0; + message.coinType = object.coinType ?? 0; + message.account = object.account ?? 0; + message.change = object.change ?? false; + message.addressIndex = object.addressIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crypto/keyring/v1/record.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/keyring/v1/record.ts new file mode 100644 index 00000000..d6e83b43 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/keyring/v1/record.ts @@ -0,0 +1,432 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/keyring/v1/record.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { BIP44Params } from "../../hd/v1/hd"; + +export const protobufPackage = "cosmos.crypto.keyring.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + pubKey: + | Any + | undefined; + /** local stores the private key locally. */ + local?: + | Record_Local + | undefined; + /** ledger stores the information about a Ledger key. */ + ledger?: + | Record_Ledger + | undefined; + /** Multi does not store any other information. */ + multi?: + | Record_Multi + | undefined; + /** Offline does not store any other information. */ + offline?: Record_Offline | undefined; +} + +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_Local { + privKey: Any | undefined; +} + +/** Ledger item */ +export interface Record_Ledger { + path: BIP44Params | undefined; +} + +/** Multi item */ +export interface Record_Multi { +} + +/** Offline item */ +export interface Record_Offline { +} + +function createBaseRecord(): Record { + return { name: "", pubKey: undefined, local: undefined, ledger: undefined, multi: undefined, offline: undefined }; +} + +export const Record: MessageFns = { + encode(message: Record, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.local !== undefined) { + Record_Local.encode(message.local, writer.uint32(26).fork()).join(); + } + if (message.ledger !== undefined) { + Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).join(); + } + if (message.multi !== undefined) { + Record_Multi.encode(message.multi, writer.uint32(42).fork()).join(); + } + if (message.offline !== undefined) { + Record_Offline.encode(message.offline, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.local = Record_Local.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.ledger = Record_Ledger.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.multi = Record_Multi.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.offline = Record_Offline.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : 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 = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.local !== undefined) { + obj.local = Record_Local.toJSON(message.local); + } + if (message.ledger !== undefined) { + obj.ledger = Record_Ledger.toJSON(message.ledger); + } + if (message.multi !== undefined) { + obj.multi = Record_Multi.toJSON(message.multi); + } + if (message.offline !== undefined) { + obj.offline = Record_Offline.toJSON(message.offline); + } + return obj; + }, + + create, I>>(base?: I): Record { + return Record.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record { + const message = createBaseRecord(); + message.name = object.name ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : 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 { privKey: undefined }; +} + +export const Record_Local: MessageFns = { + encode(message: Record_Local, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.privKey !== undefined) { + Any.encode(message.privKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Local { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.privKey = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record_Local { + return { privKey: isSet(object.privKey) ? Any.fromJSON(object.privKey) : undefined }; + }, + + toJSON(message: Record_Local): unknown { + const obj: any = {}; + if (message.privKey !== undefined) { + obj.privKey = Any.toJSON(message.privKey); + } + return obj; + }, + + create, I>>(base?: I): Record_Local { + return Record_Local.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record_Local { + const message = createBaseRecord_Local(); + message.privKey = (object.privKey !== undefined && object.privKey !== null) + ? Any.fromPartial(object.privKey) + : undefined; + return message; + }, +}; + +function createBaseRecord_Ledger(): Record_Ledger { + return { path: undefined }; +} + +export const Record_Ledger: MessageFns = { + encode(message: Record_Ledger, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined) { + BIP44Params.encode(message.path, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Ledger { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = BIP44Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.path !== undefined) { + obj.path = BIP44Params.toJSON(message.path); + } + return obj; + }, + + create, I>>(base?: I): Record_Ledger { + return Record_Ledger.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: Record_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Multi { + return {}; + }, + + toJSON(_: Record_Multi): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Multi { + return Record_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, +}; + +function createBaseRecord_Offline(): Record_Offline { + return {}; +} + +export const Record_Offline: MessageFns = { + encode(_: Record_Offline, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Offline { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Offline { + return {}; + }, + + toJSON(_: Record_Offline): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Offline { + return Record_Offline.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crypto/multisig/keys.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/multisig/keys.ts new file mode 100644 index 00000000..3aacbfda --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + publicKeys: Any[]; +} + +function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { + return { threshold: 0, publicKeys: [] }; +} + +export const LegacyAminoPubKey: MessageFns = { + encode(message: LegacyAminoPubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.publicKeys) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LegacyAminoPubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.threshold = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKeys.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyAminoPubKey { + return { + threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0, + publicKeys: globalThis.Array.isArray(object?.publicKeys) + ? object.publicKeys.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LegacyAminoPubKey): unknown { + const obj: any = {}; + if (message.threshold !== 0) { + obj.threshold = Math.round(message.threshold); + } + if (message.publicKeys?.length) { + obj.publicKeys = message.publicKeys.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LegacyAminoPubKey { + return LegacyAminoPubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.publicKeys = object.publicKeys?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crypto/multisig/v1beta1/multisig.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 00000000..4f9b99a2 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/v1beta1/multisig.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 { + extraBitsStored: number; + elems: Uint8Array; +} + +function createBaseMultiSignature(): MultiSignature { + return { signatures: [] }; +} + +export const MultiSignature: MessageFns = { + encode(message: MultiSignature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiSignature { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: MultiSignature): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MultiSignature { + return MultiSignature.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCompactBitArray(): CompactBitArray { + return { extraBitsStored: 0, elems: new Uint8Array(0) }; +} + +export const CompactBitArray: MessageFns = { + encode(message: CompactBitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompactBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.extraBitsStored = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.elems = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompactBitArray { + return { + extraBitsStored: isSet(object.extraBitsStored) ? globalThis.Number(object.extraBitsStored) : 0, + elems: isSet(object.elems) ? bytesFromBase64(object.elems) : new Uint8Array(0), + }; + }, + + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + if (message.extraBitsStored !== 0) { + obj.extraBitsStored = Math.round(message.extraBitsStored); + } + if (message.elems.length !== 0) { + obj.elems = base64FromBytes(message.elems); + } + return obj; + }, + + create, I>>(base?: I): CompactBitArray { + return CompactBitArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extraBitsStored = object.extraBitsStored ?? 0; + message.elems = object.elems ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crypto/secp256k1/keys.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 00000000..7f79f331 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256k1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/crypto/secp256r1/keys.ts b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 00000000..54922e63 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,191 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256r1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { secret: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.secret = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { secret: isSet(object.secret) ? bytesFromBase64(object.secret) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.secret.length !== 0) { + obj.secret = base64FromBytes(message.secret); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/distribution/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/module/v1/module.ts new file mode 100644 index 00000000..23f8378a --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.distribution.module.v1"; + +/** Module is the config object of the distribution module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..f23cc1d6 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1149 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/distribution.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled !== false) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? globalThis.String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? globalThis.String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? globalThis.String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? globalThis.Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled !== false) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards: MessageFns = { + encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: globalThis.Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? globalThis.Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 0; + return message; + }, +}; + +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { rewards: [], period: 0 }; +} + +export const ValidatorCurrentRewards: MessageFns = { + encode(message: ValidatorCurrentRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommission { + return { + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorAccumulatedCommission): unknown { + const obj: any = {}; + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent: MessageFns = { + encode(message: ValidatorSlashEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? globalThis.Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? globalThis.String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents: MessageFns = { + encode(message: ValidatorSlashEvents, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSlashEvents) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvents(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool: MessageFns = { + encode(message: FeePool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.communityPool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeePool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: globalThis.Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { title: "", description: "", recipient: "", amount: [] }; +} + +export const CommunityPoolSpendProposal: MessageFns = { + encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommunityPoolSpendProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo: MessageFns = { + encode(message: DelegatorStartingInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (message.height !== 0) { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? globalThis.Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? globalThis.String(object.stake) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward: MessageFns = { + encode(message: DelegationDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + reward: globalThis.Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + message.reward = object.reward?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { title: "", description: "", recipient: "", amount: "", deposit: "" }; +} + +export const CommunityPoolSpendProposalWithDeposit: MessageFns = { + encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposalWithDeposit { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + deposit: isSet(object.deposit) ? globalThis.String(object.deposit) : "", + }; + }, + + toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..16d378f9 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1000 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo: MessageFns = { + encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord: MessageFns = { + encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord: MessageFns = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.accumulated !== undefined) { + ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommissionRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord: MessageFns = { + encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + if (message.rewards !== undefined) { + ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord: MessageFns = { + encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.rewards !== undefined) { + ValidatorCurrentRewards.encode(message.rewards, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord: MessageFns = { + encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord: MessageFns = { + encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).join(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.validatorSlashEvents) { + ValidatorSlashEventRecord.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: globalThis.Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? globalThis.String(object.previousProposer) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: globalThis.Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: globalThis.Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: globalThis.Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: globalThis.Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..9d32e8cb --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1674 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest: MessageFns = { + encode(message: QueryValidatorDistributionInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse: MessageFns = { + encode(message: QueryValidatorDistributionInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + selfBondRewards: globalThis.Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { + return { rewards: undefined }; +} + +export const QueryValidatorOutstandingRewardsResponse: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rewards !== undefined) { + ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest: MessageFns = { + encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { + return { commission: undefined }; +} + +export const QueryValidatorCommissionResponse: MessageFns = { + encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commission !== undefined) { + ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest: MessageFns = { + encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? globalThis.Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? globalThis.Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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: MessageFns = { + encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.slashes) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesResponse { + return { + slashes: globalThis.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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest: MessageFns = { + encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { + return { rewards: [] }; +} + +export const QueryDelegationRewardsResponse: MessageFns = { + encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest: MessageFns = { + encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { + return { rewards: [], total: [] }; +} + +export const QueryDelegationTotalRewardsResponse: MessageFns = { + encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.total) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) + ? object.rewards.map((e: any) => DelegationDelegatorReward.fromJSON(e)) + : [], + total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationTotalRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [] }; +} + +export const QueryDelegatorValidatorsResponse: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} + +export const QueryCommunityPoolRequest: MessageFns = { + encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, +}; + +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { pool: [] }; +} + +export const QueryCommunityPoolResponse: MessageFns = { + encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommunityPoolResponse { + return { pool: globalThis.Array.isArray(object?.pool) ? object.pool.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryCommunityPoolResponse): unknown { + const obj: any = {}; + if (message.pool?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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 BinaryReader(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..bf362224 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1161 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress: MessageFns = { + encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} + +export const MsgSetWithdrawAddressResponse: MessageFns = { + encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward: MessageFns = { + encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return { amount: [] }; +} + +export const MsgWithdrawDelegatorRewardResponse: MessageFns = { + encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorRewardResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawDelegatorRewardResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission: MessageFns = { + encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return { amount: [] }; +} + +export const MsgWithdrawValidatorCommissionResponse: MessageFns = { + encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommissionResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MsgFundCommunityPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgFundCommunityPool { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: MsgFundCommunityPool): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend: MessageFns = { + encode(message: MsgCommunityPoolSpend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse: MessageFns = { + encode(_: MsgCommunityPoolSpendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool: MessageFns = { + encode(message: MsgDepositValidatorRewardsPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse: MessageFns = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(new BinaryReader(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/evidence/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/module/v1/module.ts new file mode 100644 index 00000000..f92e0da7 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.evidence.module.v1"; + +/** Module is the config object of the evidence module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/evidence.ts b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/evidence.ts new file mode 100644 index 00000000..16d4bb94 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/evidence.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/evidence.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the equivocation height. */ + height: number; + /** time is the equivocation time. */ + time: + | Date + | undefined; + /** power is the equivocation validator power. */ + power: number; + /** consensus_address is the equivocation validator consensus address. */ + consensusAddress: string; +} + +function createBaseEquivocation(): Equivocation { + return { height: 0, time: undefined, power: 0, consensusAddress: "" }; +} + +export const Equivocation: MessageFns = { + encode(message: Equivocation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(24).int64(message.power); + } + if (message.consensusAddress !== "") { + writer.uint32(34).string(message.consensusAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Equivocation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensusAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Equivocation { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + consensusAddress: isSet(object.consensusAddress) ? globalThis.String(object.consensusAddress) : "", + }; + }, + + toJSON(message: Equivocation): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + if (message.consensusAddress !== "") { + obj.consensusAddress = message.consensusAddress; + } + return obj; + }, + + create, I>>(base?: I): Equivocation { + return Equivocation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Equivocation { + const message = createBaseEquivocation(); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.power = object.power ?? 0; + message.consensusAddress = object.consensusAddress ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/genesis.ts new file mode 100644 index 00000000..5d6dc17a --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/genesis.ts @@ -0,0 +1,97 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.evidence.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/query.ts new file mode 100644 index 00000000..41408c8a --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/query.ts @@ -0,0 +1,408 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + * Deprecated: Use hash, a HEX encoded string, instead. + * + * @deprecated + */ + evidenceHash: Uint8Array; + /** + * hash defines the evidence hash of the requested evidence. + * + * Since: cosmos-sdk 0.47 + */ + hash: string; +} + +/** QueryEvidenceResponse is the response type for the Query/Evidence RPC method. */ +export interface QueryEvidenceResponse { + /** evidence returns the requested evidence. */ + evidence: Any | undefined; +} + +/** + * QueryEvidenceRequest is the request type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { + return { evidenceHash: new Uint8Array(0), hash: "" }; +} + +export const QueryEvidenceRequest: MessageFns = { + encode(message: QueryEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidenceHash.length !== 0) { + writer.uint32(10).bytes(message.evidenceHash); + } + if (message.hash !== "") { + writer.uint32(18).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceRequest { + return { + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + hash: isSet(object.hash) ? globalThis.String(object.hash) : "", + }; + }, + + toJSON(message: QueryEvidenceRequest): unknown { + const obj: any = {}; + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceRequest { + return QueryEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEvidenceRequest { + const message = createBaseQueryEvidenceRequest(); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { + return { evidence: undefined }; +} + +export const QueryEvidenceResponse: MessageFns = { + encode(message: QueryEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceResponse { + return { evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined }; + }, + + toJSON(message: QueryEvidenceResponse): unknown { + const obj: any = {}; + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceResponse { + return QueryEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllEvidenceRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceRequest { + return QueryAllEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidence.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceResponse { + return { + evidence: globalThis.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?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceResponse { + return QueryAllEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.evidence.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/tx.ts new file mode 100644 index 00000000..04c14d2d --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/evidence/v1beta1/tx.ts @@ -0,0 +1,240 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the signer account address of evidence. */ + submitter: string; + /** evidence defines the evidence of misbehavior. */ + evidence: Any | undefined; +} + +/** 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: MessageFns = { + encode(message: MsgSubmitEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.submitter !== "") { + writer.uint32(10).string(message.submitter); + } + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.submitter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidence { + return { + submitter: isSet(object.submitter) ? globalThis.String(object.submitter) : "", + evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined, + }; + }, + + toJSON(message: MsgSubmitEvidence): unknown { + const obj: any = {}; + if (message.submitter !== "") { + obj.submitter = message.submitter; + } + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidence { + return MsgSubmitEvidence.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const MsgSubmitEvidenceResponse: MessageFns = { + encode(message: MsgSubmitEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidenceResponse { + return { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0) }; + }, + + toJSON(message: MsgSubmitEvidenceResponse): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidenceResponse { + return MsgSubmitEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEvidenceResponse { + const message = createBaseMsgSubmitEvidenceResponse(); + message.hash = object.hash ?? new Uint8Array(0); + 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 const MsgServiceName = "cosmos.evidence.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 || MsgServiceName; + 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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/module/v1/module.ts new file mode 100644 index 00000000..386f9d26 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.feegrant.module.v1"; + +/** Module is the config object of the feegrant module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/feegrant.ts b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/feegrant.ts new file mode 100644 index 00000000..9c002d76 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/feegrant.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/feegrant.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 coins + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowance { + /** + * spend_limit specifies the maximum amount of coins that can be spent + * by this allowance and will be updated as coins are spent. If it is + * empty, there is no spend limit and any amount of coins can be spent. + */ + spendLimit: Coin[]; + /** expiration specifies an optional time when this allowance expires */ + expiration: Date | undefined; +} + +/** + * 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 + | undefined; + /** + * period specifies the time duration in which period_spend_limit coins can + * be spent before that allowance is reset + */ + period: + | Duration + | undefined; + /** + * period_spend_limit specifies the maximum number of coins that can be spent + * in the period + */ + periodSpendLimit: Coin[]; + /** period_can_spend is the number of coins left to be spent before the period_reset time */ + periodCanSpend: 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 + */ + periodReset: Date | undefined; +} + +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowance { + /** allowance can be any of basic and periodic fee allowance. */ + allowance: + | Any + | undefined; + /** allowed_messages are the messages for which the grantee has the access. */ + allowedMessages: 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 | undefined; +} + +function createBaseBasicAllowance(): BasicAllowance { + return { spendLimit: [], expiration: undefined }; +} + +export const BasicAllowance: MessageFns = { + encode(message: BasicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BasicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BasicAllowance { + return { + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: BasicAllowance): unknown { + const obj: any = {}; + if (message.spendLimit?.length) { + obj.spendLimit = message.spendLimit.map((e) => Coin.toJSON(e)); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): BasicAllowance { + return BasicAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBasePeriodicAllowance(): PeriodicAllowance { + return { basic: undefined, period: undefined, periodSpendLimit: [], periodCanSpend: [], periodReset: undefined }; +} + +export const PeriodicAllowance: MessageFns = { + encode(message: PeriodicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.basic !== undefined) { + BasicAllowance.encode(message.basic, writer.uint32(10).fork()).join(); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(18).fork()).join(); + } + for (const v of message.periodSpendLimit) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.periodCanSpend) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.periodReset !== undefined) { + Timestamp.encode(toTimestamp(message.periodReset), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.basic = BasicAllowance.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.period = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.periodSpendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.periodCanSpend.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.periodReset = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + periodSpendLimit: globalThis.Array.isArray(object?.periodSpendLimit) + ? object.periodSpendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + periodCanSpend: globalThis.Array.isArray(object?.periodCanSpend) + ? object.periodCanSpend.map((e: any) => Coin.fromJSON(e)) + : [], + periodReset: isSet(object.periodReset) ? fromJsonTimestamp(object.periodReset) : undefined, + }; + }, + + toJSON(message: PeriodicAllowance): unknown { + const obj: any = {}; + if (message.basic !== undefined) { + obj.basic = BasicAllowance.toJSON(message.basic); + } + if (message.period !== undefined) { + obj.period = Duration.toJSON(message.period); + } + if (message.periodSpendLimit?.length) { + obj.periodSpendLimit = message.periodSpendLimit.map((e) => Coin.toJSON(e)); + } + if (message.periodCanSpend?.length) { + obj.periodCanSpend = message.periodCanSpend.map((e) => Coin.toJSON(e)); + } + if (message.periodReset !== undefined) { + obj.periodReset = message.periodReset.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): PeriodicAllowance { + return PeriodicAllowance.fromPartial(base ?? ({} as any)); + }, + 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.periodSpendLimit = object.periodSpendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.periodCanSpend = object.periodCanSpend?.map((e) => Coin.fromPartial(e)) || []; + message.periodReset = object.periodReset ?? undefined; + return message; + }, +}; + +function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { + return { allowance: undefined, allowedMessages: [] }; +} + +export const AllowedMsgAllowance: MessageFns = { + encode(message: AllowedMsgAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(10).fork()).join(); + } + for (const v of message.allowedMessages) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AllowedMsgAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowedMessages.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AllowedMsgAllowance { + return { + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + allowedMessages: globalThis.Array.isArray(object?.allowedMessages) + ? object.allowedMessages.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: AllowedMsgAllowance): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + if (message.allowedMessages?.length) { + obj.allowedMessages = message.allowedMessages; + } + return obj; + }, + + create, I>>(base?: I): AllowedMsgAllowance { + return AllowedMsgAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + message.allowedMessages = object.allowedMessages?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGrant(): Grant { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const Grant: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Grant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/genesis.ts new file mode 100644 index 00000000..14bfd526 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + allowances: globalThis.Array.isArray(object?.allowances) + ? object.allowances.map((e: any) => Grant.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.allowances?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 00000000..3f0c781d --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,586 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterResponse { + /** allowances that have been issued by the granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { + return { granter: "", grantee: "" }; +} + +export const QueryAllowanceRequest: MessageFns = { + encode(message: QueryAllowanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: QueryAllowanceRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceRequest { + return QueryAllowanceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Grant.encode(message.allowance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowance = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceResponse { + return { allowance: isSet(object.allowance) ? Grant.fromJSON(object.allowance) : undefined }; + }, + + toJSON(message: QueryAllowanceResponse): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Grant.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceResponse { + return QueryAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesRequest { + return QueryAllowancesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesResponse { + return { + allowances: globalThis.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?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesResponse { + return QueryAllowancesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesByGranterRequest { + return QueryAllowancesByGranterRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterResponse { + return { + allowances: globalThis.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?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAllowancesByGranterResponse { + return QueryAllowancesByGranterResponse.fromPartial(base ?? ({} as any)); + }, + 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 granted allwance to the grantee by the granter. */ + Allowance(request: QueryAllowanceRequest): Promise; + /** Allowances returns all the grants for the given grantee address. */ + Allowances(request: QueryAllowancesRequest): Promise; + /** + * AllowancesByGranter returns all the grants given by an address + * + * Since: cosmos-sdk 0.46 + */ + AllowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; +} + +export const QueryServiceName = "cosmos.feegrant.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 00000000..052862c2 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,490 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 { +} + +/** + * MsgPruneAllowances prunes expired fee allowances. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowances { + /** pruner is the address of the user pruning expired allowances. */ + pruner: string; +} + +/** + * MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowancesResponse { +} + +function createBaseMsgGrantAllowance(): MsgGrantAllowance { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const MsgGrantAllowance: MessageFns = { + encode(message: MsgGrantAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrantAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: MsgGrantAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowance { + return MsgGrantAllowance.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantAllowanceResponse { + return {}; + }, + + toJSON(_: MsgGrantAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { + return { granter: "", grantee: "" }; +} + +export const MsgRevokeAllowance: MessageFns = { + encode(message: MsgRevokeAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevokeAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: MsgRevokeAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowance { + return MsgRevokeAllowance.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeAllowanceResponse { + return {}; + }, + + toJSON(_: MsgRevokeAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgPruneAllowances(): MsgPruneAllowances { + return { pruner: "" }; +} + +export const MsgPruneAllowances: MessageFns = { + encode(message: MsgPruneAllowances, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pruner !== "") { + writer.uint32(10).string(message.pruner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pruner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgPruneAllowances { + return { pruner: isSet(object.pruner) ? globalThis.String(object.pruner) : "" }; + }, + + toJSON(message: MsgPruneAllowances): unknown { + const obj: any = {}; + if (message.pruner !== "") { + obj.pruner = message.pruner; + } + return obj; + }, + + create, I>>(base?: I): MsgPruneAllowances { + return MsgPruneAllowances.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgPruneAllowances { + const message = createBaseMsgPruneAllowances(); + message.pruner = object.pruner ?? ""; + return message; + }, +}; + +function createBaseMsgPruneAllowancesResponse(): MsgPruneAllowancesResponse { + return {}; +} + +export const MsgPruneAllowancesResponse: MessageFns = { + encode(_: MsgPruneAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgPruneAllowancesResponse { + return {}; + }, + + toJSON(_: MsgPruneAllowancesResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgPruneAllowancesResponse { + return MsgPruneAllowancesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgPruneAllowancesResponse { + const message = createBaseMsgPruneAllowancesResponse(); + 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; + /** + * PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + * + * Since cosmos-sdk 0.50 + */ + PruneAllowances(request: MsgPruneAllowances): Promise; +} + +export const MsgServiceName = "cosmos.feegrant.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 || MsgServiceName; + this.rpc = rpc; + this.GrantAllowance = this.GrantAllowance.bind(this); + this.RevokeAllowance = this.RevokeAllowance.bind(this); + this.PruneAllowances = this.PruneAllowances.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 BinaryReader(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 BinaryReader(data))); + } + + PruneAllowances(request: MsgPruneAllowances): Promise { + const data = MsgPruneAllowances.encode(request).finish(); + const promise = this.rpc.request(this.service, "PruneAllowances", data); + return promise.then((data) => MsgPruneAllowancesResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/genutil/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/genutil/module/v1/module.ts new file mode 100644 index 00000000..a7da77b1 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/genutil/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.module.v1"; + +/** Module is the config object for the genutil module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/genutil/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/genutil/v1beta1/genesis.ts new file mode 100644 index 00000000..11bd3193 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/genutil/v1beta1/genesis.ts @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.v1beta1"; + +/** GenesisState defines the raw genesis transaction in JSON. */ +export interface GenesisState { + /** gen_txs defines the genesis transactions. */ + genTxs: Uint8Array[]; +} + +function createBaseGenesisState(): GenesisState { + return { genTxs: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.genTxs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.genTxs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + genTxs: globalThis.Array.isArray(object?.genTxs) ? object.genTxs.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.genTxs?.length) { + obj.genTxs = message.genTxs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.genTxs = object.genTxs?.map((e) => e) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/gov/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/gov/module/v1/module.ts new file mode 100644 index 00000000..d95ae5ed --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/gov/module/v1/module.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.gov.module.v1"; + +/** Module is the config object of the gov module. */ +export interface Module { + /** + * max_metadata_len defines the maximum proposal metadata length. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { maxMetadataLen: 0, authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMetadataLen !== 0) { + writer.uint32(8).uint64(message.maxMetadataLen); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxMetadataLen = object.maxMetadataLen ?? 0; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/genesis.ts new file mode 100644 index 00000000..d6adbe5f --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/genesis.ts @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Deposit, DepositParams, Params, 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. */ + startingProposalId: number; + /** 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[]; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: + | Params + | undefined; + /** + * The constitution allows builders to lay a foundation and define purpose. + * This is an immutable string set in genesis. + * There are no amendments, to go outside of scope, just fork. + * constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. + * + * Since: cosmos-sdk 0.50 + */ + constitution: string; + portId: string; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + params: undefined, + constitution: "", + portId: "", + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(66).fork()).join(); + } + if (message.constitution !== "") { + writer.uint32(74).string(message.constitution); + } + if (message.portId !== "") { + writer.uint32(82).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.constitution = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.constitution = object.constitution ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/gov.ts b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/gov.ts new file mode 100644 index 00000000..8b77a89a --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/gov.ts @@ -0,0 +1,2031 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines an encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + /** + * PROPOSAL_STATUS_TALLY_PERIOD - PROPOSAL_STATUS_TALLY_PERIOD defines a proposal status during the tally + * period. + */ + PROPOSAL_STATUS_TALLY_PERIOD = 6, + 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 6: + case "PROPOSAL_STATUS_TALLY_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_TALLY_PERIOD; + 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.PROPOSAL_STATUS_TALLY_PERIOD: + return "PROPOSAL_STATUS_TALLY_PERIOD"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** id defines the unique id of the proposal. */ + id: number; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: Any[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; + /** + * expedited defines if the proposal is expedited + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; + /** + * failed_reason defines the reason why the proposal failed + * + * Since: cosmos-sdk 0.50 + */ + failedReason: string; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** decryption key is used to decrypt the encrypted votes during the tally phase */ + decryptionKey: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes_count is the number of yes votes on a proposal. */ + yesCount: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstainCount: string; + /** no_count is the number of no votes on a proposal. */ + noCount: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + noWithVetoCount: string; + /** encrypted_count is the number of encrypted votes on a proposal. */ + encryptedCount: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOption[]; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + */ + metadata: string; + encryptedVoteData: string; +} + +/** + * DepositParams defines the params for deposits on governance proposals. + * + * @deprecated + */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** + * VotingParams defines the params for voting on governance proposals. + * + * @deprecated + */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** + * TallyParams defines the params for tallying votes on governance proposals. + * + * @deprecated + */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; +} + +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface Params { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: + | Duration + | undefined; + /** Duration of the voting period. */ + votingPeriod: + | Duration + | undefined; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + minInitialDepositRatio: string; + /** + * The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelRatio: string; + /** + * The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + * If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelDest: string; + /** + * Duration of the voting period of an expedited proposal. + * + * Since: cosmos-sdk 0.50 + */ + expeditedVotingPeriod: + | Duration + | undefined; + /** + * Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. + * + * Since: cosmos-sdk 0.50 + */ + expeditedThreshold: string; + /** Minimum expedited deposit for a proposal to enter voting period. */ + expeditedMinDeposit: Coin[]; + /** burn deposits if a proposal does not meet quorum */ + burnVoteQuorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burnProposalDepositPrevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burnVoteVeto: boolean; + /** + * The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + * Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + * required. + * + * Since: cosmos-sdk 0.50 + */ + minDepositRatio: string; + /** Duration of the voting period. */ + maxTallyPeriod: Duration | undefined; + trustedCounterParties: TrustedCounterParty[]; + channelId: string; + isSourceChain: boolean; +} + +export interface DecryptedVoteOption { + /** option defines the vote option. */ + option: VoteOption; + randomNo: number; +} + +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + messages: [], + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + metadata: "", + title: "", + summary: "", + proposer: "", + expedited: false, + failedReason: "", + hasEncryptedVotes: false, + identity: "", + pubkey: "", + decryptionKey: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(90).string(message.title); + } + if (message.summary !== "") { + writer.uint32(98).string(message.summary); + } + if (message.proposer !== "") { + writer.uint32(106).string(message.proposer); + } + if (message.expedited !== false) { + writer.uint32(112).bool(message.expedited); + } + if (message.failedReason !== "") { + writer.uint32(122).string(message.failedReason); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(128).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(138).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(146).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(154).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.metadata = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.title = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.summary = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.proposer = reader.string(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.expedited = reader.bool(); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.failedReason = reader.string(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.identity = reader.string(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.pubkey = reader.string(); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(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, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + failedReason: isSet(object.failedReason) ? globalThis.String(object.failedReason) : "", + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(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.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + if (message.failedReason !== "") { + obj.failedReason = message.failedReason; + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + 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; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.proposer = object.proposer ?? ""; + message.expedited = object.expedited ?? false; + message.failedReason = object.failedReason ?? ""; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "", encryptedCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + if (message.encryptedCount !== "") { + writer.uint32(42).string(message.encryptedCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + encryptedCount: isSet(object.encryptedCount) ? globalThis.String(object.encryptedCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + if (message.encryptedCount !== "") { + obj.encryptedCount = message.encryptedCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + message.encryptedCount = object.encryptedCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", options: [], metadata: "", encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(42).string(message.metadata); + } + if (message.encryptedVoteData !== "") { + writer.uint32(50).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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) : "", + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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; + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: "", threshold: "", vetoThreshold: "" }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(26).string(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + 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 ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + minDeposit: [], + maxDepositPeriod: undefined, + votingPeriod: undefined, + quorum: "", + threshold: "", + vetoThreshold: "", + minInitialDepositRatio: "", + proposalCancelRatio: "", + proposalCancelDest: "", + expeditedVotingPeriod: undefined, + expeditedThreshold: "", + expeditedMinDeposit: [], + burnVoteQuorum: false, + burnProposalDepositPrevote: false, + burnVoteVeto: false, + minDepositRatio: "", + maxTallyPeriod: undefined, + trustedCounterParties: [], + channelId: "", + isSourceChain: false, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(26).fork()).join(); + } + if (message.quorum !== "") { + writer.uint32(34).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(42).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(50).string(message.vetoThreshold); + } + if (message.minInitialDepositRatio !== "") { + writer.uint32(58).string(message.minInitialDepositRatio); + } + if (message.proposalCancelRatio !== "") { + writer.uint32(66).string(message.proposalCancelRatio); + } + if (message.proposalCancelDest !== "") { + writer.uint32(74).string(message.proposalCancelDest); + } + if (message.expeditedVotingPeriod !== undefined) { + Duration.encode(message.expeditedVotingPeriod, writer.uint32(82).fork()).join(); + } + if (message.expeditedThreshold !== "") { + writer.uint32(90).string(message.expeditedThreshold); + } + for (const v of message.expeditedMinDeposit) { + Coin.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.burnVoteQuorum !== false) { + writer.uint32(104).bool(message.burnVoteQuorum); + } + if (message.burnProposalDepositPrevote !== false) { + writer.uint32(112).bool(message.burnProposalDepositPrevote); + } + if (message.burnVoteVeto !== false) { + writer.uint32(120).bool(message.burnVoteVeto); + } + if (message.minDepositRatio !== "") { + writer.uint32(130).string(message.minDepositRatio); + } + if (message.maxTallyPeriod !== undefined) { + Duration.encode(message.maxTallyPeriod, writer.uint32(138).fork()).join(); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(146).fork()).join(); + } + if (message.channelId !== "") { + writer.uint32(154).string(message.channelId); + } + if (message.isSourceChain !== false) { + writer.uint32(160).bool(message.isSourceChain); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.quorum = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.threshold = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.minInitialDepositRatio = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposalCancelRatio = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.proposalCancelDest = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.expeditedVotingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.expeditedThreshold = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.expeditedMinDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.burnVoteQuorum = reader.bool(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.burnProposalDepositPrevote = reader.bool(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.burnVoteVeto = reader.bool(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.minDepositRatio = reader.string(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.maxTallyPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.channelId = reader.string(); + continue; + case 20: + if (tag !== 160) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + minInitialDepositRatio: isSet(object.minInitialDepositRatio) + ? globalThis.String(object.minInitialDepositRatio) + : "", + proposalCancelRatio: isSet(object.proposalCancelRatio) ? globalThis.String(object.proposalCancelRatio) : "", + proposalCancelDest: isSet(object.proposalCancelDest) ? globalThis.String(object.proposalCancelDest) : "", + expeditedVotingPeriod: isSet(object.expeditedVotingPeriod) + ? Duration.fromJSON(object.expeditedVotingPeriod) + : undefined, + expeditedThreshold: isSet(object.expeditedThreshold) ? globalThis.String(object.expeditedThreshold) : "", + expeditedMinDeposit: globalThis.Array.isArray(object?.expeditedMinDeposit) + ? object.expeditedMinDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + burnVoteQuorum: isSet(object.burnVoteQuorum) ? globalThis.Boolean(object.burnVoteQuorum) : false, + burnProposalDepositPrevote: isSet(object.burnProposalDepositPrevote) + ? globalThis.Boolean(object.burnProposalDepositPrevote) + : false, + burnVoteVeto: isSet(object.burnVoteVeto) ? globalThis.Boolean(object.burnVoteVeto) : false, + minDepositRatio: isSet(object.minDepositRatio) ? globalThis.String(object.minDepositRatio) : "", + maxTallyPeriod: isSet(object.maxTallyPeriod) ? Duration.fromJSON(object.maxTallyPeriod) : undefined, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + if (message.minInitialDepositRatio !== "") { + obj.minInitialDepositRatio = message.minInitialDepositRatio; + } + if (message.proposalCancelRatio !== "") { + obj.proposalCancelRatio = message.proposalCancelRatio; + } + if (message.proposalCancelDest !== "") { + obj.proposalCancelDest = message.proposalCancelDest; + } + if (message.expeditedVotingPeriod !== undefined) { + obj.expeditedVotingPeriod = Duration.toJSON(message.expeditedVotingPeriod); + } + if (message.expeditedThreshold !== "") { + obj.expeditedThreshold = message.expeditedThreshold; + } + if (message.expeditedMinDeposit?.length) { + obj.expeditedMinDeposit = message.expeditedMinDeposit.map((e) => Coin.toJSON(e)); + } + if (message.burnVoteQuorum !== false) { + obj.burnVoteQuorum = message.burnVoteQuorum; + } + if (message.burnProposalDepositPrevote !== false) { + obj.burnProposalDepositPrevote = message.burnProposalDepositPrevote; + } + if (message.burnVoteVeto !== false) { + obj.burnVoteVeto = message.burnVoteVeto; + } + if (message.minDepositRatio !== "") { + obj.minDepositRatio = message.minDepositRatio; + } + if (message.maxTallyPeriod !== undefined) { + obj.maxTallyPeriod = Duration.toJSON(message.maxTallyPeriod); + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + message.minInitialDepositRatio = object.minInitialDepositRatio ?? ""; + message.proposalCancelRatio = object.proposalCancelRatio ?? ""; + message.proposalCancelDest = object.proposalCancelDest ?? ""; + message.expeditedVotingPeriod = + (object.expeditedVotingPeriod !== undefined && object.expeditedVotingPeriod !== null) + ? Duration.fromPartial(object.expeditedVotingPeriod) + : undefined; + message.expeditedThreshold = object.expeditedThreshold ?? ""; + message.expeditedMinDeposit = object.expeditedMinDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.burnVoteQuorum = object.burnVoteQuorum ?? false; + message.burnProposalDepositPrevote = object.burnProposalDepositPrevote ?? false; + message.burnVoteVeto = object.burnVoteVeto ?? false; + message.minDepositRatio = object.minDepositRatio ?? ""; + message.maxTallyPeriod = (object.maxTallyPeriod !== undefined && object.maxTallyPeriod !== null) + ? Duration.fromPartial(object.maxTallyPeriod) + : undefined; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.channelId = object.channelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + return message; + }, +}; + +function createBaseDecryptedVoteOption(): DecryptedVoteOption { + return { option: 0, randomNo: 0 }; +} + +export const DecryptedVoteOption: MessageFns = { + encode(message: DecryptedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.randomNo !== 0) { + writer.uint32(16).int64(message.randomNo); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.randomNo = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + randomNo: isSet(object.randomNo) ? globalThis.Number(object.randomNo) : 0, + }; + }, + + toJSON(message: DecryptedVoteOption): unknown { + const obj: any = {}; + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.randomNo !== 0) { + obj.randomNo = Math.round(message.randomNo); + } + return obj; + }, + + create, I>>(base?: I): DecryptedVoteOption { + return DecryptedVoteOption.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptedVoteOption { + const message = createBaseDecryptedVoteOption(); + message.option = object.option ?? 0; + message.randomNo = object.randomNo ?? 0; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/query.ts new file mode 100644 index 00000000..54a6bef2 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/query.ts @@ -0,0 +1,1575 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + Deposit, + DepositParams, + Params, + Proposal, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyParams, + TallyResult, + Vote, + VotingParams, +} from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryConstitutionRequest is the request type for the Query/Constitution RPC method */ +export interface QueryConstitutionRequest { +} + +/** QueryConstitutionResponse is the response type for the Query/Constitution RPC method */ +export interface QueryConstitutionResponse { + constitution: string; +} + +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + /** proposal is the requested governance proposal. */ + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: Params | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryConstitutionRequest(): QueryConstitutionRequest { + return {}; +} + +export const QueryConstitutionRequest: MessageFns = { + encode(_: QueryConstitutionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConstitutionRequest { + return {}; + }, + + toJSON(_: QueryConstitutionRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConstitutionRequest { + return QueryConstitutionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConstitutionRequest { + const message = createBaseQueryConstitutionRequest(); + return message; + }, +}; + +function createBaseQueryConstitutionResponse(): QueryConstitutionResponse { + return { constitution: "" }; +} + +export const QueryConstitutionResponse: MessageFns = { + encode(message: QueryConstitutionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constitution !== "") { + writer.uint32(10).string(message.constitution); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.constitution = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConstitutionResponse { + return { constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "" }; + }, + + toJSON(message: QueryConstitutionResponse): unknown { + const obj: any = {}; + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + return obj; + }, + + create, I>>(base?: I): QueryConstitutionResponse { + return QueryConstitutionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryConstitutionResponse { + const message = createBaseQueryConstitutionResponse(); + message.constitution = object.constitution ?? ""; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined, params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + 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.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Constitution queries the chain's constitution. */ + Constitution(request: QueryConstitutionRequest): Promise; + /** 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 on 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 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 || QueryServiceName; + this.rpc = rpc; + this.Constitution = this.Constitution.bind(this); + 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); + } + Constitution(request: QueryConstitutionRequest): Promise { + const data = QueryConstitutionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Constitution", data); + return promise.then((data) => QueryConstitutionResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/tx.ts new file mode 100644 index 00000000..9f8156b7 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1/tx.ts @@ -0,0 +1,1531 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params, VoteOption, voteOptionFromJSON, voteOptionToJSON, WeightedVoteOption } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages: Any[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * expedited defines if the proposal is expedited or not + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContent { + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** authority must be the gov module address. */ + authority: string; +} + +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse { +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata: string; +} + +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse { +} + +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCancelProposal is the Msg/CancelProposal request type. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** canceled_time is the time when proposal is canceled. */ + canceledTime: + | Date + | undefined; + /** canceled_height defines the block height at which the proposal is canceled. */ + canceledHeight: number; +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { messages: [], initialDeposit: [], proposer: "", metadata: "", title: "", summary: "", expedited: false }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.summary !== "") { + writer.uint32(50).string(message.summary); + } + if (message.expedited !== false) { + writer.uint32(56).bool(message.expedited); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.title = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.summary = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expedited = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + 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)) || []; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.expedited = object.expedited ?? false; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { content: undefined, authority: "" }; +} + +export const MsgExecLegacyContent: MessageFns = { + encode(message: MsgExecLegacyContent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecLegacyContent { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: MsgExecLegacyContent): unknown { + const obj: any = {}; + 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) + ? Any.fromPartial(object.content) + : undefined; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} + +export const MsgExecLegacyContentResponse: MessageFns = { + encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgExecLegacyContentResponse { + return {}; + }, + + toJSON(_: MsgExecLegacyContentResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "" }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "", metadata: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [], metadata: "" }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCancelProposal(): MsgCancelProposal { + return { proposalId: 0, proposer: "" }; +} + +export const MsgCancelProposal: MessageFns = { + encode(message: MsgCancelProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.proposer !== "") { + writer.uint32(18).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgCancelProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposal { + return MsgCancelProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposal { + const message = createBaseMsgCancelProposal(); + message.proposalId = object.proposalId ?? 0; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgCancelProposalResponse(): MsgCancelProposalResponse { + return { proposalId: 0, canceledTime: undefined, canceledHeight: 0 }; +} + +export const MsgCancelProposalResponse: MessageFns = { + encode(message: MsgCancelProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.canceledTime !== undefined) { + Timestamp.encode(toTimestamp(message.canceledTime), writer.uint32(18).fork()).join(); + } + if (message.canceledHeight !== 0) { + writer.uint32(24).uint64(message.canceledHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.canceledTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.canceledHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposalResponse { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + canceledTime: isSet(object.canceledTime) ? fromJsonTimestamp(object.canceledTime) : undefined, + canceledHeight: isSet(object.canceledHeight) ? globalThis.Number(object.canceledHeight) : 0, + }; + }, + + toJSON(message: MsgCancelProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.canceledTime !== undefined) { + obj.canceledTime = message.canceledTime.toISOString(); + } + if (message.canceledHeight !== 0) { + obj.canceledHeight = Math.round(message.canceledHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposalResponse { + return MsgCancelProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposalResponse { + const message = createBaseMsgCancelProposalResponse(); + message.proposalId = object.proposalId ?? 0; + message.canceledTime = object.canceledTime ?? undefined; + message.canceledHeight = object.canceledHeight ?? 0; + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given the messages. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + */ + ExecLegacyContent(request: MsgExecLegacyContent): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): Promise; + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; + /** + * UpdateParams defines a governance operation for updating the x/gov module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CancelProposal defines a method to cancel governance proposal + * + * Since: cosmos-sdk 0.50 + */ + CancelProposal(request: MsgCancelProposal): 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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.ExecLegacyContent = this.ExecLegacyContent.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.CancelProposal = this.CancelProposal.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelProposal(request: MsgCancelProposal): Promise { + const data = MsgCancelProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelProposal", data); + return promise.then((data) => MsgCancelProposalResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 00000000..f70b4ccf --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,234 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + startingProposalId: number; + /** 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[]; + /** deposit_params defines all the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** voting_params defines all the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** tally_params defines all the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/gov.ts b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 00000000..b58fe54c --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1356 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines a encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** aggregated keyshare is used to decrypt the encrypted votes during the tally phase */ + aggrKeyshare: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + noWithVeto: string; + /** encrypted is the number of encrypted votes on a proposal. */ + encrypted: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + * + * @deprecated + */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOption[]; + encryptedVoteData: string; +} + +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: Uint8Array; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: Uint8Array; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: Uint8Array; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseTextProposal(): TextProposal { + return { title: "", description: "" }; +} + +export const TextProposal: MessageFns = { + encode(message: TextProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TextProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: TextProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): TextProposal { + return TextProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + proposalId: 0, + content: undefined, + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + hasEncryptedVotes: false, + identity: "", + pubkey: "", + aggrKeyshare: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(80).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(90).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(98).string(message.pubkey); + } + if (message.aggrKeyshare !== "") { + writer.uint32(106).string(message.aggrKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.identity = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.pubkey = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.aggrKeyshare = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + aggrKeyshare: isSet(object.aggrKeyshare) ? globalThis.String(object.aggrKeyshare) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.aggrKeyshare !== "") { + obj.aggrKeyshare = message.aggrKeyshare; + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.proposalId = object.proposalId ?? 0; + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.aggrKeyshare = object.aggrKeyshare ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes: "", abstain: "", no: "", noWithVeto: "", encrypted: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yes !== "") { + writer.uint32(10).string(message.yes); + } + if (message.abstain !== "") { + writer.uint32(18).string(message.abstain); + } + if (message.no !== "") { + writer.uint32(26).string(message.no); + } + if (message.noWithVeto !== "") { + writer.uint32(34).string(message.noWithVeto); + } + if (message.encrypted !== "") { + writer.uint32(42).string(message.encrypted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yes = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstain = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.no = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVeto = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encrypted = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes: isSet(object.yes) ? globalThis.String(object.yes) : "", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "", + no: isSet(object.no) ? globalThis.String(object.no) : "", + noWithVeto: isSet(object.noWithVeto) ? globalThis.String(object.noWithVeto) : "", + encrypted: isSet(object.encrypted) ? globalThis.String(object.encrypted) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yes !== "") { + obj.yes = message.yes; + } + if (message.abstain !== "") { + obj.abstain = message.abstain; + } + if (message.no !== "") { + obj.no = message.no; + } + if (message.noWithVeto !== "") { + obj.noWithVeto = message.noWithVeto; + } + if (message.encrypted !== "") { + obj.encrypted = message.encrypted; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.noWithVeto = object.noWithVeto ?? ""; + message.encrypted = object.encrypted ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, options: [], encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.encryptedVoteData !== "") { + writer.uint32(42).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: new Uint8Array(0), threshold: new Uint8Array(0), vetoThreshold: new Uint8Array(0) }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + writer.uint32(26).bytes(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? bytesFromBase64(object.quorum) : new Uint8Array(0), + threshold: isSet(object.threshold) ? bytesFromBase64(object.threshold) : new Uint8Array(0), + vetoThreshold: isSet(object.vetoThreshold) ? bytesFromBase64(object.vetoThreshold) : new Uint8Array(0), + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum.length !== 0) { + obj.quorum = base64FromBytes(message.quorum); + } + if (message.threshold.length !== 0) { + obj.threshold = base64FromBytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + obj.vetoThreshold = base64FromBytes(message.vetoThreshold); + } + 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 ?? new Uint8Array(0); + message.threshold = object.threshold ?? new Uint8Array(0); + message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/query.ts new file mode 100644 index 00000000..1e13f7d3 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1413 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** deposit_params defines the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** tally_params defines the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? 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 on proposalID, depositor address. */ + 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 const QueryServiceName = "cosmos.gov.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 00000000..85994854 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,880 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the proposal's content. */ + content: + | Any + | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + 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 defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { content: undefined, initialDeposit: [], proposer: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [] }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgVoteWeighted { + return MsgVoteWeighted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): 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 const MsgServiceName = "cosmos.gov.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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/group/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/group/module/v1/module.ts new file mode 100644 index 00000000..fbcfb65d --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/group/module/v1/module.ts @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../../../google/protobuf/duration"; + +export const protobufPackage = "cosmos.group.module.v1"; + +/** Module is the config object of the group module. */ +export interface Module { + /** + * max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + * to execute the proposal. + */ + maxExecutionPeriod: + | Duration + | undefined; + /** + * max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; +} + +function createBaseModule(): Module { + return { maxExecutionPeriod: undefined, maxMetadataLen: 0 }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxExecutionPeriod !== undefined) { + Duration.encode(message.maxExecutionPeriod, writer.uint32(10).fork()).join(); + } + if (message.maxMetadataLen !== 0) { + writer.uint32(16).uint64(message.maxMetadataLen); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxExecutionPeriod: isSet(object.maxExecutionPeriod) ? Duration.fromJSON(object.maxExecutionPeriod) : undefined, + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxExecutionPeriod !== undefined) { + obj.maxExecutionPeriod = Duration.toJSON(message.maxExecutionPeriod); + } + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxExecutionPeriod = (object.maxExecutionPeriod !== undefined && object.maxExecutionPeriod !== null) + ? Duration.fromPartial(object.maxExecutionPeriod) + : undefined; + message.maxMetadataLen = object.maxMetadataLen ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/events.ts b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/events.ts new file mode 100644 index 00000000..6a221d4e --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/events.ts @@ -0,0 +1,780 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/events.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyResult, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** 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. */ + proposalId: number; +} + +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposal { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVote { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExec { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** result is the proposal execution result. */ + result: ProposalExecutorResult; + /** logs contains error logs in case the execution result is FAILURE. */ + logs: string; +} + +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroup { + /** group_id is the unique ID of the group. */ + groupId: number; + /** address is the account address of the group member. */ + address: string; +} + +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPruned { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). */ + status: ProposalStatus; + /** tally_result is the proposal tally result (when applicable). */ + tallyResult: TallyResult | undefined; +} + +function createBaseEventCreateGroup(): EventCreateGroup { + return { groupId: 0 }; +} + +export const EventCreateGroup: MessageFns = { + encode(message: EventCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventCreateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroup { + return EventCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroup { + const message = createBaseEventCreateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventUpdateGroup(): EventUpdateGroup { + return { groupId: 0 }; +} + +export const EventUpdateGroup: MessageFns = { + encode(message: EventUpdateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventUpdateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroup { + return EventUpdateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { + return { address: "" }; +} + +export const EventCreateGroupPolicy: MessageFns = { + encode(message: EventCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroupPolicy { + return EventCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { + return { address: "" }; +} + +export const EventUpdateGroupPolicy: MessageFns = { + encode(message: EventUpdateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventUpdateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroupPolicy { + return EventUpdateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventSubmitProposal(): EventSubmitProposal { + return { proposalId: 0 }; +} + +export const EventSubmitProposal: MessageFns = { + encode(message: EventSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSubmitProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventSubmitProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventSubmitProposal { + return EventSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventWithdrawProposal(): EventWithdrawProposal { + return { proposalId: 0 }; +} + +export const EventWithdrawProposal: MessageFns = { + encode(message: EventWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventWithdrawProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventWithdrawProposal { + return EventWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventVote(): EventVote { + return { proposalId: 0 }; +} + +export const EventVote: MessageFns = { + encode(message: EventVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventVote { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventVote { + return EventVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventVote { + const message = createBaseEventVote(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventExec(): EventExec { + return { proposalId: 0, result: 0, logs: "" }; +} + +export const EventExec: MessageFns = { + encode(message: EventExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + if (message.logs !== "") { + writer.uint32(26).string(message.logs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.logs = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0, + logs: isSet(object.logs) ? globalThis.String(object.logs) : "", + }; + }, + + toJSON(message: EventExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + if (message.logs !== "") { + obj.logs = message.logs; + } + return obj; + }, + + create, I>>(base?: I): EventExec { + return EventExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventExec { + const message = createBaseEventExec(); + message.proposalId = object.proposalId ?? 0; + message.result = object.result ?? 0; + message.logs = object.logs ?? ""; + return message; + }, +}; + +function createBaseEventLeaveGroup(): EventLeaveGroup { + return { groupId: 0, address: "" }; +} + +export const EventLeaveGroup: MessageFns = { + encode(message: EventLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventLeaveGroup { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: EventLeaveGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventLeaveGroup { + return EventLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + message.groupId = object.groupId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventProposalPruned(): EventProposalPruned { + return { proposalId: 0, status: 0, tallyResult: undefined }; +} + +export const EventProposalPruned: MessageFns = { + encode(message: EventProposalPruned, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.tallyResult !== undefined) { + TallyResult.encode(message.tallyResult, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventProposalPruned { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventProposalPruned(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.status = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventProposalPruned { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + tallyResult: isSet(object.tallyResult) ? TallyResult.fromJSON(object.tallyResult) : undefined, + }; + }, + + toJSON(message: EventProposalPruned): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.tallyResult !== undefined) { + obj.tallyResult = TallyResult.toJSON(message.tallyResult); + } + return obj; + }, + + create, I>>(base?: I): EventProposalPruned { + return EventProposalPruned.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventProposalPruned { + const message = createBaseEventProposalPruned(); + message.proposalId = object.proposalId ?? 0; + message.status = object.status ?? 0; + message.tallyResult = (object.tallyResult !== undefined && object.tallyResult !== null) + ? TallyResult.fromPartial(object.tallyResult) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/genesis.ts new file mode 100644 index 00000000..b2d21dd4 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/genesis.ts @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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. + */ + groupSeq: number; + /** groups is the list of groups info. */ + groups: GroupInfo[]; + /** group_members is the list of groups members. */ + groupMembers: GroupMember[]; + /** + * group_policy_seq is the group policy table orm.Sequence, + * it is used to generate the next group policy account address. + */ + groupPolicySeq: number; + /** group_policies is the list of group policies info. */ + groupPolicies: GroupPolicyInfo[]; + /** + * proposal_seq is the proposal table orm.Sequence, + * it is used to get the next proposal ID. + */ + proposalSeq: number; + /** proposals is the list of proposals. */ + proposals: Proposal[]; + /** votes is the list of votes. */ + votes: Vote[]; +} + +function createBaseGenesisState(): GenesisState { + return { + groupSeq: 0, + groups: [], + groupMembers: [], + groupPolicySeq: 0, + groupPolicies: [], + proposalSeq: 0, + proposals: [], + votes: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupSeq !== 0) { + writer.uint32(8).uint64(message.groupSeq); + } + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.groupMembers) { + GroupMember.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.groupPolicySeq !== 0) { + writer.uint32(32).uint64(message.groupPolicySeq); + } + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.proposalSeq !== 0) { + writer.uint32(48).uint64(message.proposalSeq); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.groupSeq = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMembers.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.groupPolicySeq = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.proposalSeq = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + groupSeq: isSet(object.groupSeq) ? globalThis.Number(object.groupSeq) : 0, + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + groupMembers: globalThis.Array.isArray(object?.groupMembers) + ? object.groupMembers.map((e: any) => GroupMember.fromJSON(e)) + : [], + groupPolicySeq: isSet(object.groupPolicySeq) ? globalThis.Number(object.groupPolicySeq) : 0, + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + proposalSeq: isSet(object.proposalSeq) ? globalThis.Number(object.proposalSeq) : 0, + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.groupSeq !== 0) { + obj.groupSeq = Math.round(message.groupSeq); + } + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.groupMembers?.length) { + obj.groupMembers = message.groupMembers.map((e) => GroupMember.toJSON(e)); + } + if (message.groupPolicySeq !== 0) { + obj.groupPolicySeq = Math.round(message.groupPolicySeq); + } + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.proposalSeq !== 0) { + obj.proposalSeq = Math.round(message.proposalSeq); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.groupSeq = object.groupSeq ?? 0; + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.groupMembers = object.groupMembers?.map((e) => GroupMember.fromPartial(e)) || []; + message.groupPolicySeq = object.groupPolicySeq ?? 0; + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.proposalSeq = object.proposalSeq ?? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/query.ts new file mode 100644 index 00000000..d64f831a --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/query.ts @@ -0,0 +1,2395 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, TallyResult, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequest { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponse { + /** info is the GroupInfo of the group. */ + info: GroupInfo | undefined; +} + +/** 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 of the group policy. */ + info: GroupPolicyInfo | undefined; +} + +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequest { + /** group_id is the unique ID of the group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequest { + /** group_id is the unique ID of the group policy's group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponse { + /** group_policies are the group policies info associated with the provided group. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponse { + /** group_policies are the group policies info with provided admin. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponse { + /** proposal is the proposal info. */ + proposal: Proposal | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequest { + /** proposal_id is the unique id of a proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +/** + * QueryGroupsRequest is the Query/Groups request type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryGroupsResponse is the Query/Groups response type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsResponse { + /** `groups` is all the groups present in state. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { + return { groupId: 0 }; +} + +export const QueryGroupInfoRequest: MessageFns = { + encode(message: QueryGroupInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoRequest { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: QueryGroupInfoRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoRequest { + return QueryGroupInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { + return { info: undefined }; +} + +export const QueryGroupInfoResponse: MessageFns = { + encode(message: QueryGroupInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoResponse { + return { info: isSet(object.info) ? GroupInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoResponse { + return QueryGroupInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupPolicyInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryGroupPolicyInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoRequest { + return QueryGroupPolicyInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { + return { info: undefined }; +} + +export const QueryGroupPolicyInfoResponse: MessageFns = { + encode(message: QueryGroupPolicyInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupPolicyInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoResponse { + return { info: isSet(object.info) ? GroupPolicyInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupPolicyInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupPolicyInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoResponse { + return QueryGroupPolicyInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupMembersRequest: MessageFns = { + encode(message: QueryGroupMembersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupMembersRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersRequest { + return QueryGroupMembersRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + message.groupId = object.groupId ?? 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: MessageFns = { + encode(message: QueryGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.members) { + GroupMember.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.members.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersResponse { + return { + members: globalThis.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?.length) { + obj.members = message.members.map((e) => GroupMember.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersResponse { + return QueryGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminRequest { + return QueryGroupsByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminResponse { + return QueryGroupsByAdminResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupRequest: MessageFns = { + encode(message: QueryGroupPoliciesByGroupRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupRequest { + return QueryGroupPoliciesByGroupRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + message.groupId = object.groupId ?? 0; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { + return { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupResponse: MessageFns = { + encode(message: QueryGroupPoliciesByGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupResponse { + return QueryGroupPoliciesByGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.groupPolicies = object.groupPolicies?.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: MessageFns = { + encode(message: QueryGroupPoliciesByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminRequest { + return QueryGroupPoliciesByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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 { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByAdminResponse: MessageFns = { + encode(message: QueryGroupPoliciesByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminResponse { + return QueryGroupPoliciesByAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { + return { address: "", pagination: undefined }; +} + +export const QueryProposalsByGroupPolicyRequest: MessageFns = { + encode(message: QueryProposalsByGroupPolicyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsByGroupPolicyRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyRequest { + return QueryProposalsByGroupPolicyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryProposalsByGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyResponse { + return { + 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: QueryProposalsByGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyResponse { + return QueryProposalsByGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, voter: "" }; +} + +export const QueryVoteByProposalVoterRequest: MessageFns = { + encode(message: QueryVoteByProposalVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteByProposalVoterRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + return obj; + }, + + create, I>>(base?: I): QueryVoteByProposalVoterRequest { + return QueryVoteByProposalVoterRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { + return { vote: undefined }; +} + +export const QueryVoteByProposalVoterResponse: MessageFns = { + encode(message: QueryVoteByProposalVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteByProposalVoterResponse): unknown { + const obj: any = {}; + if (message.vote !== undefined) { + obj.vote = Vote.toJSON(message.vote); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVoteByProposalVoterResponse { + return QueryVoteByProposalVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesByProposalRequest: MessageFns = { + encode(message: QueryVotesByProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalRequest { + return QueryVotesByProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesByProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalResponse { + return { + 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: QueryVotesByProposalResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalResponse { + return QueryVotesByProposalResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voter !== "") { + writer.uint32(10).string(message.voter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.voter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterRequest { + return { + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByVoterRequest): unknown { + const obj: any = {}; + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterRequest { + return QueryVotesByVoterRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterResponse { + return { + 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: QueryVotesByVoterResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterResponse { + return QueryVotesByVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByMemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberRequest { + return QueryGroupsByMemberRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberResponse { + return QueryGroupsByMemberResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsRequest(): QueryGroupsRequest { + return { pagination: undefined }; +} + +export const QueryGroupsRequest: MessageFns = { + encode(message: QueryGroupsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGroupsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsRequest { + return QueryGroupsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsRequest { + const message = createBaseQueryGroupsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsResponse(): QueryGroupsResponse { + return { groups: [], pagination: undefined }; +} + +export const QueryGroupsResponse: MessageFns = { + encode(message: QueryGroupsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsResponse { + return { + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsResponse): unknown { + const obj: any = {}; + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsResponse { + return QueryGroupsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsResponse { + const message = createBaseQueryGroupsResponse(); + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : 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 by group id. */ + 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; + /** GroupPoliciesByAdmin 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 id. */ + 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 returns the tally result of a proposal. If the proposal is + * still in voting period, then this query computes the current tally state, + * which might not be final. On the other hand, if the proposal is final, + * then it simply returns the `final_tally_result` state stored in the + * proposal itself. + */ + TallyResult(request: QueryTallyResultRequest): Promise; + /** + * Groups queries all groups in state. + * + * Since: cosmos-sdk 0.47.1 + */ + Groups(request: QueryGroupsRequest): Promise; +} + +export const QueryServiceName = "cosmos.group.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 || QueryServiceName; + 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); + this.Groups = this.Groups.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + Groups(request: QueryGroupsRequest): Promise { + const data = QueryGroupsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Groups", data); + return promise.then((data) => QueryGroupsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/tx.ts new file mode 100644 index 00000000..006eb292 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/tx.ts @@ -0,0 +1,2576 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { + MemberRequest, + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + VoteOption, + voteOptionFromJSON, + voteOptionToJSON, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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: MemberRequest[]; + /** 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. */ + groupId: number; +} + +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembers { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + memberUpdates: MemberRequest[]; +} + +/** 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. */ + groupId: number; + /** new_admin is the group new admin account address. */ + newAdmin: 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. */ + groupId: number; + /** 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. */ + groupId: number; + /** metadata is any arbitrary metadata attached to the group policy. */ + metadata: string; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of the group policy. */ + groupPolicyAddress: string; + /** new_admin is the new group policy admin. */ + newAdmin: string; +} + +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponse { +} + +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicy { + /** admin is the account address of the group and group policy admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequest[]; + /** group_metadata is any arbitrary metadata attached to the group. */ + groupMetadata: string; + /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ + groupPolicyMetadata: string; + /** + * group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + * and group policy admin. + */ + groupPolicyAsAdmin: boolean; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponse { + /** group_id is the unique ID of the newly created group with policy. */ + groupId: number; + /** group_policy_address is the account address of the newly created group policy. */ + groupPolicyAddress: string; +} + +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** decision_policy is the updated group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** metadata is the group policy metadata to be updated. */ + metadata: string; +} + +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponse { +} + +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposal { + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * proposers are the account addresses of the proposers. + * Proposers signatures will be counted as yes votes. + */ + proposers: string[]; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * exec defines the mode of execution of the proposal, + * whether it should be executed immediately on creation or not. + * If so, proposers signatures are considered as Yes votes. + */ + exec: Exec; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal is the unique ID of the proposal. */ + proposalId: number; +} + +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposal { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** 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. */ + proposalId: number; + /** voter is the voter account address. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} + +/** 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. */ + proposalId: number; + /** executor is the account address used to execute the proposal. */ + executor: string; +} + +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponse { + /** result is the final result of the proposal execution. */ + result: ProposalExecutorResult; +} + +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroup { + /** address is the account address of the group member. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponse { +} + +function createBaseMsgCreateGroup(): MsgCreateGroup { + return { admin: "", members: [], metadata: "" }; +} + +export const MsgCreateGroup: MessageFns = { + encode(message: MsgCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroup { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgCreateGroup): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroup { + return MsgCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { + return { groupId: 0 }; +} + +export const MsgCreateGroupResponse: MessageFns = { + encode(message: MsgCreateGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupResponse { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: MsgCreateGroupResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupResponse { + return MsgCreateGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { + return { admin: "", groupId: 0, memberUpdates: [] }; +} + +export const MsgUpdateGroupMembers: MessageFns = { + encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + for (const v of message.memberUpdates) { + MemberRequest.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.memberUpdates.push(MemberRequest.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMembers { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + memberUpdates: globalThis.Array.isArray(object?.memberUpdates) + ? object.memberUpdates.map((e: any) => MemberRequest.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgUpdateGroupMembers): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.memberUpdates?.length) { + obj.memberUpdates = message.memberUpdates.map((e) => MemberRequest.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.memberUpdates = object.memberUpdates?.map((e) => MemberRequest.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { + return {}; +} + +export const MsgUpdateGroupMembersResponse: MessageFns = { + encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMembersResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMembersResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { + return { admin: "", groupId: 0, newAdmin: "" }; +} + +export const MsgUpdateGroupAdmin: MessageFns = { + encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { + return {}; +} + +export const MsgUpdateGroupAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { + return { admin: "", groupId: 0, metadata: "" }; +} + +export const MsgUpdateGroupMetadata: MessageFns = { + encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { + return {}; +} + +export const MsgUpdateGroupMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { + return { admin: "", groupId: 0, metadata: "", decisionPolicy: undefined }; +} + +export const MsgCreateGroupPolicy: MessageFns = { + encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { + return { address: "" }; +} + +export const MsgCreateGroupPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicyResponse { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: MsgCreateGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { + return { admin: "", groupPolicyAddress: "", newAdmin: "" }; +} + +export const MsgUpdateGroupPolicyAdmin: MessageFns = { + encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { + return {}; +} + +export const MsgUpdateGroupPolicyAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { + return { + admin: "", + members: [], + groupMetadata: "", + groupPolicyMetadata: "", + groupPolicyAsAdmin: false, + decisionPolicy: undefined, + }; +} + +export const MsgCreateGroupWithPolicy: MessageFns = { + encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.groupMetadata !== "") { + writer.uint32(26).string(message.groupMetadata); + } + if (message.groupPolicyMetadata !== "") { + writer.uint32(34).string(message.groupPolicyMetadata); + } + if (message.groupPolicyAsAdmin !== false) { + writer.uint32(40).bool(message.groupPolicyAsAdmin); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMetadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.groupPolicyMetadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.groupPolicyAsAdmin = reader.bool(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + groupMetadata: isSet(object.groupMetadata) ? globalThis.String(object.groupMetadata) : "", + groupPolicyMetadata: isSet(object.groupPolicyMetadata) ? globalThis.String(object.groupPolicyMetadata) : "", + groupPolicyAsAdmin: isSet(object.groupPolicyAsAdmin) ? globalThis.Boolean(object.groupPolicyAsAdmin) : false, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupWithPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.groupMetadata !== "") { + obj.groupMetadata = message.groupMetadata; + } + if (message.groupPolicyMetadata !== "") { + obj.groupPolicyMetadata = message.groupPolicyMetadata; + } + if (message.groupPolicyAsAdmin !== false) { + obj.groupPolicyAsAdmin = message.groupPolicyAsAdmin; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.groupMetadata = object.groupMetadata ?? ""; + message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; + message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { + return { groupId: 0, groupPolicyAddress: "" }; +} + +export const MsgCreateGroupWithPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicyResponse { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + }; + }, + + toJSON(message: MsgCreateGroupWithPolicyResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + message.groupId = object.groupId ?? 0; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { + return { admin: "", groupPolicyAddress: "", decisionPolicy: undefined }; +} + +export const MsgUpdateGroupPolicyDecisionPolicy: MessageFns = { + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyDecisionPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; +} + +export const MsgUpdateGroupPolicyDecisionPolicyResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { + return { admin: "", groupPolicyAddress: "", metadata: "" }; +} + +export const MsgUpdateGroupPolicyMetadata: MessageFns = { + encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { + return {}; +} + +export const MsgUpdateGroupPolicyMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, +}; + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { groupPolicyAddress: "", proposers: [], metadata: "", messages: [], exec: 0, title: "", summary: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupPolicyAddress !== "") { + writer.uint32(10).string(message.groupPolicyAddress); + } + for (const v of message.proposers) { + writer.uint32(18).string(v!); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + if (message.title !== "") { + writer.uint32(50).string(message.title); + } + if (message.summary !== "") { + writer.uint32(58).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.title = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.metadata = object.metadata ?? ""; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.exec = object.exec ?? 0; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { + return { proposalId: 0, address: "" }; +} + +export const MsgWithdrawProposal: MessageFns = { + encode(message: MsgWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: MsgWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposal { + return MsgWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { + return {}; +} + +export const MsgWithdrawProposalResponse: MessageFns = { + encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgWithdrawProposalResponse { + return {}; + }, + + toJSON(_: MsgWithdrawProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "", exec: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { proposalId: 0, executor: "" }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.executor !== "") { + writer.uint32(18).string(message.executor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.executor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + executor: isSet(object.executor) ? globalThis.String(object.executor) : "", + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.executor !== "") { + obj.executor = message.executor; + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.proposalId = object.proposalId ?? 0; + message.executor = object.executor ?? ""; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { result: 0 }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroup(): MsgLeaveGroup { + return { address: "", groupId: 0 }; +} + +export const MsgLeaveGroup: MessageFns = { + encode(message: MsgLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgLeaveGroup { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + }; + }, + + toJSON(message: MsgLeaveGroup): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroup { + return MsgLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { + return {}; +} + +export const MsgLeaveGroupResponse: MessageFns = { + encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgLeaveGroupResponse { + return {}; + }, + + toJSON(_: MsgLeaveGroupResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.fromPartial(base ?? ({} as any)); + }, + 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 withdraws 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 const MsgServiceName = "cosmos.group.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/types.ts b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/types.ts new file mode 100644 index 00000000..3f7a9e54 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/group/v1/types.ts @@ -0,0 +1,1799 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given proposal. */ +export enum VoteOption { + /** + * VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will + * return an error. + */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} + +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} + +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus defines proposal statuses. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when submitted. */ + PROPOSAL_STATUS_SUBMITTED = 1, + /** + * PROPOSAL_STATUS_ACCEPTED - Final status of a proposal when the final tally is done and the outcome + * passes the group policy's decision policy. + */ + PROPOSAL_STATUS_ACCEPTED = 2, + /** + * PROPOSAL_STATUS_REJECTED - Final status of a proposal when the final tally is done and the outcome + * is rejected by the group policy's decision policy. + */ + PROPOSAL_STATUS_REJECTED = 3, + /** + * PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group policy is modified before the + * final tally. + */ + PROPOSAL_STATUS_ABORTED = 4, + /** + * PROPOSAL_STATUS_WITHDRAWN - A proposal can be withdrawn before the voting start time by the owner. + * When this happens the final status is Withdrawn. + */ + PROPOSAL_STATUS_WITHDRAWN = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_SUBMITTED": + return ProposalStatus.PROPOSAL_STATUS_SUBMITTED; + case 2: + case "PROPOSAL_STATUS_ACCEPTED": + return ProposalStatus.PROPOSAL_STATUS_ACCEPTED; + case 3: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 4: + case "PROPOSAL_STATUS_ABORTED": + return ProposalStatus.PROPOSAL_STATUS_ABORTED; + case 5: + case "PROPOSAL_STATUS_WITHDRAWN": + return ProposalStatus.PROPOSAL_STATUS_WITHDRAWN; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_SUBMITTED: + return "PROPOSAL_STATUS_SUBMITTED"; + case ProposalStatus.PROPOSAL_STATUS_ACCEPTED: + return "PROPOSAL_STATUS_ACCEPTED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return "PROPOSAL_STATUS_ABORTED"; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return "PROPOSAL_STATUS_WITHDRAWN"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalExecutorResult defines types of proposal executor results. */ +export enum ProposalExecutorResult { + /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ + PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0, + /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ + PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1, + /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ + PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2, + /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ + PROPOSAL_EXECUTOR_RESULT_FAILURE = 3, + UNRECOGNIZED = -1, +} + +export function proposalExecutorResultFromJSON(object: any): ProposalExecutorResult { + switch (object) { + case 0: + case "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; + case 1: + case "PROPOSAL_EXECUTOR_RESULT_NOT_RUN": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN; + case 2: + case "PROPOSAL_EXECUTOR_RESULT_SUCCESS": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS; + case 3: + case "PROPOSAL_EXECUTOR_RESULT_FAILURE": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE; + case -1: + case "UNRECOGNIZED": + default: + return ProposalExecutorResult.UNRECOGNIZED; + } +} + +export function proposalExecutorResultToJSON(object: ProposalExecutorResult): string { + switch (object) { + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: + return "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN: + return "PROPOSAL_EXECUTOR_RESULT_NOT_RUN"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS: + return "PROPOSAL_EXECUTOR_RESULT_SUCCESS"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE: + return "PROPOSAL_EXECUTOR_RESULT_FAILURE"; + case ProposalExecutorResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface Member { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + addedAt: Date | undefined; +} + +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequest { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; +} + +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicy { + /** + * threshold is the minimum weighted sum of `YES` votes that must be met or + * exceeded for a proposal to succeed. + */ + threshold: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicy { + /** + * percentage is the minimum percentage of the weighted sum of `YES` votes must + * meet for a proposal to succeed. + */ + percentage: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindows { + /** + * voting_period is the duration from submission of a proposal to the end of voting period + * Within this times votes can be submitted with MsgVote. + */ + votingPeriod: + | Duration + | undefined; + /** + * min_execution_period is the minimum duration after the proposal submission + * where members can start sending MsgExec. This means that the window for + * sending a MsgExec transaction is: + * `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + * where max_execution_period is a app-specific config, defined in the keeper. + * If not set, min_execution_period will default to 0. + * + * Please make sure to set a `min_execution_period` that is smaller than + * `voting_period + max_execution_period`, or else the above execution window + * is empty, meaning that all proposals created with this decision policy + * won't be able to be executed. + */ + minExecutionPeriod: Duration | undefined; +} + +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfo { + /** id is the unique ID of the group. */ + id: number; + /** admin is the account address of the group's admin. */ + admin: string; + /** + * metadata is any arbitrary metadata to attached to the group. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 + */ + metadata: string; + /** + * version is used to track changes to a group's membership structure that + * would break existing proposals. Whenever any members weight is changed, + * or any member is added or removed this version is incremented and will + * cause proposals based on older versions of this group to fail + */ + version: number; + /** total_weight is the sum of the group members' weights. */ + totalWeight: string; + /** created_at is a timestamp specifying when a group was created. */ + createdAt: Date | undefined; +} + +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMember { + /** group_id is the unique ID of the group. */ + groupId: number; + /** member is the member data. */ + member: Member | undefined; +} + +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfo { + /** address is the account address of group policy. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** admin is the account address of the group admin. */ + admin: string; + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ + metadata: string; + /** + * version is used to track changes to a group's GroupPolicyInfo structure that + * would create a different result on a running proposal. + */ + version: number; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: + | Any + | undefined; + /** created_at is a timestamp specifying when a group policy was created. */ + createdAt: Date | undefined; +} + +/** + * 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: number; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ + metadata: string; + /** proposers are the account addresses of the proposers. */ + proposers: string[]; + /** submit_time is a timestamp specifying when a proposal was submitted. */ + submitTime: + | Date + | undefined; + /** + * group_version tracks the version of the group at proposal submission. + * This field is here for informational purposes only. + */ + groupVersion: number; + /** + * group_policy_version tracks the version of the group policy at proposal submission. + * When a decision policy is changed, existing proposals from previous policy + * versions will become invalid with the `ABORTED` status. + * This field is here for informational purposes only. + */ + groupPolicyVersion: number; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option. It is empty at submission, and only + * populated after tallying, at voting period end or at proposal execution, + * whichever happens first. + */ + finalTallyResult: + | TallyResult + | undefined; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successful MsgExec is called before (to execute a proposal whose + * tally is successful before the voting period ends), tallying will be done + * at this point, and the `final_tally_result`and `status` fields will be + * accordingly updated. + */ + votingPeriodEnd: + | Date + | undefined; + /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ + executorResult: ProposalExecutorResult; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResult { + /** yes_count is the weighted sum of yes votes. */ + yesCount: string; + /** abstain_count is the weighted sum of abstainers. */ + abstainCount: string; + /** no_count is the weighted sum of no votes. */ + noCount: string; + /** no_with_veto_count is the weighted sum of veto. */ + noWithVetoCount: string; +} + +/** Vote represents a vote for a proposal.string metadata */ +export interface Vote { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** voter is the account address of the voter. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 + */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submitTime: Date | undefined; +} + +function createBaseMember(): Member { + return { address: "", weight: "", metadata: "", addedAt: undefined }; +} + +export const Member: MessageFns = { + encode(message: Member, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.addedAt !== undefined) { + Timestamp.encode(toTimestamp(message.addedAt), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Member { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.addedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Member { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + addedAt: isSet(object.addedAt) ? fromJsonTimestamp(object.addedAt) : undefined, + }; + }, + + toJSON(message: Member): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.addedAt !== undefined) { + obj.addedAt = message.addedAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Member { + return Member.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Member { + const message = createBaseMember(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + message.addedAt = object.addedAt ?? undefined; + return message; + }, +}; + +function createBaseMemberRequest(): MemberRequest { + return { address: "", weight: "", metadata: "" }; +} + +export const MemberRequest: MessageFns = { + encode(message: MemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MemberRequest { + return MemberRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MemberRequest { + const message = createBaseMemberRequest(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { + return { threshold: "", windows: undefined }; +} + +export const ThresholdDecisionPolicy: MessageFns = { + encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== "") { + writer.uint32(10).string(message.threshold); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseThresholdDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.threshold = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ThresholdDecisionPolicy { + return { + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: ThresholdDecisionPolicy): unknown { + const obj: any = {}; + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: PercentageDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.percentage !== "") { + writer.uint32(10).string(message.percentage); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePercentageDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.percentage = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PercentageDecisionPolicy { + return { + percentage: isSet(object.percentage) ? globalThis.String(object.percentage) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: PercentageDecisionPolicy): unknown { + const obj: any = {}; + if (message.percentage !== "") { + obj.percentage = message.percentage; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): PercentageDecisionPolicy { + return PercentageDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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 { votingPeriod: undefined, minExecutionPeriod: undefined }; +} + +export const DecisionPolicyWindows: MessageFns = { + encode(message: DecisionPolicyWindows, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + if (message.minExecutionPeriod !== undefined) { + Duration.encode(message.minExecutionPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecisionPolicyWindows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecisionPolicyWindows { + return { + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + minExecutionPeriod: isSet(object.minExecutionPeriod) ? Duration.fromJSON(object.minExecutionPeriod) : undefined, + }; + }, + + toJSON(message: DecisionPolicyWindows): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.minExecutionPeriod !== undefined) { + obj.minExecutionPeriod = Duration.toJSON(message.minExecutionPeriod); + } + return obj; + }, + + create, I>>(base?: I): DecisionPolicyWindows { + return DecisionPolicyWindows.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.minExecutionPeriod = (object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null) + ? Duration.fromPartial(object.minExecutionPeriod) + : undefined; + return message; + }, +}; + +function createBaseGroupInfo(): GroupInfo { + return { id: 0, admin: "", metadata: "", version: 0, totalWeight: "", createdAt: undefined }; +} + +export const GroupInfo: MessageFns = { + encode(message: GroupInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.totalWeight !== "") { + writer.uint32(42).string(message.totalWeight); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.admin = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.totalWeight = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupInfo { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + totalWeight: isSet(object.totalWeight) ? globalThis.String(object.totalWeight) : "", + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupInfo): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.totalWeight !== "") { + obj.totalWeight = message.totalWeight; + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupInfo { + return GroupInfo.fromPartial(base ?? ({} as any)); + }, + 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.totalWeight = object.totalWeight ?? ""; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseGroupMember(): GroupMember { + return { groupId: 0, member: undefined }; +} + +export const GroupMember: MessageFns = { + encode(message: GroupMember, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.member !== undefined) { + Member.encode(message.member, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.member = Member.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupMember { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + member: isSet(object.member) ? Member.fromJSON(object.member) : undefined, + }; + }, + + toJSON(message: GroupMember): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.member !== undefined) { + obj.member = Member.toJSON(message.member); + } + return obj; + }, + + create, I>>(base?: I): GroupMember { + return GroupMember.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupMember { + const message = createBaseGroupMember(); + message.groupId = object.groupId ?? 0; + message.member = (object.member !== undefined && object.member !== null) + ? Member.fromPartial(object.member) + : undefined; + return message; + }, +}; + +function createBaseGroupPolicyInfo(): GroupPolicyInfo { + return { + address: "", + groupId: 0, + admin: "", + metadata: "", + version: 0, + decisionPolicy: undefined, + createdAt: undefined, + }; +} + +export const GroupPolicyInfo: MessageFns = { + encode(message: GroupPolicyInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.version !== 0) { + writer.uint32(40).uint64(message.version); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupPolicyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.admin = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupPolicyInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupPolicyInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupPolicyInfo { + return GroupPolicyInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version ?? 0; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + groupPolicyAddress: "", + metadata: "", + proposers: [], + submitTime: undefined, + groupVersion: 0, + groupPolicyVersion: 0, + status: 0, + finalTallyResult: undefined, + votingPeriodEnd: undefined, + executorResult: 0, + messages: [], + title: "", + summary: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.proposers) { + writer.uint32(34).string(v!); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.groupVersion !== 0) { + writer.uint32(48).uint64(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + writer.uint32(56).uint64(message.groupPolicyVersion); + } + if (message.status !== 0) { + writer.uint32(64).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(74).fork()).join(); + } + if (message.votingPeriodEnd !== undefined) { + Timestamp.encode(toTimestamp(message.votingPeriodEnd), writer.uint32(82).fork()).join(); + } + if (message.executorResult !== 0) { + writer.uint32(88).int32(message.executorResult); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.title !== "") { + writer.uint32(106).string(message.title); + } + if (message.summary !== "") { + writer.uint32(114).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.groupVersion = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.groupPolicyVersion = longToNumber(reader.uint64()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.status = reader.int32() as any; + continue; + case 9: + if (tag !== 74) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.votingPeriodEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.executorResult = reader.int32() as any; + continue; + case 12: + if (tag !== 98) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.title = reader.string(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + groupVersion: isSet(object.groupVersion) ? globalThis.Number(object.groupVersion) : 0, + groupPolicyVersion: isSet(object.groupPolicyVersion) ? globalThis.Number(object.groupPolicyVersion) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + votingPeriodEnd: isSet(object.votingPeriodEnd) ? fromJsonTimestamp(object.votingPeriodEnd) : undefined, + executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : 0, + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.groupVersion !== 0) { + obj.groupVersion = Math.round(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + obj.groupPolicyVersion = Math.round(message.groupPolicyVersion); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.votingPeriodEnd !== undefined) { + obj.votingPeriodEnd = message.votingPeriodEnd.toISOString(); + } + if (message.executorResult !== 0) { + obj.executorResult = proposalExecutorResultToJSON(message.executorResult); + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + 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; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.submitTime = object.submitTime ?? undefined; + message.groupVersion = object.groupVersion ?? 0; + message.groupPolicyVersion = object.groupPolicyVersion ?? 0; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; + message.executorResult = object.executorResult ?? 0; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, metadata: "", submitTime: undefined }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.submitTime = object.submitTime ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/mint/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/mint/module/v1/module.ts new file mode 100644 index 00000000..233c0dd3 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/mint/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.module.v1"; + +/** Module is the config object of the mint module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 00000000..d5580d2d --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,124 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** params defines all the parameters of the module. */ + params: Params | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { minter: undefined, params: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.minter = Minter.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.minter !== undefined) { + obj.minter = Minter.toJSON(message.minter); + } + 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.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/mint.ts b/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 00000000..c9b14ff0 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,285 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/mint.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** Minter represents the minting state. */ +export interface Minter { + /** current annual inflation rate */ + inflation: string; + /** current annual expected provisions */ + annualProvisions: string; +} + +/** Params defines the parameters for the x/mint module. */ +export interface Params { + /** type of coin to mint */ + mintDenom: string; + /** maximum annual change in inflation rate */ + inflationRateChange: string; + /** maximum inflation rate */ + inflationMax: string; + /** minimum inflation rate */ + inflationMin: string; + /** goal of percent bonded atoms */ + goalBonded: string; + /** expected blocks per year */ + blocksPerYear: number; +} + +function createBaseMinter(): Minter { + return { inflation: "", annualProvisions: "" }; +} + +export const Minter: MessageFns = { + encode(message: Minter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation !== "") { + writer.uint32(10).string(message.inflation); + } + if (message.annualProvisions !== "") { + writer.uint32(18).string(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Minter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.annualProvisions = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Minter { + return { + inflation: isSet(object.inflation) ? globalThis.String(object.inflation) : "", + annualProvisions: isSet(object.annualProvisions) ? globalThis.String(object.annualProvisions) : "", + }; + }, + + toJSON(message: Minter): unknown { + const obj: any = {}; + if (message.inflation !== "") { + obj.inflation = message.inflation; + } + if (message.annualProvisions !== "") { + obj.annualProvisions = message.annualProvisions; + } + return obj; + }, + + create, I>>(base?: I): Minter { + return Minter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Minter { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annualProvisions = object.annualProvisions ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + mintDenom: "", + inflationRateChange: "", + inflationMax: "", + inflationMin: "", + goalBonded: "", + blocksPerYear: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mintDenom !== "") { + writer.uint32(10).string(message.mintDenom); + } + if (message.inflationRateChange !== "") { + writer.uint32(18).string(message.inflationRateChange); + } + if (message.inflationMax !== "") { + writer.uint32(26).string(message.inflationMax); + } + if (message.inflationMin !== "") { + writer.uint32(34).string(message.inflationMin); + } + if (message.goalBonded !== "") { + writer.uint32(42).string(message.goalBonded); + } + if (message.blocksPerYear !== 0) { + writer.uint32(48).uint64(message.blocksPerYear); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.mintDenom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.inflationRateChange = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.inflationMax = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.inflationMin = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.goalBonded = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.blocksPerYear = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + mintDenom: isSet(object.mintDenom) ? globalThis.String(object.mintDenom) : "", + inflationRateChange: isSet(object.inflationRateChange) ? globalThis.String(object.inflationRateChange) : "", + inflationMax: isSet(object.inflationMax) ? globalThis.String(object.inflationMax) : "", + inflationMin: isSet(object.inflationMin) ? globalThis.String(object.inflationMin) : "", + goalBonded: isSet(object.goalBonded) ? globalThis.String(object.goalBonded) : "", + blocksPerYear: isSet(object.blocksPerYear) ? globalThis.Number(object.blocksPerYear) : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.mintDenom !== "") { + obj.mintDenom = message.mintDenom; + } + if (message.inflationRateChange !== "") { + obj.inflationRateChange = message.inflationRateChange; + } + if (message.inflationMax !== "") { + obj.inflationMax = message.inflationMax; + } + if (message.inflationMin !== "") { + obj.inflationMin = message.inflationMin; + } + if (message.goalBonded !== "") { + obj.goalBonded = message.goalBonded; + } + if (message.blocksPerYear !== 0) { + obj.blocksPerYear = Math.round(message.blocksPerYear); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.mintDenom = object.mintDenom ?? ""; + message.inflationRateChange = object.inflationRateChange ?? ""; + message.inflationMax = object.inflationMax ?? ""; + message.inflationMin = object.inflationMin ?? ""; + message.goalBonded = object.goalBonded ?? ""; + message.blocksPerYear = object.blocksPerYear ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/query.ts new file mode 100644 index 00000000..c90cf9db --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,450 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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. */ + annualProvisions: Uint8Array; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryInflationRequest(): QueryInflationRequest { + return {}; +} + +export const QueryInflationRequest: MessageFns = { + encode(_: QueryInflationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryInflationRequest { + return {}; + }, + + toJSON(_: QueryInflationRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryInflationRequest { + return QueryInflationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, +}; + +function createBaseQueryInflationResponse(): QueryInflationResponse { + return { inflation: new Uint8Array(0) }; +} + +export const QueryInflationResponse: MessageFns = { + encode(message: QueryInflationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryInflationResponse { + return { inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array(0) }; + }, + + toJSON(message: QueryInflationResponse): unknown { + const obj: any = {}; + if (message.inflation.length !== 0) { + obj.inflation = base64FromBytes(message.inflation); + } + return obj; + }, + + create, I>>(base?: I): QueryInflationResponse { + return QueryInflationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { + return {}; +} + +export const QueryAnnualProvisionsRequest: MessageFns = { + encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAnnualProvisionsRequest { + return {}; + }, + + toJSON(_: QueryAnnualProvisionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { + return { annualProvisions: new Uint8Array(0) }; +} + +export const QueryAnnualProvisionsResponse: MessageFns = { + encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.annualProvisions.length !== 0) { + writer.uint32(10).bytes(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.annualProvisions = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAnnualProvisionsResponse { + return { + annualProvisions: isSet(object.annualProvisions) ? bytesFromBase64(object.annualProvisions) : new Uint8Array(0), + }; + }, + + toJSON(message: QueryAnnualProvisionsResponse): unknown { + const obj: any = {}; + if (message.annualProvisions.length !== 0) { + obj.annualProvisions = base64FromBytes(message.annualProvisions); + } + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annualProvisions = object.annualProvisions ?? new Uint8Array(0); + 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 const QueryServiceName = "cosmos.mint.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/tx.ts new file mode 100644 index 00000000..c3d6285e --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/mint/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./mint"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/mint parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/mint Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/mint module + * parameters. The authority is defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.mint.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/msg/textual/v1/textual.ts b/ts-client/cosmos.circuit.v1/types/cosmos/msg/textual/v1/textual.ts new file mode 100644 index 00000000..cb8b705c --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/msg/textual/v1/textual.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/textual/v1/textual.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.textual.v1"; diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.circuit.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.circuit.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.circuit.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/nft/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/nft/module/v1/module.ts new file mode 100644 index 00000000..6a444831 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/nft/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.nft.module.v1"; + +/** Module is the config object of the nft module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/event.ts b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/event.ts new file mode 100644 index 00000000..81e4fb5e --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/event.ts @@ -0,0 +1,349 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** EventSend is emitted on Msg/Send */ +export interface EventSend { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} + +/** EventMint is emitted on Mint */ +export interface EventMint { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} + +/** EventBurn is emitted on Burn */ +export interface EventBurn { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} + +function createBaseEventSend(): EventSend { + return { classId: "", id: "", sender: "", receiver: "" }; +} + +export const EventSend: MessageFns = { + encode(message: EventSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + 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: BinaryReader | Uint8Array, length?: number): EventSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.receiver = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSend { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", + }; + }, + + toJSON(message: EventSend): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + + create, I>>(base?: I): EventSend { + return EventSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSend { + const message = createBaseEventSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseEventMint(): EventMint { + return { classId: "", id: "", owner: "" }; +} + +export const EventMint: MessageFns = { + encode(message: EventMint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventMint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventMint { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: EventMint): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): EventMint { + return EventMint.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventMint { + const message = createBaseEventMint(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseEventBurn(): EventBurn { + return { classId: "", id: "", owner: "" }; +} + +export const EventBurn: MessageFns = { + encode(message: EventBurn, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventBurn { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventBurn { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: EventBurn): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): EventBurn { + return EventBurn.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventBurn { + const message = createBaseEventBurn(); + message.classId = object.classId ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/genesis.ts new file mode 100644 index 00000000..e310a55d --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/genesis.ts @@ -0,0 +1,200 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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[]; + /** entry defines all nft owned by a person. */ + 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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + Entry.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.classes.push(Class.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(Entry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + classes: globalThis.Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => Entry.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.classes?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => Entry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Entry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Entry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.owner = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Entry { + return { + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + nfts: globalThis.Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + }; + }, + + toJSON(message: Entry): unknown { + const obj: any = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Entry { + return Entry.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/nft.ts b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/nft.ts new file mode 100644 index 00000000..bbfc88c2 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/nft.ts @@ -0,0 +1,336 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/nft.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 */ + uriHash: string; + /** data is the app specific metadata of the NFT class. Optional */ + data: Any | undefined; +} + +/** NFT defines the NFT. */ +export interface NFT { + /** class_id associated with the NFT, similar to the contract address of ERC721 */ + classId: 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 */ + uriHash: string; + /** data is an app specific data of the NFT. Optional */ + data: Any | undefined; +} + +function createBaseClass(): Class { + return { id: "", name: "", symbol: "", description: "", uri: "", uriHash: "", data: undefined }; +} + +export const Class: MessageFns = { + encode(message: Class, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.uriHash !== "") { + writer.uint32(50).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Class { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.symbol = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.description = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.uri = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.uriHash = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Class { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: Class): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): Class { + return Class.fromPartial(base ?? ({} as any)); + }, + 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.uriHash = object.uriHash ?? ""; + message.data = (object.data !== undefined && object.data !== null) ? Any.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseNFT(): NFT { + return { classId: "", id: "", uri: "", uriHash: "", data: undefined }; +} + +export const NFT: MessageFns = { + encode(message: NFT, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.uri !== "") { + writer.uint32(26).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(34).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NFT { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.uri = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.uriHash = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NFT { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: NFT): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): NFT { + return NFT.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NFT { + const message = createBaseNFT(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/query.ts new file mode 100644 index 00000000..869693cd --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/query.ts @@ -0,0 +1,1152 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; +} + +/** QueryBalanceResponse is the response type for the Query/Balance RPC method */ +export interface QueryBalanceResponse { + /** amount is the number of all NFTs of a given class owned by the owner */ + amount: number; +} + +/** QueryOwnerRequest is the request type for the Query/Owner RPC method */ +export interface QueryOwnerRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} + +/** QueryOwnerResponse is the response type for the Query/Owner RPC method */ +export interface QueryOwnerResponse { + /** owner is the owner address of the nft */ + owner: string; +} + +/** QuerySupplyRequest is the request type for the Query/Supply RPC method */ +export interface QuerySupplyRequest { + /** class_id associated with the nft */ + classId: string; +} + +/** QuerySupplyResponse is the response type for the Query/Supply RPC method */ +export interface QuerySupplyResponse { + /** amount is the number of all NFTs from the given class */ + amount: number; +} + +/** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ +export interface QueryNFTsRequest { + /** class_id associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ +export interface QueryNFTsResponse { + /** NFT defines the NFT */ + nfts: NFT[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryNFTRequest is the request type for the Query/NFT RPC method */ +export interface QueryNFTRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} + +/** QueryNFTResponse is the response type for the Query/NFT RPC method */ +export interface QueryNFTResponse { + /** owner is the owner address of the nft */ + nft: NFT | undefined; +} + +/** QueryClassRequest is the request type for the Query/Class RPC method */ +export interface QueryClassRequest { + /** class_id associated with the nft */ + classId: string; +} + +/** QueryClassResponse is the response type for the Query/Class RPC method */ +export interface QueryClassResponse { + /** class defines the class of the nft type. */ + class: Class | undefined; +} + +/** QueryClassesRequest is the request type for the Query/Classes RPC method */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryClassesResponse is the response type for the Query/Classes RPC method */ +export interface QueryClassesResponse { + /** class defines the class of the nft type. */ + classes: Class[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { classId: "", owner: "" }; +} + +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.classId = object.classId ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { amount: 0 }; +} + +export const QueryBalanceResponse: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.amount = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; + +function createBaseQueryOwnerRequest(): QueryOwnerRequest { + return { classId: "", id: "" }; +} + +export const QueryOwnerRequest: MessageFns = { + encode(message: QueryOwnerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryOwnerRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: QueryOwnerRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): QueryOwnerRequest { + return QueryOwnerRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryOwnerRequest { + const message = createBaseQueryOwnerRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryOwnerResponse(): QueryOwnerResponse { + return { owner: "" }; +} + +export const QueryOwnerResponse: MessageFns = { + encode(message: QueryOwnerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryOwnerResponse { + return { owner: isSet(object.owner) ? globalThis.String(object.owner) : "" }; + }, + + toJSON(message: QueryOwnerResponse): unknown { + const obj: any = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): QueryOwnerResponse { + return QueryOwnerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryOwnerResponse { + const message = createBaseQueryOwnerResponse(); + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyRequest(): QuerySupplyRequest { + return { classId: "" }; +} + +export const QuerySupplyRequest: MessageFns = { + encode(message: QuerySupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyRequest { + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; + }, + + toJSON(message: QuerySupplyRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyRequest { + return QuerySupplyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyRequest { + const message = createBaseQuerySupplyRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyResponse(): QuerySupplyResponse { + return { amount: 0 }; +} + +export const QuerySupplyResponse: MessageFns = { + encode(message: QuerySupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.amount = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyResponse { + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; + }, + + toJSON(message: QuerySupplyResponse): unknown { + const obj: any = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyResponse { + return QuerySupplyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyResponse { + const message = createBaseQuerySupplyResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; + +function createBaseQueryNFTsRequest(): QueryNFTsRequest { + return { classId: "", owner: "", pagination: undefined }; +} + +export const QueryNFTsRequest: MessageFns = { + encode(message: QueryNFTsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.owner = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTsRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryNFTsRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTsRequest { + return QueryNFTsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryNFTsRequest { + const message = createBaseQueryNFTsRequest(); + message.classId = object.classId ?? ""; + 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: MessageFns = { + encode(message: QueryNFTsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTsResponse { + return { + nfts: globalThis.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?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTsResponse { + return QueryNFTsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { classId: "", id: "" }; +} + +export const QueryNFTRequest: MessageFns = { + encode(message: QueryNFTRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: QueryNFTRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): QueryNFTRequest { + return QueryNFTRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryNFTRequest { + const message = createBaseQueryNFTRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryNFTResponse(): QueryNFTResponse { + return { nft: undefined }; +} + +export const QueryNFTResponse: MessageFns = { + encode(message: QueryNFTResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nft !== undefined) { + NFT.encode(message.nft, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.nft = NFT.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTResponse { + return { nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined }; + }, + + toJSON(message: QueryNFTResponse): unknown { + const obj: any = {}; + if (message.nft !== undefined) { + obj.nft = NFT.toJSON(message.nft); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTResponse { + return QueryNFTResponse.fromPartial(base ?? ({} as any)); + }, + 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 { classId: "" }; +} + +export const QueryClassRequest: MessageFns = { + encode(message: QueryClassRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassRequest { + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; + }, + + toJSON(message: QueryClassRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + + create, I>>(base?: I): QueryClassRequest { + return QueryClassRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryClassRequest { + const message = createBaseQueryClassRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; + +function createBaseQueryClassResponse(): QueryClassResponse { + return { class: undefined }; +} + +export const QueryClassResponse: MessageFns = { + encode(message: QueryClassResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.class !== undefined) { + Class.encode(message.class, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.class = Class.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassResponse { + return { class: isSet(object.class) ? Class.fromJSON(object.class) : undefined }; + }, + + toJSON(message: QueryClassResponse): unknown { + const obj: any = {}; + if (message.class !== undefined) { + obj.class = Class.toJSON(message.class); + } + return obj; + }, + + create, I>>(base?: I): QueryClassResponse { + return QueryClassResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryClassesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryClassesRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryClassesRequest { + return QueryClassesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryClassesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classes.push(Class.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassesResponse { + return { + classes: globalThis.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?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryClassesResponse { + return QueryClassesResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.nft.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/tx.ts new file mode 100644 index 00000000..63ad423f --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/nft/v1beta1/tx.ts @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 */ + classId: 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 { classId: "", id: "", sender: "", receiver: "" }; +} + +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + 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: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.receiver = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + 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 const MsgServiceName = "cosmos.nft.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 || MsgServiceName; + 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/orm/module/v1alpha1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/orm/module/v1alpha1/module.ts new file mode 100644 index 00000000..053430b5 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/orm/module/v1alpha1/module.ts @@ -0,0 +1,82 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/module/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.module.v1alpha1"; + +/** + * Module defines the ORM module which adds providers to the app container for + * ORM ModuleDB's and in the future will automatically register query + * services for modules that use the ORM. + */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/orm/query/v1alpha1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/orm/query/v1alpha1/query.ts new file mode 100644 index 00000000..da9a277e --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/orm/query/v1alpha1/query.ts @@ -0,0 +1,911 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/query/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Duration } from "../../../../google/protobuf/duration"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { PageRequest, PageResponse } from "../../../base/query/v1beta1/pagination"; + +export const protobufPackage = "cosmos.orm.query.v1alpha1"; + +/** GetRequest is the Query/Get request type. */ +export interface GetRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. If it is non-empty, it must + * refer to an unique index. + */ + index: string; + /** + * values are the values of the fields corresponding to the requested index. + * There must be as many values provided as there are fields in the index and + * these values must correspond to the index field types. + */ + values: IndexValue[]; +} + +/** GetResponse is the Query/Get response type. */ +export interface GetResponse { + /** + * result is the result of the get query. If no value is found, the gRPC + * status code NOT_FOUND will be returned. + */ + result: Any | undefined; +} + +/** ListRequest is the Query/List request type. */ +export interface ListRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. + */ + index: string; + /** prefix defines a prefix query. */ + prefix?: + | ListRequest_Prefix + | undefined; + /** range defines a range query. */ + range?: + | ListRequest_Range + | undefined; + /** pagination is the pagination request. */ + pagination: PageRequest | undefined; +} + +/** Prefix specifies the arguments to a prefix query. */ +export interface ListRequest_Prefix { + /** + * values specifies the index values for the prefix query. + * It is valid to special a partial prefix with fewer values than + * the number of fields in the index. + */ + values: IndexValue[]; +} + +/** Range specifies the arguments to a range query. */ +export interface ListRequest_Range { + /** + * start specifies the starting index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + start: IndexValue[]; + /** + * end specifies the inclusive ending index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + end: IndexValue[]; +} + +/** ListResponse is the Query/List response type. */ +export interface ListResponse { + /** results are the results of the query. */ + results: Any[]; + /** pagination is the pagination response. */ + pagination: PageResponse | undefined; +} + +/** IndexValue represents the value of a field in an ORM index expression. */ +export interface IndexValue { + /** + * uint specifies a value for an uint32, fixed32, uint64, or fixed64 + * index field. + */ + uint?: + | number + | undefined; + /** + * int64 specifies a value for an int32, sfixed32, int64, or sfixed64 + * index field. + */ + int?: + | number + | undefined; + /** str specifies a value for a string index field. */ + str?: + | string + | undefined; + /** bytes specifies a value for a bytes index field. */ + bytes?: + | Uint8Array + | undefined; + /** enum specifies a value for an enum index field. */ + enum?: + | string + | undefined; + /** bool specifies a value for a bool index field. */ + bool?: + | boolean + | undefined; + /** timestamp specifies a value for a timestamp index field. */ + timestamp?: + | Date + | undefined; + /** duration specifies a value for a duration index field. */ + duration?: Duration | undefined; +} + +function createBaseGetRequest(): GetRequest { + return { messageName: "", index: "", values: [] }; +} + +export const GetRequest: MessageFns = { + encode(message: GetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: GetRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GetRequest { + return GetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetRequest { + const message = createBaseGetRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetResponse(): GetResponse { + return { result: undefined }; +} + +export const GetResponse: MessageFns = { + encode(message: GetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== undefined) { + Any.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.result = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetResponse { + return { result: isSet(object.result) ? Any.fromJSON(object.result) : undefined }; + }, + + toJSON(message: GetResponse): unknown { + const obj: any = {}; + if (message.result !== undefined) { + obj.result = Any.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): GetResponse { + return GetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetResponse { + const message = createBaseGetResponse(); + message.result = (object.result !== undefined && object.result !== null) + ? Any.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseListRequest(): ListRequest { + return { messageName: "", index: "", prefix: undefined, range: undefined, pagination: undefined }; +} + +export const ListRequest: MessageFns = { + encode(message: ListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + if (message.prefix !== undefined) { + ListRequest_Prefix.encode(message.prefix, writer.uint32(26).fork()).join(); + } + if (message.range !== undefined) { + ListRequest_Range.encode(message.range, writer.uint32(34).fork()).join(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.prefix = ListRequest_Prefix.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.range = ListRequest_Range.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + prefix: isSet(object.prefix) ? ListRequest_Prefix.fromJSON(object.prefix) : undefined, + range: isSet(object.range) ? ListRequest_Range.fromJSON(object.range) : undefined, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.prefix !== undefined) { + obj.prefix = ListRequest_Prefix.toJSON(message.prefix); + } + if (message.range !== undefined) { + obj.range = ListRequest_Range.toJSON(message.range); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListRequest { + return ListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest { + const message = createBaseListRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.prefix = (object.prefix !== undefined && object.prefix !== null) + ? ListRequest_Prefix.fromPartial(object.prefix) + : undefined; + message.range = (object.range !== undefined && object.range !== null) + ? ListRequest_Range.fromPartial(object.range) + : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseListRequest_Prefix(): ListRequest_Prefix { + return { values: [] }; +} + +export const ListRequest_Prefix: MessageFns = { + encode(message: ListRequest_Prefix, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Prefix { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Prefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Prefix { + return { + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Prefix): unknown { + const obj: any = {}; + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Prefix { + return ListRequest_Prefix.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Prefix { + const message = createBaseListRequest_Prefix(); + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListRequest_Range(): ListRequest_Range { + return { start: [], end: [] }; +} + +export const ListRequest_Range: MessageFns = { + encode(message: ListRequest_Range, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.start) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.end) { + IndexValue.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Range { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Range(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.start.push(IndexValue.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.end.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Range { + return { + start: globalThis.Array.isArray(object?.start) ? object.start.map((e: any) => IndexValue.fromJSON(e)) : [], + end: globalThis.Array.isArray(object?.end) ? object.end.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Range): unknown { + const obj: any = {}; + if (message.start?.length) { + obj.start = message.start.map((e) => IndexValue.toJSON(e)); + } + if (message.end?.length) { + obj.end = message.end.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Range { + return ListRequest_Range.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Range { + const message = createBaseListRequest_Range(); + message.start = object.start?.map((e) => IndexValue.fromPartial(e)) || []; + message.end = object.end?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListResponse(): ListResponse { + return { results: [], pagination: undefined }; +} + +export const ListResponse: MessageFns = { + encode(message: ListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListResponse { + return ListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListResponse { + const message = createBaseListResponse(); + message.results = object.results?.map((e) => Any.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseIndexValue(): IndexValue { + return { + uint: undefined, + int: undefined, + str: undefined, + bytes: undefined, + enum: undefined, + bool: undefined, + timestamp: undefined, + duration: undefined, + }; +} + +export const IndexValue: MessageFns = { + encode(message: IndexValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uint !== undefined) { + writer.uint32(8).uint64(message.uint); + } + if (message.int !== undefined) { + writer.uint32(16).int64(message.int); + } + if (message.str !== undefined) { + writer.uint32(26).string(message.str); + } + if (message.bytes !== undefined) { + writer.uint32(34).bytes(message.bytes); + } + if (message.enum !== undefined) { + writer.uint32(42).string(message.enum); + } + if (message.bool !== undefined) { + writer.uint32(48).bool(message.bool); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(58).fork()).join(); + } + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.uint = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.int = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.str = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.enum = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.bool = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.duration = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexValue { + return { + uint: isSet(object.uint) ? globalThis.Number(object.uint) : undefined, + int: isSet(object.int) ? globalThis.Number(object.int) : undefined, + str: isSet(object.str) ? globalThis.String(object.str) : undefined, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : undefined, + enum: isSet(object.enum) ? globalThis.String(object.enum) : undefined, + bool: isSet(object.bool) ? globalThis.Boolean(object.bool) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + }; + }, + + toJSON(message: IndexValue): unknown { + const obj: any = {}; + if (message.uint !== undefined) { + obj.uint = Math.round(message.uint); + } + if (message.int !== undefined) { + obj.int = Math.round(message.int); + } + if (message.str !== undefined) { + obj.str = message.str; + } + if (message.bytes !== undefined) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.enum !== undefined) { + obj.enum = message.enum; + } + if (message.bool !== undefined) { + obj.bool = message.bool; + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.duration !== undefined) { + obj.duration = Duration.toJSON(message.duration); + } + return obj; + }, + + create, I>>(base?: I): IndexValue { + return IndexValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexValue { + const message = createBaseIndexValue(); + message.uint = object.uint ?? undefined; + message.int = object.int ?? undefined; + message.str = object.str ?? undefined; + message.bytes = object.bytes ?? undefined; + message.enum = object.enum ?? undefined; + message.bool = object.bool ?? undefined; + message.timestamp = object.timestamp ?? undefined; + message.duration = (object.duration !== undefined && object.duration !== null) + ? Duration.fromPartial(object.duration) + : undefined; + return message; + }, +}; + +/** Query is a generic gRPC service for querying ORM data. */ +export interface Query { + /** Get queries an ORM table against an unique index. */ + Get(request: GetRequest): Promise; + /** List queries an ORM table against an index. */ + List(request: ListRequest): Promise; +} + +export const QueryServiceName = "cosmos.orm.query.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Get = this.Get.bind(this); + this.List = this.List.bind(this); + } + Get(request: GetRequest): Promise { + const data = GetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Get", data); + return promise.then((data) => GetResponse.decode(new BinaryReader(data))); + } + + List(request: ListRequest): Promise { + const data = ListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "List", data); + return promise.then((data) => ListResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/orm/v1/orm.ts b/ts-client/cosmos.circuit.v1/types/cosmos/orm/v1/orm.ts new file mode 100644 index 00000000..e13476dc --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/orm/v1/orm.ts @@ -0,0 +1,444 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1/orm.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1"; + +/** TableDescriptor describes an ORM table. */ +export interface TableDescriptor { + /** primary_key defines the primary key for the table. */ + primaryKey: + | PrimaryKeyDescriptor + | undefined; + /** 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 is encoded such that values with only seconds occupy 6 bytes, + * values including nanos occupy 9 bytes, and nil values occupy 1 byte. When iterating, nil + * values will always be ordered last. Seconds and nanos values must conform to the officially + * specified ranges of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z and 0 to 999,999,999 respectively. + * - google.protobuf.Duration is 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. + */ + autoIncrement: 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 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 { primaryKey: undefined, index: [], id: 0 }; +} + +export const TableDescriptor: MessageFns = { + encode(message: TableDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.primaryKey !== undefined) { + PrimaryKeyDescriptor.encode(message.primaryKey, writer.uint32(10).fork()).join(); + } + for (const v of message.index) { + SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.id !== 0) { + writer.uint32(24).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TableDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.primaryKey = PrimaryKeyDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index.push(SecondaryIndexDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TableDescriptor { + return { + primaryKey: isSet(object.primaryKey) ? PrimaryKeyDescriptor.fromJSON(object.primaryKey) : undefined, + index: globalThis.Array.isArray(object?.index) + ? object.index.map((e: any) => SecondaryIndexDescriptor.fromJSON(e)) + : [], + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + }; + }, + + toJSON(message: TableDescriptor): unknown { + const obj: any = {}; + if (message.primaryKey !== undefined) { + obj.primaryKey = PrimaryKeyDescriptor.toJSON(message.primaryKey); + } + if (message.index?.length) { + obj.index = message.index.map((e) => SecondaryIndexDescriptor.toJSON(e)); + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): TableDescriptor { + return TableDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TableDescriptor { + const message = createBaseTableDescriptor(); + message.primaryKey = (object.primaryKey !== undefined && object.primaryKey !== null) + ? PrimaryKeyDescriptor.fromPartial(object.primaryKey) + : undefined; + message.index = object.index?.map((e) => SecondaryIndexDescriptor.fromPartial(e)) || []; + message.id = object.id ?? 0; + return message; + }, +}; + +function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { + return { fields: "", autoIncrement: false }; +} + +export const PrimaryKeyDescriptor: MessageFns = { + encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.autoIncrement !== false) { + writer.uint32(16).bool(message.autoIncrement); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrimaryKeyDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.autoIncrement = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrimaryKeyDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + autoIncrement: isSet(object.autoIncrement) ? globalThis.Boolean(object.autoIncrement) : false, + }; + }, + + toJSON(message: PrimaryKeyDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.autoIncrement !== false) { + obj.autoIncrement = message.autoIncrement; + } + return obj; + }, + + create, I>>(base?: I): PrimaryKeyDescriptor { + return PrimaryKeyDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrimaryKeyDescriptor { + const message = createBasePrimaryKeyDescriptor(); + message.fields = object.fields ?? ""; + message.autoIncrement = object.autoIncrement ?? false; + return message; + }, +}; + +function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { + return { fields: "", id: 0, unique: false }; +} + +export const SecondaryIndexDescriptor: MessageFns = { + encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.id !== 0) { + writer.uint32(16).uint32(message.id); + } + if (message.unique !== false) { + writer.uint32(24).bool(message.unique); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecondaryIndexDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.id = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.unique = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecondaryIndexDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + unique: isSet(object.unique) ? globalThis.Boolean(object.unique) : false, + }; + }, + + toJSON(message: SecondaryIndexDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.unique !== false) { + obj.unique = message.unique; + } + return obj; + }, + + create, I>>(base?: I): SecondaryIndexDescriptor { + return SecondaryIndexDescriptor.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: SingletonDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SingletonDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SingletonDescriptor { + return { id: isSet(object.id) ? globalThis.Number(object.id) : 0 }; + }, + + toJSON(message: SingletonDescriptor): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): SingletonDescriptor { + return SingletonDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/orm/v1alpha1/schema.ts b/ts-client/cosmos.circuit.v1/types/cosmos/orm/v1alpha1/schema.ts new file mode 100644 index 00000000..e326c1bc --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/orm/v1alpha1/schema.ts @@ -0,0 +1,316 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1alpha1/schema.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1alpha1"; + +/** StorageType */ +export enum StorageType { + /** + * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent storage where all + * data is stored in the regular Merkle-tree backed KV-store. + */ + 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, + 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 -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.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptor { + schemaFile: 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. + */ + protoFileName: 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. + */ + storageType: StorageType; +} + +function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { + return { schemaFile: [], prefix: new Uint8Array(0) }; +} + +export const ModuleSchemaDescriptor: MessageFns = { + encode(message: ModuleSchemaDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.schemaFile) { + ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.schemaFile.push(ModuleSchemaDescriptor_FileEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.prefix = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor { + return { + schemaFile: globalThis.Array.isArray(object?.schemaFile) + ? object.schemaFile.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)) + : [], + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0), + }; + }, + + toJSON(message: ModuleSchemaDescriptor): unknown { + const obj: any = {}; + if (message.schemaFile?.length) { + obj.schemaFile = message.schemaFile.map((e) => ModuleSchemaDescriptor_FileEntry.toJSON(e)); + } + if (message.prefix.length !== 0) { + obj.prefix = base64FromBytes(message.prefix); + } + return obj; + }, + + create, I>>(base?: I): ModuleSchemaDescriptor { + return ModuleSchemaDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schemaFile = object.schemaFile?.map((e) => ModuleSchemaDescriptor_FileEntry.fromPartial(e)) || []; + message.prefix = object.prefix ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { + return { id: 0, protoFileName: "", storageType: 0 }; +} + +export const ModuleSchemaDescriptor_FileEntry: MessageFns = { + encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.protoFileName !== "") { + writer.uint32(18).string(message.protoFileName); + } + if (message.storageType !== 0) { + writer.uint32(24).int32(message.storageType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor_FileEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.protoFileName = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.storageType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor_FileEntry { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + protoFileName: isSet(object.protoFileName) ? globalThis.String(object.protoFileName) : "", + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : 0, + }; + }, + + toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.protoFileName !== "") { + obj.protoFileName = message.protoFileName; + } + if (message.storageType !== 0) { + obj.storageType = storageTypeToJSON(message.storageType); + } + return obj; + }, + + create, I>>( + base?: I, + ): ModuleSchemaDescriptor_FileEntry { + return ModuleSchemaDescriptor_FileEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + message.id = object.id ?? 0; + message.protoFileName = object.protoFileName ?? ""; + message.storageType = object.storageType ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/params/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/params/module/v1/module.ts new file mode 100644 index 00000000..731379ce --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/params/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.params.module.v1"; + +/** Module is the config object of the params module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/params/v1beta1/params.ts b/ts-client/cosmos.circuit.v1/types/cosmos/params/v1beta1/params.ts new file mode 100644 index 00000000..24070188 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/params/v1beta1/params.ts @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: MessageFns = { + encode(message: ParameterChangeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParameterChangeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changes.push(ParamChange.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParameterChangeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + changes: globalThis.Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [], + }; + }, + + toJSON(message: ParameterChangeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.changes?.length) { + obj.changes = message.changes.map((e) => ParamChange.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ParameterChangeProposal { + return ParameterChangeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ParamChange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ParamChange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParamChange { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: ParamChange): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ParamChange { + return ParamChange.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/params/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/params/v1beta1/query.ts new file mode 100644 index 00000000..d45f57cd --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/params/v1beta1/query.ts @@ -0,0 +1,433 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesRequest { +} + +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesResponse { + subspaces: Subspace[]; +} + +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface Subspace { + subspace: string; + keys: string[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { subspace: "", key: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.param !== undefined) { + ParamChange.encode(message.param, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.param = ParamChange.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.param !== undefined) { + obj.param = ParamChange.toJSON(message.param); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QuerySubspacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QuerySubspacesRequest { + return {}; + }, + + toJSON(_: QuerySubspacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QuerySubspacesRequest { + return QuerySubspacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, +}; + +function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { + return { subspaces: [] }; +} + +export const QuerySubspacesResponse: MessageFns = { + encode(message: QuerySubspacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.subspaces) { + Subspace.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspaces.push(Subspace.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySubspacesResponse { + return { + subspaces: globalThis.Array.isArray(object?.subspaces) + ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QuerySubspacesResponse): unknown { + const obj: any = {}; + if (message.subspaces?.length) { + obj.subspaces = message.subspaces.map((e) => Subspace.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QuerySubspacesResponse { + return QuerySubspacesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Subspace, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + for (const v of message.keys) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Subspace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keys.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Subspace { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: Subspace): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.keys?.length) { + obj.keys = message.keys; + } + return obj; + }, + + create, I>>(base?: I): Subspace { + return Subspace.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + Subspaces(request: QuerySubspacesRequest): Promise; +} + +export const QueryServiceName = "cosmos.params.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/query/v1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/query/v1/query.ts index 3dfe677d..bcdfc76d 100644 --- a/ts-client/cosmos.circuit.v1/types/cosmos/query/v1/query.ts +++ b/ts-client/cosmos.circuit.v1/types/cosmos/query/v1/query.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/query/v1/query.proto + /* eslint-disable */ export const protobufPackage = "cosmos.query.v1"; diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/reflection/v1/reflection.ts b/ts-client/cosmos.circuit.v1/types/cosmos/reflection/v1/reflection.ts new file mode 100644 index 00000000..0962d0d1 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/reflection/v1/reflection.ts @@ -0,0 +1,178 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/reflection/v1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { FileDescriptorProto } from "../../../google/protobuf/descriptor"; + +export const protobufPackage = "cosmos.reflection.v1"; + +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequest { +} + +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponse { + /** files is the file descriptors. */ + files: FileDescriptorProto[]; +} + +function createBaseFileDescriptorsRequest(): FileDescriptorsRequest { + return {}; +} + +export const FileDescriptorsRequest: MessageFns = { + encode(_: FileDescriptorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): FileDescriptorsRequest { + return {}; + }, + + toJSON(_: FileDescriptorsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): FileDescriptorsRequest { + return FileDescriptorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): FileDescriptorsRequest { + const message = createBaseFileDescriptorsRequest(); + return message; + }, +}; + +function createBaseFileDescriptorsResponse(): FileDescriptorsResponse { + return { files: [] }; +} + +export const FileDescriptorsResponse: MessageFns = { + encode(message: FileDescriptorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.files) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.files.push(FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileDescriptorsResponse { + return { + files: globalThis.Array.isArray(object?.files) + ? object.files.map((e: any) => FileDescriptorProto.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileDescriptorsResponse): unknown { + const obj: any = {}; + if (message.files?.length) { + obj.files = message.files.map((e) => FileDescriptorProto.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FileDescriptorsResponse { + return FileDescriptorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileDescriptorsResponse { + const message = createBaseFileDescriptorsResponse(); + message.files = object.files?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +/** + * Package cosmos.reflection.v1 provides support for inspecting protobuf + * file descriptors. + */ +export interface ReflectionService { + /** + * FileDescriptors queries all the file descriptors in the app in order + * to enable easier generation of dynamic clients. + */ + FileDescriptors(request: FileDescriptorsRequest): Promise; +} + +export const ReflectionServiceServiceName = "cosmos.reflection.v1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + this.rpc = rpc; + this.FileDescriptors = this.FileDescriptors.bind(this); + } + FileDescriptors(request: FileDescriptorsRequest): Promise { + const data = FileDescriptorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FileDescriptors", data); + return promise.then((data) => FileDescriptorsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/slashing/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/module/v1/module.ts new file mode 100644 index 00000000..bf27cfd0 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.slashing.module.v1"; + +/** Module is the config object of the slashing module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/genesis.ts new file mode 100644 index 00000000..958b6870 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/genesis.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signingInfos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missedBlocks: 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. */ + validatorSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * 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. */ + missedBlocks: MissedBlock[]; +} + +/** MissedBlock contains height and missed status as boolean. */ +export interface MissedBlock { + /** index is the height at which the block was missed. */ + index: number; + /** missed is the missed status. */ + missed: boolean; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, signingInfos: [], missedBlocks: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.signingInfos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.missedBlocks) { + ValidatorMissedBlocks.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signingInfos.push(SigningInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.missedBlocks.push(ValidatorMissedBlocks.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signingInfos: globalThis.Array.isArray(object?.signingInfos) + ? object.signingInfos.map((e: any) => SigningInfo.fromJSON(e)) + : [], + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.signingInfos?.length) { + obj.signingInfos = message.signingInfos.map((e) => SigningInfo.toJSON(e)); + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => ValidatorMissedBlocks.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) + ? Params.fromPartial(object.params) + : undefined; + message.signingInfos = object.signingInfos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missedBlocks = object.missedBlocks?.map((e) => ValidatorMissedBlocks.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningInfo(): SigningInfo { + return { address: "", validatorSigningInfo: undefined }; +} + +export const SigningInfo: MessageFns = { + encode(message: SigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.validatorSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.validatorSigningInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + validatorSigningInfo: isSet(object.validatorSigningInfo) + ? ValidatorSigningInfo.fromJSON(object.validatorSigningInfo) + : undefined, + }; + }, + + toJSON(message: SigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.validatorSigningInfo !== undefined) { + obj.validatorSigningInfo = ValidatorSigningInfo.toJSON(message.validatorSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): SigningInfo { + return SigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningInfo { + const message = createBaseSigningInfo(); + message.address = object.address ?? ""; + message.validatorSigningInfo = (object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.validatorSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { + return { address: "", missedBlocks: [] }; +} + +export const ValidatorMissedBlocks: MessageFns = { + encode(message: ValidatorMissedBlocks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.missedBlocks) { + MissedBlock.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorMissedBlocks { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.missedBlocks.push(MissedBlock.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlocks { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => MissedBlock.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorMissedBlocks): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => MissedBlock.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorMissedBlocks { + return ValidatorMissedBlocks.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorMissedBlocks { + const message = createBaseValidatorMissedBlocks(); + message.address = object.address ?? ""; + message.missedBlocks = object.missedBlocks?.map((e) => MissedBlock.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMissedBlock(): MissedBlock { + return { index: 0, missed: false }; +} + +export const MissedBlock: MessageFns = { + encode(message: MissedBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).int64(message.index); + } + if (message.missed !== false) { + writer.uint32(16).bool(message.missed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MissedBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.missed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MissedBlock { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + missed: isSet(object.missed) ? globalThis.Boolean(object.missed) : false, + }; + }, + + toJSON(message: MissedBlock): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.missed !== false) { + obj.missed = message.missed; + } + return obj; + }, + + create, I>>(base?: I): MissedBlock { + return MissedBlock.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 00000000..bc78c27e --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,481 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoRequest { + /** cons_address is the address to query signing info of */ + consAddress: 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 */ + valSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosRequest { + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { + return { consAddress: "" }; +} + +export const QuerySigningInfoRequest: MessageFns = { + encode(message: QuerySigningInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consAddress !== "") { + writer.uint32(10).string(message.consAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.consAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoRequest { + return { consAddress: isSet(object.consAddress) ? globalThis.String(object.consAddress) : "" }; + }, + + toJSON(message: QuerySigningInfoRequest): unknown { + const obj: any = {}; + if (message.consAddress !== "") { + obj.consAddress = message.consAddress; + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoRequest { + return QuerySigningInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoRequest { + const message = createBaseQuerySigningInfoRequest(); + message.consAddress = object.consAddress ?? ""; + return message; + }, +}; + +function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { + return { valSigningInfo: undefined }; +} + +export const QuerySigningInfoResponse: MessageFns = { + encode(message: QuerySigningInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.valSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.valSigningInfo, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.valSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoResponse { + return { + valSigningInfo: isSet(object.valSigningInfo) ? ValidatorSigningInfo.fromJSON(object.valSigningInfo) : undefined, + }; + }, + + toJSON(message: QuerySigningInfoResponse): unknown { + const obj: any = {}; + if (message.valSigningInfo !== undefined) { + obj.valSigningInfo = ValidatorSigningInfo.toJSON(message.valSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoResponse { + return QuerySigningInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoResponse { + const message = createBaseQuerySigningInfoResponse(); + message.valSigningInfo = (object.valSigningInfo !== undefined && object.valSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.valSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { + return { pagination: undefined }; +} + +export const QuerySigningInfosRequest: MessageFns = { + encode(message: QuerySigningInfosRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QuerySigningInfosRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosRequest { + return QuerySigningInfosRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySigningInfosResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.info) { + ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info.push(ValidatorSigningInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosResponse { + return { + info: globalThis.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?.length) { + obj.info = message.info.map((e) => ValidatorSigningInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosResponse { + return QuerySigningInfosResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.slashing.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/slashing.ts b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/slashing.ts new file mode 100644 index 00000000..06f87d05 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/slashing.ts @@ -0,0 +1,411 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/slashing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 un-jailed */ + startHeight: number; + /** + * Index which is incremented every time a validator is bonded in a block and + * _may_ have signed a pre-commit or not. This in conjunction with the + * signed_blocks_window param determines the index in the missed block bitmap. + */ + indexOffset: number; + /** Timestamp until which the validator is jailed due to liveness downtime. */ + jailedUntil: + | Date + | undefined; + /** + * 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 misbehavior. + */ + tombstoned: boolean; + /** + * A counter of missed (unsigned) blocks. It is used to avoid unnecessary + * reads in the missed block bitmap. + */ + missedBlocksCounter: number; +} + +/** Params represents the parameters used for by the slashing module. */ +export interface Params { + signedBlocksWindow: number; + minSignedPerWindow: Uint8Array; + downtimeJailDuration: Duration | undefined; + slashFractionDoubleSign: Uint8Array; + slashFractionDowntime: Uint8Array; +} + +function createBaseValidatorSigningInfo(): ValidatorSigningInfo { + return { + address: "", + startHeight: 0, + indexOffset: 0, + jailedUntil: undefined, + tombstoned: false, + missedBlocksCounter: 0, + }; +} + +export const ValidatorSigningInfo: MessageFns = { + encode(message: ValidatorSigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.startHeight !== 0) { + writer.uint32(16).int64(message.startHeight); + } + if (message.indexOffset !== 0) { + writer.uint32(24).int64(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + Timestamp.encode(toTimestamp(message.jailedUntil), writer.uint32(34).fork()).join(); + } + if (message.tombstoned !== false) { + writer.uint32(40).bool(message.tombstoned); + } + if (message.missedBlocksCounter !== 0) { + writer.uint32(48).int64(message.missedBlocksCounter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.indexOffset = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.jailedUntil = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.tombstoned = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.missedBlocksCounter = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + startHeight: isSet(object.startHeight) ? globalThis.Number(object.startHeight) : 0, + indexOffset: isSet(object.indexOffset) ? globalThis.Number(object.indexOffset) : 0, + jailedUntil: isSet(object.jailedUntil) ? fromJsonTimestamp(object.jailedUntil) : undefined, + tombstoned: isSet(object.tombstoned) ? globalThis.Boolean(object.tombstoned) : false, + missedBlocksCounter: isSet(object.missedBlocksCounter) ? globalThis.Number(object.missedBlocksCounter) : 0, + }; + }, + + toJSON(message: ValidatorSigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.startHeight !== 0) { + obj.startHeight = Math.round(message.startHeight); + } + if (message.indexOffset !== 0) { + obj.indexOffset = Math.round(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + obj.jailedUntil = message.jailedUntil.toISOString(); + } + if (message.tombstoned !== false) { + obj.tombstoned = message.tombstoned; + } + if (message.missedBlocksCounter !== 0) { + obj.missedBlocksCounter = Math.round(message.missedBlocksCounter); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSigningInfo { + return ValidatorSigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSigningInfo { + const message = createBaseValidatorSigningInfo(); + message.address = object.address ?? ""; + message.startHeight = object.startHeight ?? 0; + message.indexOffset = object.indexOffset ?? 0; + message.jailedUntil = object.jailedUntil ?? undefined; + message.tombstoned = object.tombstoned ?? false; + message.missedBlocksCounter = object.missedBlocksCounter ?? 0; + return message; + }, +}; + +function createBaseParams(): Params { + return { + signedBlocksWindow: 0, + minSignedPerWindow: new Uint8Array(0), + downtimeJailDuration: undefined, + slashFractionDoubleSign: new Uint8Array(0), + slashFractionDowntime: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedBlocksWindow !== 0) { + writer.uint32(8).int64(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + writer.uint32(18).bytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + Duration.encode(message.downtimeJailDuration, writer.uint32(26).fork()).join(); + } + if (message.slashFractionDoubleSign.length !== 0) { + writer.uint32(34).bytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + writer.uint32(42).bytes(message.slashFractionDowntime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.signedBlocksWindow = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minSignedPerWindow = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.downtimeJailDuration = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.slashFractionDoubleSign = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionDowntime = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + signedBlocksWindow: isSet(object.signedBlocksWindow) ? globalThis.Number(object.signedBlocksWindow) : 0, + minSignedPerWindow: isSet(object.minSignedPerWindow) + ? bytesFromBase64(object.minSignedPerWindow) + : new Uint8Array(0), + downtimeJailDuration: isSet(object.downtimeJailDuration) + ? Duration.fromJSON(object.downtimeJailDuration) + : undefined, + slashFractionDoubleSign: isSet(object.slashFractionDoubleSign) + ? bytesFromBase64(object.slashFractionDoubleSign) + : new Uint8Array(0), + slashFractionDowntime: isSet(object.slashFractionDowntime) + ? bytesFromBase64(object.slashFractionDowntime) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.signedBlocksWindow !== 0) { + obj.signedBlocksWindow = Math.round(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + obj.minSignedPerWindow = base64FromBytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + obj.downtimeJailDuration = Duration.toJSON(message.downtimeJailDuration); + } + if (message.slashFractionDoubleSign.length !== 0) { + obj.slashFractionDoubleSign = base64FromBytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + obj.slashFractionDowntime = base64FromBytes(message.slashFractionDowntime); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.signedBlocksWindow = object.signedBlocksWindow ?? 0; + message.minSignedPerWindow = object.minSignedPerWindow ?? new Uint8Array(0); + message.downtimeJailDuration = (object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null) + ? Duration.fromPartial(object.downtimeJailDuration) + : undefined; + message.slashFractionDoubleSign = object.slashFractionDoubleSign ?? new Uint8Array(0); + message.slashFractionDowntime = object.slashFractionDowntime ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/tx.ts new file mode 100644 index 00000000..54377079 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/slashing/v1beta1/tx.ts @@ -0,0 +1,333 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./slashing"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** MsgUnjail defines the Msg/Unjail request type */ +export interface MsgUnjail { + validatorAddr: string; +} + +/** MsgUnjailResponse defines the Msg/Unjail response type */ +export interface MsgUnjailResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/slashing parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUnjail(): MsgUnjail { + return { validatorAddr: "" }; +} + +export const MsgUnjail: MessageFns = { + encode(message: MsgUnjail, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjail { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnjail { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: MsgUnjail): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): MsgUnjail { + return MsgUnjail.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnjail { + const message = createBaseMsgUnjail(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseMsgUnjailResponse(): MsgUnjailResponse { + return {}; +} + +export const MsgUnjailResponse: MessageFns = { + encode(_: MsgUnjailResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjailResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjailResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnjailResponse { + return {}; + }, + + toJSON(_: MsgUnjailResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnjailResponse { + return MsgUnjailResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnjailResponse { + const message = createBaseMsgUnjailResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/slashing module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.slashing.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 || MsgServiceName; + this.rpc = rpc; + this.Unjail = this.Unjail.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/staking/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/staking/module/v1/module.ts new file mode 100644 index 00000000..7f8fe4b9 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/staking/module/v1/module.ts @@ -0,0 +1,157 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.staking.module.v1"; + +/** Module is the config object of the staking module. */ +export interface Module { + /** + * hooks_order specifies the order of staking hooks and should be a list + * of module names which provide a staking hooks instance. If no order is + * provided, then hooks will be applied in alphabetical order of module names. + */ + hooksOrder: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** bech32_prefix_validator is the bech32 validator prefix for the app. */ + bech32PrefixValidator: string; + /** bech32_prefix_consensus is the bech32 consensus node prefix for the app. */ + bech32PrefixConsensus: string; +} + +function createBaseModule(): Module { + return { hooksOrder: [], authority: "", bech32PrefixValidator: "", bech32PrefixConsensus: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.hooksOrder) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + if (message.bech32PrefixValidator !== "") { + writer.uint32(26).string(message.bech32PrefixValidator); + } + if (message.bech32PrefixConsensus !== "") { + writer.uint32(34).string(message.bech32PrefixConsensus); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.hooksOrder.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bech32PrefixValidator = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bech32PrefixConsensus = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + hooksOrder: globalThis.Array.isArray(object?.hooksOrder) + ? object.hooksOrder.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + bech32PrefixValidator: isSet(object.bech32PrefixValidator) ? globalThis.String(object.bech32PrefixValidator) : "", + bech32PrefixConsensus: isSet(object.bech32PrefixConsensus) ? globalThis.String(object.bech32PrefixConsensus) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.hooksOrder?.length) { + obj.hooksOrder = message.hooksOrder; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.bech32PrefixValidator !== "") { + obj.bech32PrefixValidator = message.bech32PrefixValidator; + } + if (message.bech32PrefixConsensus !== "") { + obj.bech32PrefixConsensus = message.bech32PrefixConsensus; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.hooksOrder = object.hooksOrder?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.bech32PrefixValidator = object.bech32PrefixValidator ?? ""; + message.bech32PrefixConsensus = object.bech32PrefixConsensus ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/authz.ts b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 00000000..b989d692 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,301 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION - AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION defines an authorization type for Msg/MsgCancelUnbondingDelegation */ + AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION = 4, + 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 4: + case "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION": + return AuthorizationType.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION; + 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.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION: + return "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION"; + 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. + */ + maxTokens: + | Coin + | undefined; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allowList?: + | StakeAuthorization_Validators + | undefined; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + denyList?: + | StakeAuthorization_Validators + | undefined; + /** authorization_type defines one of AuthorizationType. */ + authorizationType: AuthorizationType; +} + +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_Validators { + address: string[]; +} + +function createBaseStakeAuthorization(): StakeAuthorization { + return { maxTokens: undefined, allowList: undefined, denyList: undefined, authorizationType: 0 }; +} + +export const StakeAuthorization: MessageFns = { + encode(message: StakeAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTokens !== undefined) { + Coin.encode(message.maxTokens, writer.uint32(10).fork()).join(); + } + if (message.allowList !== undefined) { + StakeAuthorization_Validators.encode(message.allowList, writer.uint32(18).fork()).join(); + } + if (message.denyList !== undefined) { + StakeAuthorization_Validators.encode(message.denyList, writer.uint32(26).fork()).join(); + } + if (message.authorizationType !== 0) { + writer.uint32(32).int32(message.authorizationType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxTokens = Coin.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.denyList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.authorizationType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization { + return { + maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, + allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, + denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, + authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : 0, + }; + }, + + toJSON(message: StakeAuthorization): unknown { + const obj: any = {}; + if (message.maxTokens !== undefined) { + obj.maxTokens = Coin.toJSON(message.maxTokens); + } + if (message.allowList !== undefined) { + obj.allowList = StakeAuthorization_Validators.toJSON(message.allowList); + } + if (message.denyList !== undefined) { + obj.denyList = StakeAuthorization_Validators.toJSON(message.denyList); + } + if (message.authorizationType !== 0) { + obj.authorizationType = authorizationTypeToJSON(message.authorizationType); + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization { + return StakeAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeAuthorization { + const message = createBaseStakeAuthorization(); + message.maxTokens = (object.maxTokens !== undefined && object.maxTokens !== null) + ? Coin.fromPartial(object.maxTokens) + : undefined; + message.allowList = (object.allowList !== undefined && object.allowList !== null) + ? StakeAuthorization_Validators.fromPartial(object.allowList) + : undefined; + message.denyList = (object.denyList !== undefined && object.denyList !== null) + ? StakeAuthorization_Validators.fromPartial(object.denyList) + : undefined; + message.authorizationType = object.authorizationType ?? 0; + return message; + }, +}; + +function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { + return { address: [] }; +} + +export const StakeAuthorization_Validators: MessageFns = { + encode(message: StakeAuthorization_Validators, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.address) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization_Validators { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization_Validators { + return { + address: globalThis.Array.isArray(object?.address) ? object.address.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: StakeAuthorization_Validators): unknown { + const obj: any = {}; + if (message.address?.length) { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization_Validators { + return StakeAuthorization_Validators.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/genesis.ts b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 00000000..8c967ba2 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,367 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of related to deposit. */ + params: + | Params + | undefined; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + lastTotalPower: Uint8Array; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + lastValidatorPowers: LastValidatorPower[]; + /** validators 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. */ + unbondingDelegations: UnbondingDelegation[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: Redelegation[]; + /** exported defines a bool to identify whether the chain dealing with exported or initialized genesis. */ + 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: number; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + lastTotalPower: new Uint8Array(0), + lastValidatorPowers: [], + validators: [], + delegations: [], + unbondingDelegations: [], + redelegations: [], + exported: false, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.lastTotalPower.length !== 0) { + writer.uint32(18).bytes(message.lastTotalPower); + } + for (const v of message.lastValidatorPowers) { + LastValidatorPower.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.delegations) { + Delegation.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.unbondingDelegations) { + UnbondingDelegation.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.redelegations) { + Redelegation.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.exported !== false) { + writer.uint32(64).bool(message.exported); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lastTotalPower = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.lastValidatorPowers.push(LastValidatorPower.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delegations.push(Delegation.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.unbondingDelegations.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.redelegations.push(Redelegation.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.exported = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + lastTotalPower: isSet(object.lastTotalPower) ? bytesFromBase64(object.lastTotalPower) : new Uint8Array(0), + lastValidatorPowers: globalThis.Array.isArray(object?.lastValidatorPowers) + ? object.lastValidatorPowers.map((e: any) => LastValidatorPower.fromJSON(e)) + : [], + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + delegations: globalThis.Array.isArray(object?.delegations) + ? object.delegations.map((e: any) => Delegation.fromJSON(e)) + : [], + unbondingDelegations: globalThis.Array.isArray(object?.unbondingDelegations) + ? object.unbondingDelegations.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + redelegations: globalThis.Array.isArray(object?.redelegations) + ? object.redelegations.map((e: any) => Redelegation.fromJSON(e)) + : [], + exported: isSet(object.exported) ? globalThis.Boolean(object.exported) : false, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.lastTotalPower.length !== 0) { + obj.lastTotalPower = base64FromBytes(message.lastTotalPower); + } + if (message.lastValidatorPowers?.length) { + obj.lastValidatorPowers = message.lastValidatorPowers.map((e) => LastValidatorPower.toJSON(e)); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.delegations?.length) { + obj.delegations = message.delegations.map((e) => Delegation.toJSON(e)); + } + if (message.unbondingDelegations?.length) { + obj.unbondingDelegations = message.unbondingDelegations.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.redelegations?.length) { + obj.redelegations = message.redelegations.map((e) => Redelegation.toJSON(e)); + } + if (message.exported !== false) { + obj.exported = message.exported; + } + 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) + ? Params.fromPartial(object.params) + : undefined; + message.lastTotalPower = object.lastTotalPower ?? new Uint8Array(0); + message.lastValidatorPowers = object.lastValidatorPowers?.map((e) => LastValidatorPower.fromPartial(e)) || []; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.delegations = object.delegations?.map((e) => Delegation.fromPartial(e)) || []; + message.unbondingDelegations = object.unbondingDelegations?.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: MessageFns = { + encode(message: LastValidatorPower, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LastValidatorPower { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LastValidatorPower { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: LastValidatorPower): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): LastValidatorPower { + return LastValidatorPower.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LastValidatorPower { + const message = createBaseLastValidatorPower(); + message.address = object.address ?? ""; + message.power = object.power ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/query.ts new file mode 100644 index 00000000..ef8f2dc7 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,2495 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponse { + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegationResponse: DelegationResponse | undefined; +} + +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond: UnbondingDelegation | undefined; +} + +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** src_validator_addr defines the validator address to redelegate from. */ + srcValidatorAddr: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dstValidatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponse { + redelegationResponses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: number; +} + +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist: HistoricalInfo | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { status: "", pagination: undefined }; +} + +export const QueryValidatorsRequest: MessageFns = { + encode(message: QueryValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.status = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsRequest { + return { + status: isSet(object.status) ? globalThis.String(object.status) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsRequest): unknown { + const obj: any = {}; + if (message.status !== "") { + obj.status = message.status; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsRequest { + return QueryValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsResponse { + return QueryValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "" }; +} + +export const QueryValidatorRequest: MessageFns = { + encode(message: QueryValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorRequest { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: QueryValidatorRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorRequest { + return QueryValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { validator: undefined }; +} + +export const QueryValidatorResponse: MessageFns = { + encode(message: QueryValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorResponse { + return QueryValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorDelegationsRequest: MessageFns = { + encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryValidatorDelegationsResponse: MessageFns = { + encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegationRequest: MessageFns = { + encode(message: QueryDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRequest { + return QueryDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { delegationResponse: undefined }; +} + +export const QueryDelegationResponse: MessageFns = { + encode(message: QueryDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegationResponse !== undefined) { + DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponse = DelegationResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationResponse { + return { + delegationResponse: isSet(object.delegationResponse) + ? DelegationResponse.fromJSON(object.delegationResponse) + : undefined, + }; + }, + + toJSON(message: QueryDelegationResponse): unknown { + const obj: any = {}; + if (message.delegationResponse !== undefined) { + obj.delegationResponse = DelegationResponse.toJSON(message.delegationResponse); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationResponse { + return QueryDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegationResponse = (object.delegationResponse !== undefined && object.delegationResponse !== null) + ? DelegationResponse.fromPartial(object.delegationResponse) + : undefined; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryUnbondingDelegationRequest: MessageFns = { + encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryUnbondingDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { unbond: undefined }; +} + +export const QueryUnbondingDelegationResponse: MessageFns = { + encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbond = UnbondingDelegation.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationResponse { + return { unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined }; + }, + + toJSON(message: QueryUnbondingDelegationResponse): unknown { + const obj: any = {}; + if (message.unbond !== undefined) { + obj.unbond = UnbondingDelegation.toJSON(message.unbond); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryDelegatorDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { delegatorAddr: "", srcValidatorAddr: "", dstValidatorAddr: "", pagination: undefined }; +} + +export const QueryRedelegationsRequest: MessageFns = { + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.srcValidatorAddr !== "") { + writer.uint32(18).string(message.srcValidatorAddr); + } + if (message.dstValidatorAddr !== "") { + writer.uint32(26).string(message.dstValidatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.srcValidatorAddr = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.dstValidatorAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + srcValidatorAddr: isSet(object.srcValidatorAddr) ? globalThis.String(object.srcValidatorAddr) : "", + dstValidatorAddr: isSet(object.dstValidatorAddr) ? globalThis.String(object.dstValidatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.srcValidatorAddr !== "") { + obj.srcValidatorAddr = message.srcValidatorAddr; + } + if (message.dstValidatorAddr !== "") { + obj.dstValidatorAddr = message.dstValidatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsRequest { + return QueryRedelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.srcValidatorAddr = object.srcValidatorAddr ?? ""; + message.dstValidatorAddr = object.dstValidatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { redelegationResponses: [], pagination: undefined }; +} + +export const QueryRedelegationsResponse: MessageFns = { + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.redelegationResponses) { + RedelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationResponses.push(RedelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsResponse { + return { + redelegationResponses: globalThis.Array.isArray(object?.redelegationResponses) + ? object.redelegationResponses.map((e: any) => RedelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsResponse): unknown { + const obj: any = {}; + if (message.redelegationResponses?.length) { + obj.redelegationResponses = message.redelegationResponses.map((e) => RedelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsResponse { + return QueryRedelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegationResponses?.map((e) => RedelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + 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: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegatorValidatorRequest: MessageFns = { + encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegatorValidatorRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { validator: undefined }; +} + +export const QueryDelegatorValidatorResponse: MessageFns = { + encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryDelegatorValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryHistoricalInfoRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { hist: undefined }; +} + +export const QueryHistoricalInfoResponse: MessageFns = { + encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hist = HistoricalInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoResponse { + return { hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined }; + }, + + toJSON(message: QueryHistoricalInfoResponse): unknown { + const obj: any = {}; + if (message.hist !== undefined) { + obj.hist = HistoricalInfo.toJSON(message.hist); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPoolRequest { + return {}; + }, + + toJSON(_: QueryPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPoolRequest { + return QueryPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, +}; + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +export const QueryPoolResponse: MessageFns = { + encode(message: QueryPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pool = Pool.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + if (message.pool !== undefined) { + obj.pool = Pool.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) ? Pool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Validators(request: QueryValidatorsRequest): Promise; + /** Validator queries validator info for given validator address. */ + Validator(request: QueryValidatorRequest): Promise; + /** + * ValidatorDelegations queries delegate info for given validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + ValidatorDelegations(request: QueryValidatorDelegationsRequest): Promise; + /** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; + /** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorUnbondingDelegations( + request: QueryDelegatorUnbondingDelegationsRequest, + ): Promise; + /** + * Redelegations queries redelegations of given address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Redelegations(request: QueryRedelegationsRequest): Promise; + /** + * DelegatorValidators queries all validators info for given delegator + * address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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 const QueryServiceName = "cosmos.staking.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/staking.ts b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 00000000..7ea20d02 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,2506 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/staking.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { ValidatorUpdate } from "../../../tendermint/abci/types"; +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"; + } +} + +/** Infraction indicates the infraction a validator commited. */ +export enum Infraction { + /** INFRACTION_UNSPECIFIED - UNSPECIFIED defines an empty infraction. */ + INFRACTION_UNSPECIFIED = 0, + /** INFRACTION_DOUBLE_SIGN - DOUBLE_SIGN defines a validator that double-signs a block. */ + INFRACTION_DOUBLE_SIGN = 1, + /** INFRACTION_DOWNTIME - DOWNTIME defines a validator that missed signing too many blocks. */ + INFRACTION_DOWNTIME = 2, + UNRECOGNIZED = -1, +} + +export function infractionFromJSON(object: any): Infraction { + switch (object) { + case 0: + case "INFRACTION_UNSPECIFIED": + return Infraction.INFRACTION_UNSPECIFIED; + case 1: + case "INFRACTION_DOUBLE_SIGN": + return Infraction.INFRACTION_DOUBLE_SIGN; + case 2: + case "INFRACTION_DOWNTIME": + return Infraction.INFRACTION_DOWNTIME; + case -1: + case "UNRECOGNIZED": + default: + return Infraction.UNRECOGNIZED; + } +} + +export function infractionToJSON(object: Infraction): string { + switch (object) { + case Infraction.INFRACTION_UNSPECIFIED: + return "INFRACTION_UNSPECIFIED"; + case Infraction.INFRACTION_DOUBLE_SIGN: + return "INFRACTION_DOUBLE_SIGN"; + case Infraction.INFRACTION_DOWNTIME: + return "INFRACTION_DOWNTIME"; + case Infraction.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfo { + header: Header | undefined; + 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. */ + maxRate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + maxChangeRate: 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. */ + commissionRates: + | CommissionRates + | undefined; + /** update_time is the last time the commission rate was changed. */ + updateTime: Date | undefined; +} + +/** Description defines a validator description. */ +export interface Description { + /** moniker defines a human-readable name for the validator. */ + moniker: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity: string; + /** website defines an optional website link. */ + website: string; + /** security_contact defines an optional email for security contact. */ + securityContact: string; + /** details define other optional details. */ + details: string; +} + +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface Validator { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operatorAddress: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensusPubkey: + | Any + | undefined; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegatorShares: string; + /** description defines the description terms for the validator. */ + description: + | Description + | undefined; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbondingHeight: number; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbondingTime: + | Date + | undefined; + /** commission defines the commission parameters. */ + commission: + | Commission + | undefined; + /** + * min_self_delegation is the validator's self declared minimum self delegation. + * + * Since: cosmos-sdk 0.46 + */ + minSelfDelegation: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbondingIds: number[]; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: 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 encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** shares define the delegation shares received. */ + shares: string; +} + +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegation { + /** delegator_address is the encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} + +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; + /** completion_time is the unix time for unbonding completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initialBalance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creationHeight: number; + /** completion_time defines the unix time for redelegation completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the initial balance when redelegation started. */ + initialBalance: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + sharesDst: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface Redelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegatorAddress: string; + /** validator_src_address is the validator redelegation source operator address. */ + validatorSrcAddress: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validatorDstAddress: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntry[]; +} + +/** Params defines the parameters for the x/staking module. */ +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbondingTime: + | Duration + | undefined; + /** max_validators is the maximum number of validators. */ + maxValidators: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + maxEntries: number; + /** historical_entries is the number of historical entries to persist. */ + historicalEntries: number; + /** bond_denom defines the bondable coin denomination. */ + bondDenom: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + minCommissionRate: string; +} + +/** + * 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 | undefined; + balance: Coin | undefined; +} + +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponse { + redelegationEntry: RedelegationEntry | undefined; + 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 | undefined; + entries: RedelegationEntryResponse[]; +} + +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface Pool { + notBondedTokens: string; + bondedTokens: string; +} + +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdates { + updates: ValidatorUpdate[]; +} + +function createBaseHistoricalInfo(): HistoricalInfo { + return { header: undefined, valset: [] }; +} + +export const HistoricalInfo: MessageFns = { + encode(message: HistoricalInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + for (const v of message.valset) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoricalInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.valset.push(Validator.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HistoricalInfo { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + valset: globalThis.Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [], + }; + }, + + toJSON(message: HistoricalInfo): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.valset?.length) { + obj.valset = message.valset.map((e) => Validator.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HistoricalInfo { + return HistoricalInfo.fromPartial(base ?? ({} as any)); + }, + 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: "", maxRate: "", maxChangeRate: "" }; +} + +export const CommissionRates: MessageFns = { + encode(message: CommissionRates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.maxRate !== "") { + writer.uint32(18).string(message.maxRate); + } + if (message.maxChangeRate !== "") { + writer.uint32(26).string(message.maxChangeRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rate = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxRate = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.maxChangeRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommissionRates { + return { + rate: isSet(object.rate) ? globalThis.String(object.rate) : "", + maxRate: isSet(object.maxRate) ? globalThis.String(object.maxRate) : "", + maxChangeRate: isSet(object.maxChangeRate) ? globalThis.String(object.maxChangeRate) : "", + }; + }, + + toJSON(message: CommissionRates): unknown { + const obj: any = {}; + if (message.rate !== "") { + obj.rate = message.rate; + } + if (message.maxRate !== "") { + obj.maxRate = message.maxRate; + } + if (message.maxChangeRate !== "") { + obj.maxChangeRate = message.maxChangeRate; + } + return obj; + }, + + create, I>>(base?: I): CommissionRates { + return CommissionRates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.maxRate = object.maxRate ?? ""; + message.maxChangeRate = object.maxChangeRate ?? ""; + return message; + }, +}; + +function createBaseCommission(): Commission { + return { commissionRates: undefined, updateTime: undefined }; +} + +export const Commission: MessageFns = { + encode(message: Commission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commissionRates !== undefined) { + CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).join(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commissionRates = CommissionRates.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commission { + return { + commissionRates: isSet(object.commissionRates) ? CommissionRates.fromJSON(object.commissionRates) : undefined, + updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, + }; + }, + + toJSON(message: Commission): unknown { + const obj: any = {}; + if (message.commissionRates !== undefined) { + obj.commissionRates = CommissionRates.toJSON(message.commissionRates); + } + if (message.updateTime !== undefined) { + obj.updateTime = message.updateTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Commission { + return Commission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commission { + const message = createBaseCommission(); + message.commissionRates = (object.commissionRates !== undefined && object.commissionRates !== null) + ? CommissionRates.fromPartial(object.commissionRates) + : undefined; + message.updateTime = object.updateTime ?? undefined; + return message; + }, +}; + +function createBaseDescription(): Description { + return { moniker: "", identity: "", website: "", securityContact: "", details: "" }; +} + +export const Description: MessageFns = { + encode(message: Description, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.securityContact !== "") { + writer.uint32(34).string(message.securityContact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Description { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moniker = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.website = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.securityContact = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.details = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Description { + return { + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + securityContact: isSet(object.securityContact) ? globalThis.String(object.securityContact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", + }; + }, + + toJSON(message: Description): unknown { + const obj: any = {}; + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.securityContact !== "") { + obj.securityContact = message.securityContact; + } + if (message.details !== "") { + obj.details = message.details; + } + return obj; + }, + + create, I>>(base?: I): Description { + return Description.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.securityContact = object.securityContact ?? ""; + message.details = object.details ?? ""; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { + operatorAddress: "", + consensusPubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegatorShares: "", + description: undefined, + unbondingHeight: 0, + unbondingTime: undefined, + commission: undefined, + minSelfDelegation: "", + unbondingOnHoldRefCount: 0, + unbondingIds: [], + }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + if (message.consensusPubkey !== undefined) { + Any.encode(message.consensusPubkey, writer.uint32(18).fork()).join(); + } + if (message.jailed !== false) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegatorShares !== "") { + writer.uint32(50).string(message.delegatorShares); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).join(); + } + if (message.unbondingHeight !== 0) { + writer.uint32(64).int64(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + Timestamp.encode(toTimestamp(message.unbondingTime), writer.uint32(74).fork()).join(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(90).string(message.minSelfDelegation); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(96).int64(message.unbondingOnHoldRefCount); + } + writer.uint32(106).fork(); + for (const v of message.unbondingIds) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.consensusPubkey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.jailed = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.status = reader.int32() as any; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.tokens = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.delegatorShares = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.unbondingHeight = longToNumber(reader.int64()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.unbondingTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.commission = Commission.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + case 13: + if (tag === 104) { + message.unbondingIds.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 106) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.unbondingIds.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, + jailed: isSet(object.jailed) ? globalThis.Boolean(object.jailed) : false, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + tokens: isSet(object.tokens) ? globalThis.String(object.tokens) : "", + delegatorShares: isSet(object.delegatorShares) ? globalThis.String(object.delegatorShares) : "", + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + unbondingHeight: isSet(object.unbondingHeight) ? globalThis.Number(object.unbondingHeight) : 0, + unbondingTime: isSet(object.unbondingTime) ? fromJsonTimestamp(object.unbondingTime) : undefined, + commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + unbondingIds: globalThis.Array.isArray(object?.unbondingIds) + ? object.unbondingIds.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.consensusPubkey !== undefined) { + obj.consensusPubkey = Any.toJSON(message.consensusPubkey); + } + if (message.jailed !== false) { + obj.jailed = message.jailed; + } + if (message.status !== 0) { + obj.status = bondStatusToJSON(message.status); + } + if (message.tokens !== "") { + obj.tokens = message.tokens; + } + if (message.delegatorShares !== "") { + obj.delegatorShares = message.delegatorShares; + } + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.unbondingHeight !== 0) { + obj.unbondingHeight = Math.round(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + obj.unbondingTime = message.unbondingTime.toISOString(); + } + if (message.commission !== undefined) { + obj.commission = Commission.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + if (message.unbondingIds?.length) { + obj.unbondingIds = message.unbondingIds.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.operatorAddress = object.operatorAddress ?? ""; + message.consensusPubkey = (object.consensusPubkey !== undefined && object.consensusPubkey !== null) + ? Any.fromPartial(object.consensusPubkey) + : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegatorShares = object.delegatorShares ?? ""; + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.unbondingHeight = object.unbondingHeight ?? 0; + message.unbondingTime = object.unbondingTime ?? undefined; + message.commission = (object.commission !== undefined && object.commission !== null) + ? Commission.fromPartial(object.commission) + : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + message.unbondingIds = object.unbondingIds?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValAddresses(): ValAddresses { + return { addresses: [] }; +} + +export const ValAddresses: MessageFns = { + encode(message: ValAddresses, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addresses.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValAddresses { + return { + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValAddresses): unknown { + const obj: any = {}; + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + return obj; + }, + + create, I>>(base?: I): ValAddresses { + return ValAddresses.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDVPair(): DVPair { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const DVPair: MessageFns = { + encode(message: DVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPair { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: DVPair): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): DVPair { + return DVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPair { + const message = createBaseDVPair(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseDVPairs(): DVPairs { + return { pairs: [] }; +} + +export const DVPairs: MessageFns = { + encode(message: DVPairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pairs.push(DVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] }; + }, + + toJSON(message: DVPairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => DVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVPairs { + return DVPairs.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map((e) => DVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDVVTriplet(): DVVTriplet { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" }; +} + +export const DVVTriplet: MessageFns = { + encode(message: DVVTriplet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplet { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + }; + }, + + toJSON(message: DVVTriplet): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + return obj; + }, + + create, I>>(base?: I): DVVTriplet { + return DVVTriplet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + return message; + }, +}; + +function createBaseDVVTriplets(): DVVTriplets { + return { triplets: [] }; +} + +export const DVVTriplets: MessageFns = { + encode(message: DVVTriplets, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.triplets.push(DVVTriplet.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplets { + return { + triplets: globalThis.Array.isArray(object?.triplets) + ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DVVTriplets): unknown { + const obj: any = {}; + if (message.triplets?.length) { + obj.triplets = message.triplets.map((e) => DVVTriplet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVVTriplets { + return DVVTriplets.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map((e) => DVVTriplet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDelegation(): Delegation { + return { delegatorAddress: "", validatorAddress: "", shares: "" }; +} + +export const Delegation: MessageFns = { + encode(message: Delegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Delegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.shares = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Delegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + shares: isSet(object.shares) ? globalThis.String(object.shares) : "", + }; + }, + + toJSON(message: Delegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.shares !== "") { + obj.shares = message.shares; + } + return obj; + }, + + create, I>>(base?: I): Delegation { + return Delegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Delegation { + const message = createBaseDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.shares = object.shares ?? ""; + return message; + }, +}; + +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", entries: [] }; +} + +export const UnbondingDelegation: MessageFns = { + encode(message: UnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: UnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => UnbondingDelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegation { + return UnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + balance: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const UnbondingDelegationEntry: MessageFns = { + encode(message: UnbondingDelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: UnbondingDelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.balance !== "") { + obj.balance = message.balance; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegationEntry { + return UnbondingDelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.balance = object.balance ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegationEntry(): RedelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + sharesDst: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const RedelegationEntry: MessageFns = { + encode(message: RedelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.sharesDst !== "") { + writer.uint32(34).string(message.sharesDst); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sharesDst = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + sharesDst: isSet(object.sharesDst) ? globalThis.String(object.sharesDst) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.sharesDst !== "") { + obj.sharesDst = message.sharesDst; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntry { + return RedelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.sharesDst = object.sharesDst ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegation(): Redelegation { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", entries: [] }; +} + +export const Redelegation: MessageFns = { + encode(message: Redelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Redelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Redelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Redelegation { + return Redelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Redelegation { + const message = createBaseRedelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.entries = object.entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + unbondingTime: undefined, + maxValidators: 0, + maxEntries: 0, + historicalEntries: 0, + bondDenom: "", + minCommissionRate: "", + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbondingTime !== undefined) { + Duration.encode(message.unbondingTime, writer.uint32(10).fork()).join(); + } + if (message.maxValidators !== 0) { + writer.uint32(16).uint32(message.maxValidators); + } + if (message.maxEntries !== 0) { + writer.uint32(24).uint32(message.maxEntries); + } + if (message.historicalEntries !== 0) { + writer.uint32(32).uint32(message.historicalEntries); + } + if (message.bondDenom !== "") { + writer.uint32(42).string(message.bondDenom); + } + if (message.minCommissionRate !== "") { + writer.uint32(50).string(message.minCommissionRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingTime = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxValidators = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxEntries = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.historicalEntries = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bondDenom = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.minCommissionRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbondingTime: isSet(object.unbondingTime) ? Duration.fromJSON(object.unbondingTime) : undefined, + maxValidators: isSet(object.maxValidators) ? globalThis.Number(object.maxValidators) : 0, + maxEntries: isSet(object.maxEntries) ? globalThis.Number(object.maxEntries) : 0, + historicalEntries: isSet(object.historicalEntries) ? globalThis.Number(object.historicalEntries) : 0, + bondDenom: isSet(object.bondDenom) ? globalThis.String(object.bondDenom) : "", + minCommissionRate: isSet(object.minCommissionRate) ? globalThis.String(object.minCommissionRate) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.unbondingTime !== undefined) { + obj.unbondingTime = Duration.toJSON(message.unbondingTime); + } + if (message.maxValidators !== 0) { + obj.maxValidators = Math.round(message.maxValidators); + } + if (message.maxEntries !== 0) { + obj.maxEntries = Math.round(message.maxEntries); + } + if (message.historicalEntries !== 0) { + obj.historicalEntries = Math.round(message.historicalEntries); + } + if (message.bondDenom !== "") { + obj.bondDenom = message.bondDenom; + } + if (message.minCommissionRate !== "") { + obj.minCommissionRate = message.minCommissionRate; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbondingTime = (object.unbondingTime !== undefined && object.unbondingTime !== null) + ? Duration.fromPartial(object.unbondingTime) + : undefined; + message.maxValidators = object.maxValidators ?? 0; + message.maxEntries = object.maxEntries ?? 0; + message.historicalEntries = object.historicalEntries ?? 0; + message.bondDenom = object.bondDenom ?? ""; + message.minCommissionRate = object.minCommissionRate ?? ""; + return message; + }, +}; + +function createBaseDelegationResponse(): DelegationResponse { + return { delegation: undefined, balance: undefined }; +} + +export const DelegationResponse: MessageFns = { + encode(message: DelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegation !== undefined) { + Delegation.encode(message.delegation, writer.uint32(10).fork()).join(); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegation = Delegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.delegation !== undefined) { + obj.delegation = Delegation.toJSON(message.delegation); + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DelegationResponse { + return DelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { redelegationEntry: undefined, balance: "" }; +} + +export const RedelegationEntryResponse: MessageFns = { + encode(message: RedelegationEntryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegationEntry !== undefined) { + RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).join(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationEntry = RedelegationEntry.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntryResponse { + return { + redelegationEntry: isSet(object.redelegationEntry) + ? RedelegationEntry.fromJSON(object.redelegationEntry) + : undefined, + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + }; + }, + + toJSON(message: RedelegationEntryResponse): unknown { + const obj: any = {}; + if (message.redelegationEntry !== undefined) { + obj.redelegationEntry = RedelegationEntry.toJSON(message.redelegationEntry); + } + if (message.balance !== "") { + obj.balance = message.balance; + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntryResponse { + return RedelegationEntryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegationEntry = (object.redelegationEntry !== undefined && object.redelegationEntry !== null) + ? RedelegationEntry.fromPartial(object.redelegationEntry) + : undefined; + message.balance = object.balance ?? ""; + return message; + }, +}; + +function createBaseRedelegationResponse(): RedelegationResponse { + return { redelegation: undefined, entries: [] }; +} + +export const RedelegationResponse: MessageFns = { + encode(message: RedelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegation !== undefined) { + Redelegation.encode(message.redelegation, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + RedelegationEntryResponse.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegation = Redelegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(RedelegationEntryResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationResponse { + return { + redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RedelegationResponse): unknown { + const obj: any = {}; + if (message.redelegation !== undefined) { + obj.redelegation = Redelegation.toJSON(message.redelegation); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntryResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RedelegationResponse { + return RedelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { notBondedTokens: "", bondedTokens: "" }; +} + +export const Pool: MessageFns = { + encode(message: Pool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.notBondedTokens !== "") { + writer.uint32(10).string(message.notBondedTokens); + } + if (message.bondedTokens !== "") { + writer.uint32(18).string(message.bondedTokens); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.notBondedTokens = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bondedTokens = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pool { + return { + notBondedTokens: isSet(object.notBondedTokens) ? globalThis.String(object.notBondedTokens) : "", + bondedTokens: isSet(object.bondedTokens) ? globalThis.String(object.bondedTokens) : "", + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + if (message.notBondedTokens !== "") { + obj.notBondedTokens = message.notBondedTokens; + } + if (message.bondedTokens !== "") { + obj.bondedTokens = message.bondedTokens; + } + return obj; + }, + + create, I>>(base?: I): Pool { + return Pool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.notBondedTokens = object.notBondedTokens ?? ""; + message.bondedTokens = object.bondedTokens ?? ""; + return message; + }, +}; + +function createBaseValidatorUpdates(): ValidatorUpdates { + return { updates: [] }; +} + +export const ValidatorUpdates: MessageFns = { + encode(message: ValidatorUpdates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdates { + return { + updates: globalThis.Array.isArray(object?.updates) + ? object.updates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorUpdates): unknown { + const obj: any = {}; + if (message.updates?.length) { + obj.updates = message.updates.map((e) => ValidatorUpdate.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdates { + return ValidatorUpdates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 00000000..06be4ca4 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,1403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { CommissionRates, Description, Params } from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidator { + description: Description | undefined; + commission: CommissionRates | undefined; + minSelfDelegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + * + * @deprecated + */ + delegatorAddress: string; + validatorAddress: string; + pubkey: Any | undefined; + value: Coin | undefined; +} + +/** 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 | undefined; + validatorAddress: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commissionRate: string; + minSelfDelegation: string; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; + amount: Coin | undefined; +} + +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponse { + completionTime: Date | undefined; +} + +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponse { + completionTime: + | Date + | undefined; + /** + * amount returns the amount of undelegated coins + * + * Since: cosmos-sdk 0.50 + */ + amount: Coin | undefined; +} + +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegation { + delegatorAddress: string; + validatorAddress: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: + | Coin + | undefined; + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; +} + +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: undefined, + commission: undefined, + minSelfDelegation: "", + delegatorAddress: "", + validatorAddress: "", + pubkey: undefined, + value: undefined, + }; +} + +export const MsgCreateValidator: MessageFns = { + encode(message: MsgCreateValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.commission !== undefined) { + CommissionRates.encode(message.commission, writer.uint32(18).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(26).string(message.minSelfDelegation); + } + if (message.delegatorAddress !== "") { + writer.uint32(34).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(42).string(message.validatorAddress); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(50).fork()).join(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commission = CommissionRates.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.pubkey = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + 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 = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.commission !== undefined) { + obj.commission = CommissionRates.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.pubkey !== undefined) { + obj.pubkey = Any.toJSON(message.pubkey); + } + if (message.value !== undefined) { + obj.value = Coin.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateValidator { + return MsgCreateValidator.fromPartial(base ?? ({} as any)); + }, + 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.minSelfDelegation = object.minSelfDelegation ?? ""; + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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: MessageFns = { + encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateValidatorResponse { + return {}; + }, + + toJSON(_: MsgCreateValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, +}; + +function createBaseMsgEditValidator(): MsgEditValidator { + return { description: undefined, validatorAddress: "", commissionRate: "", minSelfDelegation: "" }; +} + +export const MsgEditValidator: MessageFns = { + encode(message: MsgEditValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.commissionRate !== "") { + writer.uint32(26).string(message.commissionRate); + } + if (message.minSelfDelegation !== "") { + writer.uint32(34).string(message.minSelfDelegation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commissionRate = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + commissionRate: isSet(object.commissionRate) ? globalThis.String(object.commissionRate) : "", + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + }; + }, + + toJSON(message: MsgEditValidator): unknown { + const obj: any = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.commissionRate !== "") { + obj.commissionRate = message.commissionRate; + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + return obj; + }, + + create, I>>(base?: I): MsgEditValidator { + return MsgEditValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.validatorAddress = object.validatorAddress ?? ""; + message.commissionRate = object.commissionRate ?? ""; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, +}; + +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} + +export const MsgEditValidatorResponse: MessageFns = { + encode(_: MsgEditValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgEditValidatorResponse { + return {}; + }, + + toJSON(_: MsgEditValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgEditValidatorResponse { + return MsgEditValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, +}; + +function createBaseMsgDelegate(): MsgDelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgDelegate: MessageFns = { + encode(message: MsgDelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgDelegate { + return MsgDelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +export const MsgDelegateResponse: MessageFns = { + encode(_: MsgDelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDelegateResponse { + return MsgDelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", amount: undefined }; +} + +export const MsgBeginRedelegate: MessageFns = { + encode(message: MsgBeginRedelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgBeginRedelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegate { + return MsgBeginRedelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { completionTime: undefined }; +} + +export const MsgBeginRedelegateResponse: MessageFns = { + encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegateResponse { + return { completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined }; + }, + + toJSON(message: MsgBeginRedelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + return message; + }, +}; + +function createBaseMsgUndelegate(): MsgUndelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgUndelegate: MessageFns = { + encode(message: MsgUndelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegate { + return MsgUndelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { completionTime: undefined, amount: undefined }; +} + +export const MsgUndelegateResponse: MessageFns = { + encode(message: MsgUndelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegateResponse { + return { + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegateResponse { + return MsgUndelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegation(): MsgCancelUnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", amount: undefined, creationHeight: 0 }; +} + +export const MsgCancelUnbondingDelegation: MessageFns = { + encode(message: MsgCancelUnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + if (message.creationHeight !== 0) { + writer.uint32(32).int64(message.creationHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelUnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + }; + }, + + toJSON(message: MsgCancelUnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelUnbondingDelegation { + return MsgCancelUnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelUnbondingDelegation { + const message = createBaseMsgCancelUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + message.creationHeight = object.creationHeight ?? 0; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegationResponse(): MsgCancelUnbondingDelegationResponse { + return {}; +} + +export const MsgCancelUnbondingDelegationResponse: MessageFns = { + encode(_: MsgCancelUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelUnbondingDelegationResponse { + return {}; + }, + + toJSON(_: MsgCancelUnbondingDelegationResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCancelUnbondingDelegationResponse { + return MsgCancelUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCancelUnbondingDelegationResponse { + const message = createBaseMsgCancelUnbondingDelegationResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + * and delegate back to previous validator. + * + * Since: cosmos-sdk 0.46 + */ + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise; + /** + * UpdateParams defines an operation for updating the x/staking module + * parameters. + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.staking.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 || MsgServiceName; + 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); + this.CancelUnbondingDelegation = this.CancelUnbondingDelegation.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise { + const data = MsgCancelUnbondingDelegation.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelUnbondingDelegation", data); + return promise.then((data) => MsgCancelUnbondingDelegationResponse.decode(new BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/store/internal/kv/v1beta1/kv.ts b/ts-client/cosmos.circuit.v1/types/cosmos/store/internal/kv/v1beta1/kv.ts new file mode 100644 index 00000000..15cd0546 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/store/internal/kv/v1beta1/kv.ts @@ -0,0 +1,202 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/internal/kv/v1beta1/kv.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.internal.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: MessageFns = { + encode(message: Pairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + Pair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pairs.push(Pair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => Pair.fromJSON(e)) : [] }; + }, + + toJSON(message: Pairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => Pair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Pairs { + return Pairs.fromPartial(base ?? ({} as any)); + }, + 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(0), value: new Uint8Array(0) }; +} + +export const Pair: MessageFns = { + encode(message: Pair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pair { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Pair): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Pair { + return Pair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pair { + const message = createBasePair(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/store/snapshots/v1/snapshot.ts b/ts-client/cosmos.circuit.v1/types/cosmos/store/snapshots/v1/snapshot.ts new file mode 100644 index 00000000..6763ba8c --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/store/snapshots/v1/snapshot.ts @@ -0,0 +1,728 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/snapshots/v1/snapshot.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.snapshots.v1"; + +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface Snapshot { + height: number; + format: number; + chunks: number; + hash: Uint8Array; + metadata: Metadata | undefined; +} + +/** Metadata contains SDK-specific snapshot metadata. */ +export interface Metadata { + /** SHA-256 chunk hashes */ + chunkHashes: Uint8Array[]; +} + +/** + * SnapshotItem is an item contained in a rootmulti.Store snapshot. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotItem { + store?: SnapshotStoreItem | undefined; + iavl?: SnapshotIAVLItem | undefined; + extension?: SnapshotExtensionMeta | undefined; + extensionPayload?: SnapshotExtensionPayload | undefined; +} + +/** + * SnapshotStoreItem contains metadata about a snapshotted store. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotStoreItem { + name: string; +} + +/** + * SnapshotIAVLItem is an exported IAVL node. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotIAVLItem { + key: Uint8Array; + value: Uint8Array; + /** version is block height */ + version: number; + /** height is depth of the tree. */ + height: number; +} + +/** + * SnapshotExtensionMeta contains metadata about an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionMeta { + name: string; + format: number; +} + +/** + * SnapshotExtensionPayload contains payloads of an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionPayload { + payload: Uint8Array; +} + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: undefined }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { chunkHashes: [] }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.chunkHashes) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunkHashes.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + chunkHashes: globalThis.Array.isArray(object?.chunkHashes) + ? object.chunkHashes.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.chunkHashes?.length) { + obj.chunkHashes = message.chunkHashes.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.chunkHashes = object.chunkHashes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSnapshotItem(): SnapshotItem { + return { store: undefined, iavl: undefined, extension: undefined, extensionPayload: undefined }; +} + +export const SnapshotItem: MessageFns = { + encode(message: SnapshotItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.store !== undefined) { + SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).join(); + } + if (message.iavl !== undefined) { + SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).join(); + } + if (message.extension !== undefined) { + SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).join(); + } + if (message.extensionPayload !== undefined) { + SnapshotExtensionPayload.encode(message.extensionPayload, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.store = SnapshotStoreItem.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionPayload = SnapshotExtensionPayload.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + extensionPayload: isSet(object.extensionPayload) + ? SnapshotExtensionPayload.fromJSON(object.extensionPayload) + : undefined, + }; + }, + + toJSON(message: SnapshotItem): unknown { + const obj: any = {}; + if (message.store !== undefined) { + obj.store = SnapshotStoreItem.toJSON(message.store); + } + if (message.iavl !== undefined) { + obj.iavl = SnapshotIAVLItem.toJSON(message.iavl); + } + if (message.extension !== undefined) { + obj.extension = SnapshotExtensionMeta.toJSON(message.extension); + } + if (message.extensionPayload !== undefined) { + obj.extensionPayload = SnapshotExtensionPayload.toJSON(message.extensionPayload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotItem { + return SnapshotItem.fromPartial(base ?? ({} as any)); + }, + 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.extensionPayload = (object.extensionPayload !== undefined && object.extensionPayload !== null) + ? SnapshotExtensionPayload.fromPartial(object.extensionPayload) + : undefined; + return message; + }, +}; + +function createBaseSnapshotStoreItem(): SnapshotStoreItem { + return { name: "" }; +} + +export const SnapshotStoreItem: MessageFns = { + encode(message: SnapshotStoreItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotStoreItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotStoreItem { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: SnapshotStoreItem): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): SnapshotStoreItem { + return SnapshotStoreItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { + return { key: new Uint8Array(0), value: new Uint8Array(0), version: 0, height: 0 }; +} + +export const SnapshotIAVLItem: MessageFns = { + encode(message: SnapshotIAVLItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.version !== 0) { + writer.uint32(24).int64(message.version); + } + if (message.height !== 0) { + writer.uint32(32).int32(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotIAVLItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.height = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotIAVLItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: SnapshotIAVLItem): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): SnapshotIAVLItem { + return SnapshotIAVLItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.version = object.version ?? 0; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { + return { name: "", format: 0 }; +} + +export const SnapshotExtensionMeta: MessageFns = { + encode(message: SnapshotExtensionMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionMeta { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + }; + }, + + toJSON(message: SnapshotExtensionMeta): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionMeta { + return SnapshotExtensionMeta.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SnapshotExtensionPayload: MessageFns = { + encode(message: SnapshotExtensionPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.payload = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionPayload { + return { payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(0) }; + }, + + toJSON(message: SnapshotExtensionPayload): unknown { + const obj: any = {}; + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionPayload { + return SnapshotExtensionPayload.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + message.payload = object.payload ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/store/streaming/abci/grpc.ts b/ts-client/cosmos.circuit.v1/types/cosmos/store/streaming/abci/grpc.ts new file mode 100644 index 00000000..4e0a2d5d --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/store/streaming/abci/grpc.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/streaming/abci/grpc.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../../tendermint/abci/types"; +import { StoreKVPair } from "../../v1beta1/listening"; + +export const protobufPackage = "cosmos.store.streaming.abci"; + +/** ListenEndBlockRequest is the request type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockRequest { + req: RequestFinalizeBlock | undefined; + res: ResponseFinalizeBlock | undefined; +} + +/** ListenEndBlockResponse is the response type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockResponse { +} + +/** ListenCommitRequest is the request type for the ListenCommit RPC method */ +export interface ListenCommitRequest { + /** explicitly pass in block height as ResponseCommit does not contain this info */ + blockHeight: number; + res: ResponseCommit | undefined; + changeSet: StoreKVPair[]; +} + +/** ListenCommitResponse is the response type for the ListenCommit RPC method */ +export interface ListenCommitResponse { +} + +function createBaseListenFinalizeBlockRequest(): ListenFinalizeBlockRequest { + return { req: undefined, res: undefined }; +} + +export const ListenFinalizeBlockRequest: MessageFns = { + encode(message: ListenFinalizeBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.req !== undefined) { + RequestFinalizeBlock.encode(message.req, writer.uint32(10).fork()).join(); + } + if (message.res !== undefined) { + ResponseFinalizeBlock.encode(message.res, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.req = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenFinalizeBlockRequest { + return { + req: isSet(object.req) ? RequestFinalizeBlock.fromJSON(object.req) : undefined, + res: isSet(object.res) ? ResponseFinalizeBlock.fromJSON(object.res) : undefined, + }; + }, + + toJSON(message: ListenFinalizeBlockRequest): unknown { + const obj: any = {}; + if (message.req !== undefined) { + obj.req = RequestFinalizeBlock.toJSON(message.req); + } + if (message.res !== undefined) { + obj.res = ResponseFinalizeBlock.toJSON(message.res); + } + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockRequest { + return ListenFinalizeBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenFinalizeBlockRequest { + const message = createBaseListenFinalizeBlockRequest(); + message.req = (object.req !== undefined && object.req !== null) + ? RequestFinalizeBlock.fromPartial(object.req) + : undefined; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseFinalizeBlock.fromPartial(object.res) + : undefined; + return message; + }, +}; + +function createBaseListenFinalizeBlockResponse(): ListenFinalizeBlockResponse { + return {}; +} + +export const ListenFinalizeBlockResponse: MessageFns = { + encode(_: ListenFinalizeBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenFinalizeBlockResponse { + return {}; + }, + + toJSON(_: ListenFinalizeBlockResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockResponse { + return ListenFinalizeBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenFinalizeBlockResponse { + const message = createBaseListenFinalizeBlockResponse(); + return message; + }, +}; + +function createBaseListenCommitRequest(): ListenCommitRequest { + return { blockHeight: 0, res: undefined, changeSet: [] }; +} + +export const ListenCommitRequest: MessageFns = { + encode(message: ListenCommitRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + if (message.res !== undefined) { + ResponseCommit.encode(message.res, writer.uint32(18).fork()).join(); + } + for (const v of message.changeSet) { + StoreKVPair.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changeSet.push(StoreKVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenCommitRequest { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + res: isSet(object.res) ? ResponseCommit.fromJSON(object.res) : undefined, + changeSet: globalThis.Array.isArray(object?.changeSet) + ? object.changeSet.map((e: any) => StoreKVPair.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListenCommitRequest): unknown { + const obj: any = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.res !== undefined) { + obj.res = ResponseCommit.toJSON(message.res); + } + if (message.changeSet?.length) { + obj.changeSet = message.changeSet.map((e) => StoreKVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListenCommitRequest { + return ListenCommitRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenCommitRequest { + const message = createBaseListenCommitRequest(); + message.blockHeight = object.blockHeight ?? 0; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseCommit.fromPartial(object.res) + : undefined; + message.changeSet = object.changeSet?.map((e) => StoreKVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListenCommitResponse(): ListenCommitResponse { + return {}; +} + +export const ListenCommitResponse: MessageFns = { + encode(_: ListenCommitResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenCommitResponse { + return {}; + }, + + toJSON(_: ListenCommitResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenCommitResponse { + return ListenCommitResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenCommitResponse { + const message = createBaseListenCommitResponse(); + return message; + }, +}; + +/** ABCIListenerService is the service for the BaseApp ABCIListener interface */ +export interface ABCIListenerService { + /** ListenFinalizeBlock is the corresponding endpoint for ABCIListener.ListenEndBlock */ + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise; + /** ListenCommit is the corresponding endpoint for ABCIListener.ListenCommit */ + ListenCommit(request: ListenCommitRequest): Promise; +} + +export const ABCIListenerServiceServiceName = "cosmos.store.streaming.abci.ABCIListenerService"; +export class ABCIListenerServiceClientImpl implements ABCIListenerService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIListenerServiceServiceName; + this.rpc = rpc; + this.ListenFinalizeBlock = this.ListenFinalizeBlock.bind(this); + this.ListenCommit = this.ListenCommit.bind(this); + } + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise { + const data = ListenFinalizeBlockRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenFinalizeBlock", data); + return promise.then((data) => ListenFinalizeBlockResponse.decode(new BinaryReader(data))); + } + + ListenCommit(request: ListenCommitRequest): Promise { + const data = ListenCommitRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenCommit", data); + return promise.then((data) => ListenCommitResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/store/v1beta1/commit_info.ts b/ts-client/cosmos.circuit.v1/types/cosmos/store/v1beta1/commit_info.ts new file mode 100644 index 00000000..17c74706 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/store/v1beta1/commit_info.ts @@ -0,0 +1,363 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/commit_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.store.v1beta1"; + +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfo { + version: number; + storeInfos: StoreInfo[]; + timestamp: Date | undefined; +} + +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfo { + name: string; + commitId: CommitID | undefined; +} + +/** + * CommitID defines the commitment information when a specific store is + * committed. + */ +export interface CommitID { + version: number; + hash: Uint8Array; +} + +function createBaseCommitInfo(): CommitInfo { + return { version: 0, storeInfos: [], timestamp: undefined }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== 0) { + writer.uint32(8).int64(message.version); + } + for (const v of message.storeInfos) { + StoreInfo.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.storeInfos.push(StoreInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + storeInfos: globalThis.Array.isArray(object?.storeInfos) + ? object.storeInfos.map((e: any) => StoreInfo.fromJSON(e)) + : [], + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.storeInfos?.length) { + obj.storeInfos = message.storeInfos.map((e) => StoreInfo.toJSON(e)); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.version = object.version ?? 0; + message.storeInfos = object.storeInfos?.map((e) => StoreInfo.fromPartial(e)) || []; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseStoreInfo(): StoreInfo { + return { name: "", commitId: undefined }; +} + +export const StoreInfo: MessageFns = { + encode(message: StoreInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.commitId !== undefined) { + CommitID.encode(message.commitId, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commitId = CommitID.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + commitId: isSet(object.commitId) ? CommitID.fromJSON(object.commitId) : undefined, + }; + }, + + toJSON(message: StoreInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.commitId !== undefined) { + obj.commitId = CommitID.toJSON(message.commitId); + } + return obj; + }, + + create, I>>(base?: I): StoreInfo { + return StoreInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreInfo { + const message = createBaseStoreInfo(); + message.name = object.name ?? ""; + message.commitId = (object.commitId !== undefined && object.commitId !== null) + ? CommitID.fromPartial(object.commitId) + : undefined; + return message; + }, +}; + +function createBaseCommitID(): CommitID { + return { version: 0, hash: new Uint8Array(0) }; +} + +export const CommitID: MessageFns = { + encode(message: CommitID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): CommitID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitID { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitID): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): CommitID { + return CommitID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitID { + const message = createBaseCommitID(); + message.version = object.version ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/store/v1beta1/listening.ts b/ts-client/cosmos.circuit.v1/types/cosmos/store/v1beta1/listening.ts new file mode 100644 index 00000000..73eb4288 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/store/v1beta1/listening.ts @@ -0,0 +1,294 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/listening.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../tendermint/abci/types"; + +export const protobufPackage = "cosmos.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 */ + storeKey: string; + /** true indicates a delete operation, false indicates a set operation */ + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} + +/** + * BlockMetadata contains all the abci event data of a block + * the file streamer dump them into files together with the state changes. + */ +export interface BlockMetadata { + responseCommit: ResponseCommit | undefined; + requestFinalizeBlock: + | RequestFinalizeBlock + | undefined; + /** TODO: should we renumber this? */ + responseFinalizeBlock: ResponseFinalizeBlock | undefined; +} + +function createBaseStoreKVPair(): StoreKVPair { + return { storeKey: "", delete: false, key: new Uint8Array(0), value: new Uint8Array(0) }; +} + +export const StoreKVPair: MessageFns = { + encode(message: StoreKVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.storeKey !== "") { + writer.uint32(10).string(message.storeKey); + } + if (message.delete !== false) { + 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: BinaryReader | Uint8Array, length?: number): StoreKVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.storeKey = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.delete = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.key = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKVPair { + return { + storeKey: isSet(object.storeKey) ? globalThis.String(object.storeKey) : "", + delete: isSet(object.delete) ? globalThis.Boolean(object.delete) : false, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: StoreKVPair): unknown { + const obj: any = {}; + if (message.storeKey !== "") { + obj.storeKey = message.storeKey; + } + if (message.delete !== false) { + obj.delete = message.delete; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): StoreKVPair { + return StoreKVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKVPair { + const message = createBaseStoreKVPair(); + message.storeKey = object.storeKey ?? ""; + message.delete = object.delete ?? false; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseBlockMetadata(): BlockMetadata { + return { responseCommit: undefined, requestFinalizeBlock: undefined, responseFinalizeBlock: undefined }; +} + +export const BlockMetadata: MessageFns = { + encode(message: BlockMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.responseCommit !== undefined) { + ResponseCommit.encode(message.responseCommit, writer.uint32(50).fork()).join(); + } + if (message.requestFinalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.requestFinalizeBlock, writer.uint32(58).fork()).join(); + } + if (message.responseFinalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.responseFinalizeBlock, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + if (tag !== 50) { + break; + } + + message.responseCommit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestFinalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.responseFinalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMetadata { + return { + responseCommit: isSet(object.responseCommit) ? ResponseCommit.fromJSON(object.responseCommit) : undefined, + requestFinalizeBlock: isSet(object.requestFinalizeBlock) + ? RequestFinalizeBlock.fromJSON(object.requestFinalizeBlock) + : undefined, + responseFinalizeBlock: isSet(object.responseFinalizeBlock) + ? ResponseFinalizeBlock.fromJSON(object.responseFinalizeBlock) + : undefined, + }; + }, + + toJSON(message: BlockMetadata): unknown { + const obj: any = {}; + if (message.responseCommit !== undefined) { + obj.responseCommit = ResponseCommit.toJSON(message.responseCommit); + } + if (message.requestFinalizeBlock !== undefined) { + obj.requestFinalizeBlock = RequestFinalizeBlock.toJSON(message.requestFinalizeBlock); + } + if (message.responseFinalizeBlock !== undefined) { + obj.responseFinalizeBlock = ResponseFinalizeBlock.toJSON(message.responseFinalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): BlockMetadata { + return BlockMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMetadata { + const message = createBaseBlockMetadata(); + message.responseCommit = (object.responseCommit !== undefined && object.responseCommit !== null) + ? ResponseCommit.fromPartial(object.responseCommit) + : undefined; + message.requestFinalizeBlock = (object.requestFinalizeBlock !== undefined && object.requestFinalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.requestFinalizeBlock) + : undefined; + message.responseFinalizeBlock = + (object.responseFinalizeBlock !== undefined && object.responseFinalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.responseFinalizeBlock) + : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/tx/config/v1/config.ts b/ts-client/cosmos.circuit.v1/types/cosmos/tx/config/v1/config.ts new file mode 100644 index 00000000..aa780391 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/tx/config/v1/config.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/config/v1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.tx.config.v1"; + +/** Config is the config object of the x/auth/tx package. */ +export interface Config { + /** + * skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipAnteHandler: boolean; + /** + * skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipPostHandler: boolean; +} + +function createBaseConfig(): Config { + return { skipAnteHandler: false, skipPostHandler: false }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.skipAnteHandler !== false) { + writer.uint32(8).bool(message.skipAnteHandler); + } + if (message.skipPostHandler !== false) { + writer.uint32(16).bool(message.skipPostHandler); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.skipAnteHandler = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.skipPostHandler = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + skipAnteHandler: isSet(object.skipAnteHandler) ? globalThis.Boolean(object.skipAnteHandler) : false, + skipPostHandler: isSet(object.skipPostHandler) ? globalThis.Boolean(object.skipPostHandler) : false, + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.skipAnteHandler !== false) { + obj.skipAnteHandler = message.skipAnteHandler; + } + if (message.skipPostHandler !== false) { + obj.skipPostHandler = message.skipPostHandler; + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.skipAnteHandler = object.skipAnteHandler ?? false; + message.skipPostHandler = object.skipPostHandler ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/tx/signing/v1beta1/signing.ts b/ts-client/cosmos.circuit.v1/types/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 00000000..35f6e628 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,620 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/signing/v1beta1/signing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + * + * Since: cosmos-sdk 0.50 + */ + SIGN_MODE_TEXTUAL = 2, + /** + * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses + * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not + * require signers signing over other signers' `signer_info`. + * + * Since: cosmos-sdk 0.46 + */ + SIGN_MODE_DIRECT_AUX = 3, + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future. + */ + SIGN_MODE_LEGACY_AMINO_JSON = 127, + /** + * SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + * SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + * + * Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + * but is not implemented on the SDK by default. To enable EIP-191, you need + * to pass a custom `TxConfig` that has an implementation of + * `SignModeHandler` for EIP-191. The SDK may decide to fully support + * EIP-191 in the future. + * + * Since: cosmos-sdk 0.45.2 + */ + SIGN_MODE_EIP_191 = 191, + UNRECOGNIZED = -1, +} + +export function signModeFromJSON(object: any): SignMode { + switch (object) { + case 0: + case "SIGN_MODE_UNSPECIFIED": + return SignMode.SIGN_MODE_UNSPECIFIED; + case 1: + case "SIGN_MODE_DIRECT": + return SignMode.SIGN_MODE_DIRECT; + case 2: + case "SIGN_MODE_TEXTUAL": + return SignMode.SIGN_MODE_TEXTUAL; + case 3: + case "SIGN_MODE_DIRECT_AUX": + return SignMode.SIGN_MODE_DIRECT_AUX; + case 127: + case "SIGN_MODE_LEGACY_AMINO_JSON": + return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + case 191: + case "SIGN_MODE_EIP_191": + return SignMode.SIGN_MODE_EIP_191; + case -1: + case "UNRECOGNIZED": + default: + return SignMode.UNRECOGNIZED; + } +} + +export function signModeToJSON(object: SignMode): string { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return "SIGN_MODE_UNSPECIFIED"; + case SignMode.SIGN_MODE_DIRECT: + return "SIGN_MODE_DIRECT"; + case SignMode.SIGN_MODE_TEXTUAL: + return "SIGN_MODE_TEXTUAL"; + case SignMode.SIGN_MODE_DIRECT_AUX: + return "SIGN_MODE_DIRECT_AUX"; + case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: + return "SIGN_MODE_LEGACY_AMINO_JSON"; + case SignMode.SIGN_MODE_EIP_191: + return "SIGN_MODE_EIP_191"; + case SignMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} + +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + publicKey: Any | undefined; + data: + | SignatureDescriptor_Data + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_Data[]; +} + +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { signatures: [] }; +} + +export const SignatureDescriptors: MessageFns = { + encode(message: SignatureDescriptors, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptors(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptors { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptors): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptors { + return SignatureDescriptors.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map((e) => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { publicKey: undefined, data: undefined, sequence: 0 }; +} + +export const SignatureDescriptor: MessageFns = { + encode(message: SignatureDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + data: isSet(object.data) ? SignatureDescriptor_Data.fromJSON(object.data) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.data !== undefined) { + obj.data = SignatureDescriptor_Data.toJSON(message.data); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor { + return SignatureDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.data = (object.data !== undefined && object.data !== null) + ? SignatureDescriptor_Data.fromPartial(object.data) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { + return { single: undefined, multi: undefined }; +} + +export const SignatureDescriptor_Data: MessageFns = { + encode(message: SignatureDescriptor_Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = SignatureDescriptor_Data_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = SignatureDescriptor_Data_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data { + return SignatureDescriptor_Data.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SignatureDescriptor_Data_Single: MessageFns = { + encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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(0), + }; + }, + + toJSON(message: SignatureDescriptor_Data_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { + return { bitarray: undefined, signatures: [] }; +} + +export const SignatureDescriptor_Data_Multi: MessageFns = { + encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.signatures) { + SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor_Data_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptor_Data_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor_Data.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/tx/v1beta1/service.ts b/ts-client/cosmos.circuit.v1/types/cosmos/tx/v1beta1/service.ts new file mode 100644 index 00000000..411f1dc2 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,1855 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 - DEPRECATED: use BROADCAST_MODE_SYNC instead, + * BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + * + * @deprecated + */ + 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. + * Deprecated post v0.47.x: use query instead, which should contain a valid + * events query. + * + * @deprecated + */ + events: string[]; + /** + * pagination defines a pagination for the request. + * Deprecated post v0.46.x: use page and limit instead. + * + * @deprecated + */ + pagination: PageRequest | undefined; + orderBy: OrderBy; + /** + * page is the page number to query, starts at 1. If not provided, will + * default to first page. + */ + page: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * query defines the transaction event query that is proxied to Tendermint's + * TxSearch RPC method. The query must be valid. + * + * Since cosmos-sdk 0.50 + */ + query: string; +} + +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponse { + /** txs is the list of queried transactions. */ + txs: Tx[]; + /** tx_responses is the list of queried TxResponses. */ + txResponses: TxResponse[]; + /** + * pagination defines a pagination for the response. + * Deprecated post v0.46.x: use total instead. + * + * @deprecated + */ + pagination: + | PageResponse + | undefined; + /** total is total number of results available */ + total: number; +} + +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; + mode: BroadcastMode; +} + +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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 + | undefined; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + txBytes: 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. */ + gasInfo: + | GasInfo + | undefined; + /** result is the result of the simulation. */ + result: Result | undefined; +} + +/** + * 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 + | undefined; + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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: number; + /** pagination defines a pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponse { + /** txs are the transactions in the block. */ + txs: Tx[]; + blockId: BlockID | undefined; + block: + | Block + | undefined; + /** pagination defines a pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; +} + +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponse { + /** tx is the decoded transaction. */ + tx: Tx | undefined; +} + +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequest { + /** tx is the transaction to encode. */ + tx: Tx | undefined; +} + +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponse { + /** tx_bytes is the encoded transaction bytes. */ + txBytes: Uint8Array; +} + +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequest { + aminoJson: string; +} + +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponse { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequest { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponse { + aminoJson: string; +} + +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { events: [], pagination: undefined, orderBy: 0, page: 0, limit: 0, query: "" }; +} + +export const GetTxsEventRequest: MessageFns = { + encode(message: GetTxsEventRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.orderBy !== 0) { + writer.uint32(24).int32(message.orderBy); + } + if (message.page !== 0) { + writer.uint32(32).uint64(message.page); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + if (message.query !== "") { + writer.uint32(50).string(message.query); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.orderBy = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.page = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventRequest { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0, + page: isSet(object.page) ? globalThis.Number(object.page) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + query: isSet(object.query) ? globalThis.String(object.query) : "", + }; + }, + + toJSON(message: GetTxsEventRequest): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.orderBy !== 0) { + obj.orderBy = orderByToJSON(message.orderBy); + } + if (message.page !== 0) { + obj.page = Math.round(message.page); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.query !== "") { + obj.query = message.query; + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventRequest { + return GetTxsEventRequest.fromPartial(base ?? ({} as any)); + }, + 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.orderBy = object.orderBy ?? 0; + message.page = object.page ?? 0; + message.limit = object.limit ?? 0; + message.query = object.query ?? ""; + return message; + }, +}; + +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { txs: [], txResponses: [], pagination: undefined, total: 0 }; +} + +export const GetTxsEventResponse: MessageFns = { + encode(message: GetTxsEventResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResponses) { + TxResponse.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + if (message.total !== 0) { + writer.uint32(32).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponses.push(TxResponse.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + txResponses: globalThis.Array.isArray(object?.txResponses) + ? object.txResponses.map((e: any) => TxResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: GetTxsEventResponse): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.txResponses?.length) { + obj.txResponses = message.txResponses.map((e) => TxResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventResponse { + return GetTxsEventResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.txResponses = object.txResponses?.map((e) => TxResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.total = object.total ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { txBytes: new Uint8Array(0), mode: 0 }; +} + +export const BroadcastTxRequest: MessageFns = { + encode(message: BroadcastTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxRequest { + return { + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0, + }; + }, + + toJSON(message: BroadcastTxRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + if (message.mode !== 0) { + obj.mode = broadcastModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxRequest { + return BroadcastTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + message.mode = object.mode ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { txResponse: undefined }; +} + +export const BroadcastTxResponse: MessageFns = { + encode(message: BroadcastTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxResponse { + return { txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined }; + }, + + toJSON(message: BroadcastTxResponse): unknown { + const obj: any = {}; + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxResponse { + return BroadcastTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseSimulateRequest(): SimulateRequest { + return { tx: undefined, txBytes: new Uint8Array(0) }; +} + +export const SimulateRequest: MessageFns = { + encode(message: SimulateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txBytes.length !== 0) { + writer.uint32(18).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateRequest { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + }; + }, + + toJSON(message: SimulateRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): SimulateRequest { + return SimulateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSimulateResponse(): SimulateResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulateResponse: MessageFns = { + encode(message: SimulateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulateResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulateResponse { + return SimulateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateResponse { + const message = createBaseSimulateResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseGetTxRequest(): GetTxRequest { + return { hash: "" }; +} + +export const GetTxRequest: MessageFns = { + encode(message: GetTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxRequest { + return { hash: isSet(object.hash) ? globalThis.String(object.hash) : "" }; + }, + + toJSON(message: GetTxRequest): unknown { + const obj: any = {}; + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): GetTxRequest { + return GetTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseGetTxResponse(): GetTxResponse { + return { tx: undefined, txResponse: undefined }; +} + +export const GetTxResponse: MessageFns = { + encode(message: GetTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxResponse { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined, + }; + }, + + toJSON(message: GetTxResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): GetTxResponse { + return GetTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { height: 0, pagination: undefined }; +} + +export const GetBlockWithTxsRequest: MessageFns = { + encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.fromPartial(base ?? ({} as any)); + }, + 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: [], blockId: undefined, block: undefined, pagination: undefined }; +} + +export const GetBlockWithTxsResponse: MessageFns = { + encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(18).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(26).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : 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?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseTxDecodeRequest(): TxDecodeRequest { + return { txBytes: new Uint8Array(0) }; +} + +export const TxDecodeRequest: MessageFns = { + encode(message: TxDecodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeRequest { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeRequest { + return TxDecodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeResponse(): TxDecodeResponse { + return { tx: undefined }; +} + +export const TxDecodeResponse: MessageFns = { + encode(message: TxDecodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeResponse { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxDecodeResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeResponse { + return TxDecodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeRequest(): TxEncodeRequest { + return { tx: undefined }; +} + +export const TxEncodeRequest: MessageFns = { + encode(message: TxEncodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeRequest { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxEncodeRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeRequest { + return TxEncodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeResponse(): TxEncodeResponse { + return { txBytes: new Uint8Array(0) }; +} + +export const TxEncodeResponse: MessageFns = { + encode(message: TxEncodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeResponse { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeResponse): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeResponse { + return TxEncodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxEncodeAminoRequest(): TxEncodeAminoRequest { + return { aminoJson: "" }; +} + +export const TxEncodeAminoRequest: MessageFns = { + encode(message: TxEncodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoRequest { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxEncodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoRequest { + return TxEncodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, +}; + +function createBaseTxEncodeAminoResponse(): TxEncodeAminoResponse { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxEncodeAminoResponse: MessageFns = { + encode(message: TxEncodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoResponse { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoResponse { + return TxEncodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoRequest(): TxDecodeAminoRequest { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxDecodeAminoRequest: MessageFns = { + encode(message: TxDecodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoRequest { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoRequest { + return TxDecodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoResponse(): TxDecodeAminoResponse { + return { aminoJson: "" }; +} + +export const TxDecodeAminoResponse: MessageFns = { + encode(message: TxDecodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoResponse { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxDecodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoResponse { + return TxDecodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + message.aminoJson = object.aminoJson ?? ""; + 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; + /** + * TxDecode decodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxDecode(request: TxDecodeRequest): Promise; + /** + * TxEncode encodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxEncode(request: TxEncodeRequest): Promise; + /** + * TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. + * + * Since: cosmos-sdk 0.47 + */ + TxEncodeAmino(request: TxEncodeAminoRequest): Promise; + /** + * TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. + * + * Since: cosmos-sdk 0.47 + */ + TxDecodeAmino(request: TxDecodeAminoRequest): Promise; +} + +export const ServiceServiceName = "cosmos.tx.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.TxDecode = this.TxDecode.bind(this); + this.TxEncode = this.TxEncode.bind(this); + this.TxEncodeAmino = this.TxEncodeAmino.bind(this); + this.TxDecodeAmino = this.TxDecodeAmino.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + TxDecode(request: TxDecodeRequest): Promise { + const data = TxDecodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecode", data); + return promise.then((data) => TxDecodeResponse.decode(new BinaryReader(data))); + } + + TxEncode(request: TxEncodeRequest): Promise { + const data = TxEncodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncode", data); + return promise.then((data) => TxEncodeResponse.decode(new BinaryReader(data))); + } + + TxEncodeAmino(request: TxEncodeAminoRequest): Promise { + const data = TxEncodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncodeAmino", data); + return promise.then((data) => TxEncodeAminoResponse.decode(new BinaryReader(data))); + } + + TxDecodeAmino(request: TxDecodeAminoRequest): Promise { + const data = TxDecodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecodeAmino", data); + return promise.then((data) => TxDecodeAminoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/tx/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 00000000..f2c427d1 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,1615 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + authInfo: + | AuthInfo + | undefined; + /** + * 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. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + authInfoBytes: Uint8Array; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} + +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDoc { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + authInfoBytes: Uint8Array; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chainId: string; + /** account_number is the account number of the account in state */ + accountNumber: number; +} + +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAux { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** public_key is the public key of the signing account. */ + publicKey: + | Any + | undefined; + /** + * chain_id is the identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker. + */ + chainId: string; + /** account_number is the account number of the account in state. */ + accountNumber: number; + /** sequence is the sequence number of the signing account. */ + sequence: number; + /** + * tips have been depreacted and should not be used + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBody { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages: Any[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeoutHeight: number; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extensionOptions: Any[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + nonCriticalExtensionOptions: Any[]; +} + +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfo { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signerInfos: SignerInfo[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee: + | Fee + | undefined; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + * + * Since: cosmos-sdk 0.46 + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfo { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + publicKey: + | Any + | undefined; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + modeInfo: + | ModeInfo + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + modeInfos: 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 + */ + gasLimit: number; + /** + * 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 + * + * @deprecated + */ +export interface Tip { + /** amount is the amount of the tip */ + amount: Coin[]; + /** tipper is the address of the account paying for the tip */ + tipper: string; +} + +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerData { + /** + * address is the bech32-encoded address of the auxiliary signer. If using + * AuxSignerData across different chains, the bech32 prefix of the target + * chain (where the final transaction is broadcasted) should be used. + */ + address: string; + /** + * sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + * signs. Note: we use the same sign doc even if we're signing with + * LEGACY_AMINO_JSON. + */ + signDoc: + | SignDocDirectAux + | undefined; + /** 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, authInfo: undefined, signatures: [] }; +} + +export const Tx: MessageFns = { + encode(message: Tx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).join(); + } + if (message.authInfo !== undefined) { + AuthInfo.encode(message.authInfo, writer.uint32(18).fork()).join(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.body = TxBody.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfo = AuthInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tx { + return { + body: isSet(object.body) ? TxBody.fromJSON(object.body) : undefined, + authInfo: isSet(object.authInfo) ? AuthInfo.fromJSON(object.authInfo) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Tx): unknown { + const obj: any = {}; + if (message.body !== undefined) { + obj.body = TxBody.toJSON(message.body); + } + if (message.authInfo !== undefined) { + obj.authInfo = AuthInfo.toJSON(message.authInfo); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Tx { + return Tx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Tx { + const message = createBaseTx(); + message.body = (object.body !== undefined && object.body !== null) ? TxBody.fromPartial(object.body) : undefined; + message.authInfo = (object.authInfo !== undefined && object.authInfo !== null) + ? AuthInfo.fromPartial(object.authInfo) + : undefined; + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTxRaw(): TxRaw { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), signatures: [] }; +} + +export const TxRaw: MessageFns = { + encode(message: TxRaw, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRaw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxRaw { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: TxRaw): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): TxRaw { + return TxRaw.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxRaw { + const message = createBaseTxRaw(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSignDoc(): SignDoc { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), chainId: "", accountNumber: 0 }; +} + +export const SignDoc: MessageFns = { + encode(message: SignDoc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDoc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDoc { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + }; + }, + + toJSON(message: SignDoc): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + return obj; + }, + + create, I>>(base?: I): SignDoc { + return SignDoc.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDoc { + const message = createBaseSignDoc(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 0; + return message; + }, +}; + +function createBaseSignDocDirectAux(): SignDocDirectAux { + return { + bodyBytes: new Uint8Array(0), + publicKey: undefined, + chainId: "", + accountNumber: 0, + sequence: 0, + tip: undefined, + }; +} + +export const SignDocDirectAux: MessageFns = { + encode(message: SignDocDirectAux, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(18).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(40).uint64(message.sequence); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDocDirectAux(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDocDirectAux { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined, + }; + }, + + toJSON(message: SignDocDirectAux): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): SignDocDirectAux { + return SignDocDirectAux.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 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: "", timeoutHeight: 0, extensionOptions: [], nonCriticalExtensionOptions: [] }; +} + +export const TxBody: MessageFns = { + encode(message: TxBody, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (message.timeoutHeight !== 0) { + writer.uint32(24).uint64(message.timeoutHeight); + } + for (const v of message.extensionOptions) { + Any.encode(v!, writer.uint32(8186).fork()).join(); + } + for (const v of message.nonCriticalExtensionOptions) { + Any.encode(v!, writer.uint32(16378).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.memo = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.timeoutHeight = longToNumber(reader.uint64()); + continue; + case 1023: + if (tag !== 8186) { + break; + } + + message.extensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + case 2047: + if (tag !== 16378) { + break; + } + + message.nonCriticalExtensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxBody { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + memo: isSet(object.memo) ? globalThis.String(object.memo) : "", + timeoutHeight: isSet(object.timeoutHeight) ? globalThis.Number(object.timeoutHeight) : 0, + extensionOptions: globalThis.Array.isArray(object?.extensionOptions) + ? object.extensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + nonCriticalExtensionOptions: globalThis.Array.isArray(object?.nonCriticalExtensionOptions) + ? object.nonCriticalExtensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.memo !== "") { + obj.memo = message.memo; + } + if (message.timeoutHeight !== 0) { + obj.timeoutHeight = Math.round(message.timeoutHeight); + } + if (message.extensionOptions?.length) { + obj.extensionOptions = message.extensionOptions.map((e) => Any.toJSON(e)); + } + if (message.nonCriticalExtensionOptions?.length) { + obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxBody { + return TxBody.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeoutHeight = object.timeoutHeight ?? 0; + message.extensionOptions = object.extensionOptions?.map((e) => Any.fromPartial(e)) || []; + message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAuthInfo(): AuthInfo { + return { signerInfos: [], fee: undefined, tip: undefined }; +} + +export const AuthInfo: MessageFns = { + encode(message: AuthInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signerInfos) { + SignerInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fee !== undefined) { + Fee.encode(message.fee, writer.uint32(18).fork()).join(); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signerInfos.push(SignerInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fee = Fee.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthInfo { + return { + signerInfos: globalThis.Array.isArray(object?.signerInfos) + ? object.signerInfos.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.signerInfos?.length) { + obj.signerInfos = message.signerInfos.map((e) => SignerInfo.toJSON(e)); + } + if (message.fee !== undefined) { + obj.fee = Fee.toJSON(message.fee); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): AuthInfo { + return AuthInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signerInfos?.map((e) => SignerInfo.fromPartial(e)) || []; + message.fee = (object.fee !== undefined && object.fee !== null) ? Fee.fromPartial(object.fee) : undefined; + message.tip = (object.tip !== undefined && object.tip !== null) ? Tip.fromPartial(object.tip) : undefined; + return message; + }, +}; + +function createBaseSignerInfo(): SignerInfo { + return { publicKey: undefined, modeInfo: undefined, sequence: 0 }; +} + +export const SignerInfo: MessageFns = { + encode(message: SignerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.modeInfo !== undefined) { + ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfo = ModeInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignerInfo { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + modeInfo: isSet(object.modeInfo) ? ModeInfo.fromJSON(object.modeInfo) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.modeInfo !== undefined) { + obj.modeInfo = ModeInfo.toJSON(message.modeInfo); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignerInfo { + return SignerInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignerInfo { + const message = createBaseSignerInfo(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.modeInfo = (object.modeInfo !== undefined && object.modeInfo !== null) + ? ModeInfo.fromPartial(object.modeInfo) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModeInfo(): ModeInfo { + return { single: undefined, multi: undefined }; +} + +export const ModeInfo: MessageFns = { + encode(message: ModeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + ModeInfo_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = ModeInfo_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = ModeInfo_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = ModeInfo_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = ModeInfo_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo { + return ModeInfo.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ModeInfo_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Single { + return { mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; + }, + + toJSON(message: ModeInfo_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Single { + return ModeInfo_Single.fromPartial(base ?? ({} as any)); + }, + 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, modeInfos: [] }; +} + +export const ModeInfo_Multi: MessageFns = { + encode(message: ModeInfo_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.modeInfos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfos.push(ModeInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + modeInfos: globalThis.Array.isArray(object?.modeInfos) + ? object.modeInfos.map((e: any) => ModeInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModeInfo_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.modeInfos?.length) { + obj.modeInfos = message.modeInfos.map((e) => ModeInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Multi { + return ModeInfo_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + message.bitarray = (object.bitarray !== undefined && object.bitarray !== null) + ? CompactBitArray.fromPartial(object.bitarray) + : undefined; + message.modeInfos = object.modeInfos?.map((e) => ModeInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFee(): Fee { + return { amount: [], gasLimit: 0, payer: "", granter: "" }; +} + +export const Fee: MessageFns = { + encode(message: Fee, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.gasLimit !== 0) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.payer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.granter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Fee { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + gasLimit: isSet(object.gasLimit) ? globalThis.Number(object.gasLimit) : 0, + payer: isSet(object.payer) ? globalThis.String(object.payer) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + }; + }, + + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.gasLimit !== 0) { + obj.gasLimit = Math.round(message.gasLimit); + } + if (message.payer !== "") { + obj.payer = message.payer; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + return obj; + }, + + create, I>>(base?: I): Fee { + return Fee.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.gasLimit = object.gasLimit ?? 0; + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, +}; + +function createBaseTip(): Tip { + return { amount: [], tipper: "" }; +} + +export const Tip: MessageFns = { + encode(message: Tip, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.tipper !== "") { + writer.uint32(18).string(message.tipper); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tip { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTip(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tipper = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tip { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + tipper: isSet(object.tipper) ? globalThis.String(object.tipper) : "", + }; + }, + + toJSON(message: Tip): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.tipper !== "") { + obj.tipper = message.tipper; + } + return obj; + }, + + create, I>>(base?: I): Tip { + return Tip.fromPartial(base ?? ({} as any)); + }, + 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: "", signDoc: undefined, mode: 0, sig: new Uint8Array(0) }; +} + +export const AuxSignerData: MessageFns = { + encode(message: AuxSignerData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.signDoc !== undefined) { + SignDocDirectAux.encode(message.signDoc, writer.uint32(18).fork()).join(); + } + if (message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + if (message.sig.length !== 0) { + writer.uint32(34).bytes(message.sig); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuxSignerData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signDoc = SignDocDirectAux.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sig = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuxSignerData { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array(0), + }; + }, + + toJSON(message: AuxSignerData): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.signDoc !== undefined) { + obj.signDoc = SignDocDirectAux.toJSON(message.signDoc); + } + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.sig.length !== 0) { + obj.sig = base64FromBytes(message.sig); + } + return obj; + }, + + create, I>>(base?: I): AuxSignerData { + return AuxSignerData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuxSignerData { + const message = createBaseAuxSignerData(); + message.address = object.address ?? ""; + message.signDoc = (object.signDoc !== undefined && object.signDoc !== null) + ? SignDocDirectAux.fromPartial(object.signDoc) + : undefined; + message.mode = object.mode ?? 0; + message.sig = object.sig ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/module/v1/module.ts new file mode 100644 index 00000000..2bec3886 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.upgrade.module.v1"; + +/** Module is the config object of the upgrade module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/query.ts b/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 00000000..39cddba7 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,811 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * 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: number; +} + +/** + * 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 + */ + lastHeight: number; +} + +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + * + * @deprecated + */ +export interface QueryUpgradedConsensusStateResponse { + /** Since: cosmos-sdk 0.43 */ + upgradedConsensusState: 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 + */ + moduleName: 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. */ + moduleVersions: 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: MessageFns = { + encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCurrentPlanRequest { + return {}; + }, + + toJSON(_: QueryCurrentPlanRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, +}; + +function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { + return { plan: undefined }; +} + +export const QueryCurrentPlanResponse: MessageFns = { + encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCurrentPlanResponse { + return { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; + }, + + toJSON(message: QueryCurrentPlanResponse): unknown { + const obj: any = {}; + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryAppliedPlanRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { + return { height: 0 }; +} + +export const QueryAppliedPlanResponse: MessageFns = { + encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryAppliedPlanResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return { lastHeight: 0 }; +} + +export const QueryUpgradedConsensusStateRequest: MessageFns = { + encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.lastHeight !== 0) { + writer.uint32(8).int64(message.lastHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.lastHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateRequest { + return { lastHeight: isSet(object.lastHeight) ? globalThis.Number(object.lastHeight) : 0 }; + }, + + toJSON(message: QueryUpgradedConsensusStateRequest): unknown { + const obj: any = {}; + if (message.lastHeight !== 0) { + obj.lastHeight = Math.round(message.lastHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + message.lastHeight = object.lastHeight ?? 0; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { upgradedConsensusState: new Uint8Array(0) }; +} + +export const QueryUpgradedConsensusStateResponse: MessageFns = { + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.upgradedConsensusState.length !== 0) { + writer.uint32(18).bytes(message.upgradedConsensusState); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.upgradedConsensusState = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: isSet(object.upgradedConsensusState) + ? bytesFromBase64(object.upgradedConsensusState) + : new Uint8Array(0), + }; + }, + + toJSON(message: QueryUpgradedConsensusStateResponse): unknown { + const obj: any = {}; + if (message.upgradedConsensusState.length !== 0) { + obj.upgradedConsensusState = base64FromBytes(message.upgradedConsensusState); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgradedConsensusState = object.upgradedConsensusState ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { + return { moduleName: "" }; +} + +export const QueryModuleVersionsRequest: MessageFns = { + encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsRequest { + return { moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "" }; + }, + + toJSON(message: QueryModuleVersionsRequest): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + message.moduleName = object.moduleName ?? ""; + return message; + }, +}; + +function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { + return { moduleVersions: [] }; +} + +export const QueryModuleVersionsResponse: MessageFns = { + encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.moduleVersions) { + ModuleVersion.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.moduleVersions.push(ModuleVersion.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsResponse { + return { + moduleVersions: globalThis.Array.isArray(object?.moduleVersions) + ? object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryModuleVersionsResponse): unknown { + const obj: any = {}; + if (message.moduleVersions?.length) { + obj.moduleVersions = message.moduleVersions.map((e) => ModuleVersion.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.moduleVersions = object.moduleVersions?.map((e) => ModuleVersion.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { + return {}; +} + +export const QueryAuthorityRequest: MessageFns = { + encode(_: QueryAuthorityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAuthorityRequest { + return {}; + }, + + toJSON(_: QueryAuthorityRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAuthorityRequest { + return QueryAuthorityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAuthorityRequest { + const message = createBaseQueryAuthorityRequest(); + return message; + }, +}; + +function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { + return { address: "" }; +} + +export const QueryAuthorityResponse: MessageFns = { + encode(message: QueryAuthorityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorityResponse { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAuthorityResponse): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorityResponse { + return QueryAuthorityResponse.fromPartial(base ?? ({} as any)); + }, + 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 + * + * Since: cosmos-sdk 0.46 + */ + Authority(request: QueryAuthorityRequest): Promise; +} + +export const QueryServiceName = "cosmos.upgrade.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/tx.ts new file mode 100644 index 00000000..48e7cf58 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/tx.ts @@ -0,0 +1,337 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Plan } from "./upgrade"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgrade { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** plan is the upgrade plan. */ + plan: Plan | undefined; +} + +/** + * 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 that controls the module (defaults to x/gov unless overwritten). */ + 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: MessageFns = { + encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSoftwareUpgrade { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: MsgSoftwareUpgrade): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgSoftwareUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSoftwareUpgradeResponse { + return {}; + }, + + toJSON(_: MsgSoftwareUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSoftwareUpgradeResponse { + const message = createBaseMsgSoftwareUpgradeResponse(); + return message; + }, +}; + +function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { + return { authority: "" }; +} + +export const MsgCancelUpgrade: MessageFns = { + encode(message: MsgCancelUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelUpgrade { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: MsgCancelUpgrade): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): MsgCancelUpgrade { + return MsgCancelUpgrade.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelUpgrade { + const message = createBaseMsgCancelUpgrade(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { + return {}; +} + +export const MsgCancelUpgradeResponse: MessageFns = { + encode(_: MsgCancelUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelUpgradeResponse { + return {}; + }, + + toJSON(_: MsgCancelUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.fromPartial(base ?? ({} as any)); + }, + 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 + * approved software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + CancelUpgrade(request: MsgCancelUpgrade): Promise; +} + +export const MsgServiceName = "cosmos.upgrade.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/upgrade.ts b/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 00000000..30096c1f --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,513 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/upgrade.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** The height at which the upgrade must be performed. */ + height: number; + /** + * Any application specific upgrade info to be included on-chain + * such as a git commit that validators could automatically upgrade to + */ + info: string; + /** + * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + * moved to the IBC module in the sub module 02-client. + * If this field is not empty, an error will be thrown. + * + * @deprecated + */ + upgradedClientState: Any | undefined; +} + +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + * + * @deprecated + */ +export interface SoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; + /** plan of the proposal */ + plan: Plan | undefined; +} + +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + * + * @deprecated + */ +export interface CancelSoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; +} + +/** + * 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: number; +} + +function createBasePlan(): Plan { + return { name: "", time: undefined, height: 0, info: "", upgradedClientState: undefined }; +} + +export const Plan: MessageFns = { + encode(message: Plan, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Plan { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.upgradedClientState = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Plan { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + info: isSet(object.info) ? globalThis.String(object.info) : "", + upgradedClientState: isSet(object.upgradedClientState) ? Any.fromJSON(object.upgradedClientState) : undefined, + }; + }, + + toJSON(message: Plan): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.upgradedClientState !== undefined) { + obj.upgradedClientState = Any.toJSON(message.upgradedClientState); + } + return obj; + }, + + create, I>>(base?: I): Plan { + return Plan.fromPartial(base ?? ({} as any)); + }, + 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.upgradedClientState = (object.upgradedClientState !== undefined && object.upgradedClientState !== null) + ? Any.fromPartial(object.upgradedClientState) + : undefined; + return message; + }, +}; + +function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { + return { title: "", description: "", plan: undefined }; +} + +export const SoftwareUpgradeProposal: MessageFns = { + encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: SoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CancelSoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: CancelSoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ModuleVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.version !== 0) { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleVersion { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: ModuleVersion): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): ModuleVersion { + return ModuleVersion.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/vesting/module/v1/module.ts b/ts-client/cosmos.circuit.v1/types/cosmos/vesting/module/v1/module.ts new file mode 100644 index 00000000..99609e8c --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/vesting/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.vesting.module.v1"; + +/** Module is the config object of the vesting module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/vesting/v1beta1/tx.ts b/ts-client/cosmos.circuit.v1/types/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 00000000..034b0314 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,628 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + fromAddress: string; + toAddress: string; + amount: Coin[]; + /** end of vesting as unix time (in seconds). */ + endTime: number; + delayed: boolean; +} + +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponse { +} + +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; +} + +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponse { +} + +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccount { + fromAddress: string; + toAddress: string; + /** start of vesting as unix time (in seconds). */ + startTime: number; + vestingPeriods: Period[]; +} + +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponse { +} + +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { fromAddress: "", toAddress: "", amount: [], endTime: 0, delayed: false }; +} + +export const MsgCreateVestingAccount: MessageFns = { + encode(message: MsgCreateVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(32).int64(message.endTime); + } + if (message.delayed !== false) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.delayed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + delayed: isSet(object.delayed) ? globalThis.Boolean(object.delayed) : false, + }; + }, + + toJSON(message: MsgCreateVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + if (message.delayed !== false) { + obj.delayed = message.delayed; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccount { + return MsgCreateVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + message.delayed = object.delayed ?? false; + return message; + }, +}; + +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} + +export const MsgCreateVestingAccountResponse: MessageFns = { + encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreateVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgCreatePermanentLockedAccount: MessageFns = { + encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePermanentLockedAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCreatePermanentLockedAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { + return {}; +} + +export const MsgCreatePermanentLockedAccountResponse: MessageFns = { + encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePermanentLockedAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { + return { fromAddress: "", toAddress: "", startTime: 0, vestingPeriods: [] }; +} + +export const MsgCreatePeriodicVestingAccount: MessageFns = { + encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + if (message.startTime !== 0) { + writer.uint32(24).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePeriodicVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreatePeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { + return {}; +} + +export const MsgCreatePeriodicVestingAccountResponse: MessageFns = { + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePeriodicVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + CreatePermanentLockedAccount( + request: MsgCreatePermanentLockedAccount, + ): Promise; + /** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * + * Since: cosmos-sdk 0.46 + */ + CreatePeriodicVestingAccount( + request: MsgCreatePeriodicVestingAccount, + ): Promise; +} + +export const MsgServiceName = "cosmos.vesting.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos/vesting/v1beta1/vesting.ts b/ts-client/cosmos.circuit.v1/types/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 00000000..0fe13459 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,610 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/vesting.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + baseAccount: BaseAccount | undefined; + originalVesting: Coin[]; + delegatedFree: Coin[]; + delegatedVesting: Coin[]; + /** Vesting end time, as unix timestamp (in seconds). */ + endTime: number; +} + +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccount { + baseVestingAccount: + | BaseVestingAccount + | undefined; + /** Vesting start time, as unix timestamp (in seconds). */ + startTime: number; +} + +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; +} + +/** Period defines a length of time and amount of coins that will vest. */ +export interface Period { + /** Period duration in seconds. */ + length: number; + amount: Coin[]; +} + +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; + startTime: number; + vestingPeriods: 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 { + baseVestingAccount: BaseVestingAccount | undefined; +} + +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { baseAccount: undefined, originalVesting: [], delegatedFree: [], delegatedVesting: [], endTime: 0 }; +} + +export const BaseVestingAccount: MessageFns = { + encode(message: BaseVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + for (const v of message.originalVesting) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatedFree) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.delegatedVesting) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(40).int64(message.endTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.originalVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatedFree.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatedVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseVestingAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + originalVesting: globalThis.Array.isArray(object?.originalVesting) + ? object.originalVesting.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedFree: globalThis.Array.isArray(object?.delegatedFree) + ? object.delegatedFree.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedVesting: globalThis.Array.isArray(object?.delegatedVesting) + ? object.delegatedVesting.map((e: any) => Coin.fromJSON(e)) + : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + }; + }, + + toJSON(message: BaseVestingAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.originalVesting?.length) { + obj.originalVesting = message.originalVesting.map((e) => Coin.toJSON(e)); + } + if (message.delegatedFree?.length) { + obj.delegatedFree = message.delegatedFree.map((e) => Coin.toJSON(e)); + } + if (message.delegatedVesting?.length) { + obj.delegatedVesting = message.delegatedVesting.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + return obj; + }, + + create, I>>(base?: I): BaseVestingAccount { + return BaseVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.originalVesting = object.originalVesting?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedFree = object.delegatedFree?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedVesting = object.delegatedVesting?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + return message; + }, +}; + +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { baseVestingAccount: undefined, startTime: 0 }; +} + +export const ContinuousVestingAccount: MessageFns = { + encode(message: ContinuousVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContinuousVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + }; + }, + + toJSON(message: ContinuousVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + return obj; + }, + + create, I>>(base?: I): ContinuousVestingAccount { + return ContinuousVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + return message; + }, +}; + +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { baseVestingAccount: undefined }; +} + +export const DelayedVestingAccount: MessageFns = { + encode(message: DelayedVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelayedVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: DelayedVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): DelayedVestingAccount { + return DelayedVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +function createBasePeriod(): Period { + return { length: 0, amount: [] }; +} + +export const Period: MessageFns = { + encode(message: Period, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.length !== 0) { + writer.uint32(8).int64(message.length); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Period { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.length = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Period { + return { + length: isSet(object.length) ? globalThis.Number(object.length) : 0, + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Period): unknown { + const obj: any = {}; + if (message.length !== 0) { + obj.length = Math.round(message.length); + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Period { + return Period.fromPartial(base ?? ({} as any)); + }, + 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 { baseVestingAccount: undefined, startTime: 0, vestingPeriods: [] }; +} + +export const PeriodicVestingAccount: MessageFns = { + encode(message: PeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeriodicVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PeriodicVestingAccount { + return PeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { baseVestingAccount: undefined }; +} + +export const PermanentLockedAccount: MessageFns = { + encode(message: PermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PermanentLockedAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: PermanentLockedAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): PermanentLockedAccount { + return PermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.circuit.v1/types/cosmos_proto/cosmos.ts new file mode 100644 index 00000000..d95b944f --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/cosmos_proto/cosmos.ts @@ -0,0 +1,302 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos_proto"; + +export enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1, +} + +export function scalarTypeFromJSON(object: any): ScalarType { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} + +export function scalarTypeToJSON(object: ScalarType): string { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} + +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { name: "", description: "" }; +} + +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + 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 ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseScalarDescriptor(): ScalarDescriptor { + return { name: "", description: "", fieldType: [] }; +} + +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag === 24) { + message.fieldType.push(reader.int32() as any); + + continue; + } + + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push(reader.int32() as any); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ScalarDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], + }; + }, + + toJSON(message: ScalarDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.fieldType?.length) { + obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e)); + } + 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 ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/gogoproto/gogo.ts b/ts-client/cosmos.circuit.v1/types/gogoproto/gogo.ts new file mode 100644 index 00000000..c9ab057a --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/gogoproto/gogo.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + +/* eslint-disable */ + +export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.circuit.v1/types/google/api/annotations.ts b/ts-client/cosmos.circuit.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.circuit.v1/types/google/api/annotations.ts +++ b/ts-client/cosmos.circuit.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.circuit.v1/types/google/api/http.ts b/ts-client/cosmos.circuit.v1/types/google/api/http.ts index 9010600b..d3390802 100644 --- a/ts-client/cosmos.circuit.v1/types/google/api/http.ts +++ b/ts-client/cosmos.circuit.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,94 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} + * This enables an HTTP REST to gRPC mapping as below: * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: - * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` - * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` - * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. - * - * For HTTP method kinds which allow a request body, the `body` field + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +134,10 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +147,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +159,14 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +188,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC + * HTTP | gRPC * -----|----- * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` - * - * # Rules for HTTP mapping - * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: - * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. - * - * The syntax of the path template is as follows: + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +224,115 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +346,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +383,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +419,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +438,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +470,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +491,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +500,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +586,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +668,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +679,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +704,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +741,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; @@ -673,3 +753,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/google/protobuf/any.ts b/ts-client/cosmos.circuit.v1/types/google/protobuf/any.ts new file mode 100644 index 00000000..24b86540 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/google/protobuf/any.ts @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/any.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * // or ... + * if (any.isSameTypeAs(Foo.getDefaultInstance())) { + * foo = any.unpack(Foo.getDefaultInstance()); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := anypb.New(foo) + * if err != nil { + * ... + * } + * ... + * foo := &pb.Foo{} + * if err := any.UnmarshalTo(foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface Any { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} + +function createBaseAny(): Any { + return { typeUrl: "", value: new Uint8Array(0) }; +} + +export const Any: MessageFns = { + encode(message: Any, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.typeUrl = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Any { + return { + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Any): unknown { + const obj: any = {}; + if (message.typeUrl !== "") { + obj.typeUrl = message.typeUrl; + } + 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.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.circuit.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..b7d4af33 100644 --- a/ts-client/cosmos.circuit.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.circuit.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,106 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +112,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +133,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +142,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +178,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +193,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,33 +312,40 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** @@ -163,7 +371,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +398,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +529,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +544,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +561,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +573,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +607,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +657,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +667,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,13 +678,17 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** * 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 @@ -469,8 +697,10 @@ export interface FileOptions { * However, an extension field still accepts non-UTF-8 byte sequences. * This option has no effect on when used with the lite runtime. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +708,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +723,83 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: boolean | undefined; + phpGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,21 +871,31 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** + * 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. + * * Whether the message is an automatically generated map entry type for the * maps field. * @@ -647,12 +913,31 @@ export interface MessageOptions { * 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. + */ + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. * - * 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. + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated */ - mapEntry: boolean; + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -661,18 +946,26 @@ 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release -- sorry, we'll try to include + * other types in a future version! */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +979,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -715,17 +1010,46 @@ export interface FieldOptions { * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. + * + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1057,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1144,150 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1297,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1337,39 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1381,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1453,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,51 +1474,341 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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. +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + NONE = 1, + VERIFY = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 1: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: Edition | undefined; + features?: FeatureSet | undefined; +} + +/** + * 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. @@ -1010,8 +1822,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition occurs. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1879,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1900,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1925,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2020,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2063,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2082,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2226,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) + : [], + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2309,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2339,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2359,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2394,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2475,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2571,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2617,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2664,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2700,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2737,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2771,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2821,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,6 +2839,134 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; + return message; + }, +}; + +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; +} + +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; return message; }, }; @@ -1915,46 +2987,46 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { }; } -export const FieldDescriptorProto = { - encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(24).int32(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { writer.uint32(32).int32(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { writer.uint32(40).int32(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { writer.uint32(50).string(message.typeName); } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { writer.uint32(18).string(message.extendee); } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { writer.uint32(58).string(message.defaultValue); } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { writer.uint32(72).int32(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3113,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3198,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3234,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3274,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3294,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3340,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3402,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3438,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3480,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3526,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3571,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3617,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3671,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3747,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2736,7 +3817,7 @@ function createBaseFileOptions(): FileOptions { pyGenericServices: false, phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3825,84 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { writer.uint32(336).bool(message.phpGenericServices); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2963,6 +4048,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4066,37 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + phpGenericServices: isSet(object.phpGenericServices) ? globalThis.Boolean(object.phpGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4104,69 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { obj.phpGenericServices = message.phpGenericServices; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3094,7 +4190,7 @@ export const FileOptions = { message.pyGenericServices = object.pyGenericServices ?? false; message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4198,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4212,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4281,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4306,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4333,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4368,81 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4476,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4497,51 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4553,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4561,22 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4584,42 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,32 +4635,124 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; +} + +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptions_EditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: FieldOptions_EditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; + return message; + }, +}; + function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; + return { features: undefined, uninterpretedOption: [] }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3417,14 +4764,15 @@ export const OneofOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3432,6 +4780,9 @@ export const OneofOptions = { toJSON(message: OneofOptions): unknown { const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3443,31 +4794,48 @@ export const OneofOptions = { }, fromPartial, I>>(object: I): OneofOptions { const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { writer.uint32(16).bool(message.allowAlias); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumOptions(); while (reader.pos < end) { @@ -3487,6 +4855,20 @@ export const EnumOptions = { message.deprecated = reader.bool(); continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3498,16 +4880,20 @@ export const EnumOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumOptions { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3515,12 +4901,20 @@ export const EnumOptions = { toJSON(message: EnumOptions): unknown { const obj: any = {}; - if (message.allowAlias === true) { + if (message.allowAlias !== undefined && message.allowAlias !== false) { obj.allowAlias = message.allowAlias; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3534,28 +4928,38 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { deprecated: false, features: undefined, debugRedact: false, uninterpretedOption: [] }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +4972,20 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +4997,17 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5015,15 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5036,47 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5095,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5112,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5129,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5139,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5180,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5198,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5218,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5240,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5260,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5312,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5346,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5370,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5411,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5447,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5464,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5481,337 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, features: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +5828,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +5863,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +5887,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +5953,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +5978,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6008,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6034,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6066,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6136,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6167,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6191,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6210,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6233,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/google/protobuf/duration.ts b/ts-client/cosmos.circuit.v1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/google/protobuf/timestamp.ts b/ts-client/cosmos.circuit.v1/types/google/protobuf/timestamp.ts new file mode 100644 index 00000000..c7ff7f50 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/google/protobuf/timestamp.ts @@ -0,0 +1,227 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/timestamp.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: 0, nanos: 0 }; +} + +export const Timestamp: MessageFns = { + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/route-name.eta b/ts-client/cosmos.circuit.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/abci/types.ts b/ts-client/cosmos.circuit.v1/types/tendermint/abci/types.ts new file mode 100644 index 00000000..c4e0902e --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/abci/types.ts @@ -0,0 +1,5925 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/abci/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { ConsensusParams } from "../types/params"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON } from "../types/validator"; + +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 MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1, +} + +export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} + +export function misbehaviorTypeToJSON(object: MisbehaviorType): string { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Request { + echo?: RequestEcho | undefined; + flush?: RequestFlush | undefined; + info?: RequestInfo | undefined; + initChain?: RequestInitChain | undefined; + query?: RequestQuery | undefined; + checkTx?: RequestCheckTx | undefined; + commit?: RequestCommit | undefined; + listSnapshots?: RequestListSnapshots | undefined; + offerSnapshot?: RequestOfferSnapshot | undefined; + loadSnapshotChunk?: RequestLoadSnapshotChunk | undefined; + applySnapshotChunk?: RequestApplySnapshotChunk | undefined; + prepareProposal?: RequestPrepareProposal | undefined; + processProposal?: RequestProcessProposal | undefined; + extendVote?: RequestExtendVote | undefined; + verifyVoteExtension?: RequestVerifyVoteExtension | undefined; + finalizeBlock?: RequestFinalizeBlock | undefined; +} + +export interface RequestEcho { + message: string; +} + +export interface RequestFlush { +} + +export interface RequestInfo { + version: string; + blockVersion: number; + p2pVersion: number; + abciVersion: string; +} + +export interface RequestInitChain { + time: Date | undefined; + chainId: string; + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appStateBytes: Uint8Array; + initialHeight: number; +} + +export interface RequestQuery { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} + +export interface RequestCommit { +} + +/** lists available snapshots */ +export interface RequestListSnapshots { +} + +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot: + | Snapshot + | undefined; + /** light client-verified app hash for snapshot height */ + appHash: Uint8Array; +} + +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: number; + format: number; + chunk: number; +} + +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} + +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: number; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit: ExtendedCommitInfo | undefined; + misbehavior: Misbehavior[]; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} + +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Extends a vote with application-injected data */ +export interface RequestExtendVote { + /** the hash of the block that this vote may be referring to */ + hash: Uint8Array; + /** the height of the extended vote */ + height: number; + /** info of the block that this vote may be referring to */ + time: Date | undefined; + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Verify the vote extension */ +export interface RequestVerifyVoteExtension { + /** the hash of the block that this received vote corresponds to */ + hash: Uint8Array; + /** the validator that signed the vote extension */ + validatorAddress: Uint8Array; + height: number; + voteExtension: Uint8Array; +} + +export interface RequestFinalizeBlock { + txs: Uint8Array[]; + decidedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the decided block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +export interface Response { + exception?: ResponseException | undefined; + echo?: ResponseEcho | undefined; + flush?: ResponseFlush | undefined; + info?: ResponseInfo | undefined; + initChain?: ResponseInitChain | undefined; + query?: ResponseQuery | undefined; + checkTx?: ResponseCheckTx | undefined; + commit?: ResponseCommit | undefined; + listSnapshots?: ResponseListSnapshots | undefined; + offerSnapshot?: ResponseOfferSnapshot | undefined; + loadSnapshotChunk?: ResponseLoadSnapshotChunk | undefined; + applySnapshotChunk?: ResponseApplySnapshotChunk | undefined; + prepareProposal?: ResponsePrepareProposal | undefined; + processProposal?: ResponseProcessProposal | undefined; + extendVote?: ResponseExtendVote | undefined; + verifyVoteExtension?: ResponseVerifyVoteExtension | undefined; + finalizeBlock?: ResponseFinalizeBlock | undefined; +} + +/** nondeterministic */ +export interface ResponseException { + error: string; +} + +export interface ResponseEcho { + message: string; +} + +export interface ResponseFlush { +} + +export interface ResponseInfo { + data: string; + version: string; + appVersion: number; + lastBlockHeight: number; + lastBlockAppHash: Uint8Array; +} + +export interface ResponseInitChain { + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appHash: Uint8Array; +} + +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + events: Event[]; + codespace: string; +} + +export interface ResponseCommit { + retainHeight: number; +} + +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 */ + refetchChunks: number[]; + /** Chunk senders to reject and ban */ + rejectSenders: 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"; + } +} + +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} + +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} + +export enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} + +export function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseExtendVote { + voteExtension: Uint8Array; +} + +export interface ResponseVerifyVoteExtension { + status: ResponseVerifyVoteExtension_VerifyStatus; +} + +export enum ResponseVerifyVoteExtension_VerifyStatus { + UNKNOWN = 0, + ACCEPT = 1, + /** + * REJECT - Rejecting the vote extension will reject the entire precommit by the sender. + * Incorrectly implementing this thus has liveness implications as it may affect + * CometBFT's ability to receive 2/3+ valid votes to finalize the block. + * Honest nodes should never be rejected. + */ + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseVerifyVoteExtension_VerifyStatusFromJSON( + object: any, +): ResponseVerifyVoteExtension_VerifyStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseVerifyVoteExtension_VerifyStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseVerifyVoteExtension_VerifyStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED; + } +} + +export function responseVerifyVoteExtension_VerifyStatusToJSON( + object: ResponseVerifyVoteExtension_VerifyStatus, +): string { + switch (object) { + case ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseVerifyVoteExtension_VerifyStatus.ACCEPT: + return "ACCEPT"; + case ResponseVerifyVoteExtension_VerifyStatus.REJECT: + return "REJECT"; + case ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseFinalizeBlock { + /** set of block events emmitted as part of executing the block */ + events: Event[]; + /** + * the result of executing each transaction including the events + * the particular transction emitted. This should match the order + * of the transactions delivered in the block itself + */ + txResults: ExecTxResult[]; + /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ + validatorUpdates: ValidatorUpdate[]; + /** updates to the consensus params, if any. */ + consensusParamUpdates: + | ConsensusParams + | undefined; + /** + * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + * deterministic. It is up to the application to decide which algorithm to use. + */ + appHash: Uint8Array; +} + +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} + +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} + +/** + * Event allows application developers to attach additional information to + * ResponseFinalizeBlock and ResponseCheckTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} + +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} + +/** + * ExecTxResult contains results of executing one individual transaction. + * + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted + */ +export interface ExecTxResult { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + /** nondeterministic */ + events: Event[]; + codespace: string; +} + +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: number; + index: number; + tx: Uint8Array; + result: ExecTxResult | undefined; +} + +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: number; +} + +export interface ValidatorUpdate { + pubKey: PublicKey | undefined; + power: number; +} + +export interface VoteInfo { + validator: Validator | undefined; + blockIdFlag: BlockIDFlag; +} + +export interface ExtendedVoteInfo { + /** The validator that sent the vote. */ + validator: + | Validator + | undefined; + /** Non-deterministic extension provided by the sending validator's application. */ + voteExtension: Uint8Array; + /** Vote extension signature created by CometBFT */ + extensionSignature: Uint8Array; + /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ + blockIdFlag: BlockIDFlag; +} + +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator: + | Validator + | undefined; + /** The height when the offense occurred */ + height: number; + /** The corresponding time where the offense occurred */ + time: + | Date + | undefined; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + totalVotingPower: number; +} + +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: number; + /** 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, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Request: MessageFns = { + encode(message: Request, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.echo !== undefined) { + RequestEcho.encode(message.echo, writer.uint32(10).fork()).join(); + } + if (message.flush !== undefined) { + RequestFlush.encode(message.flush, writer.uint32(18).fork()).join(); + } + if (message.info !== undefined) { + RequestInfo.encode(message.info, writer.uint32(26).fork()).join(); + } + if (message.initChain !== undefined) { + RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).join(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).join(); + } + if (message.checkTx !== undefined) { + RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).join(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).join(); + } + if (message.listSnapshots !== undefined) { + RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.prepareProposal !== undefined) { + RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).join(); + } + if (message.processProposal !== undefined) { + RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).join(); + } + if (message.extendVote !== undefined) { + RequestExtendVote.encode(message.extendVote, writer.uint32(146).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + RequestVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(154).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.finalizeBlock, writer.uint32(162).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Request { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.echo = RequestEcho.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.flush = RequestFlush.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.info = RequestInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.initChain = RequestInitChain.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = RequestQuery.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.commit = RequestCommit.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.extendVote = RequestExtendVote.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.verifyVoteExtension = RequestVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.finalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? RequestInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? RequestCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? RequestListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? RequestOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? RequestPrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? RequestProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? RequestExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? RequestVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? RequestFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Request): unknown { + const obj: any = {}; + if (message.echo !== undefined) { + obj.echo = RequestEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = RequestFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = RequestInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = RequestInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = RequestQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = RequestCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = RequestCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = RequestListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = RequestOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = RequestPrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = RequestProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = RequestExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = RequestVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = RequestFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Request { + return Request.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? RequestInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? RequestQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? RequestCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? RequestCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? RequestListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? RequestPrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? RequestProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? RequestExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? RequestVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseRequestEcho(): RequestEcho { + return { message: "" }; +} + +export const RequestEcho: MessageFns = { + encode(message: RequestEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: RequestEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): RequestEcho { + return RequestEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseRequestFlush(): RequestFlush { + return {}; +} + +export const RequestFlush: MessageFns = { + encode(_: RequestFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestFlush { + return {}; + }, + + toJSON(_: RequestFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestFlush { + return RequestFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, +}; + +function createBaseRequestInfo(): RequestInfo { + return { version: "", blockVersion: 0, p2pVersion: 0, abciVersion: "" }; +} + +export const RequestInfo: MessageFns = { + encode(message: RequestInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.blockVersion !== 0) { + writer.uint32(16).uint64(message.blockVersion); + } + if (message.p2pVersion !== 0) { + writer.uint32(24).uint64(message.p2pVersion); + } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockVersion = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.p2pVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.abciVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo { + return { + version: isSet(object.version) ? globalThis.String(object.version) : "", + blockVersion: isSet(object.blockVersion) ? globalThis.Number(object.blockVersion) : 0, + p2pVersion: isSet(object.p2pVersion) ? globalThis.Number(object.p2pVersion) : 0, + abciVersion: isSet(object.abciVersion) ? globalThis.String(object.abciVersion) : "", + }; + }, + + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + if (message.version !== "") { + obj.version = message.version; + } + if (message.blockVersion !== 0) { + obj.blockVersion = Math.round(message.blockVersion); + } + if (message.p2pVersion !== 0) { + obj.p2pVersion = Math.round(message.p2pVersion); + } + if (message.abciVersion !== "") { + obj.abciVersion = message.abciVersion; + } + return obj; + }, + + create, I>>(base?: I): RequestInfo { + return RequestInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = object.blockVersion ?? 0; + message.p2pVersion = object.p2pVersion ?? 0; + message.abciVersion = object.abciVersion ?? ""; + return message; + }, +}; + +function createBaseRequestInitChain(): RequestInitChain { + return { + time: undefined, + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(0), + initialHeight: 0, + }; +} + +export const RequestInitChain: MessageFns = { + encode(message: RequestInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appStateBytes = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.initialHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInitChain { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appStateBytes: isSet(object.appStateBytes) ? bytesFromBase64(object.appStateBytes) : new Uint8Array(0), + initialHeight: isSet(object.initialHeight) ? globalThis.Number(object.initialHeight) : 0, + }; + }, + + toJSON(message: RequestInitChain): unknown { + const obj: any = {}; + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appStateBytes.length !== 0) { + obj.appStateBytes = base64FromBytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + obj.initialHeight = Math.round(message.initialHeight); + } + return obj; + }, + + create, I>>(base?: I): RequestInitChain { + return RequestInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(0); + message.initialHeight = object.initialHeight ?? 0; + return message; + }, +}; + +function createBaseRequestQuery(): RequestQuery { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const RequestQuery: MessageFns = { + encode(message: RequestQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestQuery { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: RequestQuery): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): RequestQuery { + return RequestQuery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseRequestCheckTx(): RequestCheckTx { + return { tx: new Uint8Array(0), type: 0 }; +} + +export const RequestCheckTx: MessageFns = { + encode(message: RequestCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestCheckTx { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + + toJSON(message: RequestCheckTx): unknown { + const obj: any = {}; + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.type !== 0) { + obj.type = checkTxTypeToJSON(message.type); + } + return obj; + }, + + create, I>>(base?: I): RequestCheckTx { + return RequestCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(0); + message.type = object.type ?? 0; + return message; + }, +}; + +function createBaseRequestCommit(): RequestCommit { + return {}; +} + +export const RequestCommit: MessageFns = { + encode(_: RequestCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestCommit { + return {}; + }, + + toJSON(_: RequestCommit): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestCommit { + return RequestCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, +}; + +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} + +export const RequestListSnapshots: MessageFns = { + encode(_: RequestListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestListSnapshots { + return {}; + }, + + toJSON(_: RequestListSnapshots): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestListSnapshots { + return RequestListSnapshots.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; + +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { snapshot: undefined, appHash: new Uint8Array(0) }; +} + +export const RequestOfferSnapshot: MessageFns = { + encode(message: RequestOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshot = Snapshot.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestOfferSnapshot { + return { + snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestOfferSnapshot): unknown { + const obj: any = {}; + if (message.snapshot !== undefined) { + obj.snapshot = Snapshot.toJSON(message.snapshot); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): RequestOfferSnapshot { + return RequestOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) + ? Snapshot.fromPartial(object.snapshot) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { height: 0, format: 0, chunk: 0 }; +} + +export const RequestLoadSnapshotChunk: MessageFns = { + encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunk = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestLoadSnapshotChunk { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunk: isSet(object.chunk) ? globalThis.Number(object.chunk) : 0, + }; + }, + + toJSON(message: RequestLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunk !== 0) { + obj.chunk = Math.round(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + 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(0), sender: "" }; +} + +export const RequestApplySnapshotChunk: MessageFns = { + encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chunk = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestApplySnapshotChunk { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0), + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + }; + }, + + toJSON(message: RequestApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + if (message.sender !== "") { + obj.sender = message.sender; + } + return obj; + }, + + create, I>>(base?: I): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(0); + message.sender = object.sender ?? ""; + return message; + }, +}; + +function createBaseRequestPrepareProposal(): RequestPrepareProposal { + return { + maxTxBytes: 0, + txs: [], + localLastCommit: undefined, + misbehavior: [], + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestPrepareProposal: MessageFns = { + encode(message: RequestPrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTxBytes !== 0) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v!); + } + if (message.localLastCommit !== undefined) { + ExtendedCommitInfo.encode(message.localLastCommit, writer.uint32(26).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxTxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.localLastCommit = ExtendedCommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrepareProposal { + return { + maxTxBytes: isSet(object.maxTxBytes) ? globalThis.Number(object.maxTxBytes) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + localLastCommit: isSet(object.localLastCommit) ? ExtendedCommitInfo.fromJSON(object.localLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestPrepareProposal): unknown { + const obj: any = {}; + if (message.maxTxBytes !== 0) { + obj.maxTxBytes = Math.round(message.maxTxBytes); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.localLastCommit !== undefined) { + obj.localLastCommit = ExtendedCommitInfo.toJSON(message.localLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestPrepareProposal { + return RequestPrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = object.maxTxBytes ?? 0; + message.txs = object.txs?.map((e) => e) || []; + message.localLastCommit = (object.localLastCommit !== undefined && object.localLastCommit !== null) + ? ExtendedCommitInfo.fromPartial(object.localLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestProcessProposal(): RequestProcessProposal { + return { + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestProcessProposal: MessageFns = { + encode(message: RequestProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestProcessProposal { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestProcessProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestProcessProposal { + return RequestProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestExtendVote(): RequestExtendVote { + return { + hash: new Uint8Array(0), + height: 0, + time: undefined, + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestExtendVote: MessageFns = { + encode(message: RequestExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(26).fork()).join(); + } + for (const v of message.txs) { + writer.uint32(34).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(42).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestExtendVote { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestExtendVote): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestExtendVote { + return RequestExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestExtendVote { + const message = createBaseRequestExtendVote(); + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestVerifyVoteExtension(): RequestVerifyVoteExtension { + return { hash: new Uint8Array(0), validatorAddress: new Uint8Array(0), height: 0, voteExtension: new Uint8Array(0) }; +} + +export const RequestVerifyVoteExtension: MessageFns = { + encode(message: RequestVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.voteExtension.length !== 0) { + writer.uint32(34).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestVerifyVoteExtension { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + message.hash = object.hash ?? new Uint8Array(0); + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestFinalizeBlock(): RequestFinalizeBlock { + return { + txs: [], + decidedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestFinalizeBlock: MessageFns = { + encode(message: RequestFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.decidedLastCommit !== undefined) { + CommitInfo.encode(message.decidedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decidedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestFinalizeBlock { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + decidedLastCommit: isSet(object.decidedLastCommit) ? CommitInfo.fromJSON(object.decidedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestFinalizeBlock): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.decidedLastCommit !== undefined) { + obj.decidedLastCommit = CommitInfo.toJSON(message.decidedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestFinalizeBlock { + return RequestFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map((e) => e) || []; + message.decidedLastCommit = (object.decidedLastCommit !== undefined && object.decidedLastCommit !== null) + ? CommitInfo.fromPartial(object.decidedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Response: MessageFns = { + encode(message: Response, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).join(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).join(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).join(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + if (message.initChain !== undefined) { + ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).join(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).join(); + } + if (message.checkTx !== undefined) { + ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).join(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).join(); + } + if (message.listSnapshots !== undefined) { + ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).join(); + } + if (message.prepareProposal !== undefined) { + ResponsePrepareProposal.encode(message.prepareProposal, writer.uint32(138).fork()).join(); + } + if (message.processProposal !== undefined) { + ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).join(); + } + if (message.extendVote !== undefined) { + ResponseExtendVote.encode(message.extendVote, writer.uint32(154).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + ResponseVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(162).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.finalizeBlock, writer.uint32(170).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exception = ResponseException.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.echo = ResponseEcho.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.flush = ResponseFlush.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = ResponseInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.initChain = ResponseInitChain.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.query = ResponseQuery.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.commit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.listSnapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.offerSnapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.applySnapshotChunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.prepareProposal = ResponsePrepareProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.processProposal = ResponseProcessProposal.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.extendVote = ResponseExtendVote.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.verifyVoteExtension = ResponseVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.finalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? ResponseInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? ResponseQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? ResponseCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? ResponseCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? ResponseListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? ResponseOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? ResponsePrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? ResponseProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? ResponseExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? ResponseVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? ResponseFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + if (message.exception !== undefined) { + obj.exception = ResponseException.toJSON(message.exception); + } + if (message.echo !== undefined) { + obj.echo = ResponseEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = ResponseFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = ResponseInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = ResponseInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = ResponseQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = ResponseCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = ResponseCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = ResponseListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = ResponseOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = ResponsePrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = ResponseProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = ResponseExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = ResponseVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = ResponseFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Response { + return Response.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? ResponseInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ResponseQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? ResponseCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? ResponseCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? ResponseListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? ResponsePrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? ResponseProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? ResponseExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? ResponseVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseResponseException(): ResponseException { + return { error: "" }; +} + +export const ResponseException: MessageFns = { + encode(message: ResponseException, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.error = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseException { + return { error: isSet(object.error) ? globalThis.String(object.error) : "" }; + }, + + toJSON(message: ResponseException): unknown { + const obj: any = {}; + if (message.error !== "") { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): ResponseException { + return ResponseException.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; + +function createBaseResponseEcho(): ResponseEcho { + return { message: "" }; +} + +export const ResponseEcho: MessageFns = { + encode(message: ResponseEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: ResponseEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ResponseEcho { + return ResponseEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseResponseFlush(): ResponseFlush { + return {}; +} + +export const ResponseFlush: MessageFns = { + encode(_: ResponseFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ResponseFlush { + return {}; + }, + + toJSON(_: ResponseFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ResponseFlush { + return ResponseFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, +}; + +function createBaseResponseInfo(): ResponseInfo { + return { data: "", version: "", appVersion: 0, lastBlockHeight: 0, lastBlockAppHash: new Uint8Array(0) }; +} + +export const ResponseInfo: MessageFns = { + encode(message: ResponseInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.appVersion !== 0) { + writer.uint32(24).uint64(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.appVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.lastBlockHeight = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockAppHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInfo { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + appVersion: isSet(object.appVersion) ? globalThis.Number(object.appVersion) : 0, + lastBlockHeight: isSet(object.lastBlockHeight) ? globalThis.Number(object.lastBlockHeight) : 0, + lastBlockAppHash: isSet(object.lastBlockAppHash) ? bytesFromBase64(object.lastBlockAppHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInfo): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.appVersion !== 0) { + obj.appVersion = Math.round(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + obj.lastBlockHeight = Math.round(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + obj.lastBlockAppHash = base64FromBytes(message.lastBlockAppHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInfo { + return ResponseInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = object.appVersion ?? 0; + message.lastBlockHeight = object.lastBlockHeight ?? 0; + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseInitChain(): ResponseInitChain { + return { consensusParams: undefined, validators: [], appHash: new Uint8Array(0) }; +} + +export const ResponseInitChain: MessageFns = { + encode(message: ResponseInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInitChain { + return { + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInitChain): unknown { + const obj: any = {}; + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInitChain { + return ResponseInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ResponseQuery: MessageFns = { + encode(message: ResponseQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseQuery { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseQuery): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseQuery { + return ResponseQuery.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCheckTx(): ResponseCheckTx { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ResponseCheckTx: MessageFns = { + encode(message: ResponseCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCheckTx { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseCheckTx): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseCheckTx { + return ResponseCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCommit(): ResponseCommit { + return { retainHeight: 0 }; +} + +export const ResponseCommit: MessageFns = { + encode(message: ResponseCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.retainHeight !== 0) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.retainHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCommit { + return { retainHeight: isSet(object.retainHeight) ? globalThis.Number(object.retainHeight) : 0 }; + }, + + toJSON(message: ResponseCommit): unknown { + const obj: any = {}; + if (message.retainHeight !== 0) { + obj.retainHeight = Math.round(message.retainHeight); + } + return obj; + }, + + create, I>>(base?: I): ResponseCommit { + return ResponseCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCommit { + const message = createBaseResponseCommit(); + message.retainHeight = object.retainHeight ?? 0; + return message; + }, +}; + +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { snapshots: [] }; +} + +export const ResponseListSnapshots: MessageFns = { + encode(message: ResponseListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshots.push(Snapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseListSnapshots { + return { + snapshots: globalThis.Array.isArray(object?.snapshots) + ? object.snapshots.map((e: any) => Snapshot.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ResponseListSnapshots): unknown { + const obj: any = {}; + if (message.snapshots?.length) { + obj.snapshots = message.snapshots.map((e) => Snapshot.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponseListSnapshots { + return ResponseListSnapshots.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ResponseOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseOfferSnapshot { + return { result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: ResponseOfferSnapshot): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseOfferSnapshot_ResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { chunk: new Uint8Array(0) }; +} + +export const ResponseLoadSnapshotChunk: MessageFns = { + encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunk = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseLoadSnapshotChunk { + return { chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { result: 0, refetchChunks: [], rejectSenders: [] }; +} + +export const ResponseApplySnapshotChunk: MessageFns = { + encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.join(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + case 2: + if (tag === 16) { + message.refetchChunks.push(reader.uint32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + + continue; + } + + break; + case 3: + if (tag !== 26) { + break; + } + + message.rejectSenders.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseApplySnapshotChunk { + return { + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + refetchChunks: globalThis.Array.isArray(object?.refetchChunks) + ? object.refetchChunks.map((e: any) => globalThis.Number(e)) + : [], + rejectSenders: globalThis.Array.isArray(object?.rejectSenders) + ? object.rejectSenders.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ResponseApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + } + if (message.refetchChunks?.length) { + obj.refetchChunks = message.refetchChunks.map((e) => Math.round(e)); + } + if (message.rejectSenders?.length) { + obj.rejectSenders = message.rejectSenders; + } + return obj; + }, + + create, I>>(base?: I): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map((e) => e) || []; + message.rejectSenders = object.rejectSenders?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponsePrepareProposal(): ResponsePrepareProposal { + return { txs: [] }; +} + +export const ResponsePrepareProposal: MessageFns = { + encode(message: ResponsePrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponsePrepareProposal { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: ResponsePrepareProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponsePrepareProposal { + return ResponsePrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { status: 0 }; +} + +export const ResponseProcessProposal: MessageFns = { + encode(message: ResponseProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseProcessProposal { + return { status: isSet(object.status) ? responseProcessProposal_ProposalStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseProcessProposal): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseProcessProposal_ProposalStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseProcessProposal { + return ResponseProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseExtendVote(): ResponseExtendVote { + return { voteExtension: new Uint8Array(0) }; +} + +export const ResponseExtendVote: MessageFns = { + encode(message: ResponseExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtension.length !== 0) { + writer.uint32(10).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseExtendVote { + return { voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseExtendVote): unknown { + const obj: any = {}; + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): ResponseExtendVote { + return ResponseExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseVerifyVoteExtension(): ResponseVerifyVoteExtension { + return { status: 0 }; +} + +export const ResponseVerifyVoteExtension: MessageFns = { + encode(message: ResponseVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseVerifyVoteExtension { + return { status: isSet(object.status) ? responseVerifyVoteExtension_VerifyStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseVerifyVoteExtension_VerifyStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseFinalizeBlock(): ResponseFinalizeBlock { + return { + events: [], + txResults: [], + validatorUpdates: [], + consensusParamUpdates: undefined, + appHash: new Uint8Array(0), + }; +} + +export const ResponseFinalizeBlock: MessageFns = { + encode(message: ResponseFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResults) { + ExecTxResult.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.validatorUpdates) { + ValidatorUpdate.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.consensusParamUpdates !== undefined) { + ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(34).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(42).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResults.push(ExecTxResult.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseFinalizeBlock { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + txResults: globalThis.Array.isArray(object?.txResults) + ? object.txResults.map((e: any) => ExecTxResult.fromJSON(e)) + : [], + validatorUpdates: globalThis.Array.isArray(object?.validatorUpdates) + ? object.validatorUpdates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + consensusParamUpdates: isSet(object.consensusParamUpdates) + ? ConsensusParams.fromJSON(object.consensusParamUpdates) + : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseFinalizeBlock): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.txResults?.length) { + obj.txResults = message.txResults.map((e) => ExecTxResult.toJSON(e)); + } + if (message.validatorUpdates?.length) { + obj.validatorUpdates = message.validatorUpdates.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.consensusParamUpdates !== undefined) { + obj.consensusParamUpdates = ConsensusParams.toJSON(message.consensusParamUpdates); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseFinalizeBlock { + return ResponseFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.txResults = object.txResults?.map((e) => ExecTxResult.fromPartial(e)) || []; + message.validatorUpdates = object.validatorUpdates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = + (object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null) + ? ConsensusParams.fromPartial(object.consensusParamUpdates) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommitInfo(): CommitInfo { + return { round: 0, votes: [] }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + VoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(VoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => VoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitInfo(): ExtendedCommitInfo { + return { round: 0, votes: [] }; +} + +export const ExtendedCommitInfo: MessageFns = { + encode(message: ExtendedCommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + ExtendedVoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => ExtendedVoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ExtendedCommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => ExtendedVoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitInfo { + return ExtendedCommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEvent(): Event { + return { type: "", attributes: [] }; +} + +export const Event: MessageFns = { + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + EventAttribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(EventAttribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Event { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => EventAttribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => EventAttribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + 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: "", value: "", index: false }; +} + +export const EventAttribute: MessageFns = { + encode(message: EventAttribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index !== false) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.index = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventAttribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + index: isSet(object.index) ? globalThis.Boolean(object.index) : false, + }; + }, + + toJSON(message: EventAttribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.index !== false) { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): EventAttribute { + return EventAttribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, +}; + +function createBaseExecTxResult(): ExecTxResult { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ExecTxResult: MessageFns = { + encode(message: ExecTxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecTxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecTxResult { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ExecTxResult): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ExecTxResult { + return ExecTxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecTxResult { + const message = createBaseExecTxResult(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseTxResult(): TxResult { + return { height: 0, index: 0, tx: new Uint8Array(0), result: undefined }; +} + +export const TxResult: MessageFns = { + encode(message: TxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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) { + ExecTxResult.encode(message.result, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tx = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.result = ExecTxResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + result: isSet(object.result) ? ExecTxResult.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.result !== undefined) { + obj.result = ExecTxResult.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): TxResult { + return TxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.height = object.height ?? 0; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(0); + message.result = (object.result !== undefined && object.result !== null) + ? ExecTxResult.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), power: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseValidatorUpdate(): ValidatorUpdate { + return { pubKey: undefined, power: 0 }; +} + +export const ValidatorUpdate: MessageFns = { + encode(message: ValidatorUpdate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdate { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: ValidatorUpdate): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdate { + return ValidatorUpdate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseVoteInfo(): VoteInfo { + return { validator: undefined, blockIdFlag: 0 }; +} + +export const VoteInfo: MessageFns = { + encode(message: VoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.blockIdFlag !== 0) { + writer.uint32(24).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: VoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): VoteInfo { + return VoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseExtendedVoteInfo(): ExtendedVoteInfo { + return { + validator: undefined, + voteExtension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + blockIdFlag: 0, + }; +} + +export const ExtendedVoteInfo: MessageFns = { + encode(message: ExtendedVoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(34).bytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + writer.uint32(40).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedVoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedVoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: ExtendedVoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): ExtendedVoteInfo { + return ExtendedVoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseMisbehavior(): Misbehavior { + return { type: 0, validator: undefined, height: 0, time: undefined, totalVotingPower: 0 }; +} + +export const Misbehavior: MessageFns = { + encode(message: Misbehavior, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Misbehavior { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Misbehavior { + return { + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: Misbehavior): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = misbehaviorTypeToJSON(message.type); + } + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): Misbehavior { + return Misbehavior.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Misbehavior { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: new Uint8Array(0) }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? bytesFromBase64(object.metadata) : new Uint8Array(0), + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata.length !== 0) { + obj.metadata = base64FromBytes(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = object.metadata ?? new Uint8Array(0); + return message; + }, +}; + +export interface ABCI { + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; + PrepareProposal(request: RequestPrepareProposal): Promise; + ProcessProposal(request: RequestProcessProposal): Promise; + ExtendVote(request: RequestExtendVote): Promise; + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise; + FinalizeBlock(request: RequestFinalizeBlock): Promise; +} + +export const ABCIServiceName = "tendermint.abci.ABCI"; +export class ABCIClientImpl implements ABCI { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIServiceName; + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.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.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + this.PrepareProposal = this.PrepareProposal.bind(this); + this.ProcessProposal = this.ProcessProposal.bind(this); + this.ExtendVote = this.ExtendVote.bind(this); + this.VerifyVoteExtension = this.VerifyVoteExtension.bind(this); + this.FinalizeBlock = this.FinalizeBlock.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + PrepareProposal(request: RequestPrepareProposal): Promise { + const data = RequestPrepareProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrepareProposal", data); + return promise.then((data) => ResponsePrepareProposal.decode(new BinaryReader(data))); + } + + ProcessProposal(request: RequestProcessProposal): Promise { + const data = RequestProcessProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "ProcessProposal", data); + return promise.then((data) => ResponseProcessProposal.decode(new BinaryReader(data))); + } + + ExtendVote(request: RequestExtendVote): Promise { + const data = RequestExtendVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExtendVote", data); + return promise.then((data) => ResponseExtendVote.decode(new BinaryReader(data))); + } + + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise { + const data = RequestVerifyVoteExtension.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifyVoteExtension", data); + return promise.then((data) => ResponseVerifyVoteExtension.decode(new BinaryReader(data))); + } + + FinalizeBlock(request: RequestFinalizeBlock): Promise { + const data = RequestFinalizeBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizeBlock", data); + return promise.then((data) => ResponseFinalizeBlock.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/crypto/keys.ts b/ts-client/cosmos.circuit.v1/types/tendermint/crypto/keys.ts new file mode 100644 index 00000000..f30b6751 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/crypto/keys.ts @@ -0,0 +1,140 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKey { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; +} + +function createBasePublicKey(): PublicKey { + return { ed25519: undefined, secp256k1: undefined }; +} + +export const PublicKey: MessageFns = { + encode(message: PublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ed25519 = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.secp256k1 = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.ed25519 !== undefined) { + obj.ed25519 = base64FromBytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + obj.secp256k1 = base64FromBytes(message.secp256k1); + } + return obj; + }, + + create, I>>(base?: I): PublicKey { + return PublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/crypto/proof.ts b/ts-client/cosmos.circuit.v1/types/tendermint/crypto/proof.ts new file mode 100644 index 00000000..2b470701 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/crypto/proof.ts @@ -0,0 +1,520 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/proof.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +export interface Proof { + total: number; + index: number; + leafHash: Uint8Array; + aunts: Uint8Array[]; +} + +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof: Proof | undefined; +} + +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, leafHash: new Uint8Array(0), aunts: [] }; +} + +export const Proof: MessageFns = { + encode(message: Proof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).int64(message.total); + } + if (message.index !== 0) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.leafHash = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aunts.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proof { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + leafHash: isSet(object.leafHash) ? bytesFromBase64(object.leafHash) : new Uint8Array(0), + aunts: globalThis.Array.isArray(object?.aunts) ? object.aunts.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Proof): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.leafHash.length !== 0) { + obj.leafHash = base64FromBytes(message.leafHash); + } + if (message.aunts?.length) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Proof { + return Proof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proof { + const message = createBaseProof(); + message.total = object.total ?? 0; + message.index = object.index ?? 0; + message.leafHash = object.leafHash ?? new Uint8Array(0); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValueOp(): ValueOp { + return { key: new Uint8Array(0), proof: undefined }; +} + +export const ValueOp: MessageFns = { + encode(message: ValueOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValueOp { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: ValueOp): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): ValueOp { + return ValueOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValueOp { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(0); + 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: MessageFns = { + encode(message: DominoOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.input = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.output = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DominoOp { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + input: isSet(object.input) ? globalThis.String(object.input) : "", + output: isSet(object.output) ? globalThis.String(object.output) : "", + }; + }, + + toJSON(message: DominoOp): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.input !== "") { + obj.input = message.input; + } + if (message.output !== "") { + obj.output = message.output; + } + return obj; + }, + + create, I>>(base?: I): DominoOp { + return DominoOp.fromPartial(base ?? ({} as any)); + }, + 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(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/libs/bits/types.ts b/ts-client/cosmos.circuit.v1/types/tendermint/libs/bits/types.ts new file mode 100644 index 00000000..e8ec9685 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/libs/bits/types.ts @@ -0,0 +1,137 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/libs/bits/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.libs.bits"; + +export interface BitArray { + bits: number; + elems: number[]; +} + +function createBaseBitArray(): BitArray { + return { bits: 0, elems: [] }; +} + +export const BitArray: MessageFns = { + encode(message: BitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bits !== 0) { + writer.uint32(8).int64(message.bits); + } + writer.uint32(18).fork(); + for (const v of message.elems) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.bits = longToNumber(reader.int64()); + continue; + case 2: + if (tag === 16) { + message.elems.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.elems.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BitArray { + return { + bits: isSet(object.bits) ? globalThis.Number(object.bits) : 0, + elems: globalThis.Array.isArray(object?.elems) ? object.elems.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: BitArray): unknown { + const obj: any = {}; + if (message.bits !== 0) { + obj.bits = Math.round(message.bits); + } + if (message.elems?.length) { + obj.elems = message.elems.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): BitArray { + return BitArray.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/p2p/types.ts b/ts-client/cosmos.circuit.v1/types/tendermint/p2p/types.ts new file mode 100644 index 00000000..4ea8187a --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/p2p/types.ts @@ -0,0 +1,528 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/p2p/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.p2p"; + +export interface NetAddress { + id: string; + ip: string; + port: number; +} + +export interface ProtocolVersion { + p2p: number; + block: number; + app: number; +} + +export interface DefaultNodeInfo { + protocolVersion: ProtocolVersion | undefined; + defaultNodeId: string; + listenAddr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other: DefaultNodeInfoOther | undefined; +} + +export interface DefaultNodeInfoOther { + txIndex: string; + rpcAddress: string; +} + +function createBaseNetAddress(): NetAddress { + return { id: "", ip: "", port: 0 }; +} + +export const NetAddress: MessageFns = { + encode(message: NetAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.ip !== "") { + writer.uint32(18).string(message.ip); + } + if (message.port !== 0) { + writer.uint32(24).uint32(message.port); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.ip = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.port = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NetAddress { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + ip: isSet(object.ip) ? globalThis.String(object.ip) : "", + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + }; + }, + + toJSON(message: NetAddress): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.ip !== "") { + obj.ip = message.ip; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + + create, I>>(base?: I): NetAddress { + return NetAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetAddress { + const message = createBaseNetAddress(); + message.id = object.id ?? ""; + message.ip = object.ip ?? ""; + message.port = object.port ?? 0; + return message; + }, +}; + +function createBaseProtocolVersion(): ProtocolVersion { + return { p2p: 0, block: 0, app: 0 }; +} + +export const ProtocolVersion: MessageFns = { + encode(message: ProtocolVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ProtocolVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.p2p = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProtocolVersion { + return { + p2p: isSet(object.p2p) ? globalThis.Number(object.p2p) : 0, + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: ProtocolVersion): unknown { + const obj: any = {}; + if (message.p2p !== 0) { + obj.p2p = Math.round(message.p2p); + } + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): ProtocolVersion { + return ProtocolVersion.fromPartial(base ?? ({} as any)); + }, + 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 createBaseDefaultNodeInfo(): DefaultNodeInfo { + return { + protocolVersion: undefined, + defaultNodeId: "", + listenAddr: "", + network: "", + version: "", + channels: new Uint8Array(0), + moniker: "", + other: undefined, + }; +} + +export const DefaultNodeInfo: MessageFns = { + encode(message: DefaultNodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocolVersion !== undefined) { + ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).join(); + } + if (message.defaultNodeId !== "") { + writer.uint32(18).string(message.defaultNodeId); + } + if (message.listenAddr !== "") { + writer.uint32(26).string(message.listenAddr); + } + 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) { + DefaultNodeInfoOther.encode(message.other, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protocolVersion = ProtocolVersion.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.defaultNodeId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.listenAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.network = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.version = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.channels = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.moniker = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.other = DefaultNodeInfoOther.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfo { + return { + protocolVersion: isSet(object.protocolVersion) ? ProtocolVersion.fromJSON(object.protocolVersion) : undefined, + defaultNodeId: isSet(object.defaultNodeId) ? globalThis.String(object.defaultNodeId) : "", + listenAddr: isSet(object.listenAddr) ? globalThis.String(object.listenAddr) : "", + network: isSet(object.network) ? globalThis.String(object.network) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + channels: isSet(object.channels) ? bytesFromBase64(object.channels) : new Uint8Array(0), + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + other: isSet(object.other) ? DefaultNodeInfoOther.fromJSON(object.other) : undefined, + }; + }, + + toJSON(message: DefaultNodeInfo): unknown { + const obj: any = {}; + if (message.protocolVersion !== undefined) { + obj.protocolVersion = ProtocolVersion.toJSON(message.protocolVersion); + } + if (message.defaultNodeId !== "") { + obj.defaultNodeId = message.defaultNodeId; + } + if (message.listenAddr !== "") { + obj.listenAddr = message.listenAddr; + } + if (message.network !== "") { + obj.network = message.network; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.channels.length !== 0) { + obj.channels = base64FromBytes(message.channels); + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.other !== undefined) { + obj.other = DefaultNodeInfoOther.toJSON(message.other); + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfo { + return DefaultNodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfo { + const message = createBaseDefaultNodeInfo(); + message.protocolVersion = (object.protocolVersion !== undefined && object.protocolVersion !== null) + ? ProtocolVersion.fromPartial(object.protocolVersion) + : undefined; + message.defaultNodeId = object.defaultNodeId ?? ""; + message.listenAddr = object.listenAddr ?? ""; + message.network = object.network ?? ""; + message.version = object.version ?? ""; + message.channels = object.channels ?? new Uint8Array(0); + message.moniker = object.moniker ?? ""; + message.other = (object.other !== undefined && object.other !== null) + ? DefaultNodeInfoOther.fromPartial(object.other) + : undefined; + return message; + }, +}; + +function createBaseDefaultNodeInfoOther(): DefaultNodeInfoOther { + return { txIndex: "", rpcAddress: "" }; +} + +export const DefaultNodeInfoOther: MessageFns = { + encode(message: DefaultNodeInfoOther, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txIndex !== "") { + writer.uint32(10).string(message.txIndex); + } + if (message.rpcAddress !== "") { + writer.uint32(18).string(message.rpcAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfoOther { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfoOther(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txIndex = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfoOther { + return { + txIndex: isSet(object.txIndex) ? globalThis.String(object.txIndex) : "", + rpcAddress: isSet(object.rpcAddress) ? globalThis.String(object.rpcAddress) : "", + }; + }, + + toJSON(message: DefaultNodeInfoOther): unknown { + const obj: any = {}; + if (message.txIndex !== "") { + obj.txIndex = message.txIndex; + } + if (message.rpcAddress !== "") { + obj.rpcAddress = message.rpcAddress; + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfoOther { + return DefaultNodeInfoOther.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfoOther { + const message = createBaseDefaultNodeInfoOther(); + message.txIndex = object.txIndex ?? ""; + message.rpcAddress = object.rpcAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/types/block.ts b/ts-client/cosmos.circuit.v1/types/tendermint/types/block.ts new file mode 100644 index 00000000..4fbb3c13 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/types/block.ts @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/block.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { EvidenceList } from "./evidence"; +import { Commit, Data, Header } from "./types"; + +export const protobufPackage = "tendermint.types"; + +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/types/evidence.ts b/ts-client/cosmos.circuit.v1/types/tendermint/types/evidence.ts new file mode 100644 index 00000000..9a2fc48b --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/types/evidence.ts @@ -0,0 +1,489 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/evidence.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { LightBlock, Vote } from "./types"; +import { Validator } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +export interface Evidence { + duplicateVoteEvidence?: DuplicateVoteEvidence | undefined; + lightClientAttackEvidence?: LightClientAttackEvidence | undefined; +} + +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidence { + voteA: Vote | undefined; + voteB: Vote | undefined; + totalVotingPower: number; + validatorPower: number; + timestamp: Date | undefined; +} + +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidence { + conflictingBlock: LightBlock | undefined; + commonHeight: number; + byzantineValidators: Validator[]; + totalVotingPower: number; + timestamp: Date | undefined; +} + +export interface EvidenceList { + evidence: Evidence[]; +} + +function createBaseEvidence(): Evidence { + return { duplicateVoteEvidence: undefined, lightClientAttackEvidence: undefined }; +} + +export const Evidence: MessageFns = { + encode(message: Evidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.duplicateVoteEvidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).join(); + } + if (message.lightClientAttackEvidence !== undefined) { + LightClientAttackEvidence.encode(message.lightClientAttackEvidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.duplicateVoteEvidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lightClientAttackEvidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + duplicateVoteEvidence: isSet(object.duplicateVoteEvidence) + ? DuplicateVoteEvidence.fromJSON(object.duplicateVoteEvidence) + : undefined, + lightClientAttackEvidence: isSet(object.lightClientAttackEvidence) + ? LightClientAttackEvidence.fromJSON(object.lightClientAttackEvidence) + : undefined, + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + if (message.duplicateVoteEvidence !== undefined) { + obj.duplicateVoteEvidence = DuplicateVoteEvidence.toJSON(message.duplicateVoteEvidence); + } + if (message.lightClientAttackEvidence !== undefined) { + obj.lightClientAttackEvidence = LightClientAttackEvidence.toJSON(message.lightClientAttackEvidence); + } + return obj; + }, + + create, I>>(base?: I): Evidence { + return Evidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.duplicateVoteEvidence = + (object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null) + ? DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) + : undefined; + message.lightClientAttackEvidence = + (object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null) + ? LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) + : undefined; + return message; + }, +}; + +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { voteA: undefined, voteB: undefined, totalVotingPower: 0, validatorPower: 0, timestamp: undefined }; +} + +export const DuplicateVoteEvidence: MessageFns = { + encode(message: DuplicateVoteEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteA !== undefined) { + Vote.encode(message.voteA, writer.uint32(10).fork()).join(); + } + if (message.voteB !== undefined) { + Vote.encode(message.voteB, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + writer.uint32(32).int64(message.validatorPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuplicateVoteEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteA = Vote.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voteB = Vote.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.validatorPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DuplicateVoteEvidence { + return { + voteA: isSet(object.voteA) ? Vote.fromJSON(object.voteA) : undefined, + voteB: isSet(object.voteB) ? Vote.fromJSON(object.voteB) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + validatorPower: isSet(object.validatorPower) ? globalThis.Number(object.validatorPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: DuplicateVoteEvidence): unknown { + const obj: any = {}; + if (message.voteA !== undefined) { + obj.voteA = Vote.toJSON(message.voteA); + } + if (message.voteB !== undefined) { + obj.voteB = Vote.toJSON(message.voteB); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + obj.validatorPower = Math.round(message.validatorPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.voteA = (object.voteA !== undefined && object.voteA !== null) ? Vote.fromPartial(object.voteA) : undefined; + message.voteB = (object.voteB !== undefined && object.voteB !== null) ? Vote.fromPartial(object.voteB) : undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.validatorPower = object.validatorPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflictingBlock: undefined, + commonHeight: 0, + byzantineValidators: [], + totalVotingPower: 0, + timestamp: undefined, + }; +} + +export const LightClientAttackEvidence: MessageFns = { + encode(message: LightClientAttackEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.conflictingBlock !== undefined) { + LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).join(); + } + if (message.commonHeight !== 0) { + writer.uint32(16).int64(message.commonHeight); + } + for (const v of message.byzantineValidators) { + Validator.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(32).int64(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightClientAttackEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.conflictingBlock = LightBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.commonHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.byzantineValidators.push(Validator.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightClientAttackEvidence { + return { + conflictingBlock: isSet(object.conflictingBlock) ? LightBlock.fromJSON(object.conflictingBlock) : undefined, + commonHeight: isSet(object.commonHeight) ? globalThis.Number(object.commonHeight) : 0, + byzantineValidators: globalThis.Array.isArray(object?.byzantineValidators) + ? object.byzantineValidators.map((e: any) => Validator.fromJSON(e)) + : [], + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: LightClientAttackEvidence): unknown { + const obj: any = {}; + if (message.conflictingBlock !== undefined) { + obj.conflictingBlock = LightBlock.toJSON(message.conflictingBlock); + } + if (message.commonHeight !== 0) { + obj.commonHeight = Math.round(message.commonHeight); + } + if (message.byzantineValidators?.length) { + obj.byzantineValidators = message.byzantineValidators.map((e) => Validator.toJSON(e)); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): LightClientAttackEvidence { + return LightClientAttackEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflictingBlock = (object.conflictingBlock !== undefined && object.conflictingBlock !== null) + ? LightBlock.fromPartial(object.conflictingBlock) + : undefined; + message.commonHeight = object.commonHeight ?? 0; + message.byzantineValidators = object.byzantineValidators?.map((e) => Validator.fromPartial(e)) || []; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseEvidenceList(): EvidenceList { + return { evidence: [] }; +} + +export const EvidenceList: MessageFns = { + encode(message: EvidenceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence.push(Evidence.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceList { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Evidence.fromJSON(e)) : [], + }; + }, + + toJSON(message: EvidenceList): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Evidence.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EvidenceList { + return EvidenceList.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/types/params.ts b/ts-client/cosmos.circuit.v1/types/tendermint/types/params.ts new file mode 100644 index 00000000..d4cc2b8a --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/types/params.ts @@ -0,0 +1,686 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; + evidence: EvidenceParams | undefined; + validator: ValidatorParams | undefined; + version: VersionParams | undefined; + abci: ABCIParams | undefined; +} + +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + maxBytes: number; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + maxGas: number; +} + +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + maxAgeNumBlocks: number; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + maxAgeDuration: + | Duration + | undefined; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + maxBytes: number; +} + +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pubKeyTypes: string[]; +} + +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app: number; +} + +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + blockMaxBytes: number; + blockMaxGas: number; +} + +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParams { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + voteExtensionsEnableHeight: number; +} + +function createBaseConsensusParams(): ConsensusParams { + return { block: undefined, evidence: undefined, validator: undefined, version: undefined, abci: undefined }; +} + +export const ConsensusParams: MessageFns = { + encode(message: ConsensusParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(10).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(26).fork()).join(); + } + if (message.version !== undefined) { + VersionParams.encode(message.version, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.version = VersionParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.version !== undefined) { + obj.version = VersionParams.toJSON(message.version); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + return obj; + }, + + create, I>>(base?: I): ConsensusParams { + return ConsensusParams.fromPartial(base ?? ({} as any)); + }, + 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; + message.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseBlockParams(): BlockParams { + return { maxBytes: 0, maxGas: 0 }; +} + +export const BlockParams: MessageFns = { + encode(message: BlockParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxBytes !== 0) { + writer.uint32(8).int64(message.maxBytes); + } + if (message.maxGas !== 0) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + maxGas: isSet(object.maxGas) ? globalThis.Number(object.maxGas) : 0, + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxGas !== 0) { + obj.maxGas = Math.round(message.maxGas); + } + return obj; + }, + + create, I>>(base?: I): BlockParams { + return BlockParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes ?? 0; + message.maxGas = object.maxGas ?? 0; + return message; + }, +}; + +function createBaseEvidenceParams(): EvidenceParams { + return { maxAgeNumBlocks: 0, maxAgeDuration: undefined, maxBytes: 0 }; +} + +export const EvidenceParams: MessageFns = { + encode(message: EvidenceParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxAgeNumBlocks !== 0) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).join(); + } + if (message.maxBytes !== 0) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxAgeNumBlocks = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxAgeDuration = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceParams { + return { + maxAgeNumBlocks: isSet(object.maxAgeNumBlocks) ? globalThis.Number(object.maxAgeNumBlocks) : 0, + maxAgeDuration: isSet(object.maxAgeDuration) ? Duration.fromJSON(object.maxAgeDuration) : undefined, + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + }; + }, + + toJSON(message: EvidenceParams): unknown { + const obj: any = {}; + if (message.maxAgeNumBlocks !== 0) { + obj.maxAgeNumBlocks = Math.round(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + obj.maxAgeDuration = Duration.toJSON(message.maxAgeDuration); + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + return obj; + }, + + create, I>>(base?: I): EvidenceParams { + return EvidenceParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EvidenceParams { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = object.maxAgeNumBlocks ?? 0; + message.maxAgeDuration = (object.maxAgeDuration !== undefined && object.maxAgeDuration !== null) + ? Duration.fromPartial(object.maxAgeDuration) + : undefined; + message.maxBytes = object.maxBytes ?? 0; + return message; + }, +}; + +function createBaseValidatorParams(): ValidatorParams { + return { pubKeyTypes: [] }; +} + +export const ValidatorParams: MessageFns = { + encode(message: ValidatorParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKeyTypes.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorParams { + return { + pubKeyTypes: globalThis.Array.isArray(object?.pubKeyTypes) + ? object.pubKeyTypes.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValidatorParams): unknown { + const obj: any = {}; + if (message.pubKeyTypes?.length) { + obj.pubKeyTypes = message.pubKeyTypes; + } + return obj; + }, + + create, I>>(base?: I): ValidatorParams { + return ValidatorParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVersionParams(): VersionParams { + return { app: 0 }; +} + +export const VersionParams: MessageFns = { + encode(message: VersionParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.app !== 0) { + writer.uint32(8).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionParams { + return { app: isSet(object.app) ? globalThis.Number(object.app) : 0 }; + }, + + toJSON(message: VersionParams): unknown { + const obj: any = {}; + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): VersionParams { + return VersionParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionParams { + const message = createBaseVersionParams(); + message.app = object.app ?? 0; + return message; + }, +}; + +function createBaseHashedParams(): HashedParams { + return { blockMaxBytes: 0, blockMaxGas: 0 }; +} + +export const HashedParams: MessageFns = { + encode(message: HashedParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockMaxBytes !== 0) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockMaxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockMaxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashedParams { + return { + blockMaxBytes: isSet(object.blockMaxBytes) ? globalThis.Number(object.blockMaxBytes) : 0, + blockMaxGas: isSet(object.blockMaxGas) ? globalThis.Number(object.blockMaxGas) : 0, + }; + }, + + toJSON(message: HashedParams): unknown { + const obj: any = {}; + if (message.blockMaxBytes !== 0) { + obj.blockMaxBytes = Math.round(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + obj.blockMaxGas = Math.round(message.blockMaxGas); + } + return obj; + }, + + create, I>>(base?: I): HashedParams { + return HashedParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HashedParams { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes ?? 0; + message.blockMaxGas = object.blockMaxGas ?? 0; + return message; + }, +}; + +function createBaseABCIParams(): ABCIParams { + return { voteExtensionsEnableHeight: 0 }; +} + +export const ABCIParams: MessageFns = { + encode(message: ABCIParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtensionsEnableHeight !== 0) { + writer.uint32(8).int64(message.voteExtensionsEnableHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.voteExtensionsEnableHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIParams { + return { + voteExtensionsEnableHeight: isSet(object.voteExtensionsEnableHeight) + ? globalThis.Number(object.voteExtensionsEnableHeight) + : 0, + }; + }, + + toJSON(message: ABCIParams): unknown { + const obj: any = {}; + if (message.voteExtensionsEnableHeight !== 0) { + obj.voteExtensionsEnableHeight = Math.round(message.voteExtensionsEnableHeight); + } + return obj; + }, + + create, I>>(base?: I): ABCIParams { + return ABCIParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIParams { + const message = createBaseABCIParams(); + message.voteExtensionsEnableHeight = object.voteExtensionsEnableHeight ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/types/types.ts b/ts-client/cosmos.circuit.v1/types/tendermint/types/types.ts new file mode 100644 index 00000000..85454a42 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/types/types.ts @@ -0,0 +1,2065 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON, ValidatorSet } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +/** 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 | undefined; +} + +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + partSetHeader: PartSetHeader | undefined; +} + +/** Header defines the structure of a block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** original proposer of the block */ + proposerAddress: Uint8Array; +} + +/** 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 or precommit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: number; + round: number; + /** zero if vote is nil. */ + blockId: BlockID | undefined; + timestamp: Date | undefined; + validatorAddress: Uint8Array; + validatorIndex: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ + signature: Uint8Array; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension: Uint8Array; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. + * Only valid for precommit messages. + */ + extensionSignature: Uint8Array; +} + +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: number; + round: number; + blockId: BlockID | undefined; + signatures: CommitSig[]; +} + +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface ExtendedCommit { + height: number; + round: number; + blockId: BlockID | undefined; + extendedSignatures: ExtendedCommitSig[]; +} + +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; + /** Vote extension data */ + extension: Uint8Array; + /** Vote extension signature */ + extensionSignature: Uint8Array; +} + +export interface Proposal { + type: SignedMsgType; + height: number; + round: number; + polRound: number; + blockId: BlockID | undefined; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface SignedHeader { + header: Header | undefined; + commit: Commit | undefined; +} + +export interface LightBlock { + signedHeader: SignedHeader | undefined; + validatorSet: ValidatorSet | undefined; +} + +export interface BlockMeta { + blockId: BlockID | undefined; + blockSize: number; + header: Header | undefined; + numTxs: number; +} + +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + rootHash: Uint8Array; + data: Uint8Array; + proof: Proof | undefined; +} + +function createBasePartSetHeader(): PartSetHeader { + return { total: 0, hash: new Uint8Array(0) }; +} + +export const PartSetHeader: MessageFns = { + encode(message: PartSetHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PartSetHeader { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: PartSetHeader): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): PartSetHeader { + return PartSetHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePart(): Part { + return { index: 0, bytes: new Uint8Array(0), proof: undefined }; +} + +export const Part: MessageFns = { + encode(message: Part, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Part { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Part { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: Part): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.bytes.length !== 0) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): Part { + return Part.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Part { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function createBaseBlockID(): BlockID { + return { hash: new Uint8Array(0), partSetHeader: undefined }; +} + +export const BlockID: MessageFns = { + encode(message: BlockID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.partSetHeader = PartSetHeader.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockID { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + partSetHeader: isSet(object.partSetHeader) ? PartSetHeader.fromJSON(object.partSetHeader) : undefined, + }; + }, + + toJSON(message: BlockID): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.partSetHeader !== undefined) { + obj.partSetHeader = PartSetHeader.toJSON(message.partSetHeader); + } + return obj; + }, + + create, I>>(base?: I): BlockID { + return BlockID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(0); + message.partSetHeader = (object.partSetHeader !== undefined && object.partSetHeader !== null) + ? PartSetHeader.fromPartial(object.partSetHeader) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseData(): Data { + return { txs: [] }; +} + +export const Data: MessageFns = { + encode(message: Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Data { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: Data): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Data { + return Data.fromPartial(base ?? ({} as any)); + }, + 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, + blockId: undefined, + timestamp: undefined, + validatorAddress: new Uint8Array(0), + validatorIndex: 0, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(74).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(82).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.validatorIndex = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.signature = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.extension = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + validatorIndex: isSet(object.validatorIndex) ? globalThis.Number(object.validatorIndex) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + obj.validatorIndex = Math.round(message.validatorIndex); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommit(): Commit { + return { height: 0, round: 0, blockId: undefined, signatures: [] }; +} + +export const Commit: MessageFns = { + encode(message: Commit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signatures.push(CommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => CommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Commit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => CommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Commit { + return Commit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commit { + const message = createBaseCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.signatures = object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommitSig(): CommitSig { + return { blockIdFlag: 0, validatorAddress: new Uint8Array(0), timestamp: undefined, signature: new Uint8Array(0) }; +} + +export const CommitSig: MessageFns = { + encode(message: CommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): CommitSig { + return CommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitSig { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseExtendedCommit(): ExtendedCommit { + return { height: 0, round: 0, blockId: undefined, extendedSignatures: [] }; +} + +export const ExtendedCommit: MessageFns = { + encode(message: ExtendedCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.extendedSignatures) { + ExtendedCommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extendedSignatures.push(ExtendedCommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + extendedSignatures: globalThis.Array.isArray(object?.extendedSignatures) + ? object.extendedSignatures.map((e: any) => ExtendedCommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ExtendedCommit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.extendedSignatures?.length) { + obj.extendedSignatures = message.extendedSignatures.map((e) => ExtendedCommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommit { + return ExtendedCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommit { + const message = createBaseExtendedCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.extendedSignatures = object.extendedSignatures?.map((e) => ExtendedCommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitSig(): ExtendedCommitSig { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(0), + timestamp: undefined, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const ExtendedCommitSig: MessageFns = { + encode(message: ExtendedCommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(42).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(50).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.extension = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: ExtendedCommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitSig { + return ExtendedCommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + type: 0, + height: 0, + round: 0, + polRound: 0, + blockId: undefined, + timestamp: undefined, + signature: new Uint8Array(0), + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(42).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.polRound = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + polRound: isSet(object.polRound) ? globalThis.Number(object.polRound) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.polRound !== 0) { + obj.polRound = Math.round(message.polRound); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignedHeader(): SignedHeader { + return { header: undefined, commit: undefined }; +} + +export const SignedHeader: MessageFns = { + encode(message: SignedHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.commit !== undefined) { + Commit.encode(message.commit, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.commit !== undefined) { + obj.commit = Commit.toJSON(message.commit); + } + return obj; + }, + + create, I>>(base?: I): SignedHeader { + return SignedHeader.fromPartial(base ?? ({} as any)); + }, + 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 { signedHeader: undefined, validatorSet: undefined }; +} + +export const LightBlock: MessageFns = { + encode(message: LightBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedHeader !== undefined) { + SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).join(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightBlock { + return { + signedHeader: isSet(object.signedHeader) ? SignedHeader.fromJSON(object.signedHeader) : undefined, + validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined, + }; + }, + + toJSON(message: LightBlock): unknown { + const obj: any = {}; + if (message.signedHeader !== undefined) { + obj.signedHeader = SignedHeader.toJSON(message.signedHeader); + } + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): LightBlock { + return LightBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightBlock { + const message = createBaseLightBlock(); + message.signedHeader = (object.signedHeader !== undefined && object.signedHeader !== null) + ? SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseBlockMeta(): BlockMeta { + return { blockId: undefined, blockSize: 0, header: undefined, numTxs: 0 }; +} + +export const BlockMeta: MessageFns = { + encode(message: BlockMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.blockSize !== 0) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).join(); + } + if (message.numTxs !== 0) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockSize = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numTxs = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMeta { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + blockSize: isSet(object.blockSize) ? globalThis.Number(object.blockSize) : 0, + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + numTxs: isSet(object.numTxs) ? globalThis.Number(object.numTxs) : 0, + }; + }, + + toJSON(message: BlockMeta): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.blockSize !== 0) { + obj.blockSize = Math.round(message.blockSize); + } + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.numTxs !== 0) { + obj.numTxs = Math.round(message.numTxs); + } + return obj; + }, + + create, I>>(base?: I): BlockMeta { + return BlockMeta.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMeta { + const message = createBaseBlockMeta(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.blockSize = object.blockSize ?? 0; + message.header = (object.header !== undefined && object.header !== null) + ? Header.fromPartial(object.header) + : undefined; + message.numTxs = object.numTxs ?? 0; + return message; + }, +}; + +function createBaseTxProof(): TxProof { + return { rootHash: new Uint8Array(0), data: new Uint8Array(0), proof: undefined }; +} + +export const TxProof: MessageFns = { + encode(message: TxProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rootHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxProof { + return { + rootHash: isSet(object.rootHash) ? bytesFromBase64(object.rootHash) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: TxProof): unknown { + const obj: any = {}; + if (message.rootHash.length !== 0) { + obj.rootHash = base64FromBytes(message.rootHash); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): TxProof { + return TxProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxProof { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/types/validator.ts b/ts-client/cosmos.circuit.v1/types/tendermint/types/validator.ts new file mode 100644 index 00000000..623b14d8 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/types/validator.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/validator.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PublicKey } from "../crypto/keys"; + +export const protobufPackage = "tendermint.types"; + +/** BlockIdFlag indicates which BlockID the signature is for */ +export enum BlockIDFlag { + /** BLOCK_ID_FLAG_UNKNOWN - indicates an error condition */ + BLOCK_ID_FLAG_UNKNOWN = 0, + /** BLOCK_ID_FLAG_ABSENT - the vote was not received */ + BLOCK_ID_FLAG_ABSENT = 1, + /** BLOCK_ID_FLAG_COMMIT - voted for the block that received the majority */ + BLOCK_ID_FLAG_COMMIT = 2, + /** BLOCK_ID_FLAG_NIL - voted for nil */ + 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"; + } +} + +export interface ValidatorSet { + validators: Validator[]; + proposer: Validator | undefined; + totalVotingPower: number; +} + +export interface Validator { + address: Uint8Array; + pubKey: PublicKey | undefined; + votingPower: number; + proposerPriority: number; +} + +export interface SimpleValidator { + pubKey: PublicKey | undefined; + votingPower: number; +} + +function createBaseValidatorSet(): ValidatorSet { + return { validators: [], proposer: undefined, totalVotingPower: 0 }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.proposer !== undefined) { + Validator.encode(message.proposer, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.proposer !== undefined) { + obj.proposer = Validator.toJSON(message.proposer); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + 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.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseSimpleValidator(): SimpleValidator { + return { pubKey: undefined, votingPower: 0 }; +} + +export const SimpleValidator: MessageFns = { + encode(message: SimpleValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimpleValidator { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + }; + }, + + toJSON(message: SimpleValidator): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + return obj; + }, + + create, I>>(base?: I): SimpleValidator { + return SimpleValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.circuit.v1/types/tendermint/version/types.ts b/ts-client/cosmos.circuit.v1/types/tendermint/version/types.ts new file mode 100644 index 00000000..7a4b2fa4 --- /dev/null +++ b/ts-client/cosmos.circuit.v1/types/tendermint/version/types.ts @@ -0,0 +1,214 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/version/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: number; + 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: number; + app: number; +} + +function createBaseApp(): App { + return { protocol: 0, software: "" }; +} + +export const App: MessageFns = { + encode(message: App, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocol !== 0) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): App { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.protocol = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.software = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): App { + return { + protocol: isSet(object.protocol) ? globalThis.Number(object.protocol) : 0, + software: isSet(object.software) ? globalThis.String(object.software) : "", + }; + }, + + toJSON(message: App): unknown { + const obj: any = {}; + if (message.protocol !== 0) { + obj.protocol = Math.round(message.protocol); + } + if (message.software !== "") { + obj.software = message.software; + } + return obj; + }, + + create, I>>(base?: I): App { + return App.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Consensus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== 0) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== 0) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Consensus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Consensus { + return { + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: Consensus): unknown { + const obj: any = {}; + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): Consensus { + return Consensus.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/module.ts b/ts-client/cosmos.consensus.v1/module.ts index 195de805..bbbdc1e7 100755 --- a/ts-client/cosmos.consensus.v1/module.ts +++ b/ts-client/cosmos.consensus.v1/module.ts @@ -6,13 +6,19 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { QueryParamsRequest } from "./types/cosmos/consensus/v1/query"; -import { QueryParamsResponse } from "./types/cosmos/consensus/v1/query"; -import { MsgUpdateParamsResponse } from "./types/cosmos/consensus/v1/tx"; -import { MsgUpdateParams } from "./types/cosmos/consensus/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/consensus/v1/tx"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/consensus/v1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/consensus/v1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/consensus/v1/tx"; -export { QueryParamsRequest, QueryParamsResponse, MsgUpdateParamsResponse, MsgUpdateParams }; +export { MsgUpdateParams, QueryParamsRequest, QueryParamsResponse, MsgUpdateParamsResponse }; + +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, + fee?: StdFee, + memo?: string +}; type sendQueryParamsRequestParams = { value: QueryParamsRequest, @@ -32,13 +38,11 @@ type sendMsgUpdateParamsResponseParams = { memo?: string }; -type sendMsgUpdateParamsParams = { + +type msgUpdateParamsParams = { value: MsgUpdateParams, - fee?: StdFee, - memo?: string }; - type queryParamsRequestParams = { value: QueryParamsRequest, }; @@ -51,10 +55,6 @@ type msgUpdateParamsResponseParams = { value: MsgUpdateParamsResponse, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, -}; - export const registry = new Registry(msgTypes); @@ -85,6 +85,20 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + } + }, + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') @@ -127,21 +141,15 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { - if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + try { + return { typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { return { typeUrl: "/cosmos.consensus.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } @@ -166,14 +174,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { - try { - return { typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) - } - }, - } }; diff --git a/ts-client/cosmos.consensus.v1/registry.ts b/ts-client/cosmos.consensus.v1/registry.ts index 6a2aede9..a6fd5675 100755 --- a/ts-client/cosmos.consensus.v1/registry.ts +++ b/ts-client/cosmos.consensus.v1/registry.ts @@ -1,14 +1,14 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { QueryParamsRequest } from "./types/cosmos/consensus/v1/query"; -import { QueryParamsResponse } from "./types/cosmos/consensus/v1/query"; -import { MsgUpdateParamsResponse } from "./types/cosmos/consensus/v1/tx"; -import { MsgUpdateParams } from "./types/cosmos/consensus/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/consensus/v1/tx"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/consensus/v1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/consensus/v1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/consensus/v1/tx"; const msgTypes: Array<[string, GeneratedType]> = [ + ["/cosmos.consensus.v1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.consensus.v1.QueryParamsRequest", QueryParamsRequest], ["/cosmos.consensus.v1.QueryParamsResponse", QueryParamsResponse], ["/cosmos.consensus.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/cosmos.consensus.v1.MsgUpdateParams", MsgUpdateParams], ]; diff --git a/ts-client/cosmos.consensus.v1/types/amino/amino.ts b/ts-client/cosmos.consensus.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.consensus.v1/types/amino/amino.ts +++ b/ts-client/cosmos.consensus.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.consensus.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.consensus.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.consensus.v1/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..effd5449 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} + +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + 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(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: 0 }; +} + +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.consensus.v1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.consensus.v1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.consensus.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.consensus.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.consensus.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.consensus.v1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.consensus.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.consensus.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.consensus.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.consensus.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.consensus.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.consensus.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.consensus.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.consensus.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/pep/params.ts b/ts-client/cosmos.consensus.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.consensus.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/pep/query.ts b/ts-client/cosmos.consensus.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.consensus.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/fairyring/pep/tx.ts b/ts-client/cosmos.consensus.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/gogoproto/gogo.ts b/ts-client/cosmos.consensus.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.consensus.v1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.consensus.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.consensus.v1/types/google/api/annotations.ts b/ts-client/cosmos.consensus.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.consensus.v1/types/google/api/annotations.ts +++ b/ts-client/cosmos.consensus.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.consensus.v1/types/google/api/http.ts b/ts-client/cosmos.consensus.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.consensus.v1/types/google/api/http.ts +++ b/ts-client/cosmos.consensus.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.consensus.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.consensus.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.consensus.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/google/protobuf/duration.ts b/ts-client/cosmos.consensus.v1/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/cosmos.consensus.v1/types/google/protobuf/duration.ts +++ b/ts-client/cosmos.consensus.v1/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.consensus.v1/types/route-name.eta b/ts-client/cosmos.consensus.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.consensus.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.crisis.v1beta1/module.ts b/ts-client/cosmos.crisis.v1beta1/module.ts index 4efe8f56..7f4a7ecc 100755 --- a/ts-client/cosmos.crisis.v1beta1/module.ts +++ b/ts-client/cosmos.crisis.v1beta1/module.ts @@ -6,23 +6,23 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { GenesisState } from "./types/cosmos/crisis/v1beta1/genesis"; -import { MsgVerifyInvariant } from "./types/cosmos/crisis/v1beta1/tx"; -import { MsgVerifyInvariantResponse } from "./types/cosmos/crisis/v1beta1/tx"; -import { MsgUpdateParams } from "./types/cosmos/crisis/v1beta1/tx"; -import { MsgUpdateParamsResponse } from "./types/cosmos/crisis/v1beta1/tx"; +import { MsgVerifyInvariant } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/genesis"; +import { MsgVerifyInvariantResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/tx"; -export { GenesisState, MsgVerifyInvariant, MsgVerifyInvariantResponse, MsgUpdateParams, MsgUpdateParamsResponse }; +export { MsgVerifyInvariant, GenesisState, MsgVerifyInvariantResponse, MsgUpdateParams, MsgUpdateParamsResponse }; -type sendGenesisStateParams = { - value: GenesisState, +type sendMsgVerifyInvariantParams = { + value: MsgVerifyInvariant, fee?: StdFee, memo?: string }; -type sendMsgVerifyInvariantParams = { - value: MsgVerifyInvariant, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; @@ -46,14 +46,14 @@ type sendMsgUpdateParamsResponseParams = { }; -type genesisStateParams = { - value: GenesisState, -}; - type msgVerifyInvariantParams = { value: MsgVerifyInvariant, }; +type genesisStateParams = { + value: GenesisState, +}; + type msgVerifyInvariantResponseParams = { value: MsgVerifyInvariantResponse, }; @@ -96,31 +96,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendMsgVerifyInvariant({ value, fee, memo }: sendMsgVerifyInvariantParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVerifyInvariant: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.msgVerifyInvariant({ value: MsgVerifyInvariant.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVerifyInvariant: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVerifyInvariant({ value, fee, memo }: sendMsgVerifyInvariantParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVerifyInvariant: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVerifyInvariant({ value: MsgVerifyInvariant.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVerifyInvariant: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, @@ -167,19 +167,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht }, - genesisState({ value }: genesisStateParams): EncodeObject { + msgVerifyInvariant({ value }: msgVerifyInvariantParams): EncodeObject { try { - return { typeUrl: "/cosmos.crisis.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant", value: MsgVerifyInvariant.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVerifyInvariant: Could not create message: ' + e.message) } }, - msgVerifyInvariant({ value }: msgVerifyInvariantParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant", value: MsgVerifyInvariant.fromPartial( value ) } + return { typeUrl: "/cosmos.crisis.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVerifyInvariant: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.crisis.v1beta1/registry.ts b/ts-client/cosmos.crisis.v1beta1/registry.ts index d9e06a8c..fd05f929 100755 --- a/ts-client/cosmos.crisis.v1beta1/registry.ts +++ b/ts-client/cosmos.crisis.v1beta1/registry.ts @@ -1,13 +1,13 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { GenesisState } from "./types/cosmos/crisis/v1beta1/genesis"; -import { MsgVerifyInvariant } from "./types/cosmos/crisis/v1beta1/tx"; -import { MsgVerifyInvariantResponse } from "./types/cosmos/crisis/v1beta1/tx"; -import { MsgUpdateParams } from "./types/cosmos/crisis/v1beta1/tx"; -import { MsgUpdateParamsResponse } from "./types/cosmos/crisis/v1beta1/tx"; +import { MsgVerifyInvariant } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/genesis"; +import { MsgVerifyInvariantResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/crisis/v1beta1/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.crisis.v1beta1.GenesisState", GenesisState], ["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant], + ["/cosmos.crisis.v1beta1.GenesisState", GenesisState], ["/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse", MsgVerifyInvariantResponse], ["/cosmos.crisis.v1beta1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.crisis.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], diff --git a/ts-client/cosmos.crisis.v1beta1/types/amino/amino.ts b/ts-client/cosmos.crisis.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.crisis.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.crisis.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.crisis.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.crisis.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.crisis.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..effd5449 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} + +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + 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(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: 0 }; +} + +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.crisis.v1beta1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/cosmos.crisis.v1beta1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmos.crisis.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.crisis.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.crisis.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.crisis.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.crisis.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.crisis.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.crisis.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.crisis.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.crisis.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.crisis.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.crisis.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.crisis.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.crisis.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.crisis.v1beta1/types/google/api/annotations.ts new file mode 100644 index 00000000..d089209b --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/google/api/annotations.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + +/* eslint-disable */ + +export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.crisis.v1beta1/types/google/api/http.ts b/ts-client/cosmos.crisis.v1beta1/types/google/api/http.ts new file mode 100644 index 00000000..9ee09880 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/google/api/http.ts @@ -0,0 +1,756 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.api"; + +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface Http { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRule[]; + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fullyDecodeReservedExpansion: boolean; +} + +/** + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * The following HTTP JSON to RPC mapping is enabled: + * + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` + * + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` + * + * Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRule { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + */ + selector: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: + | string + | undefined; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: + | string + | undefined; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: + | string + | undefined; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: + | string + | undefined; + /** Maps to HTTP PATCH. Used for updating a resource. */ + patch?: + | string + | undefined; + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + */ + custom?: + | CustomHttpPattern + | undefined; + /** + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} + +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} + +function createBaseHttp(): Http { + return { rules: [], fullyDecodeReservedExpansion: false }; +} + +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fullyDecodeReservedExpansion !== false) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rules.push(HttpRule.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.fullyDecodeReservedExpansion = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Http { + return { + rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) + : false, + }; + }, + + toJSON(message: Http): unknown { + const obj: any = {}; + if (message.rules?.length) { + obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); + } + if (message.fullyDecodeReservedExpansion !== false) { + obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + } + 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)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, +}; + +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [], + }; +} + +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.selector = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.get = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.put = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.post = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delete = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.patch = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.body = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.responseBody = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HttpRule { + return { + 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) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) + ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HttpRule): unknown { + const obj: any = {}; + 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.responseBody !== "") { + obj.responseBody = message.responseBody; + } + if (message.additionalBindings?.length) { + obj.additionalBindings = message.additionalBindings.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 ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = (object.custom !== undefined && object.custom !== null) + ? CustomHttpPattern.fromPartial(object.custom) + : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { kind: "", path: "" }; +} + +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CustomHttpPattern { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + path: isSet(object.path) ? globalThis.String(object.path) : "", + }; + }, + + toJSON(message: CustomHttpPattern): unknown { + const obj: any = {}; + 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 ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.crisis.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.crisis.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.crisis.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.crisis.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.crisis.v1beta1/types/route-name.eta b/ts-client/cosmos.crisis.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.crisis.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.distribution.v1beta1/module.ts b/ts-client/cosmos.distribution.v1beta1/module.ts index f7c27c9f..4e407a56 100755 --- a/ts-client/cosmos.distribution.v1beta1/module.ts +++ b/ts-client/cosmos.distribution.v1beta1/module.ts @@ -6,90 +6,90 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { QueryParamsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegationTotalRewardsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { DelegationDelegatorReward } from "./types/cosmos/distribution/v1beta1/distribution"; -import { ValidatorCurrentRewards } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgFundCommunityPool } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgCommunityPoolSpendResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryCommunityPoolResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryParamsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegationRewardsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { CommunityPoolSpendProposalWithDeposit } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgDepositValidatorRewardsPool } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorOutstandingRewardsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegatorValidatorsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { FeePool } from "./types/cosmos/distribution/v1beta1/distribution"; -import { QueryValidatorCommissionResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegatorWithdrawAddressResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { GenesisState } from "./types/cosmos/distribution/v1beta1/genesis"; -import { MsgWithdrawDelegatorRewardResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorDistributionInfoResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegatorValidatorsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegatorWithdrawAddressRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryCommunityPoolRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { CommunityPoolSpendProposal } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgSetWithdrawAddressResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorOutstandingRewardsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryValidatorCommissionRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryValidatorSlashesRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { ValidatorOutstandingRewardsRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { ValidatorHistoricalRewardsRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { ValidatorCurrentRewardsRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { ValidatorSlashEventRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { DelegatorWithdrawInfo } from "./types/cosmos/distribution/v1beta1/genesis"; -import { MsgWithdrawDelegatorReward } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgCommunityPoolSpend } from "./types/cosmos/distribution/v1beta1/tx"; -import { ValidatorOutstandingRewards } from "./types/cosmos/distribution/v1beta1/distribution"; -import { ValidatorSlashEvents } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgWithdrawValidatorCommissionResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorSlashesResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { DelegatorStartingInfo } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgUpdateParams } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryDelegationTotalRewardsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { Params } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorDistributionInfoRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { ValidatorHistoricalRewards } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgUpdateParamsResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryDelegationRewardsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { ValidatorAccumulatedCommissionRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { DelegatorStartingInfoRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { MsgFundCommunityPoolResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgDepositValidatorRewardsPoolResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { ValidatorAccumulatedCommission } from "./types/cosmos/distribution/v1beta1/distribution"; -import { ValidatorSlashEvent } from "./types/cosmos/distribution/v1beta1/distribution"; - - -export { QueryParamsResponse, QueryDelegationTotalRewardsRequest, DelegationDelegatorReward, ValidatorCurrentRewards, MsgSetWithdrawAddress, MsgFundCommunityPool, MsgCommunityPoolSpendResponse, QueryCommunityPoolResponse, QueryParamsRequest, QueryDelegationRewardsRequest, CommunityPoolSpendProposalWithDeposit, MsgDepositValidatorRewardsPool, QueryValidatorOutstandingRewardsResponse, QueryDelegatorValidatorsRequest, FeePool, QueryValidatorCommissionResponse, QueryDelegatorWithdrawAddressResponse, GenesisState, MsgWithdrawDelegatorRewardResponse, QueryValidatorDistributionInfoResponse, QueryDelegatorValidatorsResponse, QueryDelegatorWithdrawAddressRequest, QueryCommunityPoolRequest, CommunityPoolSpendProposal, MsgSetWithdrawAddressResponse, QueryValidatorOutstandingRewardsRequest, QueryValidatorCommissionRequest, QueryValidatorSlashesRequest, ValidatorOutstandingRewardsRecord, ValidatorHistoricalRewardsRecord, ValidatorCurrentRewardsRecord, ValidatorSlashEventRecord, DelegatorWithdrawInfo, MsgWithdrawDelegatorReward, MsgCommunityPoolSpend, ValidatorOutstandingRewards, ValidatorSlashEvents, MsgWithdrawValidatorCommissionResponse, QueryValidatorSlashesResponse, DelegatorStartingInfo, MsgUpdateParams, QueryDelegationTotalRewardsResponse, Params, MsgWithdrawValidatorCommission, QueryValidatorDistributionInfoRequest, ValidatorHistoricalRewards, MsgUpdateParamsResponse, QueryDelegationRewardsResponse, ValidatorAccumulatedCommissionRecord, DelegatorStartingInfoRecord, MsgFundCommunityPoolResponse, MsgDepositValidatorRewardsPoolResponse, ValidatorAccumulatedCommission, ValidatorSlashEvent }; +import { ValidatorAccumulatedCommissionRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryValidatorSlashesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegatorValidatorsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryValidatorCommissionRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegationTotalRewardsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgFundCommunityPool } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { MsgCommunityPoolSpendResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorOutstandingRewards } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { DelegatorStartingInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { DelegatorWithdrawInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { ValidatorSlashEventRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryValidatorOutstandingRewardsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegationRewardsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegatorWithdrawAddressResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgDepositValidatorRewardsPoolResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { QueryDelegatorWithdrawAddressRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryCommunityPoolRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgWithdrawValidatorCommissionResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorCurrentRewardsRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryValidatorOutstandingRewardsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { CommunityPoolSpendProposalWithDeposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { ValidatorSlashEvent } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { QueryValidatorDistributionInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryValidatorSlashesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegationRewardsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorHistoricalRewards } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { ValidatorSlashEvents } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { DelegatorStartingInfoRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryDelegatorValidatorsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryCommunityPoolResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { ValidatorOutstandingRewardsRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgSetWithdrawAddress } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { MsgSetWithdrawAddressResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { MsgWithdrawDelegatorRewardResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { MsgDepositValidatorRewardsPool } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { FeePool } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { MsgWithdrawDelegatorReward } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { DelegationDelegatorReward } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryValidatorCommissionResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgWithdrawValidatorCommission } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorCurrentRewards } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { ValidatorAccumulatedCommission } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { CommunityPoolSpendProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { QueryDelegationTotalRewardsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgFundCommunityPoolResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorHistoricalRewardsRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryValidatorDistributionInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgCommunityPoolSpend } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; + + +export { ValidatorAccumulatedCommissionRecord, QueryValidatorSlashesResponse, QueryDelegatorValidatorsRequest, QueryValidatorCommissionRequest, QueryDelegationTotalRewardsResponse, MsgFundCommunityPool, GenesisState, MsgCommunityPoolSpendResponse, ValidatorOutstandingRewards, DelegatorStartingInfo, DelegatorWithdrawInfo, ValidatorSlashEventRecord, QueryValidatorOutstandingRewardsRequest, QueryDelegationRewardsResponse, QueryDelegatorWithdrawAddressResponse, MsgDepositValidatorRewardsPoolResponse, QueryDelegatorWithdrawAddressRequest, QueryCommunityPoolRequest, MsgWithdrawValidatorCommissionResponse, ValidatorCurrentRewardsRecord, QueryValidatorOutstandingRewardsResponse, CommunityPoolSpendProposalWithDeposit, Params, ValidatorSlashEvent, QueryValidatorDistributionInfoRequest, QueryValidatorSlashesRequest, QueryDelegationRewardsRequest, MsgUpdateParamsResponse, ValidatorHistoricalRewards, ValidatorSlashEvents, DelegatorStartingInfoRecord, QueryDelegatorValidatorsResponse, QueryCommunityPoolResponse, ValidatorOutstandingRewardsRecord, QueryParamsRequest, MsgSetWithdrawAddress, MsgSetWithdrawAddressResponse, MsgWithdrawDelegatorRewardResponse, MsgUpdateParams, MsgDepositValidatorRewardsPool, FeePool, MsgWithdrawDelegatorReward, DelegationDelegatorReward, QueryParamsResponse, QueryValidatorCommissionResponse, MsgWithdrawValidatorCommission, ValidatorCurrentRewards, ValidatorAccumulatedCommission, CommunityPoolSpendProposal, QueryDelegationTotalRewardsRequest, MsgFundCommunityPoolResponse, ValidatorHistoricalRewardsRecord, QueryValidatorDistributionInfoResponse, MsgCommunityPoolSpend }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendValidatorAccumulatedCommissionRecordParams = { + value: ValidatorAccumulatedCommissionRecord, fee?: StdFee, memo?: string }; -type sendQueryDelegationTotalRewardsRequestParams = { - value: QueryDelegationTotalRewardsRequest, +type sendQueryValidatorSlashesResponseParams = { + value: QueryValidatorSlashesResponse, fee?: StdFee, memo?: string }; -type sendDelegationDelegatorRewardParams = { - value: DelegationDelegatorReward, +type sendQueryDelegatorValidatorsRequestParams = { + value: QueryDelegatorValidatorsRequest, fee?: StdFee, memo?: string }; -type sendValidatorCurrentRewardsParams = { - value: ValidatorCurrentRewards, +type sendQueryValidatorCommissionRequestParams = { + value: QueryValidatorCommissionRequest, fee?: StdFee, memo?: string }; -type sendMsgSetWithdrawAddressParams = { - value: MsgSetWithdrawAddress, +type sendQueryDelegationTotalRewardsResponseParams = { + value: QueryDelegationTotalRewardsResponse, fee?: StdFee, memo?: string }; @@ -100,266 +100,266 @@ type sendMsgFundCommunityPoolParams = { memo?: string }; -type sendMsgCommunityPoolSpendResponseParams = { - value: MsgCommunityPoolSpendResponse, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendQueryCommunityPoolResponseParams = { - value: QueryCommunityPoolResponse, +type sendMsgCommunityPoolSpendResponseParams = { + value: MsgCommunityPoolSpendResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendValidatorOutstandingRewardsParams = { + value: ValidatorOutstandingRewards, fee?: StdFee, memo?: string }; -type sendQueryDelegationRewardsRequestParams = { - value: QueryDelegationRewardsRequest, +type sendDelegatorStartingInfoParams = { + value: DelegatorStartingInfo, fee?: StdFee, memo?: string }; -type sendCommunityPoolSpendProposalWithDepositParams = { - value: CommunityPoolSpendProposalWithDeposit, +type sendDelegatorWithdrawInfoParams = { + value: DelegatorWithdrawInfo, fee?: StdFee, memo?: string }; -type sendMsgDepositValidatorRewardsPoolParams = { - value: MsgDepositValidatorRewardsPool, +type sendValidatorSlashEventRecordParams = { + value: ValidatorSlashEventRecord, fee?: StdFee, memo?: string }; -type sendQueryValidatorOutstandingRewardsResponseParams = { - value: QueryValidatorOutstandingRewardsResponse, +type sendQueryValidatorOutstandingRewardsRequestParams = { + value: QueryValidatorOutstandingRewardsRequest, fee?: StdFee, memo?: string }; -type sendQueryDelegatorValidatorsRequestParams = { - value: QueryDelegatorValidatorsRequest, +type sendQueryDelegationRewardsResponseParams = { + value: QueryDelegationRewardsResponse, fee?: StdFee, memo?: string }; -type sendFeePoolParams = { - value: FeePool, +type sendQueryDelegatorWithdrawAddressResponseParams = { + value: QueryDelegatorWithdrawAddressResponse, fee?: StdFee, memo?: string }; -type sendQueryValidatorCommissionResponseParams = { - value: QueryValidatorCommissionResponse, +type sendMsgDepositValidatorRewardsPoolResponseParams = { + value: MsgDepositValidatorRewardsPoolResponse, fee?: StdFee, memo?: string }; -type sendQueryDelegatorWithdrawAddressResponseParams = { - value: QueryDelegatorWithdrawAddressResponse, +type sendQueryDelegatorWithdrawAddressRequestParams = { + value: QueryDelegatorWithdrawAddressRequest, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryCommunityPoolRequestParams = { + value: QueryCommunityPoolRequest, fee?: StdFee, memo?: string }; -type sendMsgWithdrawDelegatorRewardResponseParams = { - value: MsgWithdrawDelegatorRewardResponse, +type sendMsgWithdrawValidatorCommissionResponseParams = { + value: MsgWithdrawValidatorCommissionResponse, fee?: StdFee, memo?: string }; -type sendQueryValidatorDistributionInfoResponseParams = { - value: QueryValidatorDistributionInfoResponse, +type sendValidatorCurrentRewardsRecordParams = { + value: ValidatorCurrentRewardsRecord, fee?: StdFee, memo?: string }; -type sendQueryDelegatorValidatorsResponseParams = { - value: QueryDelegatorValidatorsResponse, +type sendQueryValidatorOutstandingRewardsResponseParams = { + value: QueryValidatorOutstandingRewardsResponse, fee?: StdFee, memo?: string }; -type sendQueryDelegatorWithdrawAddressRequestParams = { - value: QueryDelegatorWithdrawAddressRequest, +type sendCommunityPoolSpendProposalWithDepositParams = { + value: CommunityPoolSpendProposalWithDeposit, fee?: StdFee, memo?: string }; -type sendQueryCommunityPoolRequestParams = { - value: QueryCommunityPoolRequest, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendCommunityPoolSpendProposalParams = { - value: CommunityPoolSpendProposal, +type sendValidatorSlashEventParams = { + value: ValidatorSlashEvent, fee?: StdFee, memo?: string }; -type sendMsgSetWithdrawAddressResponseParams = { - value: MsgSetWithdrawAddressResponse, +type sendQueryValidatorDistributionInfoRequestParams = { + value: QueryValidatorDistributionInfoRequest, fee?: StdFee, memo?: string }; -type sendQueryValidatorOutstandingRewardsRequestParams = { - value: QueryValidatorOutstandingRewardsRequest, +type sendQueryValidatorSlashesRequestParams = { + value: QueryValidatorSlashesRequest, fee?: StdFee, memo?: string }; -type sendQueryValidatorCommissionRequestParams = { - value: QueryValidatorCommissionRequest, +type sendQueryDelegationRewardsRequestParams = { + value: QueryDelegationRewardsRequest, fee?: StdFee, memo?: string }; -type sendQueryValidatorSlashesRequestParams = { - value: QueryValidatorSlashesRequest, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendValidatorOutstandingRewardsRecordParams = { - value: ValidatorOutstandingRewardsRecord, +type sendValidatorHistoricalRewardsParams = { + value: ValidatorHistoricalRewards, fee?: StdFee, memo?: string }; -type sendValidatorHistoricalRewardsRecordParams = { - value: ValidatorHistoricalRewardsRecord, +type sendValidatorSlashEventsParams = { + value: ValidatorSlashEvents, fee?: StdFee, memo?: string }; -type sendValidatorCurrentRewardsRecordParams = { - value: ValidatorCurrentRewardsRecord, +type sendDelegatorStartingInfoRecordParams = { + value: DelegatorStartingInfoRecord, fee?: StdFee, memo?: string }; -type sendValidatorSlashEventRecordParams = { - value: ValidatorSlashEventRecord, +type sendQueryDelegatorValidatorsResponseParams = { + value: QueryDelegatorValidatorsResponse, fee?: StdFee, memo?: string }; -type sendDelegatorWithdrawInfoParams = { - value: DelegatorWithdrawInfo, +type sendQueryCommunityPoolResponseParams = { + value: QueryCommunityPoolResponse, fee?: StdFee, memo?: string }; -type sendMsgWithdrawDelegatorRewardParams = { - value: MsgWithdrawDelegatorReward, +type sendValidatorOutstandingRewardsRecordParams = { + value: ValidatorOutstandingRewardsRecord, fee?: StdFee, memo?: string }; -type sendMsgCommunityPoolSpendParams = { - value: MsgCommunityPoolSpend, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendValidatorOutstandingRewardsParams = { - value: ValidatorOutstandingRewards, +type sendMsgSetWithdrawAddressParams = { + value: MsgSetWithdrawAddress, fee?: StdFee, memo?: string }; -type sendValidatorSlashEventsParams = { - value: ValidatorSlashEvents, +type sendMsgSetWithdrawAddressResponseParams = { + value: MsgSetWithdrawAddressResponse, fee?: StdFee, memo?: string }; -type sendMsgWithdrawValidatorCommissionResponseParams = { - value: MsgWithdrawValidatorCommissionResponse, +type sendMsgWithdrawDelegatorRewardResponseParams = { + value: MsgWithdrawDelegatorRewardResponse, fee?: StdFee, memo?: string }; -type sendQueryValidatorSlashesResponseParams = { - value: QueryValidatorSlashesResponse, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendDelegatorStartingInfoParams = { - value: DelegatorStartingInfo, +type sendMsgDepositValidatorRewardsPoolParams = { + value: MsgDepositValidatorRewardsPool, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendFeePoolParams = { + value: FeePool, fee?: StdFee, memo?: string }; -type sendQueryDelegationTotalRewardsResponseParams = { - value: QueryDelegationTotalRewardsResponse, +type sendMsgWithdrawDelegatorRewardParams = { + value: MsgWithdrawDelegatorReward, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendDelegationDelegatorRewardParams = { + value: DelegationDelegatorReward, fee?: StdFee, memo?: string }; -type sendMsgWithdrawValidatorCommissionParams = { - value: MsgWithdrawValidatorCommission, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryValidatorDistributionInfoRequestParams = { - value: QueryValidatorDistributionInfoRequest, +type sendQueryValidatorCommissionResponseParams = { + value: QueryValidatorCommissionResponse, fee?: StdFee, memo?: string }; -type sendValidatorHistoricalRewardsParams = { - value: ValidatorHistoricalRewards, +type sendMsgWithdrawValidatorCommissionParams = { + value: MsgWithdrawValidatorCommission, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendValidatorCurrentRewardsParams = { + value: ValidatorCurrentRewards, fee?: StdFee, memo?: string }; -type sendQueryDelegationRewardsResponseParams = { - value: QueryDelegationRewardsResponse, +type sendValidatorAccumulatedCommissionParams = { + value: ValidatorAccumulatedCommission, fee?: StdFee, memo?: string }; -type sendValidatorAccumulatedCommissionRecordParams = { - value: ValidatorAccumulatedCommissionRecord, +type sendCommunityPoolSpendProposalParams = { + value: CommunityPoolSpendProposal, fee?: StdFee, memo?: string }; -type sendDelegatorStartingInfoRecordParams = { - value: DelegatorStartingInfoRecord, +type sendQueryDelegationTotalRewardsRequestParams = { + value: QueryDelegationTotalRewardsRequest, fee?: StdFee, memo?: string }; @@ -370,239 +370,239 @@ type sendMsgFundCommunityPoolResponseParams = { memo?: string }; -type sendMsgDepositValidatorRewardsPoolResponseParams = { - value: MsgDepositValidatorRewardsPoolResponse, +type sendValidatorHistoricalRewardsRecordParams = { + value: ValidatorHistoricalRewardsRecord, fee?: StdFee, memo?: string }; -type sendValidatorAccumulatedCommissionParams = { - value: ValidatorAccumulatedCommission, +type sendQueryValidatorDistributionInfoResponseParams = { + value: QueryValidatorDistributionInfoResponse, fee?: StdFee, memo?: string }; -type sendValidatorSlashEventParams = { - value: ValidatorSlashEvent, +type sendMsgCommunityPoolSpendParams = { + value: MsgCommunityPoolSpend, fee?: StdFee, memo?: string }; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type validatorAccumulatedCommissionRecordParams = { + value: ValidatorAccumulatedCommissionRecord, }; -type queryDelegationTotalRewardsRequestParams = { - value: QueryDelegationTotalRewardsRequest, +type queryValidatorSlashesResponseParams = { + value: QueryValidatorSlashesResponse, }; -type delegationDelegatorRewardParams = { - value: DelegationDelegatorReward, +type queryDelegatorValidatorsRequestParams = { + value: QueryDelegatorValidatorsRequest, }; -type validatorCurrentRewardsParams = { - value: ValidatorCurrentRewards, +type queryValidatorCommissionRequestParams = { + value: QueryValidatorCommissionRequest, }; -type msgSetWithdrawAddressParams = { - value: MsgSetWithdrawAddress, +type queryDelegationTotalRewardsResponseParams = { + value: QueryDelegationTotalRewardsResponse, }; type msgFundCommunityPoolParams = { value: MsgFundCommunityPool, }; +type genesisStateParams = { + value: GenesisState, +}; + type msgCommunityPoolSpendResponseParams = { value: MsgCommunityPoolSpendResponse, }; -type queryCommunityPoolResponseParams = { - value: QueryCommunityPoolResponse, +type validatorOutstandingRewardsParams = { + value: ValidatorOutstandingRewards, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type delegatorStartingInfoParams = { + value: DelegatorStartingInfo, }; -type queryDelegationRewardsRequestParams = { - value: QueryDelegationRewardsRequest, +type delegatorWithdrawInfoParams = { + value: DelegatorWithdrawInfo, }; -type communityPoolSpendProposalWithDepositParams = { - value: CommunityPoolSpendProposalWithDeposit, +type validatorSlashEventRecordParams = { + value: ValidatorSlashEventRecord, }; -type msgDepositValidatorRewardsPoolParams = { - value: MsgDepositValidatorRewardsPool, +type queryValidatorOutstandingRewardsRequestParams = { + value: QueryValidatorOutstandingRewardsRequest, }; -type queryValidatorOutstandingRewardsResponseParams = { - value: QueryValidatorOutstandingRewardsResponse, -}; - -type queryDelegatorValidatorsRequestParams = { - value: QueryDelegatorValidatorsRequest, -}; - -type feePoolParams = { - value: FeePool, -}; - -type queryValidatorCommissionResponseParams = { - value: QueryValidatorCommissionResponse, +type queryDelegationRewardsResponseParams = { + value: QueryDelegationRewardsResponse, }; type queryDelegatorWithdrawAddressResponseParams = { value: QueryDelegatorWithdrawAddressResponse, }; -type genesisStateParams = { - value: GenesisState, +type msgDepositValidatorRewardsPoolResponseParams = { + value: MsgDepositValidatorRewardsPoolResponse, }; -type msgWithdrawDelegatorRewardResponseParams = { - value: MsgWithdrawDelegatorRewardResponse, +type queryDelegatorWithdrawAddressRequestParams = { + value: QueryDelegatorWithdrawAddressRequest, }; -type queryValidatorDistributionInfoResponseParams = { - value: QueryValidatorDistributionInfoResponse, +type queryCommunityPoolRequestParams = { + value: QueryCommunityPoolRequest, }; -type queryDelegatorValidatorsResponseParams = { - value: QueryDelegatorValidatorsResponse, +type msgWithdrawValidatorCommissionResponseParams = { + value: MsgWithdrawValidatorCommissionResponse, }; -type queryDelegatorWithdrawAddressRequestParams = { - value: QueryDelegatorWithdrawAddressRequest, +type validatorCurrentRewardsRecordParams = { + value: ValidatorCurrentRewardsRecord, }; -type queryCommunityPoolRequestParams = { - value: QueryCommunityPoolRequest, +type queryValidatorOutstandingRewardsResponseParams = { + value: QueryValidatorOutstandingRewardsResponse, }; -type communityPoolSpendProposalParams = { - value: CommunityPoolSpendProposal, +type communityPoolSpendProposalWithDepositParams = { + value: CommunityPoolSpendProposalWithDeposit, }; -type msgSetWithdrawAddressResponseParams = { - value: MsgSetWithdrawAddressResponse, +type paramsParams = { + value: Params, }; -type queryValidatorOutstandingRewardsRequestParams = { - value: QueryValidatorOutstandingRewardsRequest, +type validatorSlashEventParams = { + value: ValidatorSlashEvent, }; -type queryValidatorCommissionRequestParams = { - value: QueryValidatorCommissionRequest, +type queryValidatorDistributionInfoRequestParams = { + value: QueryValidatorDistributionInfoRequest, }; type queryValidatorSlashesRequestParams = { value: QueryValidatorSlashesRequest, }; -type validatorOutstandingRewardsRecordParams = { - value: ValidatorOutstandingRewardsRecord, +type queryDelegationRewardsRequestParams = { + value: QueryDelegationRewardsRequest, }; -type validatorHistoricalRewardsRecordParams = { - value: ValidatorHistoricalRewardsRecord, +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; -type validatorCurrentRewardsRecordParams = { - value: ValidatorCurrentRewardsRecord, +type validatorHistoricalRewardsParams = { + value: ValidatorHistoricalRewards, }; -type validatorSlashEventRecordParams = { - value: ValidatorSlashEventRecord, +type validatorSlashEventsParams = { + value: ValidatorSlashEvents, }; -type delegatorWithdrawInfoParams = { - value: DelegatorWithdrawInfo, +type delegatorStartingInfoRecordParams = { + value: DelegatorStartingInfoRecord, }; -type msgWithdrawDelegatorRewardParams = { - value: MsgWithdrawDelegatorReward, +type queryDelegatorValidatorsResponseParams = { + value: QueryDelegatorValidatorsResponse, }; -type msgCommunityPoolSpendParams = { - value: MsgCommunityPoolSpend, +type queryCommunityPoolResponseParams = { + value: QueryCommunityPoolResponse, }; -type validatorOutstandingRewardsParams = { - value: ValidatorOutstandingRewards, +type validatorOutstandingRewardsRecordParams = { + value: ValidatorOutstandingRewardsRecord, }; -type validatorSlashEventsParams = { - value: ValidatorSlashEvents, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; -type msgWithdrawValidatorCommissionResponseParams = { - value: MsgWithdrawValidatorCommissionResponse, +type msgSetWithdrawAddressParams = { + value: MsgSetWithdrawAddress, }; -type queryValidatorSlashesResponseParams = { - value: QueryValidatorSlashesResponse, +type msgSetWithdrawAddressResponseParams = { + value: MsgSetWithdrawAddressResponse, }; -type delegatorStartingInfoParams = { - value: DelegatorStartingInfo, +type msgWithdrawDelegatorRewardResponseParams = { + value: MsgWithdrawDelegatorRewardResponse, }; type msgUpdateParamsParams = { value: MsgUpdateParams, }; -type queryDelegationTotalRewardsResponseParams = { - value: QueryDelegationTotalRewardsResponse, +type msgDepositValidatorRewardsPoolParams = { + value: MsgDepositValidatorRewardsPool, }; -type paramsParams = { - value: Params, +type feePoolParams = { + value: FeePool, }; -type msgWithdrawValidatorCommissionParams = { - value: MsgWithdrawValidatorCommission, +type msgWithdrawDelegatorRewardParams = { + value: MsgWithdrawDelegatorReward, }; -type queryValidatorDistributionInfoRequestParams = { - value: QueryValidatorDistributionInfoRequest, +type delegationDelegatorRewardParams = { + value: DelegationDelegatorReward, }; -type validatorHistoricalRewardsParams = { - value: ValidatorHistoricalRewards, +type queryParamsResponseParams = { + value: QueryParamsResponse, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type queryValidatorCommissionResponseParams = { + value: QueryValidatorCommissionResponse, }; -type queryDelegationRewardsResponseParams = { - value: QueryDelegationRewardsResponse, +type msgWithdrawValidatorCommissionParams = { + value: MsgWithdrawValidatorCommission, }; -type validatorAccumulatedCommissionRecordParams = { - value: ValidatorAccumulatedCommissionRecord, +type validatorCurrentRewardsParams = { + value: ValidatorCurrentRewards, }; -type delegatorStartingInfoRecordParams = { - value: DelegatorStartingInfoRecord, +type validatorAccumulatedCommissionParams = { + value: ValidatorAccumulatedCommission, +}; + +type communityPoolSpendProposalParams = { + value: CommunityPoolSpendProposal, +}; + +type queryDelegationTotalRewardsRequestParams = { + value: QueryDelegationTotalRewardsRequest, }; type msgFundCommunityPoolResponseParams = { value: MsgFundCommunityPoolResponse, }; -type msgDepositValidatorRewardsPoolResponseParams = { - value: MsgDepositValidatorRewardsPoolResponse, +type validatorHistoricalRewardsRecordParams = { + value: ValidatorHistoricalRewardsRecord, }; -type validatorAccumulatedCommissionParams = { - value: ValidatorAccumulatedCommission, +type queryValidatorDistributionInfoResponseParams = { + value: QueryValidatorDistributionInfoResponse, }; -type validatorSlashEventParams = { - value: ValidatorSlashEvent, +type msgCommunityPoolSpendParams = { + value: MsgCommunityPoolSpend, }; @@ -635,73 +635,73 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendValidatorAccumulatedCommissionRecord({ value, fee, memo }: sendValidatorAccumulatedCommissionRecordParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorAccumulatedCommissionRecord: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.validatorAccumulatedCommissionRecord({ value: ValidatorAccumulatedCommissionRecord.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorAccumulatedCommissionRecord: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegationTotalRewardsRequest({ value, fee, memo }: sendQueryDelegationTotalRewardsRequestParams): Promise { + async sendQueryValidatorSlashesResponse({ value, fee, memo }: sendQueryValidatorSlashesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegationTotalRewardsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorSlashesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegationTotalRewardsRequest({ value: QueryDelegationTotalRewardsRequest.fromPartial(value) }) + let msg = this.queryValidatorSlashesResponse({ value: QueryValidatorSlashesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegationTotalRewardsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorSlashesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendDelegationDelegatorReward({ value, fee, memo }: sendDelegationDelegatorRewardParams): Promise { + async sendQueryDelegatorValidatorsRequest({ value, fee, memo }: sendQueryDelegatorValidatorsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendDelegationDelegatorReward: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorValidatorsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.delegationDelegatorReward({ value: DelegationDelegatorReward.fromPartial(value) }) + let msg = this.queryDelegatorValidatorsRequest({ value: QueryDelegatorValidatorsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDelegationDelegatorReward: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorValidatorsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorCurrentRewards({ value, fee, memo }: sendValidatorCurrentRewardsParams): Promise { + async sendQueryValidatorCommissionRequest({ value, fee, memo }: sendQueryValidatorCommissionRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorCurrentRewards: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorCommissionRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorCurrentRewards({ value: ValidatorCurrentRewards.fromPartial(value) }) + let msg = this.queryValidatorCommissionRequest({ value: QueryValidatorCommissionRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorCurrentRewards: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorCommissionRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSetWithdrawAddress({ value, fee, memo }: sendMsgSetWithdrawAddressParams): Promise { + async sendQueryDelegationTotalRewardsResponse({ value, fee, memo }: sendQueryDelegationTotalRewardsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSetWithdrawAddress: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegationTotalRewardsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSetWithdrawAddress({ value: MsgSetWithdrawAddress.fromPartial(value) }) + let msg = this.queryDelegationTotalRewardsResponse({ value: QueryDelegationTotalRewardsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSetWithdrawAddress: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegationTotalRewardsResponse: Could not broadcast Tx: '+ e.message) } }, @@ -719,143 +719,115 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgCommunityPoolSpendResponse({ value, fee, memo }: sendMsgCommunityPoolSpendResponseParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCommunityPoolSpendResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCommunityPoolSpendResponse({ value: MsgCommunityPoolSpendResponse.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCommunityPoolSpendResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCommunityPoolResponse({ value, fee, memo }: sendQueryCommunityPoolResponseParams): Promise { + async sendMsgCommunityPoolSpendResponse({ value, fee, memo }: sendMsgCommunityPoolSpendResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCommunityPoolResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCommunityPoolSpendResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCommunityPoolResponse({ value: QueryCommunityPoolResponse.fromPartial(value) }) + let msg = this.msgCommunityPoolSpendResponse({ value: MsgCommunityPoolSpendResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCommunityPoolResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCommunityPoolSpendResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendValidatorOutstandingRewards({ value, fee, memo }: sendValidatorOutstandingRewardsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorOutstandingRewards: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.validatorOutstandingRewards({ value: ValidatorOutstandingRewards.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorOutstandingRewards: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegationRewardsRequest({ value, fee, memo }: sendQueryDelegationRewardsRequestParams): Promise { + async sendDelegatorStartingInfo({ value, fee, memo }: sendDelegatorStartingInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegationRewardsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDelegatorStartingInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegationRewardsRequest({ value: QueryDelegationRewardsRequest.fromPartial(value) }) + let msg = this.delegatorStartingInfo({ value: DelegatorStartingInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegationRewardsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDelegatorStartingInfo: Could not broadcast Tx: '+ e.message) } }, - async sendCommunityPoolSpendProposalWithDeposit({ value, fee, memo }: sendCommunityPoolSpendProposalWithDepositParams): Promise { + async sendDelegatorWithdrawInfo({ value, fee, memo }: sendDelegatorWithdrawInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendCommunityPoolSpendProposalWithDeposit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDelegatorWithdrawInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.communityPoolSpendProposalWithDeposit({ value: CommunityPoolSpendProposalWithDeposit.fromPartial(value) }) + let msg = this.delegatorWithdrawInfo({ value: DelegatorWithdrawInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCommunityPoolSpendProposalWithDeposit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDelegatorWithdrawInfo: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDepositValidatorRewardsPool({ value, fee, memo }: sendMsgDepositValidatorRewardsPoolParams): Promise { + async sendValidatorSlashEventRecord({ value, fee, memo }: sendValidatorSlashEventRecordParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDepositValidatorRewardsPool: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorSlashEventRecord: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDepositValidatorRewardsPool({ value: MsgDepositValidatorRewardsPool.fromPartial(value) }) + let msg = this.validatorSlashEventRecord({ value: ValidatorSlashEventRecord.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDepositValidatorRewardsPool: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorSlashEventRecord: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorOutstandingRewardsResponse({ value, fee, memo }: sendQueryValidatorOutstandingRewardsResponseParams): Promise { + async sendQueryValidatorOutstandingRewardsRequest({ value, fee, memo }: sendQueryValidatorOutstandingRewardsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorOutstandingRewardsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorOutstandingRewardsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorOutstandingRewardsResponse({ value: QueryValidatorOutstandingRewardsResponse.fromPartial(value) }) + let msg = this.queryValidatorOutstandingRewardsRequest({ value: QueryValidatorOutstandingRewardsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorOutstandingRewardsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorOutstandingRewardsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorValidatorsRequest({ value, fee, memo }: sendQueryDelegatorValidatorsRequestParams): Promise { + async sendQueryDelegationRewardsResponse({ value, fee, memo }: sendQueryDelegationRewardsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorValidatorsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegationRewardsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorValidatorsRequest({ value: QueryDelegatorValidatorsRequest.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorValidatorsRequest: Could not broadcast Tx: '+ e.message) - } - }, - - async sendFeePool({ value, fee, memo }: sendFeePoolParams): Promise { - if (!signer) { - throw new Error('TxClient:sendFeePool: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.feePool({ value: FeePool.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendFeePool: Could not broadcast Tx: '+ e.message) - } - }, - - async sendQueryValidatorCommissionResponse({ value, fee, memo }: sendQueryValidatorCommissionResponseParams): Promise { - if (!signer) { - throw new Error('TxClient:sendQueryValidatorCommissionResponse: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorCommissionResponse({ value: QueryValidatorCommissionResponse.fromPartial(value) }) + let msg = this.queryDelegationRewardsResponse({ value: QueryDelegationRewardsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorCommissionResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegationRewardsResponse: Could not broadcast Tx: '+ e.message) } }, @@ -873,143 +845,143 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendMsgDepositValidatorRewardsPoolResponse({ value, fee, memo }: sendMsgDepositValidatorRewardsPoolResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDepositValidatorRewardsPoolResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.msgDepositValidatorRewardsPoolResponse({ value: MsgDepositValidatorRewardsPoolResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDepositValidatorRewardsPoolResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgWithdrawDelegatorRewardResponse({ value, fee, memo }: sendMsgWithdrawDelegatorRewardResponseParams): Promise { + async sendQueryDelegatorWithdrawAddressRequest({ value, fee, memo }: sendQueryDelegatorWithdrawAddressRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgWithdrawDelegatorRewardResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorWithdrawAddressRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgWithdrawDelegatorRewardResponse({ value: MsgWithdrawDelegatorRewardResponse.fromPartial(value) }) + let msg = this.queryDelegatorWithdrawAddressRequest({ value: QueryDelegatorWithdrawAddressRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgWithdrawDelegatorRewardResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorWithdrawAddressRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorDistributionInfoResponse({ value, fee, memo }: sendQueryValidatorDistributionInfoResponseParams): Promise { + async sendQueryCommunityPoolRequest({ value, fee, memo }: sendQueryCommunityPoolRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorDistributionInfoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCommunityPoolRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorDistributionInfoResponse({ value: QueryValidatorDistributionInfoResponse.fromPartial(value) }) + let msg = this.queryCommunityPoolRequest({ value: QueryCommunityPoolRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorDistributionInfoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCommunityPoolRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorValidatorsResponse({ value, fee, memo }: sendQueryDelegatorValidatorsResponseParams): Promise { + async sendMsgWithdrawValidatorCommissionResponse({ value, fee, memo }: sendMsgWithdrawValidatorCommissionResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorValidatorsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgWithdrawValidatorCommissionResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorValidatorsResponse({ value: QueryDelegatorValidatorsResponse.fromPartial(value) }) + let msg = this.msgWithdrawValidatorCommissionResponse({ value: MsgWithdrawValidatorCommissionResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorValidatorsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgWithdrawValidatorCommissionResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorWithdrawAddressRequest({ value, fee, memo }: sendQueryDelegatorWithdrawAddressRequestParams): Promise { + async sendValidatorCurrentRewardsRecord({ value, fee, memo }: sendValidatorCurrentRewardsRecordParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorWithdrawAddressRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorCurrentRewardsRecord: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorWithdrawAddressRequest({ value: QueryDelegatorWithdrawAddressRequest.fromPartial(value) }) + let msg = this.validatorCurrentRewardsRecord({ value: ValidatorCurrentRewardsRecord.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorWithdrawAddressRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorCurrentRewardsRecord: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCommunityPoolRequest({ value, fee, memo }: sendQueryCommunityPoolRequestParams): Promise { + async sendQueryValidatorOutstandingRewardsResponse({ value, fee, memo }: sendQueryValidatorOutstandingRewardsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCommunityPoolRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorOutstandingRewardsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCommunityPoolRequest({ value: QueryCommunityPoolRequest.fromPartial(value) }) + let msg = this.queryValidatorOutstandingRewardsResponse({ value: QueryValidatorOutstandingRewardsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCommunityPoolRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorOutstandingRewardsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendCommunityPoolSpendProposal({ value, fee, memo }: sendCommunityPoolSpendProposalParams): Promise { + async sendCommunityPoolSpendProposalWithDeposit({ value, fee, memo }: sendCommunityPoolSpendProposalWithDepositParams): Promise { if (!signer) { - throw new Error('TxClient:sendCommunityPoolSpendProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCommunityPoolSpendProposalWithDeposit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.communityPoolSpendProposal({ value: CommunityPoolSpendProposal.fromPartial(value) }) + let msg = this.communityPoolSpendProposalWithDeposit({ value: CommunityPoolSpendProposalWithDeposit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCommunityPoolSpendProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCommunityPoolSpendProposalWithDeposit: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSetWithdrawAddressResponse({ value, fee, memo }: sendMsgSetWithdrawAddressResponseParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSetWithdrawAddressResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSetWithdrawAddressResponse({ value: MsgSetWithdrawAddressResponse.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSetWithdrawAddressResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorOutstandingRewardsRequest({ value, fee, memo }: sendQueryValidatorOutstandingRewardsRequestParams): Promise { + async sendValidatorSlashEvent({ value, fee, memo }: sendValidatorSlashEventParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorOutstandingRewardsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorSlashEvent: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorOutstandingRewardsRequest({ value: QueryValidatorOutstandingRewardsRequest.fromPartial(value) }) + let msg = this.validatorSlashEvent({ value: ValidatorSlashEvent.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorOutstandingRewardsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorSlashEvent: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorCommissionRequest({ value, fee, memo }: sendQueryValidatorCommissionRequestParams): Promise { + async sendQueryValidatorDistributionInfoRequest({ value, fee, memo }: sendQueryValidatorDistributionInfoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorCommissionRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorDistributionInfoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorCommissionRequest({ value: QueryValidatorCommissionRequest.fromPartial(value) }) + let msg = this.queryValidatorDistributionInfoRequest({ value: QueryValidatorDistributionInfoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorCommissionRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorDistributionInfoRequest: Could not broadcast Tx: '+ e.message) } }, @@ -1027,171 +999,171 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendValidatorOutstandingRewardsRecord({ value, fee, memo }: sendValidatorOutstandingRewardsRecordParams): Promise { + async sendQueryDelegationRewardsRequest({ value, fee, memo }: sendQueryDelegationRewardsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorOutstandingRewardsRecord: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegationRewardsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorOutstandingRewardsRecord({ value: ValidatorOutstandingRewardsRecord.fromPartial(value) }) + let msg = this.queryDelegationRewardsRequest({ value: QueryDelegationRewardsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorOutstandingRewardsRecord: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegationRewardsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorHistoricalRewardsRecord({ value, fee, memo }: sendValidatorHistoricalRewardsRecordParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorHistoricalRewardsRecord: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorHistoricalRewardsRecord({ value: ValidatorHistoricalRewardsRecord.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorHistoricalRewardsRecord: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorCurrentRewardsRecord({ value, fee, memo }: sendValidatorCurrentRewardsRecordParams): Promise { + async sendValidatorHistoricalRewards({ value, fee, memo }: sendValidatorHistoricalRewardsParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorCurrentRewardsRecord: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorHistoricalRewards: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorCurrentRewardsRecord({ value: ValidatorCurrentRewardsRecord.fromPartial(value) }) + let msg = this.validatorHistoricalRewards({ value: ValidatorHistoricalRewards.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorCurrentRewardsRecord: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorHistoricalRewards: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorSlashEventRecord({ value, fee, memo }: sendValidatorSlashEventRecordParams): Promise { + async sendValidatorSlashEvents({ value, fee, memo }: sendValidatorSlashEventsParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorSlashEventRecord: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorSlashEvents: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorSlashEventRecord({ value: ValidatorSlashEventRecord.fromPartial(value) }) + let msg = this.validatorSlashEvents({ value: ValidatorSlashEvents.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorSlashEventRecord: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorSlashEvents: Could not broadcast Tx: '+ e.message) } }, - async sendDelegatorWithdrawInfo({ value, fee, memo }: sendDelegatorWithdrawInfoParams): Promise { + async sendDelegatorStartingInfoRecord({ value, fee, memo }: sendDelegatorStartingInfoRecordParams): Promise { if (!signer) { - throw new Error('TxClient:sendDelegatorWithdrawInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDelegatorStartingInfoRecord: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.delegatorWithdrawInfo({ value: DelegatorWithdrawInfo.fromPartial(value) }) + let msg = this.delegatorStartingInfoRecord({ value: DelegatorStartingInfoRecord.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDelegatorWithdrawInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDelegatorStartingInfoRecord: Could not broadcast Tx: '+ e.message) } }, - async sendMsgWithdrawDelegatorReward({ value, fee, memo }: sendMsgWithdrawDelegatorRewardParams): Promise { + async sendQueryDelegatorValidatorsResponse({ value, fee, memo }: sendQueryDelegatorValidatorsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgWithdrawDelegatorReward: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorValidatorsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgWithdrawDelegatorReward({ value: MsgWithdrawDelegatorReward.fromPartial(value) }) + let msg = this.queryDelegatorValidatorsResponse({ value: QueryDelegatorValidatorsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgWithdrawDelegatorReward: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorValidatorsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCommunityPoolSpend({ value, fee, memo }: sendMsgCommunityPoolSpendParams): Promise { + async sendQueryCommunityPoolResponse({ value, fee, memo }: sendQueryCommunityPoolResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCommunityPoolSpend: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCommunityPoolResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCommunityPoolSpend({ value: MsgCommunityPoolSpend.fromPartial(value) }) + let msg = this.queryCommunityPoolResponse({ value: QueryCommunityPoolResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCommunityPoolSpend: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCommunityPoolResponse: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorOutstandingRewards({ value, fee, memo }: sendValidatorOutstandingRewardsParams): Promise { + async sendValidatorOutstandingRewardsRecord({ value, fee, memo }: sendValidatorOutstandingRewardsRecordParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorOutstandingRewards: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorOutstandingRewardsRecord: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorOutstandingRewards({ value: ValidatorOutstandingRewards.fromPartial(value) }) + let msg = this.validatorOutstandingRewardsRecord({ value: ValidatorOutstandingRewardsRecord.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorOutstandingRewards: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorOutstandingRewardsRecord: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorSlashEvents({ value, fee, memo }: sendValidatorSlashEventsParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorSlashEvents: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorSlashEvents({ value: ValidatorSlashEvents.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorSlashEvents: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgWithdrawValidatorCommissionResponse({ value, fee, memo }: sendMsgWithdrawValidatorCommissionResponseParams): Promise { + async sendMsgSetWithdrawAddress({ value, fee, memo }: sendMsgSetWithdrawAddressParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgWithdrawValidatorCommissionResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSetWithdrawAddress: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgWithdrawValidatorCommissionResponse({ value: MsgWithdrawValidatorCommissionResponse.fromPartial(value) }) + let msg = this.msgSetWithdrawAddress({ value: MsgSetWithdrawAddress.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgWithdrawValidatorCommissionResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSetWithdrawAddress: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorSlashesResponse({ value, fee, memo }: sendQueryValidatorSlashesResponseParams): Promise { + async sendMsgSetWithdrawAddressResponse({ value, fee, memo }: sendMsgSetWithdrawAddressResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorSlashesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSetWithdrawAddressResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorSlashesResponse({ value: QueryValidatorSlashesResponse.fromPartial(value) }) + let msg = this.msgSetWithdrawAddressResponse({ value: MsgSetWithdrawAddressResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorSlashesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSetWithdrawAddressResponse: Could not broadcast Tx: '+ e.message) } }, - async sendDelegatorStartingInfo({ value, fee, memo }: sendDelegatorStartingInfoParams): Promise { + async sendMsgWithdrawDelegatorRewardResponse({ value, fee, memo }: sendMsgWithdrawDelegatorRewardResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendDelegatorStartingInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgWithdrawDelegatorRewardResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.delegatorStartingInfo({ value: DelegatorStartingInfo.fromPartial(value) }) + let msg = this.msgWithdrawDelegatorRewardResponse({ value: MsgWithdrawDelegatorRewardResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDelegatorStartingInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgWithdrawDelegatorRewardResponse: Could not broadcast Tx: '+ e.message) } }, @@ -1209,129 +1181,157 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryDelegationTotalRewardsResponse({ value, fee, memo }: sendQueryDelegationTotalRewardsResponseParams): Promise { + async sendMsgDepositValidatorRewardsPool({ value, fee, memo }: sendMsgDepositValidatorRewardsPoolParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegationTotalRewardsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDepositValidatorRewardsPool: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegationTotalRewardsResponse({ value: QueryDelegationTotalRewardsResponse.fromPartial(value) }) + let msg = this.msgDepositValidatorRewardsPool({ value: MsgDepositValidatorRewardsPool.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegationTotalRewardsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDepositValidatorRewardsPool: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendFeePool({ value, fee, memo }: sendFeePoolParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendFeePool: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.feePool({ value: FeePool.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendFeePool: Could not broadcast Tx: '+ e.message) } }, - async sendMsgWithdrawValidatorCommission({ value, fee, memo }: sendMsgWithdrawValidatorCommissionParams): Promise { + async sendMsgWithdrawDelegatorReward({ value, fee, memo }: sendMsgWithdrawDelegatorRewardParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgWithdrawValidatorCommission: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgWithdrawDelegatorReward: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgWithdrawValidatorCommission({ value: MsgWithdrawValidatorCommission.fromPartial(value) }) + let msg = this.msgWithdrawDelegatorReward({ value: MsgWithdrawDelegatorReward.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgWithdrawValidatorCommission: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgWithdrawDelegatorReward: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorDistributionInfoRequest({ value, fee, memo }: sendQueryValidatorDistributionInfoRequestParams): Promise { + async sendDelegationDelegatorReward({ value, fee, memo }: sendDelegationDelegatorRewardParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorDistributionInfoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDelegationDelegatorReward: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorDistributionInfoRequest({ value: QueryValidatorDistributionInfoRequest.fromPartial(value) }) + let msg = this.delegationDelegatorReward({ value: DelegationDelegatorReward.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorDistributionInfoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDelegationDelegatorReward: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorHistoricalRewards({ value, fee, memo }: sendValidatorHistoricalRewardsParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorHistoricalRewards: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorHistoricalRewards({ value: ValidatorHistoricalRewards.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorHistoricalRewards: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendQueryValidatorCommissionResponse({ value, fee, memo }: sendQueryValidatorCommissionResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorCommissionResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.queryValidatorCommissionResponse({ value: QueryValidatorCommissionResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorCommissionResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegationRewardsResponse({ value, fee, memo }: sendQueryDelegationRewardsResponseParams): Promise { + async sendMsgWithdrawValidatorCommission({ value, fee, memo }: sendMsgWithdrawValidatorCommissionParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegationRewardsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgWithdrawValidatorCommission: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegationRewardsResponse({ value: QueryDelegationRewardsResponse.fromPartial(value) }) + let msg = this.msgWithdrawValidatorCommission({ value: MsgWithdrawValidatorCommission.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegationRewardsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgWithdrawValidatorCommission: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorAccumulatedCommissionRecord({ value, fee, memo }: sendValidatorAccumulatedCommissionRecordParams): Promise { + async sendValidatorCurrentRewards({ value, fee, memo }: sendValidatorCurrentRewardsParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorAccumulatedCommissionRecord: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorCurrentRewards: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorAccumulatedCommissionRecord({ value: ValidatorAccumulatedCommissionRecord.fromPartial(value) }) + let msg = this.validatorCurrentRewards({ value: ValidatorCurrentRewards.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorAccumulatedCommissionRecord: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorCurrentRewards: Could not broadcast Tx: '+ e.message) } }, - async sendDelegatorStartingInfoRecord({ value, fee, memo }: sendDelegatorStartingInfoRecordParams): Promise { + async sendValidatorAccumulatedCommission({ value, fee, memo }: sendValidatorAccumulatedCommissionParams): Promise { if (!signer) { - throw new Error('TxClient:sendDelegatorStartingInfoRecord: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorAccumulatedCommission: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.delegatorStartingInfoRecord({ value: DelegatorStartingInfoRecord.fromPartial(value) }) + let msg = this.validatorAccumulatedCommission({ value: ValidatorAccumulatedCommission.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDelegatorStartingInfoRecord: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorAccumulatedCommission: Could not broadcast Tx: '+ e.message) + } + }, + + async sendCommunityPoolSpendProposal({ value, fee, memo }: sendCommunityPoolSpendProposalParams): Promise { + if (!signer) { + throw new Error('TxClient:sendCommunityPoolSpendProposal: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.communityPoolSpendProposal({ value: CommunityPoolSpendProposal.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendCommunityPoolSpendProposal: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryDelegationTotalRewardsRequest({ value, fee, memo }: sendQueryDelegationTotalRewardsRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryDelegationTotalRewardsRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryDelegationTotalRewardsRequest({ value: QueryDelegationTotalRewardsRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryDelegationTotalRewardsRequest: Could not broadcast Tx: '+ e.message) } }, @@ -1349,86 +1349,86 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgDepositValidatorRewardsPoolResponse({ value, fee, memo }: sendMsgDepositValidatorRewardsPoolResponseParams): Promise { + async sendValidatorHistoricalRewardsRecord({ value, fee, memo }: sendValidatorHistoricalRewardsRecordParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDepositValidatorRewardsPoolResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorHistoricalRewardsRecord: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDepositValidatorRewardsPoolResponse({ value: MsgDepositValidatorRewardsPoolResponse.fromPartial(value) }) + let msg = this.validatorHistoricalRewardsRecord({ value: ValidatorHistoricalRewardsRecord.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDepositValidatorRewardsPoolResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorHistoricalRewardsRecord: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorAccumulatedCommission({ value, fee, memo }: sendValidatorAccumulatedCommissionParams): Promise { + async sendQueryValidatorDistributionInfoResponse({ value, fee, memo }: sendQueryValidatorDistributionInfoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorAccumulatedCommission: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorDistributionInfoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorAccumulatedCommission({ value: ValidatorAccumulatedCommission.fromPartial(value) }) + let msg = this.queryValidatorDistributionInfoResponse({ value: QueryValidatorDistributionInfoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorAccumulatedCommission: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorDistributionInfoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorSlashEvent({ value, fee, memo }: sendValidatorSlashEventParams): Promise { + async sendMsgCommunityPoolSpend({ value, fee, memo }: sendMsgCommunityPoolSpendParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorSlashEvent: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCommunityPoolSpend: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorSlashEvent({ value: ValidatorSlashEvent.fromPartial(value) }) + let msg = this.msgCommunityPoolSpend({ value: MsgCommunityPoolSpend.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorSlashEvent: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCommunityPoolSpend: Could not broadcast Tx: '+ e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + validatorAccumulatedCommissionRecord({ value }: validatorAccumulatedCommissionRecordParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", value: ValidatorAccumulatedCommissionRecord.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorAccumulatedCommissionRecord: Could not create message: ' + e.message) } }, - queryDelegationTotalRewardsRequest({ value }: queryDelegationTotalRewardsRequestParams): EncodeObject { + queryValidatorSlashesResponse({ value }: queryValidatorSlashesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", value: QueryDelegationTotalRewardsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", value: QueryValidatorSlashesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegationTotalRewardsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorSlashesResponse: Could not create message: ' + e.message) } }, - delegationDelegatorReward({ value }: delegationDelegatorRewardParams): EncodeObject { + queryDelegatorValidatorsRequest({ value }: queryDelegatorValidatorsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", value: DelegationDelegatorReward.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", value: QueryDelegatorValidatorsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DelegationDelegatorReward: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorValidatorsRequest: Could not create message: ' + e.message) } }, - validatorCurrentRewards({ value }: validatorCurrentRewardsParams): EncodeObject { + queryValidatorCommissionRequest({ value }: queryValidatorCommissionRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", value: ValidatorCurrentRewards.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", value: QueryValidatorCommissionRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorCurrentRewards: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorCommissionRequest: Could not create message: ' + e.message) } }, - msgSetWithdrawAddress({ value }: msgSetWithdrawAddressParams): EncodeObject { + queryDelegationTotalRewardsResponse({ value }: queryDelegationTotalRewardsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: MsgSetWithdrawAddress.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", value: QueryDelegationTotalRewardsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSetWithdrawAddress: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegationTotalRewardsResponse: Could not create message: ' + e.message) } }, @@ -1440,355 +1440,355 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgCommunityPoolSpendResponse({ value }: msgCommunityPoolSpendResponseParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse", value: MsgCommunityPoolSpendResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCommunityPoolSpendResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - queryCommunityPoolResponse({ value }: queryCommunityPoolResponseParams): EncodeObject { + msgCommunityPoolSpendResponse({ value }: msgCommunityPoolSpendResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", value: QueryCommunityPoolResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse", value: MsgCommunityPoolSpendResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCommunityPoolResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCommunityPoolSpendResponse: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + validatorOutstandingRewards({ value }: validatorOutstandingRewardsParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", value: ValidatorOutstandingRewards.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorOutstandingRewards: Could not create message: ' + e.message) } }, - queryDelegationRewardsRequest({ value }: queryDelegationRewardsRequestParams): EncodeObject { + delegatorStartingInfo({ value }: delegatorStartingInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", value: QueryDelegationRewardsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", value: DelegatorStartingInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegationRewardsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:DelegatorStartingInfo: Could not create message: ' + e.message) } }, - communityPoolSpendProposalWithDeposit({ value }: communityPoolSpendProposalWithDepositParams): EncodeObject { + delegatorWithdrawInfo({ value }: delegatorWithdrawInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", value: CommunityPoolSpendProposalWithDeposit.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", value: DelegatorWithdrawInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:CommunityPoolSpendProposalWithDeposit: Could not create message: ' + e.message) + throw new Error('TxClient:DelegatorWithdrawInfo: Could not create message: ' + e.message) } }, - msgDepositValidatorRewardsPool({ value }: msgDepositValidatorRewardsPoolParams): EncodeObject { + validatorSlashEventRecord({ value }: validatorSlashEventRecordParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", value: MsgDepositValidatorRewardsPool.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", value: ValidatorSlashEventRecord.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDepositValidatorRewardsPool: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorSlashEventRecord: Could not create message: ' + e.message) } }, - queryValidatorOutstandingRewardsResponse({ value }: queryValidatorOutstandingRewardsResponseParams): EncodeObject { + queryValidatorOutstandingRewardsRequest({ value }: queryValidatorOutstandingRewardsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", value: QueryValidatorOutstandingRewardsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", value: QueryValidatorOutstandingRewardsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorOutstandingRewardsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorOutstandingRewardsRequest: Could not create message: ' + e.message) } }, - queryDelegatorValidatorsRequest({ value }: queryDelegatorValidatorsRequestParams): EncodeObject { + queryDelegationRewardsResponse({ value }: queryDelegationRewardsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", value: QueryDelegatorValidatorsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", value: QueryDelegationRewardsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorValidatorsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegationRewardsResponse: Could not create message: ' + e.message) } }, - feePool({ value }: feePoolParams): EncodeObject { + queryDelegatorWithdrawAddressResponse({ value }: queryDelegatorWithdrawAddressResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.FeePool", value: FeePool.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", value: QueryDelegatorWithdrawAddressResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:FeePool: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorWithdrawAddressResponse: Could not create message: ' + e.message) } }, - queryValidatorCommissionResponse({ value }: queryValidatorCommissionResponseParams): EncodeObject { + msgDepositValidatorRewardsPoolResponse({ value }: msgDepositValidatorRewardsPoolResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", value: QueryValidatorCommissionResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse", value: MsgDepositValidatorRewardsPoolResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorCommissionResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDepositValidatorRewardsPoolResponse: Could not create message: ' + e.message) } }, - queryDelegatorWithdrawAddressResponse({ value }: queryDelegatorWithdrawAddressResponseParams): EncodeObject { + queryDelegatorWithdrawAddressRequest({ value }: queryDelegatorWithdrawAddressRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", value: QueryDelegatorWithdrawAddressResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", value: QueryDelegatorWithdrawAddressRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorWithdrawAddressResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorWithdrawAddressRequest: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryCommunityPoolRequest({ value }: queryCommunityPoolRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", value: QueryCommunityPoolRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCommunityPoolRequest: Could not create message: ' + e.message) } }, - msgWithdrawDelegatorRewardResponse({ value }: msgWithdrawDelegatorRewardResponseParams): EncodeObject { + msgWithdrawValidatorCommissionResponse({ value }: msgWithdrawValidatorCommissionResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", value: MsgWithdrawDelegatorRewardResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", value: MsgWithdrawValidatorCommissionResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgWithdrawDelegatorRewardResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgWithdrawValidatorCommissionResponse: Could not create message: ' + e.message) } }, - queryValidatorDistributionInfoResponse({ value }: queryValidatorDistributionInfoResponseParams): EncodeObject { + validatorCurrentRewardsRecord({ value }: validatorCurrentRewardsRecordParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse", value: QueryValidatorDistributionInfoResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", value: ValidatorCurrentRewardsRecord.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorDistributionInfoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorCurrentRewardsRecord: Could not create message: ' + e.message) } }, - queryDelegatorValidatorsResponse({ value }: queryDelegatorValidatorsResponseParams): EncodeObject { + queryValidatorOutstandingRewardsResponse({ value }: queryValidatorOutstandingRewardsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", value: QueryDelegatorValidatorsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", value: QueryValidatorOutstandingRewardsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorValidatorsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorOutstandingRewardsResponse: Could not create message: ' + e.message) } }, - queryDelegatorWithdrawAddressRequest({ value }: queryDelegatorWithdrawAddressRequestParams): EncodeObject { + communityPoolSpendProposalWithDeposit({ value }: communityPoolSpendProposalWithDepositParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", value: QueryDelegatorWithdrawAddressRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", value: CommunityPoolSpendProposalWithDeposit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorWithdrawAddressRequest: Could not create message: ' + e.message) + throw new Error('TxClient:CommunityPoolSpendProposalWithDeposit: Could not create message: ' + e.message) } }, - queryCommunityPoolRequest({ value }: queryCommunityPoolRequestParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", value: QueryCommunityPoolRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCommunityPoolRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - communityPoolSpendProposal({ value }: communityPoolSpendProposalParams): EncodeObject { + validatorSlashEvent({ value }: validatorSlashEventParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", value: CommunityPoolSpendProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", value: ValidatorSlashEvent.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:CommunityPoolSpendProposal: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorSlashEvent: Could not create message: ' + e.message) } }, - msgSetWithdrawAddressResponse({ value }: msgSetWithdrawAddressResponseParams): EncodeObject { + queryValidatorDistributionInfoRequest({ value }: queryValidatorDistributionInfoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", value: MsgSetWithdrawAddressResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest", value: QueryValidatorDistributionInfoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSetWithdrawAddressResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorDistributionInfoRequest: Could not create message: ' + e.message) } }, - queryValidatorOutstandingRewardsRequest({ value }: queryValidatorOutstandingRewardsRequestParams): EncodeObject { + queryValidatorSlashesRequest({ value }: queryValidatorSlashesRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", value: QueryValidatorOutstandingRewardsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", value: QueryValidatorSlashesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorOutstandingRewardsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorSlashesRequest: Could not create message: ' + e.message) } }, - queryValidatorCommissionRequest({ value }: queryValidatorCommissionRequestParams): EncodeObject { + queryDelegationRewardsRequest({ value }: queryDelegationRewardsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", value: QueryValidatorCommissionRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", value: QueryDelegationRewardsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorCommissionRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegationRewardsRequest: Could not create message: ' + e.message) } }, - queryValidatorSlashesRequest({ value }: queryValidatorSlashesRequestParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", value: QueryValidatorSlashesRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorSlashesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - validatorOutstandingRewardsRecord({ value }: validatorOutstandingRewardsRecordParams): EncodeObject { + validatorHistoricalRewards({ value }: validatorHistoricalRewardsParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", value: ValidatorOutstandingRewardsRecord.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", value: ValidatorHistoricalRewards.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorOutstandingRewardsRecord: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorHistoricalRewards: Could not create message: ' + e.message) } }, - validatorHistoricalRewardsRecord({ value }: validatorHistoricalRewardsRecordParams): EncodeObject { + validatorSlashEvents({ value }: validatorSlashEventsParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", value: ValidatorHistoricalRewardsRecord.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", value: ValidatorSlashEvents.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorHistoricalRewardsRecord: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorSlashEvents: Could not create message: ' + e.message) } }, - validatorCurrentRewardsRecord({ value }: validatorCurrentRewardsRecordParams): EncodeObject { + delegatorStartingInfoRecord({ value }: delegatorStartingInfoRecordParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", value: ValidatorCurrentRewardsRecord.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", value: DelegatorStartingInfoRecord.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorCurrentRewardsRecord: Could not create message: ' + e.message) + throw new Error('TxClient:DelegatorStartingInfoRecord: Could not create message: ' + e.message) } }, - validatorSlashEventRecord({ value }: validatorSlashEventRecordParams): EncodeObject { + queryDelegatorValidatorsResponse({ value }: queryDelegatorValidatorsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", value: ValidatorSlashEventRecord.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", value: QueryDelegatorValidatorsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorSlashEventRecord: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorValidatorsResponse: Could not create message: ' + e.message) } }, - delegatorWithdrawInfo({ value }: delegatorWithdrawInfoParams): EncodeObject { + queryCommunityPoolResponse({ value }: queryCommunityPoolResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", value: DelegatorWithdrawInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", value: QueryCommunityPoolResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DelegatorWithdrawInfo: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCommunityPoolResponse: Could not create message: ' + e.message) } }, - msgWithdrawDelegatorReward({ value }: msgWithdrawDelegatorRewardParams): EncodeObject { + validatorOutstandingRewardsRecord({ value }: validatorOutstandingRewardsRecordParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: MsgWithdrawDelegatorReward.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", value: ValidatorOutstandingRewardsRecord.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgWithdrawDelegatorReward: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorOutstandingRewardsRecord: Could not create message: ' + e.message) } }, - msgCommunityPoolSpend({ value }: msgCommunityPoolSpendParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", value: MsgCommunityPoolSpend.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCommunityPoolSpend: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - validatorOutstandingRewards({ value }: validatorOutstandingRewardsParams): EncodeObject { + msgSetWithdrawAddress({ value }: msgSetWithdrawAddressParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", value: ValidatorOutstandingRewards.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: MsgSetWithdrawAddress.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorOutstandingRewards: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSetWithdrawAddress: Could not create message: ' + e.message) } }, - validatorSlashEvents({ value }: validatorSlashEventsParams): EncodeObject { + msgSetWithdrawAddressResponse({ value }: msgSetWithdrawAddressResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", value: ValidatorSlashEvents.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", value: MsgSetWithdrawAddressResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorSlashEvents: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSetWithdrawAddressResponse: Could not create message: ' + e.message) } }, - msgWithdrawValidatorCommissionResponse({ value }: msgWithdrawValidatorCommissionResponseParams): EncodeObject { + msgWithdrawDelegatorRewardResponse({ value }: msgWithdrawDelegatorRewardResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", value: MsgWithdrawValidatorCommissionResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", value: MsgWithdrawDelegatorRewardResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgWithdrawValidatorCommissionResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgWithdrawDelegatorRewardResponse: Could not create message: ' + e.message) } }, - queryValidatorSlashesResponse({ value }: queryValidatorSlashesResponseParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", value: QueryValidatorSlashesResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorSlashesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - delegatorStartingInfo({ value }: delegatorStartingInfoParams): EncodeObject { + msgDepositValidatorRewardsPool({ value }: msgDepositValidatorRewardsPoolParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", value: DelegatorStartingInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", value: MsgDepositValidatorRewardsPool.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DelegatorStartingInfo: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDepositValidatorRewardsPool: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + feePool({ value }: feePoolParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.FeePool", value: FeePool.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:FeePool: Could not create message: ' + e.message) } }, - queryDelegationTotalRewardsResponse({ value }: queryDelegationTotalRewardsResponseParams): EncodeObject { + msgWithdrawDelegatorReward({ value }: msgWithdrawDelegatorRewardParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", value: QueryDelegationTotalRewardsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: MsgWithdrawDelegatorReward.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegationTotalRewardsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgWithdrawDelegatorReward: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + delegationDelegatorReward({ value }: delegationDelegatorRewardParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", value: DelegationDelegatorReward.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:DelegationDelegatorReward: Could not create message: ' + e.message) } }, - msgWithdrawValidatorCommission({ value }: msgWithdrawValidatorCommissionParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgWithdrawValidatorCommission: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - queryValidatorDistributionInfoRequest({ value }: queryValidatorDistributionInfoRequestParams): EncodeObject { + queryValidatorCommissionResponse({ value }: queryValidatorCommissionResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest", value: QueryValidatorDistributionInfoRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", value: QueryValidatorCommissionResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorDistributionInfoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorCommissionResponse: Could not create message: ' + e.message) } }, - validatorHistoricalRewards({ value }: validatorHistoricalRewardsParams): EncodeObject { + msgWithdrawValidatorCommission({ value }: msgWithdrawValidatorCommissionParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", value: ValidatorHistoricalRewards.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorHistoricalRewards: Could not create message: ' + e.message) + throw new Error('TxClient:MsgWithdrawValidatorCommission: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + validatorCurrentRewards({ value }: validatorCurrentRewardsParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", value: ValidatorCurrentRewards.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorCurrentRewards: Could not create message: ' + e.message) } }, - queryDelegationRewardsResponse({ value }: queryDelegationRewardsResponseParams): EncodeObject { + validatorAccumulatedCommission({ value }: validatorAccumulatedCommissionParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", value: QueryDelegationRewardsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", value: ValidatorAccumulatedCommission.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegationRewardsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorAccumulatedCommission: Could not create message: ' + e.message) } }, - validatorAccumulatedCommissionRecord({ value }: validatorAccumulatedCommissionRecordParams): EncodeObject { + communityPoolSpendProposal({ value }: communityPoolSpendProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", value: ValidatorAccumulatedCommissionRecord.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", value: CommunityPoolSpendProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorAccumulatedCommissionRecord: Could not create message: ' + e.message) + throw new Error('TxClient:CommunityPoolSpendProposal: Could not create message: ' + e.message) } }, - delegatorStartingInfoRecord({ value }: delegatorStartingInfoRecordParams): EncodeObject { + queryDelegationTotalRewardsRequest({ value }: queryDelegationTotalRewardsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", value: DelegatorStartingInfoRecord.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", value: QueryDelegationTotalRewardsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DelegatorStartingInfoRecord: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegationTotalRewardsRequest: Could not create message: ' + e.message) } }, @@ -1800,27 +1800,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgDepositValidatorRewardsPoolResponse({ value }: msgDepositValidatorRewardsPoolResponseParams): EncodeObject { + validatorHistoricalRewardsRecord({ value }: validatorHistoricalRewardsRecordParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse", value: MsgDepositValidatorRewardsPoolResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", value: ValidatorHistoricalRewardsRecord.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDepositValidatorRewardsPoolResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorHistoricalRewardsRecord: Could not create message: ' + e.message) } }, - validatorAccumulatedCommission({ value }: validatorAccumulatedCommissionParams): EncodeObject { + queryValidatorDistributionInfoResponse({ value }: queryValidatorDistributionInfoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", value: ValidatorAccumulatedCommission.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse", value: QueryValidatorDistributionInfoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorAccumulatedCommission: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorDistributionInfoResponse: Could not create message: ' + e.message) } }, - validatorSlashEvent({ value }: validatorSlashEventParams): EncodeObject { + msgCommunityPoolSpend({ value }: msgCommunityPoolSpendParams): EncodeObject { try { - return { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", value: ValidatorSlashEvent.fromPartial( value ) } + return { typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", value: MsgCommunityPoolSpend.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorSlashEvent: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCommunityPoolSpend: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.distribution.v1beta1/registry.ts b/ts-client/cosmos.distribution.v1beta1/registry.ts index fd523fa1..8b93fbfc 100755 --- a/ts-client/cosmos.distribution.v1beta1/registry.ts +++ b/ts-client/cosmos.distribution.v1beta1/registry.ts @@ -1,114 +1,114 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { QueryParamsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegationTotalRewardsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { DelegationDelegatorReward } from "./types/cosmos/distribution/v1beta1/distribution"; -import { ValidatorCurrentRewards } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgFundCommunityPool } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgCommunityPoolSpendResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryCommunityPoolResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryParamsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegationRewardsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { CommunityPoolSpendProposalWithDeposit } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgDepositValidatorRewardsPool } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorOutstandingRewardsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegatorValidatorsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { FeePool } from "./types/cosmos/distribution/v1beta1/distribution"; -import { QueryValidatorCommissionResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegatorWithdrawAddressResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { GenesisState } from "./types/cosmos/distribution/v1beta1/genesis"; -import { MsgWithdrawDelegatorRewardResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorDistributionInfoResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegatorValidatorsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryDelegatorWithdrawAddressRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryCommunityPoolRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { CommunityPoolSpendProposal } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgSetWithdrawAddressResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorOutstandingRewardsRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryValidatorCommissionRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { QueryValidatorSlashesRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { ValidatorOutstandingRewardsRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { ValidatorHistoricalRewardsRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { ValidatorCurrentRewardsRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { ValidatorSlashEventRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { DelegatorWithdrawInfo } from "./types/cosmos/distribution/v1beta1/genesis"; -import { MsgWithdrawDelegatorReward } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgCommunityPoolSpend } from "./types/cosmos/distribution/v1beta1/tx"; -import { ValidatorOutstandingRewards } from "./types/cosmos/distribution/v1beta1/distribution"; -import { ValidatorSlashEvents } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgWithdrawValidatorCommissionResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorSlashesResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { DelegatorStartingInfo } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgUpdateParams } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryDelegationTotalRewardsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { Params } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryValidatorDistributionInfoRequest } from "./types/cosmos/distribution/v1beta1/query"; -import { ValidatorHistoricalRewards } from "./types/cosmos/distribution/v1beta1/distribution"; -import { MsgUpdateParamsResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { QueryDelegationRewardsResponse } from "./types/cosmos/distribution/v1beta1/query"; -import { ValidatorAccumulatedCommissionRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { DelegatorStartingInfoRecord } from "./types/cosmos/distribution/v1beta1/genesis"; -import { MsgFundCommunityPoolResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgDepositValidatorRewardsPoolResponse } from "./types/cosmos/distribution/v1beta1/tx"; -import { ValidatorAccumulatedCommission } from "./types/cosmos/distribution/v1beta1/distribution"; -import { ValidatorSlashEvent } from "./types/cosmos/distribution/v1beta1/distribution"; +import { ValidatorAccumulatedCommissionRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryValidatorSlashesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegatorValidatorsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryValidatorCommissionRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegationTotalRewardsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgFundCommunityPool } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { MsgCommunityPoolSpendResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorOutstandingRewards } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { DelegatorStartingInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { DelegatorWithdrawInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { ValidatorSlashEventRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryValidatorOutstandingRewardsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegationRewardsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegatorWithdrawAddressResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgDepositValidatorRewardsPoolResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { QueryDelegatorWithdrawAddressRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryCommunityPoolRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgWithdrawValidatorCommissionResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorCurrentRewardsRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryValidatorOutstandingRewardsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { CommunityPoolSpendProposalWithDeposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { ValidatorSlashEvent } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { QueryValidatorDistributionInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryValidatorSlashesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryDelegationRewardsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorHistoricalRewards } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { ValidatorSlashEvents } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { DelegatorStartingInfoRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryDelegatorValidatorsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryCommunityPoolResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { ValidatorOutstandingRewardsRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgSetWithdrawAddress } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { MsgSetWithdrawAddressResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { MsgWithdrawDelegatorRewardResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { MsgDepositValidatorRewardsPool } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { FeePool } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { MsgWithdrawDelegatorReward } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { DelegationDelegatorReward } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { QueryValidatorCommissionResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgWithdrawValidatorCommission } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorCurrentRewards } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { ValidatorAccumulatedCommission } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { CommunityPoolSpendProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/distribution"; +import { QueryDelegationTotalRewardsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgFundCommunityPoolResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; +import { ValidatorHistoricalRewardsRecord } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/genesis"; +import { QueryValidatorDistributionInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/query"; +import { MsgCommunityPoolSpend } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/distribution/v1beta1/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.distribution.v1beta1.QueryParamsResponse", QueryParamsResponse], - ["/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", QueryDelegationTotalRewardsRequest], - ["/cosmos.distribution.v1beta1.DelegationDelegatorReward", DelegationDelegatorReward], - ["/cosmos.distribution.v1beta1.ValidatorCurrentRewards", ValidatorCurrentRewards], - ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], + ["/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", ValidatorAccumulatedCommissionRecord], + ["/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", QueryValidatorSlashesResponse], + ["/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", QueryDelegatorValidatorsRequest], + ["/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", QueryValidatorCommissionRequest], + ["/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", QueryDelegationTotalRewardsResponse], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool], + ["/cosmos.distribution.v1beta1.GenesisState", GenesisState], ["/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse", MsgCommunityPoolSpendResponse], - ["/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", QueryCommunityPoolResponse], - ["/cosmos.distribution.v1beta1.QueryParamsRequest", QueryParamsRequest], - ["/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", QueryDelegationRewardsRequest], - ["/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", CommunityPoolSpendProposalWithDeposit], - ["/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", MsgDepositValidatorRewardsPool], - ["/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", QueryValidatorOutstandingRewardsResponse], - ["/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", QueryDelegatorValidatorsRequest], - ["/cosmos.distribution.v1beta1.FeePool", FeePool], - ["/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", QueryValidatorCommissionResponse], + ["/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", ValidatorOutstandingRewards], + ["/cosmos.distribution.v1beta1.DelegatorStartingInfo", DelegatorStartingInfo], + ["/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", DelegatorWithdrawInfo], + ["/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", ValidatorSlashEventRecord], + ["/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", QueryValidatorOutstandingRewardsRequest], + ["/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", QueryDelegationRewardsResponse], ["/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", QueryDelegatorWithdrawAddressResponse], - ["/cosmos.distribution.v1beta1.GenesisState", GenesisState], - ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", MsgWithdrawDelegatorRewardResponse], - ["/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse", QueryValidatorDistributionInfoResponse], - ["/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", QueryDelegatorValidatorsResponse], + ["/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse", MsgDepositValidatorRewardsPoolResponse], ["/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", QueryDelegatorWithdrawAddressRequest], ["/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", QueryCommunityPoolRequest], - ["/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", CommunityPoolSpendProposal], - ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", MsgSetWithdrawAddressResponse], - ["/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", QueryValidatorOutstandingRewardsRequest], - ["/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", QueryValidatorCommissionRequest], - ["/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", QueryValidatorSlashesRequest], - ["/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", ValidatorOutstandingRewardsRecord], - ["/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", ValidatorHistoricalRewardsRecord], - ["/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", ValidatorCurrentRewardsRecord], - ["/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", ValidatorSlashEventRecord], - ["/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", DelegatorWithdrawInfo], - ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], - ["/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", MsgCommunityPoolSpend], - ["/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", ValidatorOutstandingRewards], - ["/cosmos.distribution.v1beta1.ValidatorSlashEvents", ValidatorSlashEvents], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", MsgWithdrawValidatorCommissionResponse], - ["/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", QueryValidatorSlashesResponse], - ["/cosmos.distribution.v1beta1.DelegatorStartingInfo", DelegatorStartingInfo], - ["/cosmos.distribution.v1beta1.MsgUpdateParams", MsgUpdateParams], - ["/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", QueryDelegationTotalRewardsResponse], + ["/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", ValidatorCurrentRewardsRecord], + ["/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", QueryValidatorOutstandingRewardsResponse], + ["/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", CommunityPoolSpendProposalWithDeposit], ["/cosmos.distribution.v1beta1.Params", Params], - ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], + ["/cosmos.distribution.v1beta1.ValidatorSlashEvent", ValidatorSlashEvent], ["/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest", QueryValidatorDistributionInfoRequest], - ["/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", ValidatorHistoricalRewards], + ["/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", QueryValidatorSlashesRequest], + ["/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", QueryDelegationRewardsRequest], ["/cosmos.distribution.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", QueryDelegationRewardsResponse], - ["/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", ValidatorAccumulatedCommissionRecord], + ["/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", ValidatorHistoricalRewards], + ["/cosmos.distribution.v1beta1.ValidatorSlashEvents", ValidatorSlashEvents], ["/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", DelegatorStartingInfoRecord], - ["/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", MsgFundCommunityPoolResponse], - ["/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse", MsgDepositValidatorRewardsPoolResponse], + ["/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", QueryDelegatorValidatorsResponse], + ["/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", QueryCommunityPoolResponse], + ["/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", ValidatorOutstandingRewardsRecord], + ["/cosmos.distribution.v1beta1.QueryParamsRequest", QueryParamsRequest], + ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], + ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", MsgSetWithdrawAddressResponse], + ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", MsgWithdrawDelegatorRewardResponse], + ["/cosmos.distribution.v1beta1.MsgUpdateParams", MsgUpdateParams], + ["/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", MsgDepositValidatorRewardsPool], + ["/cosmos.distribution.v1beta1.FeePool", FeePool], + ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], + ["/cosmos.distribution.v1beta1.DelegationDelegatorReward", DelegationDelegatorReward], + ["/cosmos.distribution.v1beta1.QueryParamsResponse", QueryParamsResponse], + ["/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", QueryValidatorCommissionResponse], + ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], + ["/cosmos.distribution.v1beta1.ValidatorCurrentRewards", ValidatorCurrentRewards], ["/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", ValidatorAccumulatedCommission], - ["/cosmos.distribution.v1beta1.ValidatorSlashEvent", ValidatorSlashEvent], + ["/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", CommunityPoolSpendProposal], + ["/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", QueryDelegationTotalRewardsRequest], + ["/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", MsgFundCommunityPoolResponse], + ["/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", ValidatorHistoricalRewardsRecord], + ["/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse", QueryValidatorDistributionInfoResponse], + ["/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", MsgCommunityPoolSpend], ]; diff --git a/ts-client/cosmos.distribution.v1beta1/types/amino/amino.ts b/ts-client/cosmos.distribution.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.distribution.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.distribution.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.distribution.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.distribution.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.distribution.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.distribution.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.distribution.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.distribution.v1beta1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/cosmos.distribution.v1beta1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmos.distribution.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.distribution.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.distribution.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.distribution.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.distribution.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.distribution.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.distribution.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.distribution.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.distribution.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.distribution.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.distribution.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.distribution.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.distribution.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.distribution.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.distribution.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.distribution.v1beta1/types/google/api/http.ts b/ts-client/cosmos.distribution.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.distribution.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.distribution.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.distribution.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.distribution.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.distribution.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.distribution.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.distribution.v1beta1/types/route-name.eta b/ts-client/cosmos.distribution.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.distribution.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.evidence.v1beta1/module.ts b/ts-client/cosmos.evidence.v1beta1/module.ts index f8eb47ff..7d7f6280 100755 --- a/ts-client/cosmos.evidence.v1beta1/module.ts +++ b/ts-client/cosmos.evidence.v1beta1/module.ts @@ -6,26 +6,26 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; +import { QueryAllEvidenceResponse } from "./types/cosmos/evidence/v1beta1/query"; import { Equivocation } from "./types/cosmos/evidence/v1beta1/evidence"; -import { MsgSubmitEvidence } from "./types/cosmos/evidence/v1beta1/tx"; import { GenesisState } from "./types/cosmos/evidence/v1beta1/genesis"; +import { MsgSubmitEvidence } from "./types/cosmos/evidence/v1beta1/tx"; import { QueryEvidenceRequest } from "./types/cosmos/evidence/v1beta1/query"; -import { QueryEvidenceResponse } from "./types/cosmos/evidence/v1beta1/query"; -import { QueryAllEvidenceResponse } from "./types/cosmos/evidence/v1beta1/query"; import { QueryAllEvidenceRequest } from "./types/cosmos/evidence/v1beta1/query"; import { MsgSubmitEvidenceResponse } from "./types/cosmos/evidence/v1beta1/tx"; +import { QueryEvidenceResponse } from "./types/cosmos/evidence/v1beta1/query"; -export { Equivocation, MsgSubmitEvidence, GenesisState, QueryEvidenceRequest, QueryEvidenceResponse, QueryAllEvidenceResponse, QueryAllEvidenceRequest, MsgSubmitEvidenceResponse }; +export { QueryAllEvidenceResponse, Equivocation, GenesisState, MsgSubmitEvidence, QueryEvidenceRequest, QueryAllEvidenceRequest, MsgSubmitEvidenceResponse, QueryEvidenceResponse }; -type sendEquivocationParams = { - value: Equivocation, +type sendQueryAllEvidenceResponseParams = { + value: QueryAllEvidenceResponse, fee?: StdFee, memo?: string }; -type sendMsgSubmitEvidenceParams = { - value: MsgSubmitEvidence, +type sendEquivocationParams = { + value: Equivocation, fee?: StdFee, memo?: string }; @@ -36,20 +36,14 @@ type sendGenesisStateParams = { memo?: string }; -type sendQueryEvidenceRequestParams = { - value: QueryEvidenceRequest, - fee?: StdFee, - memo?: string -}; - -type sendQueryEvidenceResponseParams = { - value: QueryEvidenceResponse, +type sendMsgSubmitEvidenceParams = { + value: MsgSubmitEvidence, fee?: StdFee, memo?: string }; -type sendQueryAllEvidenceResponseParams = { - value: QueryAllEvidenceResponse, +type sendQueryEvidenceRequestParams = { + value: QueryEvidenceRequest, fee?: StdFee, memo?: string }; @@ -66,29 +60,31 @@ type sendMsgSubmitEvidenceResponseParams = { memo?: string }; +type sendQueryEvidenceResponseParams = { + value: QueryEvidenceResponse, + fee?: StdFee, + memo?: string +}; -type equivocationParams = { - value: Equivocation, + +type queryAllEvidenceResponseParams = { + value: QueryAllEvidenceResponse, }; -type msgSubmitEvidenceParams = { - value: MsgSubmitEvidence, +type equivocationParams = { + value: Equivocation, }; type genesisStateParams = { value: GenesisState, }; -type queryEvidenceRequestParams = { - value: QueryEvidenceRequest, -}; - -type queryEvidenceResponseParams = { - value: QueryEvidenceResponse, +type msgSubmitEvidenceParams = { + value: MsgSubmitEvidence, }; -type queryAllEvidenceResponseParams = { - value: QueryAllEvidenceResponse, +type queryEvidenceRequestParams = { + value: QueryEvidenceRequest, }; type queryAllEvidenceRequestParams = { @@ -99,6 +95,10 @@ type msgSubmitEvidenceResponseParams = { value: MsgSubmitEvidenceResponse, }; +type queryEvidenceResponseParams = { + value: QueryEvidenceResponse, +}; + export const registry = new Registry(msgTypes); @@ -129,31 +129,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendEquivocation({ value, fee, memo }: sendEquivocationParams): Promise { + async sendQueryAllEvidenceResponse({ value, fee, memo }: sendQueryAllEvidenceResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendEquivocation: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllEvidenceResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.equivocation({ value: Equivocation.fromPartial(value) }) + let msg = this.queryAllEvidenceResponse({ value: QueryAllEvidenceResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEquivocation: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllEvidenceResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitEvidence({ value, fee, memo }: sendMsgSubmitEvidenceParams): Promise { + async sendEquivocation({ value, fee, memo }: sendEquivocationParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitEvidence: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEquivocation: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitEvidence({ value: MsgSubmitEvidence.fromPartial(value) }) + let msg = this.equivocation({ value: Equivocation.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitEvidence: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEquivocation: Could not broadcast Tx: '+ e.message) } }, @@ -171,90 +171,90 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryEvidenceRequest({ value, fee, memo }: sendQueryEvidenceRequestParams): Promise { + async sendMsgSubmitEvidence({ value, fee, memo }: sendMsgSubmitEvidenceParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryEvidenceRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitEvidence: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryEvidenceRequest({ value: QueryEvidenceRequest.fromPartial(value) }) + let msg = this.msgSubmitEvidence({ value: MsgSubmitEvidence.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryEvidenceRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitEvidence: Could not broadcast Tx: '+ e.message) } }, - async sendQueryEvidenceResponse({ value, fee, memo }: sendQueryEvidenceResponseParams): Promise { + async sendQueryEvidenceRequest({ value, fee, memo }: sendQueryEvidenceRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryEvidenceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryEvidenceRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryEvidenceResponse({ value: QueryEvidenceResponse.fromPartial(value) }) + let msg = this.queryEvidenceRequest({ value: QueryEvidenceRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryEvidenceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryEvidenceRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllEvidenceResponse({ value, fee, memo }: sendQueryAllEvidenceResponseParams): Promise { + async sendQueryAllEvidenceRequest({ value, fee, memo }: sendQueryAllEvidenceRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllEvidenceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllEvidenceRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllEvidenceResponse({ value: QueryAllEvidenceResponse.fromPartial(value) }) + let msg = this.queryAllEvidenceRequest({ value: QueryAllEvidenceRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllEvidenceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllEvidenceRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllEvidenceRequest({ value, fee, memo }: sendQueryAllEvidenceRequestParams): Promise { + async sendMsgSubmitEvidenceResponse({ value, fee, memo }: sendMsgSubmitEvidenceResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllEvidenceRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitEvidenceResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllEvidenceRequest({ value: QueryAllEvidenceRequest.fromPartial(value) }) + let msg = this.msgSubmitEvidenceResponse({ value: MsgSubmitEvidenceResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllEvidenceRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitEvidenceResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitEvidenceResponse({ value, fee, memo }: sendMsgSubmitEvidenceResponseParams): Promise { + async sendQueryEvidenceResponse({ value, fee, memo }: sendQueryEvidenceResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitEvidenceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryEvidenceResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitEvidenceResponse({ value: MsgSubmitEvidenceResponse.fromPartial(value) }) + let msg = this.queryEvidenceResponse({ value: QueryEvidenceResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitEvidenceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryEvidenceResponse: Could not broadcast Tx: '+ e.message) } }, - equivocation({ value }: equivocationParams): EncodeObject { + queryAllEvidenceResponse({ value }: queryAllEvidenceResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.evidence.v1beta1.Equivocation", value: Equivocation.fromPartial( value ) } + return { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", value: QueryAllEvidenceResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Equivocation: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAllEvidenceResponse: Could not create message: ' + e.message) } }, - msgSubmitEvidence({ value }: msgSubmitEvidenceParams): EncodeObject { + equivocation({ value }: equivocationParams): EncodeObject { try { - return { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence", value: MsgSubmitEvidence.fromPartial( value ) } + return { typeUrl: "/cosmos.evidence.v1beta1.Equivocation", value: Equivocation.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitEvidence: Could not create message: ' + e.message) + throw new Error('TxClient:Equivocation: Could not create message: ' + e.message) } }, @@ -266,27 +266,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryEvidenceRequest({ value }: queryEvidenceRequestParams): EncodeObject { - try { - return { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceRequest", value: QueryEvidenceRequest.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:QueryEvidenceRequest: Could not create message: ' + e.message) - } - }, - - queryEvidenceResponse({ value }: queryEvidenceResponseParams): EncodeObject { + msgSubmitEvidence({ value }: msgSubmitEvidenceParams): EncodeObject { try { - return { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceResponse", value: QueryEvidenceResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence", value: MsgSubmitEvidence.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryEvidenceResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitEvidence: Could not create message: ' + e.message) } }, - queryAllEvidenceResponse({ value }: queryAllEvidenceResponseParams): EncodeObject { + queryEvidenceRequest({ value }: queryEvidenceRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", value: QueryAllEvidenceResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceRequest", value: QueryEvidenceRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllEvidenceResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryEvidenceRequest: Could not create message: ' + e.message) } }, @@ -306,6 +298,14 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, + queryEvidenceResponse({ value }: queryEvidenceResponseParams): EncodeObject { + try { + return { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceResponse", value: QueryEvidenceResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryEvidenceResponse: Could not create message: ' + e.message) + } + }, + } }; diff --git a/ts-client/cosmos.evidence.v1beta1/registry.ts b/ts-client/cosmos.evidence.v1beta1/registry.ts index 6b9099d1..c3d09f1a 100755 --- a/ts-client/cosmos.evidence.v1beta1/registry.ts +++ b/ts-client/cosmos.evidence.v1beta1/registry.ts @@ -1,22 +1,22 @@ import { GeneratedType } from "@cosmjs/proto-signing"; +import { QueryAllEvidenceResponse } from "./types/cosmos/evidence/v1beta1/query"; import { Equivocation } from "./types/cosmos/evidence/v1beta1/evidence"; -import { MsgSubmitEvidence } from "./types/cosmos/evidence/v1beta1/tx"; import { GenesisState } from "./types/cosmos/evidence/v1beta1/genesis"; +import { MsgSubmitEvidence } from "./types/cosmos/evidence/v1beta1/tx"; import { QueryEvidenceRequest } from "./types/cosmos/evidence/v1beta1/query"; -import { QueryEvidenceResponse } from "./types/cosmos/evidence/v1beta1/query"; -import { QueryAllEvidenceResponse } from "./types/cosmos/evidence/v1beta1/query"; import { QueryAllEvidenceRequest } from "./types/cosmos/evidence/v1beta1/query"; import { MsgSubmitEvidenceResponse } from "./types/cosmos/evidence/v1beta1/tx"; +import { QueryEvidenceResponse } from "./types/cosmos/evidence/v1beta1/query"; const msgTypes: Array<[string, GeneratedType]> = [ + ["/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", QueryAllEvidenceResponse], ["/cosmos.evidence.v1beta1.Equivocation", Equivocation], - ["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence], ["/cosmos.evidence.v1beta1.GenesisState", GenesisState], + ["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence], ["/cosmos.evidence.v1beta1.QueryEvidenceRequest", QueryEvidenceRequest], - ["/cosmos.evidence.v1beta1.QueryEvidenceResponse", QueryEvidenceResponse], - ["/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", QueryAllEvidenceResponse], ["/cosmos.evidence.v1beta1.QueryAllEvidenceRequest", QueryAllEvidenceRequest], ["/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse", MsgSubmitEvidenceResponse], + ["/cosmos.evidence.v1beta1.QueryEvidenceResponse", QueryEvidenceResponse], ]; diff --git a/ts-client/cosmos.evidence.v1beta1/types/amino/amino.ts b/ts-client/cosmos.evidence.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts new file mode 100644 index 00000000..0dddf30c --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts @@ -0,0 +1,378 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/runtime/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.app.runtime.v1alpha1"; + +/** Module is the config object for the runtime module. */ +export interface Module { + /** app_name is the name of the app. */ + appName: string; + /** + * begin_blockers specifies the module names of begin blockers + * to call in the order in which they should be called. If this is left empty + * no begin blocker will be registered. + */ + beginBlockers: string[]; + /** + * end_blockers specifies the module names of the end blockers + * to call in the order in which they should be called. If this is left empty + * no end blocker will be registered. + */ + endBlockers: string[]; + /** + * init_genesis specifies the module names of init genesis functions + * to call in the order in which they should be called. If this is left empty + * no init genesis function will be registered. + */ + initGenesis: string[]; + /** + * export_genesis specifies the order in which to export module genesis data. + * If this is left empty, the init_genesis order will be used for export genesis + * if it is specified. + */ + exportGenesis: string[]; + /** + * override_store_keys is an optional list of overrides for the module store keys + * to be used in keeper construction. + */ + overrideStoreKeys: StoreKeyConfig[]; + /** + * order_migrations defines the order in which module migrations are performed. + * If this is left empty, it uses the default migration order. + * https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.0-alpha2/types/module#DefaultMigrationsOrder + */ + orderMigrations: string[]; + /** + * precommiters specifies the module names of the precommiters + * to call in the order in which they should be called. If this is left empty + * no precommit function will be registered. + */ + precommiters: string[]; + /** + * prepare_check_staters specifies the module names of the prepare_check_staters + * to call in the order in which they should be called. If this is left empty + * no preparecheckstate function will be registered. + */ + prepareCheckStaters: string[]; +} + +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfig { + /** name of the module to override the store key of */ + moduleName: string; + /** the kv store key to use instead of the module name. */ + kvStoreKey: string; +} + +function createBaseModule(): Module { + return { + appName: "", + beginBlockers: [], + endBlockers: [], + initGenesis: [], + exportGenesis: [], + overrideStoreKeys: [], + orderMigrations: [], + precommiters: [], + prepareCheckStaters: [], + }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + for (const v of message.beginBlockers) { + writer.uint32(18).string(v!); + } + for (const v of message.endBlockers) { + writer.uint32(26).string(v!); + } + for (const v of message.initGenesis) { + writer.uint32(34).string(v!); + } + for (const v of message.exportGenesis) { + writer.uint32(42).string(v!); + } + for (const v of message.overrideStoreKeys) { + StoreKeyConfig.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.orderMigrations) { + writer.uint32(58).string(v!); + } + for (const v of message.precommiters) { + writer.uint32(66).string(v!); + } + for (const v of message.prepareCheckStaters) { + writer.uint32(74).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.appName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.beginBlockers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.endBlockers.push(reader.string()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.initGenesis.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.exportGenesis.push(reader.string()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.overrideStoreKeys.push(StoreKeyConfig.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.orderMigrations.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.precommiters.push(reader.string()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.prepareCheckStaters.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + beginBlockers: globalThis.Array.isArray(object?.beginBlockers) + ? object.beginBlockers.map((e: any) => globalThis.String(e)) + : [], + endBlockers: globalThis.Array.isArray(object?.endBlockers) + ? object.endBlockers.map((e: any) => globalThis.String(e)) + : [], + initGenesis: globalThis.Array.isArray(object?.initGenesis) + ? object.initGenesis.map((e: any) => globalThis.String(e)) + : [], + exportGenesis: globalThis.Array.isArray(object?.exportGenesis) + ? object.exportGenesis.map((e: any) => globalThis.String(e)) + : [], + overrideStoreKeys: globalThis.Array.isArray(object?.overrideStoreKeys) + ? object.overrideStoreKeys.map((e: any) => StoreKeyConfig.fromJSON(e)) + : [], + orderMigrations: globalThis.Array.isArray(object?.orderMigrations) + ? object.orderMigrations.map((e: any) => globalThis.String(e)) + : [], + precommiters: globalThis.Array.isArray(object?.precommiters) + ? object.precommiters.map((e: any) => globalThis.String(e)) + : [], + prepareCheckStaters: globalThis.Array.isArray(object?.prepareCheckStaters) + ? object.prepareCheckStaters.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.beginBlockers?.length) { + obj.beginBlockers = message.beginBlockers; + } + if (message.endBlockers?.length) { + obj.endBlockers = message.endBlockers; + } + if (message.initGenesis?.length) { + obj.initGenesis = message.initGenesis; + } + if (message.exportGenesis?.length) { + obj.exportGenesis = message.exportGenesis; + } + if (message.overrideStoreKeys?.length) { + obj.overrideStoreKeys = message.overrideStoreKeys.map((e) => StoreKeyConfig.toJSON(e)); + } + if (message.orderMigrations?.length) { + obj.orderMigrations = message.orderMigrations; + } + if (message.precommiters?.length) { + obj.precommiters = message.precommiters; + } + if (message.prepareCheckStaters?.length) { + obj.prepareCheckStaters = message.prepareCheckStaters; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.appName = object.appName ?? ""; + message.beginBlockers = object.beginBlockers?.map((e) => e) || []; + message.endBlockers = object.endBlockers?.map((e) => e) || []; + message.initGenesis = object.initGenesis?.map((e) => e) || []; + message.exportGenesis = object.exportGenesis?.map((e) => e) || []; + message.overrideStoreKeys = object.overrideStoreKeys?.map((e) => StoreKeyConfig.fromPartial(e)) || []; + message.orderMigrations = object.orderMigrations?.map((e) => e) || []; + message.precommiters = object.precommiters?.map((e) => e) || []; + message.prepareCheckStaters = object.prepareCheckStaters?.map((e) => e) || []; + return message; + }, +}; + +function createBaseStoreKeyConfig(): StoreKeyConfig { + return { moduleName: "", kvStoreKey: "" }; +} + +export const StoreKeyConfig: MessageFns = { + encode(message: StoreKeyConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.kvStoreKey !== "") { + writer.uint32(18).string(message.kvStoreKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreKeyConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKeyConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.kvStoreKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKeyConfig { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + kvStoreKey: isSet(object.kvStoreKey) ? globalThis.String(object.kvStoreKey) : "", + }; + }, + + toJSON(message: StoreKeyConfig): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.kvStoreKey !== "") { + obj.kvStoreKey = message.kvStoreKey; + } + return obj; + }, + + create, I>>(base?: I): StoreKeyConfig { + return StoreKeyConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKeyConfig { + const message = createBaseStoreKeyConfig(); + message.moduleName = object.moduleName ?? ""; + message.kvStoreKey = object.kvStoreKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/config.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/config.ts new file mode 100644 index 00000000..da9f2893 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/config.ts @@ -0,0 +1,339 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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[]; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is global (not module specific). + */ + golangBindings: GolangBinding[]; +} + +/** 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 + | undefined; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is module specific. + */ + golangBindings: GolangBinding[]; +} + +/** GolangBinding is an explicit interface type to implementing type binding for dependency injection. */ +export interface GolangBinding { + /** interface_type is the interface type which will be bound to a specific implementation type */ + interfaceType: string; + /** implementation is the implementing type which will be supplied when an input of type interface is requested */ + implementation: string; +} + +function createBaseConfig(): Config { + return { modules: [], golangBindings: [] }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.modules) { + ModuleConfig.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.modules.push(ModuleConfig.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + modules: globalThis.Array.isArray(object?.modules) + ? object.modules.map((e: any) => ModuleConfig.fromJSON(e)) + : [], + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.modules?.length) { + obj.modules = message.modules.map((e) => ModuleConfig.toJSON(e)); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.modules = object.modules?.map((e) => ModuleConfig.fromPartial(e)) || []; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseModuleConfig(): ModuleConfig { + return { name: "", config: undefined, golangBindings: [] }; +} + +export const ModuleConfig: MessageFns = { + encode(message: ModuleConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.config !== undefined) { + Any.encode(message.config, writer.uint32(18).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.config = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleConfig { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + config: isSet(object.config) ? Any.fromJSON(object.config) : undefined, + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleConfig): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.config !== undefined) { + obj.config = Any.toJSON(message.config); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleConfig { + return ModuleConfig.fromPartial(base ?? ({} as any)); + }, + 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; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGolangBinding(): GolangBinding { + return { interfaceType: "", implementation: "" }; +} + +export const GolangBinding: MessageFns = { + encode(message: GolangBinding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceType !== "") { + writer.uint32(10).string(message.interfaceType); + } + if (message.implementation !== "") { + writer.uint32(18).string(message.implementation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GolangBinding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGolangBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.interfaceType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.implementation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GolangBinding { + return { + interfaceType: isSet(object.interfaceType) ? globalThis.String(object.interfaceType) : "", + implementation: isSet(object.implementation) ? globalThis.String(object.implementation) : "", + }; + }, + + toJSON(message: GolangBinding): unknown { + const obj: any = {}; + if (message.interfaceType !== "") { + obj.interfaceType = message.interfaceType; + } + if (message.implementation !== "") { + obj.implementation = message.implementation; + } + return obj; + }, + + create, I>>(base?: I): GolangBinding { + return GolangBinding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GolangBinding { + const message = createBaseGolangBinding(); + message.interfaceType = object.interfaceType ?? ""; + message.implementation = object.implementation ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/query.ts new file mode 100644 index 00000000..3a172979 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/app/v1alpha1/query.ts @@ -0,0 +1,174 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +function createBaseQueryConfigRequest(): QueryConfigRequest { + return {}; +} + +export const QueryConfigRequest: MessageFns = { + encode(_: QueryConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConfigRequest { + return {}; + }, + + toJSON(_: QueryConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConfigRequest { + return QueryConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConfigRequest { + const message = createBaseQueryConfigRequest(); + return message; + }, +}; + +function createBaseQueryConfigResponse(): QueryConfigResponse { + return { config: undefined }; +} + +export const QueryConfigResponse: MessageFns = { + encode(message: QueryConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + Config.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = Config.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConfigResponse { + return { config: isSet(object.config) ? Config.fromJSON(object.config) : undefined }; + }, + + toJSON(message: QueryConfigResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = Config.toJSON(message.config); + } + return obj; + }, + + create, I>>(base?: I): QueryConfigResponse { + return QueryConfigResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.app.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/module/v1/module.ts new file mode 100644 index 00000000..c426dc68 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/module/v1/module.ts @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.auth.module.v1"; + +/** Module is the config object for the auth module. */ +export interface Module { + /** bech32_prefix is the bech32 account prefix for the app. */ + bech32Prefix: string; + /** module_account_permissions are module account permissions. */ + moduleAccountPermissions: ModuleAccountPermission[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermission { + /** account is the name of the module. */ + account: string; + /** + * permissions are the permissions this module has. Currently recognized + * values are minter, burner and staking. + */ + permissions: string[]; +} + +function createBaseModule(): Module { + return { bech32Prefix: "", moduleAccountPermissions: [], authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + for (const v of message.moduleAccountPermissions) { + ModuleAccountPermission.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(26).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.moduleAccountPermissions.push(ModuleAccountPermission.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "", + moduleAccountPermissions: globalThis.Array.isArray(object?.moduleAccountPermissions) + ? object.moduleAccountPermissions.map((e: any) => ModuleAccountPermission.fromJSON(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + if (message.moduleAccountPermissions?.length) { + obj.moduleAccountPermissions = message.moduleAccountPermissions.map((e) => ModuleAccountPermission.toJSON(e)); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.bech32Prefix = object.bech32Prefix ?? ""; + message.moduleAccountPermissions = + object.moduleAccountPermissions?.map((e) => ModuleAccountPermission.fromPartial(e)) || []; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseModuleAccountPermission(): ModuleAccountPermission { + return { account: "", permissions: [] }; +} + +export const ModuleAccountPermission: MessageFns = { + encode(message: ModuleAccountPermission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + for (const v of message.permissions) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccountPermission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccountPermission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccountPermission { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccountPermission): unknown { + const obj: any = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccountPermission { + return ModuleAccountPermission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccountPermission { + const message = createBaseModuleAccountPermission(); + message.account = object.account ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/auth.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..4dd78b9e --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,517 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/auth.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + pubKey: Any | undefined; + accountNumber: number; + sequence: number; +} + +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + baseAccount: BaseAccount | undefined; + name: string; + permissions: string[]; +} + +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredential { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + moduleName: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivationKeys: Uint8Array[]; +} + +/** Params defines the parameters for the auth module. */ +export interface Params { + maxMemoCharacters: number; + txSigLimit: number; + txSizeCostPerByte: number; + sigVerifyCostEd25519: number; + sigVerifyCostSecp256k1: number; +} + +function createBaseBaseAccount(): BaseAccount { + return { address: "", pubKey: undefined, accountNumber: 0, sequence: 0 }; +} + +export const BaseAccount: MessageFns = { + encode(message: BaseAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.accountNumber !== 0) { + writer.uint32(24).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseAccount { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): BaseAccount { + return BaseAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.accountNumber = object.accountNumber ?? 0; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModuleAccount(): ModuleAccount { + return { baseAccount: undefined, name: "", permissions: [] }; +} + +export const ModuleAccount: MessageFns = { + encode(message: ModuleAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + for (const v of message.permissions) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + name: isSet(object.name) ? globalThis.String(object.name) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccount { + return ModuleAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccount { + const message = createBaseModuleAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseModuleCredential(): ModuleCredential { + return { moduleName: "", derivationKeys: [] }; +} + +export const ModuleCredential: MessageFns = { + encode(message: ModuleCredential, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + for (const v of message.derivationKeys) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleCredential { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.derivationKeys.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleCredential { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + derivationKeys: globalThis.Array.isArray(object?.derivationKeys) + ? object.derivationKeys.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: ModuleCredential): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.derivationKeys?.length) { + obj.derivationKeys = message.derivationKeys.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleCredential { + return ModuleCredential.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleCredential { + const message = createBaseModuleCredential(); + message.moduleName = object.moduleName ?? ""; + message.derivationKeys = object.derivationKeys?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + maxMemoCharacters: 0, + txSigLimit: 0, + txSizeCostPerByte: 0, + sigVerifyCostEd25519: 0, + sigVerifyCostSecp256k1: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMemoCharacters !== 0) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxMemoCharacters = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.txSigLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.txSizeCostPerByte = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sigVerifyCostEd25519 = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sigVerifyCostSecp256k1 = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + maxMemoCharacters: isSet(object.maxMemoCharacters) ? globalThis.Number(object.maxMemoCharacters) : 0, + txSigLimit: isSet(object.txSigLimit) ? globalThis.Number(object.txSigLimit) : 0, + txSizeCostPerByte: isSet(object.txSizeCostPerByte) ? globalThis.Number(object.txSizeCostPerByte) : 0, + sigVerifyCostEd25519: isSet(object.sigVerifyCostEd25519) ? globalThis.Number(object.sigVerifyCostEd25519) : 0, + sigVerifyCostSecp256k1: isSet(object.sigVerifyCostSecp256k1) + ? globalThis.Number(object.sigVerifyCostSecp256k1) + : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.maxMemoCharacters !== 0) { + obj.maxMemoCharacters = Math.round(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + obj.txSigLimit = Math.round(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + obj.txSizeCostPerByte = Math.round(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + obj.sigVerifyCostEd25519 = Math.round(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + obj.sigVerifyCostSecp256k1 = Math.round(message.sigVerifyCostSecp256k1); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.maxMemoCharacters = object.maxMemoCharacters ?? 0; + message.txSigLimit = object.txSigLimit ?? 0; + message.txSizeCostPerByte = object.txSizeCostPerByte ?? 0; + message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 ?? 0; + message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 00000000..d165dd08 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** accounts are the accounts present at genesis. */ + accounts: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, accounts: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.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) + ? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/query.ts new file mode 100644 index 00000000..e187ff09 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,1545 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { BaseAccount, 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} + +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account: Any | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequest { +} + +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponse { + accounts: Any[]; +} + +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequest { + name: string; +} + +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponse { + account: Any | undefined; +} + +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequest { +} + +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponse { + bech32Prefix: string; +} + +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequest { + addressBytes: Uint8Array; +} + +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponse { + addressString: string; +} + +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequest { + addressString: string; +} + +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponse { + addressBytes: Uint8Array; +} + +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequest { + /** + * Deprecated, use account_id instead + * + * id is the account number of the address to be queried. This field + * should have been an uint64 (like all account numbers), and will be + * updated to uint64 in a future version of the auth query. + * + * @deprecated + */ + id: number; + /** + * account_id is the account number of the address to be queried. + * + * Since: cosmos-sdk 0.47 + */ + accountId: number; +} + +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponse { + accountAddress: string; +} + +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequest { + /** address is the account address string. */ + address: string; +} + +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponse { + /** info is the account info which is represented by BaseAccount. */ + info: BaseAccount | undefined; +} + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsResponse { + return { + accounts: globalThis.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?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsResponse { + return QueryAccountsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { account: undefined }; +} + +export const QueryAccountResponse: MessageFns = { + encode(message: QueryAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryAccountResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountResponse { + return QueryAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { + return {}; +} + +export const QueryModuleAccountsRequest: MessageFns = { + encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryModuleAccountsRequest { + return {}; + }, + + toJSON(_: QueryModuleAccountsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, +}; + +function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { + return { accounts: [] }; +} + +export const QueryModuleAccountsResponse: MessageFns = { + encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryModuleAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameRequest(): QueryModuleAccountByNameRequest { + return { name: "" }; +} + +export const QueryModuleAccountByNameRequest: MessageFns = { + encode(message: QueryModuleAccountByNameRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryModuleAccountByNameRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountByNameRequest { + return QueryModuleAccountByNameRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameRequest { + const message = createBaseQueryModuleAccountByNameRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameResponse(): QueryModuleAccountByNameResponse { + return { account: undefined }; +} + +export const QueryModuleAccountByNameResponse: MessageFns = { + encode(message: QueryModuleAccountByNameResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryModuleAccountByNameResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryModuleAccountByNameResponse { + return QueryModuleAccountByNameResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameResponse { + const message = createBaseQueryModuleAccountByNameResponse(); + message.account = (object.account !== undefined && object.account !== null) + ? Any.fromPartial(object.account) + : undefined; + return message; + }, +}; + +function createBaseBech32PrefixRequest(): Bech32PrefixRequest { + return {}; +} + +export const Bech32PrefixRequest: MessageFns = { + encode(_: Bech32PrefixRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Bech32PrefixRequest { + return {}; + }, + + toJSON(_: Bech32PrefixRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Bech32PrefixRequest { + return Bech32PrefixRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, +}; + +function createBaseBech32PrefixResponse(): Bech32PrefixResponse { + return { bech32Prefix: "" }; +} + +export const Bech32PrefixResponse: MessageFns = { + encode(message: Bech32PrefixResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Bech32PrefixResponse { + return { bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "" }; + }, + + toJSON(message: Bech32PrefixResponse): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + return obj; + }, + + create, I>>(base?: I): Bech32PrefixResponse { + return Bech32PrefixResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + message.bech32Prefix = object.bech32Prefix ?? ""; + return message; + }, +}; + +function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressBytesToStringRequest: MessageFns = { + encode(message: AddressBytesToStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringRequest { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressBytesToStringRequest): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringRequest { + return AddressBytesToStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { + return { addressString: "" }; +} + +export const AddressBytesToStringResponse: MessageFns = { + encode(message: AddressBytesToStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringResponse { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressBytesToStringResponse): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringResponse { + return AddressBytesToStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { + return { addressString: "" }; +} + +export const AddressStringToBytesRequest: MessageFns = { + encode(message: AddressStringToBytesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesRequest { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressStringToBytesRequest): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesRequest { + return AddressStringToBytesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressStringToBytesResponse: MessageFns = { + encode(message: AddressStringToBytesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesResponse { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressStringToBytesResponse): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesResponse { + return AddressStringToBytesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAccountAddressByIDRequest(): QueryAccountAddressByIDRequest { + return { id: 0, accountId: 0 }; +} + +export const QueryAccountAddressByIDRequest: MessageFns = { + encode(message: QueryAccountAddressByIDRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int64(message.id); + } + if (message.accountId !== 0) { + writer.uint32(16).uint64(message.accountId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.accountId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDRequest { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0, + }; + }, + + toJSON(message: QueryAccountAddressByIDRequest): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.accountId !== 0) { + obj.accountId = Math.round(message.accountId); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDRequest { + return QueryAccountAddressByIDRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDRequest { + const message = createBaseQueryAccountAddressByIDRequest(); + message.id = object.id ?? 0; + message.accountId = object.accountId ?? 0; + return message; + }, +}; + +function createBaseQueryAccountAddressByIDResponse(): QueryAccountAddressByIDResponse { + return { accountAddress: "" }; +} + +export const QueryAccountAddressByIDResponse: MessageFns = { + encode(message: QueryAccountAddressByIDResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.accountAddress !== "") { + writer.uint32(10).string(message.accountAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accountAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDResponse { + return { accountAddress: isSet(object.accountAddress) ? globalThis.String(object.accountAddress) : "" }; + }, + + toJSON(message: QueryAccountAddressByIDResponse): unknown { + const obj: any = {}; + if (message.accountAddress !== "") { + obj.accountAddress = message.accountAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDResponse { + return QueryAccountAddressByIDResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDResponse { + const message = createBaseQueryAccountAddressByIDResponse(); + message.accountAddress = object.accountAddress ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoRequest(): QueryAccountInfoRequest { + return { address: "" }; +} + +export const QueryAccountInfoRequest: MessageFns = { + encode(message: QueryAccountInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoRequest { + return QueryAccountInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoResponse(): QueryAccountInfoResponse { + return { info: undefined }; +} + +export const QueryAccountInfoResponse: MessageFns = { + encode(message: QueryAccountInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + BaseAccount.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.info = BaseAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoResponse { + return { info: isSet(object.info) ? BaseAccount.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryAccountInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = BaseAccount.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoResponse { + return QueryAccountInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + message.info = (object.info !== undefined && object.info !== null) + ? BaseAccount.fromPartial(object.info) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Accounts returns all the existing accounts. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.43 + */ + Accounts(request: QueryAccountsRequest): Promise; + /** Account returns account details based on address. */ + Account(request: QueryAccountRequest): Promise; + /** + * AccountAddressByID returns account address based on account number. + * + * Since: cosmos-sdk 0.46.2 + */ + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise; + /** Params queries all parameters. */ + Params(request: QueryParamsRequest): Promise; + /** + * ModuleAccounts returns all the existing module accounts. + * + * Since: cosmos-sdk 0.46 + */ + ModuleAccounts(request: QueryModuleAccountsRequest): Promise; + /** ModuleAccountByName returns the module account info by module name */ + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise; + /** + * Bech32Prefix queries bech32Prefix + * + * Since: cosmos-sdk 0.46 + */ + Bech32Prefix(request: Bech32PrefixRequest): Promise; + /** + * AddressBytesToString converts Account Address bytes to string + * + * Since: cosmos-sdk 0.46 + */ + AddressBytesToString(request: AddressBytesToStringRequest): Promise; + /** + * AddressStringToBytes converts Address string to bytes + * + * Since: cosmos-sdk 0.46 + */ + AddressStringToBytes(request: AddressStringToBytesRequest): Promise; + /** + * AccountInfo queries account info which is common to all account types. + * + * Since: cosmos-sdk 0.47 + */ + AccountInfo(request: QueryAccountInfoRequest): Promise; +} + +export const QueryServiceName = "cosmos.auth.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 || QueryServiceName; + this.rpc = rpc; + this.Accounts = this.Accounts.bind(this); + this.Account = this.Account.bind(this); + this.AccountAddressByID = this.AccountAddressByID.bind(this); + this.Params = this.Params.bind(this); + this.ModuleAccounts = this.ModuleAccounts.bind(this); + this.ModuleAccountByName = this.ModuleAccountByName.bind(this); + this.Bech32Prefix = this.Bech32Prefix.bind(this); + this.AddressBytesToString = this.AddressBytesToString.bind(this); + this.AddressStringToBytes = this.AddressStringToBytes.bind(this); + this.AccountInfo = this.AccountInfo.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 BinaryReader(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 BinaryReader(data))); + } + + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise { + const data = QueryAccountAddressByIDRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountAddressByID", data); + return promise.then((data) => QueryAccountAddressByIDResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise { + const data = QueryModuleAccountByNameRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ModuleAccountByName", data); + return promise.then((data) => QueryModuleAccountByNameResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + AccountInfo(request: QueryAccountInfoRequest): Promise { + const data = QueryAccountInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountInfo", data); + return promise.then((data) => QueryAccountInfoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/tx.ts new file mode 100644 index 00000000..535a19af --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/auth/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./auth"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/auth parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/auth Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the x/auth module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.auth.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/module/v1/module.ts new file mode 100644 index 00000000..053622ff --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.authz.module.v1"; + +/** Module is the config object of the authz module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/authz.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 00000000..a3685068 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * time when the grant will expire and will be pruned. If null, then the grant + * doesn't have a time expiration (other conditions in `authorization` + * may apply to invalidate the grant) + */ + expiration: Date | undefined; +} + +/** + * GrantAuthorization extends a grant with both the addresses of the grantee and granter. + * It is used in genesis.proto and query.proto + */ +export interface GrantAuthorization { + granter: string; + grantee: string; + authorization: Any | undefined; + expiration: Date | undefined; +} + +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItem { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msgTypeUrls: string[]; +} + +function createBaseGenericAuthorization(): GenericAuthorization { + return { msg: "" }; +} + +export const GenericAuthorization: MessageFns = { + encode(message: GenericAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msg = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenericAuthorization { + return { msg: isSet(object.msg) ? globalThis.String(object.msg) : "" }; + }, + + toJSON(message: GenericAuthorization): unknown { + const obj: any = {}; + if (message.msg !== "") { + obj.msg = message.msg; + } + return obj; + }, + + create, I>>(base?: I): GenericAuthorization { + return GenericAuthorization.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: GrantAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(26).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantAuthorization { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.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 = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GrantAuthorization { + return GrantAuthorization.fromPartial(base ?? ({} as any)); + }, + 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 { msgTypeUrls: [] }; +} + +export const GrantQueueItem: MessageFns = { + encode(message: GrantQueueItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.msgTypeUrls) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantQueueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantQueueItem { + return { + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: GrantQueueItem): unknown { + const obj: any = {}; + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): GrantQueueItem { + return GrantQueueItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/event.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/event.ts new file mode 100644 index 00000000..42e74923 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,235 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 */ + msgTypeUrl: 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 */ + msgTypeUrl: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} + +function createBaseEventGrant(): EventGrant { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventGrant: MessageFns = { + encode(message: EventGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventGrant { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventGrant): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventGrant { + return EventGrant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventGrant { + const message = createBaseEventGrant(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseEventRevoke(): EventRevoke { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventRevoke: MessageFns = { + encode(message: EventRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventRevoke { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventRevoke): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventRevoke { + return EventRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventRevoke { + const message = createBaseEventRevoke(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 00000000..96e4d5bf --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorization) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.authorization.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + authorization: globalThis.Array.isArray(object?.authorization) + ? object.authorization.map((e: any) => GrantAuthorization.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.authorization?.length) { + obj.authorization = message.authorization.map((e) => GrantAuthorization.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/query.ts new file mode 100644 index 00000000..ef3cc0e5 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,629 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + msgTypeUrl: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryGrantsRequest(): QueryGrantsRequest { + return { granter: "", grantee: "", msgTypeUrl: "", pagination: undefined }; +} + +export const QueryGrantsRequest: MessageFns = { + encode(message: QueryGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsRequest { + return QueryGrantsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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: MessageFns = { + encode(message: QueryGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsResponse { + return QueryGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.authz.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 00000000..10bc628d --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,565 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse { +} + +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExec { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; +} + +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} + +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevoke { + granter: string; + grantee: string; + msgTypeUrl: string; +} + +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponse { +} + +function createBaseMsgGrant(): MsgGrant { + return { granter: "", grantee: "", grant: undefined }; +} + +export const MsgGrant: MessageFns = { + encode(message: MsgGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + Grant.encode(message.grant, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.grant = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined, + }; + }, + + toJSON(message: MsgGrant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.grant !== undefined) { + obj.grant = Grant.toJSON(message.grant); + } + return obj; + }, + + create, I>>(base?: I): MsgGrant { + return MsgGrant.fromPartial(base ?? ({} as any)); + }, + 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 createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} + +export const MsgGrantResponse: MessageFns = { + encode(_: MsgGrantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantResponse { + return {}; + }, + + toJSON(_: MsgGrantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantResponse { + return MsgGrantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { grantee: "", msgs: [] }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { results: [] }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgRevoke(): MsgRevoke { + return { granter: "", grantee: "", msgTypeUrl: "" }; +} + +export const MsgRevoke: MessageFns = { + encode(message: MsgRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevoke { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + }; + }, + + toJSON(message: MsgRevoke): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgRevoke { + return MsgRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} + +export const MsgRevokeResponse: MessageFns = { + encode(_: MsgRevokeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeResponse { + return {}; + }, + + toJSON(_: MsgRevokeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeResponse { + return MsgRevokeResponse.fromPartial(base ?? ({} as any)); + }, + 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 const MsgServiceName = "cosmos.authz.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/autocli/v1/options.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/autocli/v1/options.ts new file mode 100644 index 00000000..4ad6ac83 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/autocli/v1/options.ts @@ -0,0 +1,1019 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/options.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** ModuleOptions describes the CLI options for a Cosmos SDK module. */ +export interface ModuleOptions { + /** tx describes the tx commands for the module. */ + tx: + | ServiceCommandDescriptor + | undefined; + /** query describes the queries commands for the module. */ + query: ServiceCommandDescriptor | undefined; +} + +/** ServiceCommandDescriptor describes a CLI command based on a protobuf service. */ +export interface ServiceCommandDescriptor { + /** + * service is the fully qualified name of the protobuf service to build + * the command from. It can be left empty if sub_commands are used instead + * which may be the case if a module provides multiple tx and/or query services. + */ + service: string; + /** + * rpc_command_options are options for commands generated from rpc methods. + * If no options are specified for a given rpc method on the service, a + * command will be generated for that method with the default options. + */ + rpcCommandOptions: RpcCommandOptions[]; + /** + * sub_commands is a map of optional sub-commands for this command based on + * different protobuf services. The map key is used as the name of the + * sub-command. + */ + subCommands: { [key: string]: ServiceCommandDescriptor }; +} + +export interface ServiceCommandDescriptor_SubCommandsEntry { + key: string; + value: ServiceCommandDescriptor | undefined; +} + +/** + * RpcCommandOptions specifies options for commands generated from protobuf + * rpc methods. + */ +export interface RpcCommandOptions { + /** + * rpc_method is short name of the protobuf rpc method that this command is + * generated from. + */ + rpcMethod: string; + /** + * use is the one-line usage method. It also allows specifying an alternate + * name for the command as the first word of the usage text. + * + * By default the name of an rpc command is the kebab-case short name of the + * rpc method. + */ + use: string; + /** long is the long message shown in the 'help ' output. */ + long: string; + /** short is the short description shown in the 'help' output. */ + short: string; + /** example is examples of how to use the command. */ + example: string; + /** alias is an array of aliases that can be used instead of the first word in Use. */ + alias: string[]; + /** + * suggest_for is an array of command names for which this command will be suggested - + * similar to aliases but only suggests. + */ + suggestFor: string[]; + /** deprecated defines, if this command is deprecated and should print this string when used. */ + deprecated: string; + /** + * version defines the version for this command. If this value is non-empty and the command does not + * define a "version" flag, a "version" boolean flag will be added to the command and, if specified, + * will print content of the "Version" variable. A shorthand "v" flag will also be added if the + * command does not define one. + */ + version: string; + /** + * flag_options are options for flags generated from rpc request fields. + * By default all request fields are configured as flags. They can + * also be configured as positional args instead using positional_args. + */ + flagOptions: { [key: string]: FlagOptions }; + /** positional_args specifies positional arguments for the command. */ + positionalArgs: PositionalArgDescriptor[]; + /** skip specifies whether to skip this rpc method when generating commands. */ + skip: boolean; +} + +export interface RpcCommandOptions_FlagOptionsEntry { + key: string; + value: FlagOptions | undefined; +} + +/** + * FlagOptions are options for flags generated from rpc request fields. + * By default, all request fields are configured as flags based on the + * kebab-case name of the field. Fields can be turned into positional arguments + * instead by using RpcCommandOptions.positional_args. + */ +export interface FlagOptions { + /** name is an alternate name to use for the field flag. */ + name: string; + /** shorthand is a one-letter abbreviated flag. */ + shorthand: string; + /** usage is the help message. */ + usage: string; + /** default_value is the default value as text. */ + defaultValue: string; + /** deprecated is the usage text to show if this flag is deprecated. */ + deprecated: string; + /** shorthand_deprecated is the usage text to show if the shorthand of this flag is deprecated. */ + shorthandDeprecated: string; + /** hidden hides the flag from help/usage text */ + hidden: boolean; +} + +/** PositionalArgDescriptor describes a positional argument. */ +export interface PositionalArgDescriptor { + /** + * proto_field specifies the proto field to use as the positional arg. Any + * fields used as positional args will not have a flag generated. + */ + protoField: string; + /** + * varargs makes a positional parameter a varargs parameter. This can only be + * applied to last positional parameter and the proto_field must a repeated + * field. + */ + varargs: boolean; +} + +function createBaseModuleOptions(): ModuleOptions { + return { tx: undefined, query: undefined }; +} + +export const ModuleOptions: MessageFns = { + encode(message: ModuleOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + ServiceCommandDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.query !== undefined) { + ServiceCommandDescriptor.encode(message.query, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.query = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleOptions { + return { + tx: isSet(object.tx) ? ServiceCommandDescriptor.fromJSON(object.tx) : undefined, + query: isSet(object.query) ? ServiceCommandDescriptor.fromJSON(object.query) : undefined, + }; + }, + + toJSON(message: ModuleOptions): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = ServiceCommandDescriptor.toJSON(message.tx); + } + if (message.query !== undefined) { + obj.query = ServiceCommandDescriptor.toJSON(message.query); + } + return obj; + }, + + create, I>>(base?: I): ModuleOptions { + return ModuleOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleOptions { + const message = createBaseModuleOptions(); + message.tx = (object.tx !== undefined && object.tx !== null) + ? ServiceCommandDescriptor.fromPartial(object.tx) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ServiceCommandDescriptor.fromPartial(object.query) + : undefined; + return message; + }, +}; + +function createBaseServiceCommandDescriptor(): ServiceCommandDescriptor { + return { service: "", rpcCommandOptions: [], subCommands: {} }; +} + +export const ServiceCommandDescriptor: MessageFns = { + encode(message: ServiceCommandDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.service !== "") { + writer.uint32(10).string(message.service); + } + for (const v of message.rpcCommandOptions) { + RpcCommandOptions.encode(v!, writer.uint32(18).fork()).join(); + } + Object.entries(message.subCommands).forEach(([key, value]) => { + ServiceCommandDescriptor_SubCommandsEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.service = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcCommandOptions.push(RpcCommandOptions.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + const entry3 = ServiceCommandDescriptor_SubCommandsEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.subCommands[entry3.key] = entry3.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor { + return { + service: isSet(object.service) ? globalThis.String(object.service) : "", + rpcCommandOptions: globalThis.Array.isArray(object?.rpcCommandOptions) + ? object.rpcCommandOptions.map((e: any) => RpcCommandOptions.fromJSON(e)) + : [], + subCommands: isObject(object.subCommands) + ? Object.entries(object.subCommands).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + acc[key] = ServiceCommandDescriptor.fromJSON(value); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: ServiceCommandDescriptor): unknown { + const obj: any = {}; + if (message.service !== "") { + obj.service = message.service; + } + if (message.rpcCommandOptions?.length) { + obj.rpcCommandOptions = message.rpcCommandOptions.map((e) => RpcCommandOptions.toJSON(e)); + } + if (message.subCommands) { + const entries = Object.entries(message.subCommands); + if (entries.length > 0) { + obj.subCommands = {}; + entries.forEach(([k, v]) => { + obj.subCommands[k] = ServiceCommandDescriptor.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): ServiceCommandDescriptor { + return ServiceCommandDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceCommandDescriptor { + const message = createBaseServiceCommandDescriptor(); + message.service = object.service ?? ""; + message.rpcCommandOptions = object.rpcCommandOptions?.map((e) => RpcCommandOptions.fromPartial(e)) || []; + message.subCommands = Object.entries(object.subCommands ?? {}).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ServiceCommandDescriptor.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseServiceCommandDescriptor_SubCommandsEntry(): ServiceCommandDescriptor_SubCommandsEntry { + return { key: "", value: undefined }; +} + +export const ServiceCommandDescriptor_SubCommandsEntry: MessageFns = { + encode(message: ServiceCommandDescriptor_SubCommandsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ServiceCommandDescriptor.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor_SubCommandsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor_SubCommandsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ServiceCommandDescriptor.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ServiceCommandDescriptor_SubCommandsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ServiceCommandDescriptor.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + return ServiceCommandDescriptor_SubCommandsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ServiceCommandDescriptor.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseRpcCommandOptions(): RpcCommandOptions { + return { + rpcMethod: "", + use: "", + long: "", + short: "", + example: "", + alias: [], + suggestFor: [], + deprecated: "", + version: "", + flagOptions: {}, + positionalArgs: [], + skip: false, + }; +} + +export const RpcCommandOptions: MessageFns = { + encode(message: RpcCommandOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rpcMethod !== "") { + writer.uint32(10).string(message.rpcMethod); + } + if (message.use !== "") { + writer.uint32(18).string(message.use); + } + if (message.long !== "") { + writer.uint32(26).string(message.long); + } + if (message.short !== "") { + writer.uint32(34).string(message.short); + } + if (message.example !== "") { + writer.uint32(42).string(message.example); + } + for (const v of message.alias) { + writer.uint32(50).string(v!); + } + for (const v of message.suggestFor) { + writer.uint32(58).string(v!); + } + if (message.deprecated !== "") { + writer.uint32(66).string(message.deprecated); + } + if (message.version !== "") { + writer.uint32(74).string(message.version); + } + Object.entries(message.flagOptions).forEach(([key, value]) => { + RpcCommandOptions_FlagOptionsEntry.encode({ key: key as any, value }, writer.uint32(82).fork()).join(); + }); + for (const v of message.positionalArgs) { + PositionalArgDescriptor.encode(v!, writer.uint32(90).fork()).join(); + } + if (message.skip !== false) { + writer.uint32(96).bool(message.skip); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rpcMethod = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.use = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.long = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.short = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.example = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.alias.push(reader.string()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.suggestFor.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.deprecated = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.version = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + const entry10 = RpcCommandOptions_FlagOptionsEntry.decode(reader, reader.uint32()); + if (entry10.value !== undefined) { + message.flagOptions[entry10.key] = entry10.value; + } + continue; + case 11: + if (tag !== 90) { + break; + } + + message.positionalArgs.push(PositionalArgDescriptor.decode(reader, reader.uint32())); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.skip = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions { + return { + rpcMethod: isSet(object.rpcMethod) ? globalThis.String(object.rpcMethod) : "", + use: isSet(object.use) ? globalThis.String(object.use) : "", + long: isSet(object.long) ? globalThis.String(object.long) : "", + short: isSet(object.short) ? globalThis.String(object.short) : "", + example: isSet(object.example) ? globalThis.String(object.example) : "", + alias: globalThis.Array.isArray(object?.alias) ? object.alias.map((e: any) => globalThis.String(e)) : [], + suggestFor: globalThis.Array.isArray(object?.suggestFor) + ? object.suggestFor.map((e: any) => globalThis.String(e)) + : [], + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + flagOptions: isObject(object.flagOptions) + ? Object.entries(object.flagOptions).reduce<{ [key: string]: FlagOptions }>((acc, [key, value]) => { + acc[key] = FlagOptions.fromJSON(value); + return acc; + }, {}) + : {}, + positionalArgs: globalThis.Array.isArray(object?.positionalArgs) + ? object.positionalArgs.map((e: any) => PositionalArgDescriptor.fromJSON(e)) + : [], + skip: isSet(object.skip) ? globalThis.Boolean(object.skip) : false, + }; + }, + + toJSON(message: RpcCommandOptions): unknown { + const obj: any = {}; + if (message.rpcMethod !== "") { + obj.rpcMethod = message.rpcMethod; + } + if (message.use !== "") { + obj.use = message.use; + } + if (message.long !== "") { + obj.long = message.long; + } + if (message.short !== "") { + obj.short = message.short; + } + if (message.example !== "") { + obj.example = message.example; + } + if (message.alias?.length) { + obj.alias = message.alias; + } + if (message.suggestFor?.length) { + obj.suggestFor = message.suggestFor; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.flagOptions) { + const entries = Object.entries(message.flagOptions); + if (entries.length > 0) { + obj.flagOptions = {}; + entries.forEach(([k, v]) => { + obj.flagOptions[k] = FlagOptions.toJSON(v); + }); + } + } + if (message.positionalArgs?.length) { + obj.positionalArgs = message.positionalArgs.map((e) => PositionalArgDescriptor.toJSON(e)); + } + if (message.skip !== false) { + obj.skip = message.skip; + } + return obj; + }, + + create, I>>(base?: I): RpcCommandOptions { + return RpcCommandOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RpcCommandOptions { + const message = createBaseRpcCommandOptions(); + message.rpcMethod = object.rpcMethod ?? ""; + message.use = object.use ?? ""; + message.long = object.long ?? ""; + message.short = object.short ?? ""; + message.example = object.example ?? ""; + message.alias = object.alias?.map((e) => e) || []; + message.suggestFor = object.suggestFor?.map((e) => e) || []; + message.deprecated = object.deprecated ?? ""; + message.version = object.version ?? ""; + message.flagOptions = Object.entries(object.flagOptions ?? {}).reduce<{ [key: string]: FlagOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = FlagOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + message.positionalArgs = object.positionalArgs?.map((e) => PositionalArgDescriptor.fromPartial(e)) || []; + message.skip = object.skip ?? false; + return message; + }, +}; + +function createBaseRpcCommandOptions_FlagOptionsEntry(): RpcCommandOptions_FlagOptionsEntry { + return { key: "", value: undefined }; +} + +export const RpcCommandOptions_FlagOptionsEntry: MessageFns = { + encode(message: RpcCommandOptions_FlagOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + FlagOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions_FlagOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = FlagOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions_FlagOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? FlagOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: RpcCommandOptions_FlagOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = FlagOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): RpcCommandOptions_FlagOptionsEntry { + return RpcCommandOptions_FlagOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RpcCommandOptions_FlagOptionsEntry { + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? FlagOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseFlagOptions(): FlagOptions { + return { + name: "", + shorthand: "", + usage: "", + defaultValue: "", + deprecated: "", + shorthandDeprecated: "", + hidden: false, + }; +} + +export const FlagOptions: MessageFns = { + encode(message: FlagOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.shorthand !== "") { + writer.uint32(18).string(message.shorthand); + } + if (message.usage !== "") { + writer.uint32(26).string(message.usage); + } + if (message.defaultValue !== "") { + writer.uint32(34).string(message.defaultValue); + } + if (message.deprecated !== "") { + writer.uint32(50).string(message.deprecated); + } + if (message.shorthandDeprecated !== "") { + writer.uint32(58).string(message.shorthandDeprecated); + } + if (message.hidden !== false) { + writer.uint32(64).bool(message.hidden); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlagOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlagOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.shorthand = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.usage = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.defaultValue = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.deprecated = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.shorthandDeprecated = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.hidden = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FlagOptions { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + shorthand: isSet(object.shorthand) ? globalThis.String(object.shorthand) : "", + usage: isSet(object.usage) ? globalThis.String(object.usage) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + shorthandDeprecated: isSet(object.shorthandDeprecated) ? globalThis.String(object.shorthandDeprecated) : "", + hidden: isSet(object.hidden) ? globalThis.Boolean(object.hidden) : false, + }; + }, + + toJSON(message: FlagOptions): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.shorthand !== "") { + obj.shorthand = message.shorthand; + } + if (message.usage !== "") { + obj.usage = message.usage; + } + if (message.defaultValue !== "") { + obj.defaultValue = message.defaultValue; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.shorthandDeprecated !== "") { + obj.shorthandDeprecated = message.shorthandDeprecated; + } + if (message.hidden !== false) { + obj.hidden = message.hidden; + } + return obj; + }, + + create, I>>(base?: I): FlagOptions { + return FlagOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlagOptions { + const message = createBaseFlagOptions(); + message.name = object.name ?? ""; + message.shorthand = object.shorthand ?? ""; + message.usage = object.usage ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.deprecated = object.deprecated ?? ""; + message.shorthandDeprecated = object.shorthandDeprecated ?? ""; + message.hidden = object.hidden ?? false; + return message; + }, +}; + +function createBasePositionalArgDescriptor(): PositionalArgDescriptor { + return { protoField: "", varargs: false }; +} + +export const PositionalArgDescriptor: MessageFns = { + encode(message: PositionalArgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protoField !== "") { + writer.uint32(10).string(message.protoField); + } + if (message.varargs !== false) { + writer.uint32(16).bool(message.varargs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PositionalArgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePositionalArgDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protoField = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.varargs = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PositionalArgDescriptor { + return { + protoField: isSet(object.protoField) ? globalThis.String(object.protoField) : "", + varargs: isSet(object.varargs) ? globalThis.Boolean(object.varargs) : false, + }; + }, + + toJSON(message: PositionalArgDescriptor): unknown { + const obj: any = {}; + if (message.protoField !== "") { + obj.protoField = message.protoField; + } + if (message.varargs !== false) { + obj.varargs = message.varargs; + } + return obj; + }, + + create, I>>(base?: I): PositionalArgDescriptor { + return PositionalArgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PositionalArgDescriptor { + const message = createBasePositionalArgDescriptor(); + message.protoField = object.protoField ?? ""; + message.varargs = object.varargs ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/autocli/v1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/autocli/v1/query.ts new file mode 100644 index 00000000..5fcd821c --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/autocli/v1/query.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ModuleOptions } from "./options"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** AppOptionsRequest is the RemoteInfoService/AppOptions request type. */ +export interface AppOptionsRequest { +} + +/** AppOptionsResponse is the RemoteInfoService/AppOptions response type. */ +export interface AppOptionsResponse { + /** module_options is a map of module name to autocli module options. */ + moduleOptions: { [key: string]: ModuleOptions }; +} + +export interface AppOptionsResponse_ModuleOptionsEntry { + key: string; + value: ModuleOptions | undefined; +} + +function createBaseAppOptionsRequest(): AppOptionsRequest { + return {}; +} + +export const AppOptionsRequest: MessageFns = { + encode(_: AppOptionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): AppOptionsRequest { + return {}; + }, + + toJSON(_: AppOptionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): AppOptionsRequest { + return AppOptionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): AppOptionsRequest { + const message = createBaseAppOptionsRequest(); + return message; + }, +}; + +function createBaseAppOptionsResponse(): AppOptionsResponse { + return { moduleOptions: {} }; +} + +export const AppOptionsResponse: MessageFns = { + encode(message: AppOptionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.moduleOptions).forEach(([key, value]) => { + AppOptionsResponse_ModuleOptionsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = AppOptionsResponse_ModuleOptionsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.moduleOptions[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse { + return { + moduleOptions: isObject(object.moduleOptions) + ? Object.entries(object.moduleOptions).reduce<{ [key: string]: ModuleOptions }>((acc, [key, value]) => { + acc[key] = ModuleOptions.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: AppOptionsResponse): unknown { + const obj: any = {}; + if (message.moduleOptions) { + const entries = Object.entries(message.moduleOptions); + if (entries.length > 0) { + obj.moduleOptions = {}; + entries.forEach(([k, v]) => { + obj.moduleOptions[k] = ModuleOptions.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): AppOptionsResponse { + return AppOptionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AppOptionsResponse { + const message = createBaseAppOptionsResponse(); + message.moduleOptions = Object.entries(object.moduleOptions ?? {}).reduce<{ [key: string]: ModuleOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ModuleOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseAppOptionsResponse_ModuleOptionsEntry(): AppOptionsResponse_ModuleOptionsEntry { + return { key: "", value: undefined }; +} + +export const AppOptionsResponse_ModuleOptionsEntry: MessageFns = { + encode(message: AppOptionsResponse_ModuleOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ModuleOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse_ModuleOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ModuleOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse_ModuleOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ModuleOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: AppOptionsResponse_ModuleOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ModuleOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): AppOptionsResponse_ModuleOptionsEntry { + return AppOptionsResponse_ModuleOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): AppOptionsResponse_ModuleOptionsEntry { + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ModuleOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +/** + * RemoteInfoService provides clients with the information they need + * to build dynamically CLI clients for remote chains. + */ +export interface Query { + /** AppOptions returns the autocli options for all of the modules in an app. */ + AppOptions(request: AppOptionsRequest): Promise; +} + +export const QueryServiceName = "cosmos.autocli.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 || QueryServiceName; + this.rpc = rpc; + this.AppOptions = this.AppOptions.bind(this); + } + AppOptions(request: AppOptionsRequest): Promise { + const data = AppOptionsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AppOptions", data); + return promise.then((data) => AppOptionsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/module/v1/module.ts new file mode 100644 index 00000000..18dd6917 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/module/v1/module.ts @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.bank.module.v1"; + +/** Module is the config object of the bank module. */ +export interface Module { + /** + * blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving + * funds. If left empty it defaults to the list of account names supplied in the auth module configuration as + * module_account_permissions + */ + blockedModuleAccountsOverride: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** + * restrictions_order specifies the order of send restrictions and should be + * a list of module names which provide a send restriction instance. If no + * order is provided, then restrictions will be applied in alphabetical order + * of module names. + */ + restrictionsOrder: string[]; +} + +function createBaseModule(): Module { + return { blockedModuleAccountsOverride: [], authority: "", restrictionsOrder: [] }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.blockedModuleAccountsOverride) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + for (const v of message.restrictionsOrder) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockedModuleAccountsOverride.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.restrictionsOrder.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + blockedModuleAccountsOverride: globalThis.Array.isArray(object?.blockedModuleAccountsOverride) + ? object.blockedModuleAccountsOverride.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + restrictionsOrder: globalThis.Array.isArray(object?.restrictionsOrder) + ? object.restrictionsOrder.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.blockedModuleAccountsOverride?.length) { + obj.blockedModuleAccountsOverride = message.blockedModuleAccountsOverride; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.restrictionsOrder?.length) { + obj.restrictionsOrder = message.restrictionsOrder; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.blockedModuleAccountsOverride = object.blockedModuleAccountsOverride?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.restrictionsOrder = object.restrictionsOrder?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/authz.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 00000000..3437ed53 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,127 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + spendLimit: Coin[]; + /** + * allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + * granter. If omitted, any recipient is allowed. + * + * Since: cosmos-sdk 0.47 + */ + allowList: string[]; +} + +function createBaseSendAuthorization(): SendAuthorization { + return { spendLimit: [], allowList: [] }; +} + +export const SendAuthorization: MessageFns = { + encode(message: SendAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.allowList) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendAuthorization { + return { + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + allowList: globalThis.Array.isArray(object?.allowList) + ? object.allowList.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: SendAuthorization): unknown { + const obj: any = {}; + if (message.spendLimit?.length) { + obj.spendLimit = message.spendLimit.map((e) => Coin.toJSON(e)); + } + if (message.allowList?.length) { + obj.allowList = message.allowList; + } + return obj; + }, + + create, I>>(base?: I): SendAuthorization { + return SendAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.allowList = object.allowList?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/bank.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..92e997fb --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,755 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/bank.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** Params defines the parameters for the bank module. */ +export interface Params { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + * + * @deprecated + */ + sendEnabled: SendEnabled[]; + defaultSendEnabled: boolean; +} + +/** + * 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 */ + denomUnits: DenomUnit[]; + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ + base: string; + /** + * display indicates the suggested denom that should be + * displayed in clients. + */ + display: string; + /** + * name defines the name of the token (eg: Cosmos Atom) + * + * Since: cosmos-sdk 0.43 + */ + name: string; + /** + * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + * be the same as the display. + * + * Since: cosmos-sdk 0.43 + */ + symbol: string; + /** + * URI to a document (on or off-chain) that contains additional information. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uri: string; + /** + * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + * the document didn't change. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uriHash: string; +} + +function createBaseParams(): Params { + return { sendEnabled: [], defaultSendEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.defaultSendEnabled !== false) { + writer.uint32(16).bool(message.defaultSendEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.defaultSendEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + defaultSendEnabled: isSet(object.defaultSendEnabled) ? globalThis.Boolean(object.defaultSendEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.defaultSendEnabled !== false) { + obj.defaultSendEnabled = message.defaultSendEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.defaultSendEnabled = object.defaultSendEnabled ?? false; + return message; + }, +}; + +function createBaseSendEnabled(): SendEnabled { + return { denom: "", enabled: false }; +} + +export const SendEnabled: MessageFns = { + encode(message: SendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled !== false) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendEnabled { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false, + }; + }, + + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.enabled !== false) { + obj.enabled = message.enabled; + } + return obj; + }, + + create, I>>(base?: I): SendEnabled { + return SendEnabled.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Input, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Input { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Input { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Input): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Input { + return Input.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Output, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Output { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Output { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Output): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Output { + return Output.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Supply, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Supply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSupply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.total.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Supply { + return { total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: Supply): unknown { + const obj: any = {}; + if (message.total?.length) { + obj.total = message.total.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Supply { + return Supply.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomUnit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } + for (const v of message.aliases) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomUnit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.exponent = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.aliases.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomUnit { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + exponent: isSet(object.exponent) ? globalThis.Number(object.exponent) : 0, + aliases: globalThis.Array.isArray(object?.aliases) ? object.aliases.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.exponent !== 0) { + obj.exponent = Math.round(message.exponent); + } + if (message.aliases?.length) { + obj.aliases = message.aliases; + } + return obj; + }, + + create, I>>(base?: I): DenomUnit { + return DenomUnit.fromPartial(base ?? ({} as any)); + }, + 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: "", denomUnits: [], base: "", display: "", name: "", symbol: "", uri: "", uriHash: "" }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denomUnits) { + DenomUnit.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } + if (message.name !== "") { + writer.uint32(42).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(50).string(message.symbol); + } + if (message.uri !== "") { + writer.uint32(58).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(66).string(message.uriHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denomUnits.push(DenomUnit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.base = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.display = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.symbol = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.uri = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.uriHash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + description: isSet(object.description) ? globalThis.String(object.description) : "", + denomUnits: globalThis.Array.isArray(object?.denomUnits) + ? object.denomUnits.map((e: any) => DenomUnit.fromJSON(e)) + : [], + base: isSet(object.base) ? globalThis.String(object.base) : "", + display: isSet(object.display) ? globalThis.String(object.display) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.description !== "") { + obj.description = message.description; + } + if (message.denomUnits?.length) { + obj.denomUnits = message.denomUnits.map((e) => DenomUnit.toJSON(e)); + } + if (message.base !== "") { + obj.base = message.base; + } + if (message.display !== "") { + obj.display = message.display; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denomUnits = object.denomUnits?.map((e) => DenomUnit.fromPartial(e)) || []; + message.base = object.base ?? ""; + message.display = object.display ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 00000000..b9d9a434 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,270 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** 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 different coins. */ + denomMetadata: Metadata[]; + /** + * send_enabled defines the denoms where send is enabled or disabled. + * + * Since: cosmos-sdk 0.47 + */ + sendEnabled: SendEnabled[]; +} + +/** + * 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: [], denomMetadata: [], sendEnabled: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.balances) { + Balance.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.denomMetadata) { + Metadata.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balances.push(Balance.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.denomMetadata.push(Metadata.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + balances: globalThis.Array.isArray(object?.balances) ? object.balances.map((e: any) => Balance.fromJSON(e)) : [], + supply: globalThis.Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + denomMetadata: globalThis.Array.isArray(object?.denomMetadata) + ? object.denomMetadata.map((e: any) => Metadata.fromJSON(e)) + : [], + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Balance.toJSON(e)); + } + if (message.supply?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.denomMetadata?.length) { + obj.denomMetadata = message.denomMetadata.map((e) => Metadata.toJSON(e)); + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.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) + ? Params.fromPartial(object.params) + : undefined; + message.balances = object.balances?.map((e) => Balance.fromPartial(e)) || []; + message.supply = object.supply?.map((e) => Coin.fromPartial(e)) || []; + message.denomMetadata = object.denomMetadata?.map((e) => Metadata.fromPartial(e)) || []; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBalance(): Balance { + return { address: "", coins: [] }; +} + +export const Balance: MessageFns = { + encode(message: Balance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Balance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Balance { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Balance): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Balance { + return Balance.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/query.ts new file mode 100644 index 00000000..67edba9b --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,2382 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } 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 | undefined; +} + +/** 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 + | undefined; + /** + * resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. + * + * Since: cosmos-sdk 0.50 + */ + resolveDenom: boolean; +} + +/** + * 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 | undefined; +} + +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} + +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponse { + /** balance is the balance of the coin. */ + balance: Coin | undefined; +} + +/** + * 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 provides the parameters of the bank module. */ + params: Params | undefined; +} + +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} + +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata: Metadata | undefined; +} + +/** + * 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 | undefined; +} + +/** + * DenomOwner defines structure representing an account that owns or holds a + * particular denominated token. It contains the account address and account + * balance of the denominated token. + * + * Since: cosmos-sdk 0.46 + */ +export interface DenomOwner { + /** address defines the address that owns a particular denomination. */ + address: string; + /** balance is the balance of the denominated coin for an account. */ + balance: Coin | undefined; +} + +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryRequest { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequest { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination: PageRequest | undefined; +} + +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponse { + sendEnabled: SendEnabled[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination: PageResponse | undefined; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { address: "", denom: "" }; +} + +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + 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, resolveDenom: false }; +} + +export const QueryAllBalancesRequest: MessageFns = { + encode(message: QueryAllBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.resolveDenom !== false) { + writer.uint32(24).bool(message.resolveDenom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.resolveDenom = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + resolveDenom: isSet(object.resolveDenom) ? globalThis.Boolean(object.resolveDenom) : false, + }; + }, + + toJSON(message: QueryAllBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.resolveDenom !== false) { + obj.resolveDenom = message.resolveDenom; + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesRequest { + return QueryAllBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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; + message.resolveDenom = object.resolveDenom ?? false; + return message; + }, +}; + +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { balances: [], pagination: undefined }; +} + +export const QueryAllBalancesResponse: MessageFns = { + encode(message: QueryAllBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesResponse { + return QueryAllBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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 createBaseQuerySpendableBalanceByDenomRequest(): QuerySpendableBalanceByDenomRequest { + return { address: "", denom: "" }; +} + +export const QuerySpendableBalanceByDenomRequest: MessageFns = { + encode(message: QuerySpendableBalanceByDenomRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QuerySpendableBalanceByDenomRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySpendableBalanceByDenomResponse(): QuerySpendableBalanceByDenomResponse { + return { balance: undefined }; +} + +export const QuerySpendableBalanceByDenomResponse: MessageFns = { + encode(message: QuerySpendableBalanceByDenomResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QuerySpendableBalanceByDenomResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + message.balance = (object.balance !== undefined && object.balance !== null) + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; + +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { pagination: undefined }; +} + +export const QueryTotalSupplyRequest: MessageFns = { + encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryTotalSupplyRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyResponse { + return { + supply: globalThis.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?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySupplyOfRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QuerySupplyOfRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfRequest { + return QuerySupplyOfRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { amount: undefined }; +} + +export const QuerySupplyOfResponse: MessageFns = { + encode(message: QuerySupplyOfResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfResponse { + return { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; + }, + + toJSON(message: QuerySupplyOfResponse): unknown { + const obj: any = {}; + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfResponse { + return QuerySupplyOfResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { pagination: undefined }; +} + +export const QueryDenomsMetadataRequest: MessageFns = { + encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDenomsMetadataRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.metadatas) { + Metadata.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadatas.push(Metadata.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataResponse { + return { + metadatas: globalThis.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?.length) { + obj.metadatas = message.metadatas.map((e) => Metadata.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataResponse: MessageFns = { + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringRequest(): QueryDenomMetadataByQueryStringRequest { + return { denom: "" }; +} + +export const QueryDenomMetadataByQueryStringRequest: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringRequest { + return QueryDenomMetadataByQueryStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringRequest { + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringResponse(): QueryDenomMetadataByQueryStringResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataByQueryStringResponse: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringResponse { + return QueryDenomMetadataByQueryStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringResponse { + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + 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: MessageFns = { + encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomOwner, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomOwner(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomOwner { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DenomOwner): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DenomOwner { + return DenomOwner.fromPartial(base ?? ({} as any)); + }, + 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 { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersResponse: MessageFns = { + encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryRequest(): QueryDenomOwnersByQueryRequest { + return { denom: "", pagination: undefined }; +} + +export const QueryDenomOwnersByQueryRequest: MessageFns = { + encode(message: QueryDenomOwnersByQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryRequest { + return QueryDenomOwnersByQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryRequest { + const message = createBaseQueryDenomOwnersByQueryRequest(); + message.denom = object.denom ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryResponse(): QueryDenomOwnersByQueryResponse { + return { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersByQueryResponse: MessageFns = { + encode(message: QueryDenomOwnersByQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryResponse { + return QueryDenomOwnersByQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryResponse { + const message = createBaseQueryDenomOwnersByQueryResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledRequest(): QuerySendEnabledRequest { + return { denoms: [], pagination: undefined }; +} + +export const QuerySendEnabledRequest: MessageFns = { + encode(message: QuerySendEnabledRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denoms.push(reader.string()); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledRequest { + return { + denoms: globalThis.Array.isArray(object?.denoms) ? object.denoms.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledRequest): unknown { + const obj: any = {}; + if (message.denoms?.length) { + obj.denoms = message.denoms; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledRequest { + return QuerySendEnabledRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map((e) => e) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledResponse(): QuerySendEnabledResponse { + return { sendEnabled: [], pagination: undefined }; +} + +export const QuerySendEnabledResponse: MessageFns = { + encode(message: QuerySendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledResponse { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledResponse): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledResponse { + return QuerySendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + AllBalances(request: QueryAllBalancesRequest): Promise; + /** + * SpendableBalances queries the spendable balance of all coins for a single + * account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + SpendableBalances(request: QuerySpendableBalancesRequest): Promise; + /** + * SpendableBalanceByDenom queries the spendable balance of a single denom for + * a single account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.47 + */ + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise; + /** + * TotalSupply queries the total supply of all coins. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + TotalSupply(request: QueryTotalSupplyRequest): Promise; + /** + * SupplyOf queries the supply of a single coin. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + SupplyOf(request: QuerySupplyOfRequest): Promise; + /** Params queries the parameters of x/bank module. */ + Params(request: QueryParamsRequest): Promise; + /** DenomMetadata queries the client metadata of a given coin denomination. */ + DenomMetadata(request: QueryDenomMetadataRequest): Promise; + /** DenomMetadataByQueryString queries the client metadata of a given coin denomination. */ + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + DenomOwners(request: QueryDenomOwnersRequest): Promise; + /** + * DenomOwnersByQuery queries for all account addresses that own a particular token + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise; + /** + * SendEnabled queries for SendEnabled entries. + * + * This query only returns denominations that have specific SendEnabled settings. + * Any denomination that does not have a specific setting will use the default + * params.default_send_enabled, and will not be returned by this query. + * + * Since: cosmos-sdk 0.47 + */ + SendEnabled(request: QuerySendEnabledRequest): Promise; +} + +export const QueryServiceName = "cosmos.bank.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 || QueryServiceName; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.AllBalances = this.AllBalances.bind(this); + this.SpendableBalances = this.SpendableBalances.bind(this); + this.SpendableBalanceByDenom = this.SpendableBalanceByDenom.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.DenomMetadataByQueryString = this.DenomMetadataByQueryString.bind(this); + this.DenomsMetadata = this.DenomsMetadata.bind(this); + this.DenomOwners = this.DenomOwners.bind(this); + this.DenomOwnersByQuery = this.DenomOwnersByQuery.bind(this); + this.SendEnabled = this.SendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise { + const data = QuerySpendableBalanceByDenomRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SpendableBalanceByDenom", data); + return promise.then((data) => QuerySpendableBalanceByDenomResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): Promise { + const data = QueryDenomMetadataByQueryStringRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomMetadataByQueryString", data); + return promise.then((data) => QueryDenomMetadataByQueryStringResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise { + const data = QueryDenomOwnersByQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomOwnersByQuery", data); + return promise.then((data) => QueryDenomOwnersByQueryResponse.decode(new BinaryReader(data))); + } + + SendEnabled(request: QuerySendEnabledRequest): Promise { + const data = QuerySendEnabledRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendEnabled", data); + return promise.then((data) => QuerySendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 00000000..1f1637f5 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,687 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Input, Output, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSend { + fromAddress: string; + toAddress: 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, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: Input[]; + outputs: Output[]; +} + +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabled { + /** authority is the address that controls the module. */ + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; +} + +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponse { +} + +function createBaseMsgSend(): MsgSend { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +function createBaseMsgMultiSend(): MsgMultiSend { + return { inputs: [], outputs: [] }; +} + +export const MsgMultiSend: MessageFns = { + encode(message: MsgMultiSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.inputs) { + Input.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.outputs) { + Output.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inputs.push(Input.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outputs.push(Output.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgMultiSend { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e: any) => Input.fromJSON(e)) : [], + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e: any) => Output.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgMultiSend): unknown { + const obj: any = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => Input.toJSON(e)); + } + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => Output.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgMultiSend { + return MsgMultiSend.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgMultiSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgMultiSendResponse { + return {}; + }, + + toJSON(_: MsgMultiSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgMultiSendResponse { + return MsgMultiSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSetSendEnabled(): MsgSetSendEnabled { + return { authority: "", sendEnabled: [], useDefaultFor: [] }; +} + +export const MsgSetSendEnabled: MessageFns = { + encode(message: MsgSetSendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.useDefaultFor) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.useDefaultFor.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetSendEnabled { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + useDefaultFor: globalThis.Array.isArray(object?.useDefaultFor) + ? object.useDefaultFor.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgSetSendEnabled): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.useDefaultFor?.length) { + obj.useDefaultFor = message.useDefaultFor; + } + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabled { + return MsgSetSendEnabled.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + message.authority = object.authority ?? ""; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.useDefaultFor = object.useDefaultFor?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgSetSendEnabledResponse(): MsgSetSendEnabledResponse { + return {}; +} + +export const MsgSetSendEnabledResponse: MessageFns = { + encode(_: MsgSetSendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetSendEnabledResponse { + return {}; + }, + + toJSON(_: MsgSetSendEnabledResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/bank module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SetSendEnabled is a governance operation for setting the SendEnabled flag + * on any number of Denoms. Only the entries to add or update should be + * included. Entries that already exist in the store, but that aren't + * included in this message, will be left unchanged. + * + * Since: cosmos-sdk 0.47 + */ + SetSendEnabled(request: MsgSetSendEnabled): Promise; +} + +export const MsgServiceName = "cosmos.bank.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 || MsgServiceName; + this.rpc = rpc; + this.Send = this.Send.bind(this); + this.MultiSend = this.MultiSend.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.SetSendEnabled = this.SetSendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SetSendEnabled(request: MsgSetSendEnabled): Promise { + const data = MsgSetSendEnabled.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetSendEnabled", data); + return promise.then((data) => MsgSetSendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 00000000..6da88804 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1425 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/abci/v1beta1/abci.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Event } from "../../../../tendermint/abci/types"; +import { Block } from "../../../../tendermint/types/block"; + +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: number; + /** The transaction hash. */ + txhash: string; + /** Namespace for the Code */ + codespace: string; + /** Response code. */ + code: number; + /** Result bytes, if any. */ + data: string; + /** + * The output of the application's logger (raw string). May be + * non-deterministic. + */ + rawLog: string; + /** The output of the application's logger (typed). May be non-deterministic. */ + logs: ABCIMessageLog[]; + /** Additional information. May be non-deterministic. */ + info: string; + /** Amount of gas requested for transaction. */ + gasWanted: number; + /** Amount of gas consumed by transaction. */ + gasUsed: number; + /** The request transaction bytes. */ + tx: + | Any + | undefined; + /** + * Time of the previous block. For heights > 1, it's the weighted median of + * the timestamps of the valid votes in the block.LastCommit. For height == 1, + * it's genesis time. + */ + timestamp: string; + /** + * Events defines all the events emitted by processing a transaction. Note, + * these events include those emitted by processing all the messages and those + * emitted from the ante. Whereas Logs contains the events, with + * additional metadata, emitted only by processing the messages. + * + * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + */ + events: Event[]; +} + +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLog { + msgIndex: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEvent[]; +} + +/** + * 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. */ + gasWanted: number; + /** GasUsed is the amount of gas actually consumed. */ + gasUsed: number; +} + +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface Result { + /** + * Data is any data returned from message or handler execution. It MUST be + * length prefixed in order to separate data from multiple message executions. + * Deprecated. This field is still populated, but prefer msg_response instead + * because it also contains the Msg response typeURL. + * + * @deprecated + */ + data: Uint8Array; + /** Log contains the log information from message or handler execution. */ + log: string; + /** + * Events contains a slice of Event objects that were emitted during message + * or handler execution. + */ + events: Event[]; + /** + * msg_responses contains the Msg handler responses type packed in Anys. + * + * Since: cosmos-sdk 0.46 + */ + msgResponses: Any[]; +} + +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponse { + gasInfo: GasInfo | undefined; + result: Result | undefined; +} + +/** + * MsgData defines the data returned in a Result object during message + * execution. + * + * @deprecated + */ +export interface MsgData { + msgType: 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 + */ + msgResponses: Any[]; +} + +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResult { + /** Count of all txs */ + totalCount: number; + /** Count of txs in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count txs per page */ + limit: number; + /** List of txs in current page */ + txs: TxResponse[]; +} + +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResult { + /** Count of all blocks */ + totalCount: number; + /** Count of blocks in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count blocks per page */ + limit: number; + /** List of blocks in current page */ + blocks: Block[]; +} + +function createBaseTxResponse(): TxResponse { + return { + height: 0, + txhash: "", + codespace: "", + code: 0, + data: "", + rawLog: "", + logs: [], + info: "", + gasWanted: 0, + gasUsed: 0, + tx: undefined, + timestamp: "", + events: [], + }; +} + +export const TxResponse: MessageFns = { + encode(message: TxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.rawLog !== "") { + writer.uint32(50).string(message.rawLog); + } + for (const v of message.logs) { + ABCIMessageLog.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.info !== "") { + writer.uint32(66).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(72).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(80).int64(message.gasUsed); + } + if (message.tx !== undefined) { + Any.encode(message.tx, writer.uint32(90).fork()).join(); + } + if (message.timestamp !== "") { + writer.uint32(98).string(message.timestamp); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(106).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txhash = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codespace = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.code = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.data = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.rawLog = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.info = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.tx = Any.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.timestamp = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResponse { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + txhash: isSet(object.txhash) ? globalThis.String(object.txhash) : "", + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + rawLog: isSet(object.rawLog) ? globalThis.String(object.rawLog) : "", + logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => ABCIMessageLog.fromJSON(e)) : [], + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + tx: isSet(object.tx) ? Any.fromJSON(object.tx) : undefined, + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.txhash !== "") { + obj.txhash = message.txhash; + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.rawLog !== "") { + obj.rawLog = message.rawLog; + } + if (message.logs?.length) { + obj.logs = message.logs.map((e) => ABCIMessageLog.toJSON(e)); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + if (message.tx !== undefined) { + obj.tx = Any.toJSON(message.tx); + } + if (message.timestamp !== "") { + obj.timestamp = message.timestamp; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxResponse { + return TxResponse.fromPartial(base ?? ({} as any)); + }, + 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.rawLog = object.rawLog ?? ""; + message.logs = object.logs?.map((e) => ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 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 { msgIndex: 0, log: "", events: [] }; +} + +export const ABCIMessageLog: MessageFns = { + encode(message: ABCIMessageLog, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgIndex !== 0) { + writer.uint32(8).uint32(message.msgIndex); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + StringEvent.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIMessageLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.msgIndex = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(StringEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIMessageLog { + return { + msgIndex: isSet(object.msgIndex) ? globalThis.Number(object.msgIndex) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => StringEvent.fromJSON(e)) : [], + }; + }, + + toJSON(message: ABCIMessageLog): unknown { + const obj: any = {}; + if (message.msgIndex !== 0) { + obj.msgIndex = Math.round(message.msgIndex); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => StringEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ABCIMessageLog { + return ABCIMessageLog.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msgIndex = object.msgIndex ?? 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: MessageFns = { + encode(message: StringEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + Attribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(Attribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StringEvent { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => Attribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: StringEvent): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => Attribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): StringEvent { + return StringEvent.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Attribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Attribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Attribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: Attribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Attribute { + return Attribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseGasInfo(): GasInfo { + return { gasWanted: 0, gasUsed: 0 }; +} + +export const GasInfo: MessageFns = { + encode(message: GasInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasWanted !== 0) { + writer.uint32(8).uint64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(16).uint64(message.gasUsed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.gasWanted = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasUsed = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GasInfo { + return { + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + }; + }, + + toJSON(message: GasInfo): unknown { + const obj: any = {}; + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + return obj; + }, + + create, I>>(base?: I): GasInfo { + return GasInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GasInfo { + const message = createBaseGasInfo(); + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + return message; + }, +}; + +function createBaseResult(): Result { + return { data: new Uint8Array(0), log: "", events: [], msgResponses: [] }; +} + +export const Result: MessageFns = { + encode(message: Result, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Result { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Result { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Result): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Result { + return Result.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Result { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSimulationResponse(): SimulationResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulationResponse: MessageFns = { + encode(message: SimulationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulationResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulationResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulationResponse { + return SimulationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulationResponse { + const message = createBaseSimulationResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseMsgData(): MsgData { + return { msgType: "", data: new Uint8Array(0) }; +} + +export const MsgData: MessageFns = { + encode(message: MsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgType !== "") { + writer.uint32(10).string(message.msgType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgData { + return { + msgType: isSet(object.msgType) ? globalThis.String(object.msgType) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: MsgData): unknown { + const obj: any = {}; + if (message.msgType !== "") { + obj.msgType = message.msgType; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): MsgData { + return MsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgData { + const message = createBaseMsgData(); + message.msgType = object.msgType ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxMsgData(): TxMsgData { + return { data: [], msgResponses: [] }; +} + +export const TxMsgData: MessageFns = { + encode(message: TxMsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.data) { + MsgData.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data.push(MsgData.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxMsgData { + return { + data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => MsgData.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxMsgData): unknown { + const obj: any = {}; + if (message.data?.length) { + obj.data = message.data.map((e) => MsgData.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxMsgData { + return TxMsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map((e) => MsgData.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchTxsResult(): SearchTxsResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, txs: [] }; +} + +export const SearchTxsResult: MessageFns = { + encode(message: SearchTxsResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).uint64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).uint64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).uint64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).uint64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + for (const v of message.txs) { + TxResponse.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchTxsResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.txs.push(TxResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchTxsResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => TxResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchTxsResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => TxResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchTxsResult { + return SearchTxsResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.txs = object.txs?.map((e) => TxResponse.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchBlocksResult(): SearchBlocksResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, blocks: [] }; +} + +export const SearchBlocksResult: MessageFns = { + encode(message: SearchBlocksResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).int64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).int64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).int64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).int64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).int64(message.limit); + } + for (const v of message.blocks) { + Block.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchBlocksResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchBlocksResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.blocks.push(Block.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchBlocksResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e: any) => Block.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchBlocksResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.blocks?.length) { + obj.blocks = message.blocks.map((e) => Block.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchBlocksResult { + return SearchBlocksResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchBlocksResult { + const message = createBaseSearchBlocksResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.blocks = object.blocks?.map((e) => Block.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/node/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/node/v1beta1/query.ts new file mode 100644 index 00000000..ee56c0a8 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/node/v1beta1/query.ts @@ -0,0 +1,476 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/node/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.base.node.v1beta1"; + +/** ConfigRequest defines the request structure for the Config gRPC query. */ +export interface ConfigRequest { +} + +/** ConfigResponse defines the response structure for the Config gRPC query. */ +export interface ConfigResponse { + minimumGasPrice: string; + pruningKeepRecent: string; + pruningInterval: string; + haltHeight: number; +} + +/** StateRequest defines the request structure for the status of a node. */ +export interface StatusRequest { +} + +/** StateResponse defines the response structure for the status of a node. */ +export interface StatusResponse { + /** earliest block height available in the store */ + earliestStoreHeight: number; + /** current block height */ + height: number; + /** block height timestamp */ + timestamp: + | Date + | undefined; + /** app hash of the current block */ + appHash: Uint8Array; + /** validator hash provided by the consensus header */ + validatorHash: Uint8Array; +} + +function createBaseConfigRequest(): ConfigRequest { + return {}; +} + +export const ConfigRequest: MessageFns = { + encode(_: ConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ConfigRequest { + return {}; + }, + + toJSON(_: ConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ConfigRequest { + return ConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ConfigRequest { + const message = createBaseConfigRequest(); + return message; + }, +}; + +function createBaseConfigResponse(): ConfigResponse { + return { minimumGasPrice: "", pruningKeepRecent: "", pruningInterval: "", haltHeight: 0 }; +} + +export const ConfigResponse: MessageFns = { + encode(message: ConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minimumGasPrice !== "") { + writer.uint32(10).string(message.minimumGasPrice); + } + if (message.pruningKeepRecent !== "") { + writer.uint32(18).string(message.pruningKeepRecent); + } + if (message.pruningInterval !== "") { + writer.uint32(26).string(message.pruningInterval); + } + if (message.haltHeight !== 0) { + writer.uint32(32).uint64(message.haltHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minimumGasPrice = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pruningKeepRecent = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pruningInterval = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.haltHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigResponse { + return { + minimumGasPrice: isSet(object.minimumGasPrice) ? globalThis.String(object.minimumGasPrice) : "", + pruningKeepRecent: isSet(object.pruningKeepRecent) ? globalThis.String(object.pruningKeepRecent) : "", + pruningInterval: isSet(object.pruningInterval) ? globalThis.String(object.pruningInterval) : "", + haltHeight: isSet(object.haltHeight) ? globalThis.Number(object.haltHeight) : 0, + }; + }, + + toJSON(message: ConfigResponse): unknown { + const obj: any = {}; + if (message.minimumGasPrice !== "") { + obj.minimumGasPrice = message.minimumGasPrice; + } + if (message.pruningKeepRecent !== "") { + obj.pruningKeepRecent = message.pruningKeepRecent; + } + if (message.pruningInterval !== "") { + obj.pruningInterval = message.pruningInterval; + } + if (message.haltHeight !== 0) { + obj.haltHeight = Math.round(message.haltHeight); + } + return obj; + }, + + create, I>>(base?: I): ConfigResponse { + return ConfigResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigResponse { + const message = createBaseConfigResponse(); + message.minimumGasPrice = object.minimumGasPrice ?? ""; + message.pruningKeepRecent = object.pruningKeepRecent ?? ""; + message.pruningInterval = object.pruningInterval ?? ""; + message.haltHeight = object.haltHeight ?? 0; + return message; + }, +}; + +function createBaseStatusRequest(): StatusRequest { + return {}; +} + +export const StatusRequest: MessageFns = { + encode(_: StatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): StatusRequest { + return {}; + }, + + toJSON(_: StatusRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): StatusRequest { + return StatusRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): StatusRequest { + const message = createBaseStatusRequest(); + return message; + }, +}; + +function createBaseStatusResponse(): StatusResponse { + return { + earliestStoreHeight: 0, + height: 0, + timestamp: undefined, + appHash: new Uint8Array(0), + validatorHash: new Uint8Array(0), + }; +} + +export const StatusResponse: MessageFns = { + encode(message: StatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.earliestStoreHeight !== 0) { + writer.uint32(8).uint64(message.earliestStoreHeight); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(34).bytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + writer.uint32(42).bytes(message.validatorHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.earliestStoreHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StatusResponse { + return { + earliestStoreHeight: isSet(object.earliestStoreHeight) ? globalThis.Number(object.earliestStoreHeight) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + validatorHash: isSet(object.validatorHash) ? bytesFromBase64(object.validatorHash) : new Uint8Array(0), + }; + }, + + toJSON(message: StatusResponse): unknown { + const obj: any = {}; + if (message.earliestStoreHeight !== 0) { + obj.earliestStoreHeight = Math.round(message.earliestStoreHeight); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + obj.validatorHash = base64FromBytes(message.validatorHash); + } + return obj; + }, + + create, I>>(base?: I): StatusResponse { + return StatusResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatusResponse { + const message = createBaseStatusResponse(); + message.earliestStoreHeight = object.earliestStoreHeight ?? 0; + message.height = object.height ?? 0; + message.timestamp = object.timestamp ?? undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + message.validatorHash = object.validatorHash ?? new Uint8Array(0); + return message; + }, +}; + +/** Service defines the gRPC querier service for node related queries. */ +export interface Service { + /** Config queries for the operator configuration. */ + Config(request: ConfigRequest): Promise; + /** Status queries for the node status. */ + Status(request: StatusRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.node.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + this.rpc = rpc; + this.Config = this.Config.bind(this); + this.Status = this.Status.bind(this); + } + Config(request: ConfigRequest): Promise { + const data = ConfigRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Config", data); + return promise.then((data) => ConfigResponse.decode(new BinaryReader(data))); + } + + Status(request: StatusRequest): Promise { + const data = StatusRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Status", data); + return promise.then((data) => StatusResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts new file mode 100644 index 00000000..ebb67be4 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v1beta1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. */ + interfaceNames: string[]; +} + +/** + * ListImplementationsRequest is the request type of the ListImplementations + * RPC. + */ +export interface ListImplementationsRequest { + /** interface_name defines the interface to query the implementations for. */ + interfaceName: string; +} + +/** + * ListImplementationsResponse is the response type of the ListImplementations + * RPC. + */ +export interface ListImplementationsResponse { + implementationMessageNames: string[]; +} + +function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { + return {}; +} + +export const ListAllInterfacesRequest: MessageFns = { + encode(_: ListAllInterfacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListAllInterfacesRequest { + return {}; + }, + + toJSON(_: ListAllInterfacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesRequest { + return ListAllInterfacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListAllInterfacesRequest { + const message = createBaseListAllInterfacesRequest(); + return message; + }, +}; + +function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { + return { interfaceNames: [] }; +} + +export const ListAllInterfacesResponse: MessageFns = { + encode(message: ListAllInterfacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaceNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAllInterfacesResponse { + return { + interfaceNames: globalThis.Array.isArray(object?.interfaceNames) + ? object.interfaceNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListAllInterfacesResponse): unknown { + const obj: any = {}; + if (message.interfaceNames?.length) { + obj.interfaceNames = message.interfaceNames; + } + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesResponse { + return ListAllInterfacesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListAllInterfacesResponse { + const message = createBaseListAllInterfacesResponse(); + message.interfaceNames = object.interfaceNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListImplementationsRequest(): ListImplementationsRequest { + return { interfaceName: "" }; +} + +export const ListImplementationsRequest: MessageFns = { + encode(message: ListImplementationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceName !== "") { + writer.uint32(10).string(message.interfaceName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsRequest { + return { interfaceName: isSet(object.interfaceName) ? globalThis.String(object.interfaceName) : "" }; + }, + + toJSON(message: ListImplementationsRequest): unknown { + const obj: any = {}; + if (message.interfaceName !== "") { + obj.interfaceName = message.interfaceName; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsRequest { + return ListImplementationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsRequest { + const message = createBaseListImplementationsRequest(); + message.interfaceName = object.interfaceName ?? ""; + return message; + }, +}; + +function createBaseListImplementationsResponse(): ListImplementationsResponse { + return { implementationMessageNames: [] }; +} + +export const ListImplementationsResponse: MessageFns = { + encode(message: ListImplementationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.implementationMessageNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.implementationMessageNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsResponse { + return { + implementationMessageNames: globalThis.Array.isArray(object?.implementationMessageNames) + ? object.implementationMessageNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListImplementationsResponse): unknown { + const obj: any = {}; + if (message.implementationMessageNames?.length) { + obj.implementationMessageNames = message.implementationMessageNames; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsResponse { + return ListImplementationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsResponse { + const message = createBaseListImplementationsResponse(); + message.implementationMessageNames = object.implementationMessageNames?.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 const ReflectionServiceServiceName = "cosmos.base.reflection.v1beta1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 00000000..23a7ca89 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,2057 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v2alpha1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 + | undefined; + /** chain provides the chain descriptor */ + chain: + | ChainDescriptor + | undefined; + /** codec provides metadata information regarding codec related types */ + codec: + | CodecDescriptor + | undefined; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration: + | ConfigurationDescriptor + | undefined; + /** query_services provides metadata information regarding the available queriable endpoints */ + queryServices: + | QueryServicesDescriptor + | undefined; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx: TxDescriptor | undefined; +} + +/** 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 */ + signModes: 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 + */ + authnInfoProviderMethodFullname: 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 + */ + interfaceAcceptingMessages: InterfaceAcceptingMessageDescriptor[]; + /** interface_implementers is a list of the descriptors of the interface implementers */ + interfaceImplementers: 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 + */ + typeUrl: 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) + */ + fieldDescriptorNames: string[]; +} + +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptor { + /** bech32_account_address_prefix is the account address prefix */ + bech32AccountAddressPrefix: 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. */ + msgTypeUrl: 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptor { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + queryServices: 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 */ + isModule: 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 + */ + fullQueryPath: string; +} + +function createBaseAppDescriptor(): AppDescriptor { + return { + authn: undefined, + chain: undefined, + codec: undefined, + configuration: undefined, + queryServices: undefined, + tx: undefined, + }; +} + +export const AppDescriptor: MessageFns = { + encode(message: AppDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).join(); + } + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).join(); + } + if (message.configuration !== undefined) { + ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).join(); + } + if (message.queryServices !== undefined) { + QueryServicesDescriptor.encode(message.queryServices, writer.uint32(42).fork()).join(); + } + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.queryServices = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + queryServices: isSet(object.queryServices) ? QueryServicesDescriptor.fromJSON(object.queryServices) : undefined, + tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined, + }; + }, + + toJSON(message: AppDescriptor): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + if (message.configuration !== undefined) { + obj.configuration = ConfigurationDescriptor.toJSON(message.configuration); + } + if (message.queryServices !== undefined) { + obj.queryServices = QueryServicesDescriptor.toJSON(message.queryServices); + } + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): AppDescriptor { + return AppDescriptor.fromPartial(base ?? ({} as any)); + }, + 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.queryServices = (object.queryServices !== undefined && object.queryServices !== null) + ? QueryServicesDescriptor.fromPartial(object.queryServices) + : 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: MessageFns = { + encode(message: TxDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.msgs) { + MsgDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(MsgDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => MsgDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => MsgDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxDescriptor { + return TxDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 { signModes: [] }; +} + +export const AuthnDescriptor: MessageFns = { + encode(message: AuthnDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signModes) { + SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthnDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.signModes.push(SigningModeDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthnDescriptor { + return { + signModes: globalThis.Array.isArray(object?.signModes) + ? object.signModes.map((e: any) => SigningModeDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AuthnDescriptor): unknown { + const obj: any = {}; + if (message.signModes?.length) { + obj.signModes = message.signModes.map((e) => SigningModeDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): AuthnDescriptor { + return AuthnDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.signModes = object.signModes?.map((e) => SigningModeDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningModeDescriptor(): SigningModeDescriptor { + return { name: "", number: 0, authnInfoProviderMethodFullname: "" }; +} + +export const SigningModeDescriptor: MessageFns = { + encode(message: SigningModeDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + writer.uint32(26).string(message.authnInfoProviderMethodFullname); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningModeDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authnInfoProviderMethodFullname = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningModeDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + authnInfoProviderMethodFullname: isSet(object.authnInfoProviderMethodFullname) + ? globalThis.String(object.authnInfoProviderMethodFullname) + : "", + }; + }, + + toJSON(message: SigningModeDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + obj.authnInfoProviderMethodFullname = message.authnInfoProviderMethodFullname; + } + return obj; + }, + + create, I>>(base?: I): SigningModeDescriptor { + return SigningModeDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.authnInfoProviderMethodFullname = object.authnInfoProviderMethodFullname ?? ""; + return message; + }, +}; + +function createBaseChainDescriptor(): ChainDescriptor { + return { id: "" }; +} + +export const ChainDescriptor: MessageFns = { + encode(message: ChainDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChainDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChainDescriptor { + return { id: isSet(object.id) ? globalThis.String(object.id) : "" }; + }, + + toJSON(message: ChainDescriptor): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): ChainDescriptor { + return ChainDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ChainDescriptor { + const message = createBaseChainDescriptor(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseCodecDescriptor(): CodecDescriptor { + return { interfaces: [] }; +} + +export const CodecDescriptor: MessageFns = { + encode(message: CodecDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaces) { + InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CodecDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CodecDescriptor { + return { + interfaces: globalThis.Array.isArray(object?.interfaces) + ? object.interfaces.map((e: any) => InterfaceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: CodecDescriptor): unknown { + const obj: any = {}; + if (message.interfaces?.length) { + obj.interfaces = message.interfaces.map((e) => InterfaceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CodecDescriptor { + return CodecDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map((e) => InterfaceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { fullname: "", interfaceAcceptingMessages: [], interfaceImplementers: [] }; +} + +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.interfaceAcceptingMessages) { + InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.interfaceImplementers) { + InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.interfaceAcceptingMessages.push(InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.interfaceImplementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + interfaceAcceptingMessages: globalThis.Array.isArray(object?.interfaceAcceptingMessages) + ? object.interfaceAcceptingMessages.map((e: any) => InterfaceAcceptingMessageDescriptor.fromJSON(e)) + : [], + interfaceImplementers: globalThis.Array.isArray(object?.interfaceImplementers) + ? object.interfaceImplementers.map((e: any) => InterfaceImplementerDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.interfaceAcceptingMessages?.length) { + obj.interfaceAcceptingMessages = message.interfaceAcceptingMessages.map((e) => + InterfaceAcceptingMessageDescriptor.toJSON(e) + ); + } + if (message.interfaceImplementers?.length) { + obj.interfaceImplementers = message.interfaceImplementers.map((e) => InterfaceImplementerDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): InterfaceDescriptor { + return InterfaceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.fullname = object.fullname ?? ""; + message.interfaceAcceptingMessages = + object.interfaceAcceptingMessages?.map((e) => InterfaceAcceptingMessageDescriptor.fromPartial(e)) || []; + message.interfaceImplementers = + object.interfaceImplementers?.map((e) => InterfaceImplementerDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { + return { fullname: "", typeUrl: "" }; +} + +export const InterfaceImplementerDescriptor: MessageFns = { + encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.typeUrl !== "") { + writer.uint32(18).string(message.typeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceImplementerDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.typeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceImplementerDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", + }; + }, + + toJSON(message: InterfaceImplementerDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.typeUrl !== "") { + obj.typeUrl = message.typeUrl; + } + return obj; + }, + + create, I>>(base?: I): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + message.fullname = object.fullname ?? ""; + message.typeUrl = object.typeUrl ?? ""; + return message; + }, +}; + +function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { + return { fullname: "", fieldDescriptorNames: [] }; +} + +export const InterfaceAcceptingMessageDescriptor: MessageFns = { + encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.fieldDescriptorNames) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fieldDescriptorNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceAcceptingMessageDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + fieldDescriptorNames: globalThis.Array.isArray(object?.fieldDescriptorNames) + ? object.fieldDescriptorNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: InterfaceAcceptingMessageDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.fieldDescriptorNames?.length) { + obj.fieldDescriptorNames = message.fieldDescriptorNames; + } + return obj; + }, + + create, I>>( + base?: I, + ): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + message.fullname = object.fullname ?? ""; + message.fieldDescriptorNames = object.fieldDescriptorNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseConfigurationDescriptor(): ConfigurationDescriptor { + return { bech32AccountAddressPrefix: "" }; +} + +export const ConfigurationDescriptor: MessageFns = { + encode(message: ConfigurationDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32AccountAddressPrefix !== "") { + writer.uint32(10).string(message.bech32AccountAddressPrefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigurationDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32AccountAddressPrefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigurationDescriptor { + return { + bech32AccountAddressPrefix: isSet(object.bech32AccountAddressPrefix) + ? globalThis.String(object.bech32AccountAddressPrefix) + : "", + }; + }, + + toJSON(message: ConfigurationDescriptor): unknown { + const obj: any = {}; + if (message.bech32AccountAddressPrefix !== "") { + obj.bech32AccountAddressPrefix = message.bech32AccountAddressPrefix; + } + return obj; + }, + + create, I>>(base?: I): ConfigurationDescriptor { + return ConfigurationDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + message.bech32AccountAddressPrefix = object.bech32AccountAddressPrefix ?? ""; + return message; + }, +}; + +function createBaseMsgDescriptor(): MsgDescriptor { + return { msgTypeUrl: "" }; +} + +export const MsgDescriptor: MessageFns = { + encode(message: MsgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(10).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDescriptor { + return { msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "" }; + }, + + toJSON(message: MsgDescriptor): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgDescriptor { + return MsgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDescriptor { + const message = createBaseMsgDescriptor(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { + return {}; +} + +export const GetAuthnDescriptorRequest: MessageFns = { + encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetAuthnDescriptorRequest { + return {}; + }, + + toJSON(_: GetAuthnDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, +}; + +function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { + return { authn: undefined }; +} + +export const GetAuthnDescriptorResponse: MessageFns = { + encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetAuthnDescriptorResponse { + return { authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined }; + }, + + toJSON(message: GetAuthnDescriptorResponse): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetChainDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetChainDescriptorRequest { + return {}; + }, + + toJSON(_: GetChainDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorRequest { + return GetChainDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, +}; + +function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { + return { chain: undefined }; +} + +export const GetChainDescriptorResponse: MessageFns = { + encode(message: GetChainDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetChainDescriptorResponse { + return { chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined }; + }, + + toJSON(message: GetChainDescriptorResponse): unknown { + const obj: any = {}; + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorResponse { + return GetChainDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetCodecDescriptorRequest { + return {}; + }, + + toJSON(_: GetCodecDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, +}; + +function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { + return { codec: undefined }; +} + +export const GetCodecDescriptorResponse: MessageFns = { + encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCodecDescriptorResponse { + return { codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined }; + }, + + toJSON(message: GetCodecDescriptorResponse): unknown { + const obj: any = {}; + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetConfigurationDescriptorRequest { + return {}; + }, + + toJSON(_: GetConfigurationDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, +}; + +function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { + return { config: undefined }; +} + +export const GetConfigurationDescriptorResponse: MessageFns = { + encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetConfigurationDescriptorResponse { + return { config: isSet(object.config) ? ConfigurationDescriptor.fromJSON(object.config) : undefined }; + }, + + toJSON(message: GetConfigurationDescriptorResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = ConfigurationDescriptor.toJSON(message.config); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetQueryServicesDescriptorRequest { + return {}; + }, + + toJSON(_: GetQueryServicesDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, +}; + +function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { + return { queries: undefined }; +} + +export const GetQueryServicesDescriptorResponse: MessageFns = { + encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.queries !== undefined) { + QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetQueryServicesDescriptorResponse { + return { queries: isSet(object.queries) ? QueryServicesDescriptor.fromJSON(object.queries) : undefined }; + }, + + toJSON(message: GetQueryServicesDescriptorResponse): unknown { + const obj: any = {}; + if (message.queries !== undefined) { + obj.queries = QueryServicesDescriptor.toJSON(message.queries); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetTxDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetTxDescriptorRequest { + return {}; + }, + + toJSON(_: GetTxDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorRequest { + return GetTxDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, +}; + +function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { + return { tx: undefined }; +} + +export const GetTxDescriptorResponse: MessageFns = { + encode(message: GetTxDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxDescriptorResponse { + return { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: GetTxDescriptorResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorResponse { + return GetTxDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { queryServices: [] }; +} + +export const QueryServicesDescriptor: MessageFns = { + encode(message: QueryServicesDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.queryServices) { + QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServicesDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queryServices.push(QueryServiceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServicesDescriptor { + return { + queryServices: globalThis.Array.isArray(object?.queryServices) + ? object.queryServices.map((e: any) => QueryServiceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServicesDescriptor): unknown { + const obj: any = {}; + if (message.queryServices?.length) { + obj.queryServices = message.queryServices.map((e) => QueryServiceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServicesDescriptor { + return QueryServicesDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.queryServices = object.queryServices?.map((e) => QueryServiceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { + return { fullname: "", isModule: false, methods: [] }; +} + +export const QueryServiceDescriptor: MessageFns = { + encode(message: QueryServiceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.isModule !== false) { + writer.uint32(16).bool(message.isModule); + } + for (const v of message.methods) { + QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServiceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isModule = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServiceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + isModule: isSet(object.isModule) ? globalThis.Boolean(object.isModule) : false, + methods: globalThis.Array.isArray(object?.methods) + ? object.methods.map((e: any) => QueryMethodDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServiceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.isModule !== false) { + obj.isModule = message.isModule; + } + if (message.methods?.length) { + obj.methods = message.methods.map((e) => QueryMethodDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServiceDescriptor { + return QueryServiceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + message.fullname = object.fullname ?? ""; + message.isModule = object.isModule ?? false; + message.methods = object.methods?.map((e) => QueryMethodDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { + return { name: "", fullQueryPath: "" }; +} + +export const QueryMethodDescriptor: MessageFns = { + encode(message: QueryMethodDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.fullQueryPath !== "") { + writer.uint32(18).string(message.fullQueryPath); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryMethodDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullQueryPath = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryMethodDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + fullQueryPath: isSet(object.fullQueryPath) ? globalThis.String(object.fullQueryPath) : "", + }; + }, + + toJSON(message: QueryMethodDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.fullQueryPath !== "") { + obj.fullQueryPath = message.fullQueryPath; + } + return obj; + }, + + create, I>>(base?: I): QueryMethodDescriptor { + return QueryMethodDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + message.name = object.name ?? ""; + message.fullQueryPath = object.fullQueryPath ?? ""; + 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 const ReflectionServiceServiceName = "cosmos.base.reflection.v2alpha1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts new file mode 100644 index 00000000..f58dfb17 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts @@ -0,0 +1,1974 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { DefaultNodeInfo } from "../../../../tendermint/p2p/types"; +import { Block } from "../../../../tendermint/types/block"; +import { BlockID } from "../../../../tendermint/types/types"; +import { PageRequest, PageResponse } from "../../query/v1beta1/pagination"; +import { Block as Block1 } from "./types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightRequest { + height: number; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetRequest { + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** Validator is the type for the validator-set. */ +export interface Validator { + address: string; + pubKey: Any | undefined; + votingPower: number; + proposerPriority: number; +} + +/** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightRequest { + height: number; +} + +/** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightResponse { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + defaultNodeInfo: DefaultNodeInfo | undefined; + applicationVersion: VersionInfo | undefined; +} + +/** VersionInfo is the type for the GetNodeInfoResponse message. */ +export interface VersionInfo { + name: string; + appName: string; + version: string; + gitCommit: string; + buildTags: string; + goVersion: string; + buildDeps: Module[]; + /** Since: cosmos-sdk 0.43 */ + cosmosSdkVersion: string; +} + +/** Module is the type for VersionInfo */ +export interface Module { + /** module path */ + path: string; + /** module version */ + version: string; + /** checksum */ + sum: string; +} + +/** ABCIQueryRequest defines the request structure for the ABCIQuery gRPC query. */ +export interface ABCIQueryRequest { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +/** + * ABCIQueryResponse defines the response structure for the ABCIQuery gRPC query. + * + * Note: This type is a duplicate of the ResponseQuery proto type defined in + * Tendermint. + */ +export interface ABCIQueryResponse { + code: number; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +/** + * ProofOp defines an operation used for calculating Merkle root. The data could + * be arbitrary format, providing necessary data for example neighbouring node + * hash. + * + * Note: This type is a duplicate of the ProofOp proto type defined in Tendermint. + */ +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} + +/** + * ProofOps is Merkle proof defined by the list of ProofOps. + * + * Note: This type is a duplicate of the ProofOps proto type defined in Tendermint. + */ +export interface ProofOps { + ops: ProofOp[]; +} + +function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequest { + return { height: 0, pagination: undefined }; +} + +export const GetValidatorSetByHeightRequest: MessageFns = { + encode(message: GetValidatorSetByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightRequest { + return GetValidatorSetByHeightRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetValidatorSetByHeightResponse: MessageFns = { + encode(message: GetValidatorSetByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightResponse { + return GetValidatorSetByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetValidatorSetByHeightResponse { + const message = createBaseGetValidatorSetByHeightResponse(); + message.blockHeight = object.blockHeight ?? 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: MessageFns = { + encode(message: GetLatestValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: GetLatestValidatorSetRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetRequest { + return GetLatestValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetLatestValidatorSetResponse: MessageFns = { + encode(message: GetLatestValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetResponse { + return GetLatestValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetLatestValidatorSetResponse { + const message = createBaseGetLatestValidatorSetResponse(); + message.blockHeight = object.blockHeight ?? 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: "", pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { + return { height: 0 }; +} + +export const GetBlockByHeightRequest: MessageFns = { + encode(message: GetBlockByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: GetBlockByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightRequest { + return GetBlockByHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightRequest { + const message = createBaseGetBlockByHeightRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetBlockByHeightResponse: MessageFns = { + encode(message: GetBlockByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetBlockByHeightResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightResponse { + return GetBlockByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightResponse { + const message = createBaseGetBlockByHeightResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { + return {}; +} + +export const GetLatestBlockRequest: MessageFns = { + encode(_: GetLatestBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetLatestBlockRequest { + return {}; + }, + + toJSON(_: GetLatestBlockRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetLatestBlockRequest { + return GetLatestBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetLatestBlockRequest { + const message = createBaseGetLatestBlockRequest(); + return message; + }, +}; + +function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetLatestBlockResponse: MessageFns = { + encode(message: GetLatestBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestBlockResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetLatestBlockResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetLatestBlockResponse { + return GetLatestBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetLatestBlockResponse { + const message = createBaseGetLatestBlockResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetSyncingRequest(): GetSyncingRequest { + return {}; +} + +export const GetSyncingRequest: MessageFns = { + encode(_: GetSyncingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetSyncingRequest { + return {}; + }, + + toJSON(_: GetSyncingRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetSyncingRequest { + return GetSyncingRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetSyncingRequest { + const message = createBaseGetSyncingRequest(); + return message; + }, +}; + +function createBaseGetSyncingResponse(): GetSyncingResponse { + return { syncing: false }; +} + +export const GetSyncingResponse: MessageFns = { + encode(message: GetSyncingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.syncing !== false) { + writer.uint32(8).bool(message.syncing); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.syncing = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetSyncingResponse { + return { syncing: isSet(object.syncing) ? globalThis.Boolean(object.syncing) : false }; + }, + + toJSON(message: GetSyncingResponse): unknown { + const obj: any = {}; + if (message.syncing !== false) { + obj.syncing = message.syncing; + } + return obj; + }, + + create, I>>(base?: I): GetSyncingResponse { + return GetSyncingResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetSyncingResponse { + const message = createBaseGetSyncingResponse(); + message.syncing = object.syncing ?? false; + return message; + }, +}; + +function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { + return {}; +} + +export const GetNodeInfoRequest: MessageFns = { + encode(_: GetNodeInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetNodeInfoRequest { + return {}; + }, + + toJSON(_: GetNodeInfoRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetNodeInfoRequest { + return GetNodeInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetNodeInfoRequest { + const message = createBaseGetNodeInfoRequest(); + return message; + }, +}; + +function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { + return { defaultNodeInfo: undefined, applicationVersion: undefined }; +} + +export const GetNodeInfoResponse: MessageFns = { + encode(message: GetNodeInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.defaultNodeInfo !== undefined) { + DefaultNodeInfo.encode(message.defaultNodeInfo, writer.uint32(10).fork()).join(); + } + if (message.applicationVersion !== undefined) { + VersionInfo.encode(message.applicationVersion, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.defaultNodeInfo = DefaultNodeInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.applicationVersion = VersionInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetNodeInfoResponse { + return { + defaultNodeInfo: isSet(object.defaultNodeInfo) ? DefaultNodeInfo.fromJSON(object.defaultNodeInfo) : undefined, + applicationVersion: isSet(object.applicationVersion) + ? VersionInfo.fromJSON(object.applicationVersion) + : undefined, + }; + }, + + toJSON(message: GetNodeInfoResponse): unknown { + const obj: any = {}; + if (message.defaultNodeInfo !== undefined) { + obj.defaultNodeInfo = DefaultNodeInfo.toJSON(message.defaultNodeInfo); + } + if (message.applicationVersion !== undefined) { + obj.applicationVersion = VersionInfo.toJSON(message.applicationVersion); + } + return obj; + }, + + create, I>>(base?: I): GetNodeInfoResponse { + return GetNodeInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetNodeInfoResponse { + const message = createBaseGetNodeInfoResponse(); + message.defaultNodeInfo = (object.defaultNodeInfo !== undefined && object.defaultNodeInfo !== null) + ? DefaultNodeInfo.fromPartial(object.defaultNodeInfo) + : undefined; + message.applicationVersion = (object.applicationVersion !== undefined && object.applicationVersion !== null) + ? VersionInfo.fromPartial(object.applicationVersion) + : undefined; + return message; + }, +}; + +function createBaseVersionInfo(): VersionInfo { + return { + name: "", + appName: "", + version: "", + gitCommit: "", + buildTags: "", + goVersion: "", + buildDeps: [], + cosmosSdkVersion: "", + }; +} + +export const VersionInfo: MessageFns = { + encode(message: VersionInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.appName !== "") { + writer.uint32(18).string(message.appName); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.gitCommit !== "") { + writer.uint32(34).string(message.gitCommit); + } + if (message.buildTags !== "") { + writer.uint32(42).string(message.buildTags); + } + if (message.goVersion !== "") { + writer.uint32(50).string(message.goVersion); + } + for (const v of message.buildDeps) { + Module.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.cosmosSdkVersion !== "") { + writer.uint32(66).string(message.cosmosSdkVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.version = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gitCommit = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.buildTags = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.goVersion = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.buildDeps.push(Module.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.cosmosSdkVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + gitCommit: isSet(object.gitCommit) ? globalThis.String(object.gitCommit) : "", + buildTags: isSet(object.buildTags) ? globalThis.String(object.buildTags) : "", + goVersion: isSet(object.goVersion) ? globalThis.String(object.goVersion) : "", + buildDeps: globalThis.Array.isArray(object?.buildDeps) + ? object.buildDeps.map((e: any) => Module.fromJSON(e)) + : [], + cosmosSdkVersion: isSet(object.cosmosSdkVersion) ? globalThis.String(object.cosmosSdkVersion) : "", + }; + }, + + toJSON(message: VersionInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.gitCommit !== "") { + obj.gitCommit = message.gitCommit; + } + if (message.buildTags !== "") { + obj.buildTags = message.buildTags; + } + if (message.goVersion !== "") { + obj.goVersion = message.goVersion; + } + if (message.buildDeps?.length) { + obj.buildDeps = message.buildDeps.map((e) => Module.toJSON(e)); + } + if (message.cosmosSdkVersion !== "") { + obj.cosmosSdkVersion = message.cosmosSdkVersion; + } + return obj; + }, + + create, I>>(base?: I): VersionInfo { + return VersionInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionInfo { + const message = createBaseVersionInfo(); + message.name = object.name ?? ""; + message.appName = object.appName ?? ""; + message.version = object.version ?? ""; + message.gitCommit = object.gitCommit ?? ""; + message.buildTags = object.buildTags ?? ""; + message.goVersion = object.goVersion ?? ""; + message.buildDeps = object.buildDeps?.map((e) => Module.fromPartial(e)) || []; + message.cosmosSdkVersion = object.cosmosSdkVersion ?? ""; + return message; + }, +}; + +function createBaseModule(): Module { + return { path: "", version: "", sum: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sum = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + path: isSet(object.path) ? globalThis.String(object.path) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + sum: isSet(object.sum) ? globalThis.String(object.sum) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.sum !== "") { + obj.sum = message.sum; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.path = object.path ?? ""; + message.version = object.version ?? ""; + message.sum = object.sum ?? ""; + return message; + }, +}; + +function createBaseABCIQueryRequest(): ABCIQueryRequest { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const ABCIQueryRequest: MessageFns = { + encode(message: ABCIQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryRequest { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: ABCIQueryRequest): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryRequest { + return ABCIQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryRequest { + const message = createBaseABCIQueryRequest(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseABCIQueryResponse(): ABCIQueryResponse { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ABCIQueryResponse: MessageFns = { + encode(message: ABCIQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryResponse { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ABCIQueryResponse): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryResponse { + return ABCIQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryResponse { + const message = createBaseABCIQueryResponse(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? 0; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseProofOp(): ProofOp { + return { type: "", key: new Uint8Array(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + 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; + /** + * ABCIQuery defines a query handler that supports ABCI queries directly to the + * application, bypassing Tendermint completely. The ABCI query must contain + * a valid and supported path, including app, custom, p2p, and store. + * + * Since: cosmos-sdk 0.46 + */ + ABCIQuery(request: ABCIQueryRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.tendermint.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.ABCIQuery = this.ABCIQuery.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ABCIQuery(request: ABCIQueryRequest): Promise { + const data = ABCIQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ABCIQuery", data); + return promise.then((data) => ABCIQueryResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts new file mode 100644 index 00000000..2d229c81 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts @@ -0,0 +1,530 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { EvidenceList } from "../../../../tendermint/types/evidence"; +import { BlockID, Commit, Data } from "../../../../tendermint/types/types"; +import { Consensus } from "../../../../tendermint/version/types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** + * Block is tendermint type Block, with the Header proposer address + * field converted to bech32 string. + */ +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +/** Header defines the structure of a Tendermint block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** + * proposer_address is the original block proposer address, formatted as a Bech32 string. + * In Tendermint, this type is `bytes`, but in the SDK, we convert it to a Bech32 string + * for better UX. + */ + proposerAddress: string; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: "", + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + writer.uint32(114).string(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? globalThis.String(object.proposerAddress) : "", + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + obj.proposerAddress = message.proposerAddress; + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..72eff8cb --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,335 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ +export interface IntProto { + int: string; +} + +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ +export interface DecProto { + dec: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +export const IntProto: MessageFns = { + encode(message: IntProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IntProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.int = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IntProto { + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + 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 ?? ""; + return message; + }, +}; + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +export const DecProto: MessageFns = { + encode(message: DecProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dec = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecProto { + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + 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 ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/module/v1/module.ts new file mode 100644 index 00000000..733fcc4e --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.circuit.module.v1"; + +/** Module is the config object of the circuit module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/query.ts new file mode 100644 index 00000000..7d1037ab --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/query.ts @@ -0,0 +1,470 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GenesisAccountPermissions, Permissions } from "./types"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + address: string; +} + +/** AccountResponse is the response type for the Query/Account RPC method. */ +export interface AccountResponse { + permission: Permissions | undefined; +} + +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ +export interface QueryAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** AccountsResponse is the response type for the Query/Accounts RPC method. */ +export interface AccountsResponse { + accounts: GenesisAccountPermissions[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryDisableListRequest is the request type for the Query/DisabledList RPC method. */ +export interface QueryDisabledListRequest { +} + +/** DisabledListResponse is the response type for the Query/DisabledList RPC method. */ +export interface DisabledListResponse { + disabledList: string[]; +} + +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { address: "" }; +} + +export const QueryAccountRequest: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseAccountResponse(): AccountResponse { + return { permission: undefined }; +} + +export const AccountResponse: MessageFns = { + encode(message: AccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.permission !== undefined) { + Permissions.encode(message.permission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.permission = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccountResponse { + return { permission: isSet(object.permission) ? Permissions.fromJSON(object.permission) : undefined }; + }, + + toJSON(message: AccountResponse): unknown { + const obj: any = {}; + if (message.permission !== undefined) { + obj.permission = Permissions.toJSON(message.permission); + } + return obj; + }, + + create, I>>(base?: I): AccountResponse { + return AccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccountResponse { + const message = createBaseAccountResponse(); + message.permission = (object.permission !== undefined && object.permission !== null) + ? Permissions.fromPartial(object.permission) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseAccountsResponse(): AccountsResponse { + return { accounts: [], pagination: undefined }; +} + +export const AccountsResponse: MessageFns = { + encode(message: AccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e: any) => GenesisAccountPermissions.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: AccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => GenesisAccountPermissions.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): AccountsResponse { + return AccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccountsResponse { + const message = createBaseAccountsResponse(); + message.accounts = object.accounts?.map((e) => GenesisAccountPermissions.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDisabledListRequest(): QueryDisabledListRequest { + return {}; +} + +export const QueryDisabledListRequest: MessageFns = { + encode(_: QueryDisabledListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDisabledListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDisabledListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryDisabledListRequest { + return {}; + }, + + toJSON(_: QueryDisabledListRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryDisabledListRequest { + return QueryDisabledListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryDisabledListRequest { + const message = createBaseQueryDisabledListRequest(); + return message; + }, +}; + +function createBaseDisabledListResponse(): DisabledListResponse { + return { disabledList: [] }; +} + +export const DisabledListResponse: MessageFns = { + encode(message: DisabledListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.disabledList) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DisabledListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDisabledListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.disabledList.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DisabledListResponse { + return { + disabledList: globalThis.Array.isArray(object?.disabledList) + ? object.disabledList.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: DisabledListResponse): unknown { + const obj: any = {}; + if (message.disabledList?.length) { + obj.disabledList = message.disabledList; + } + return obj; + }, + + create, I>>(base?: I): DisabledListResponse { + return DisabledListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DisabledListResponse { + const message = createBaseDisabledListResponse(); + message.disabledList = object.disabledList?.map((e) => e) || []; + return message; + }, +}; + +/** Query defines the circuit gRPC querier service. */ +export interface Query { + /** Account returns account permissions. */ + Account(request: QueryAccountRequest): Promise; + /** Account returns account permissions. */ + Accounts(request: QueryAccountsRequest): Promise; + /** DisabledList returns a list of disabled message urls */ + DisabledList(request: QueryDisabledListRequest): Promise; +} + +export const QueryServiceName = "cosmos.circuit.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 || QueryServiceName; + this.rpc = rpc; + this.Account = this.Account.bind(this); + this.Accounts = this.Accounts.bind(this); + this.DisabledList = this.DisabledList.bind(this); + } + Account(request: QueryAccountRequest): Promise { + const data = QueryAccountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Account", data); + return promise.then((data) => AccountResponse.decode(new BinaryReader(data))); + } + + Accounts(request: QueryAccountsRequest): Promise { + const data = QueryAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Accounts", data); + return promise.then((data) => AccountsResponse.decode(new BinaryReader(data))); + } + + DisabledList(request: QueryDisabledListRequest): Promise { + const data = QueryDisabledListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DisabledList", data); + return promise.then((data) => DisabledListResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/tx.ts new file mode 100644 index 00000000..1cc16218 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/tx.ts @@ -0,0 +1,566 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Permissions } from "./types"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. */ +export interface MsgAuthorizeCircuitBreaker { + /** + * granter is the granter of the circuit breaker permissions and must have + * LEVEL_SUPER_ADMIN. + */ + granter: string; + /** grantee is the account authorized with the provided permissions. */ + grantee: string; + /** + * permissions are the circuit breaker permissions that the grantee receives. + * These will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can + * be specified to revoke all permissions. + */ + permissions: Permissions | undefined; +} + +/** MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. */ +export interface MsgAuthorizeCircuitBreakerResponse { + success: boolean; +} + +/** MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. */ +export interface MsgTripCircuitBreaker { + /** authority is the account authorized to trip the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of type URLs to immediately stop processing. + * IF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY. + * This value is validated against the authority's permissions and if the + * authority does not have permissions to trip the specified msg type URLs + * (or all URLs), the operation will fail. + */ + msgTypeUrls: string[]; +} + +/** MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. */ +export interface MsgTripCircuitBreakerResponse { + success: boolean; +} + +/** MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. */ +export interface MsgResetCircuitBreaker { + /** authority is the account authorized to trip or reset the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of Msg type URLs to resume processing. If + * it is left empty all Msg processing for type URLs that the account is + * authorized to trip will resume. + */ + msgTypeUrls: string[]; +} + +/** MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. */ +export interface MsgResetCircuitBreakerResponse { + success: boolean; +} + +function createBaseMsgAuthorizeCircuitBreaker(): MsgAuthorizeCircuitBreaker { + return { granter: "", grantee: "", permissions: undefined }; +} + +export const MsgAuthorizeCircuitBreaker: MessageFns = { + encode(message: MsgAuthorizeCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAuthorizeCircuitBreaker { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, + }; + }, + + toJSON(message: MsgAuthorizeCircuitBreaker): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.permissions !== undefined) { + obj.permissions = Permissions.toJSON(message.permissions); + } + return obj; + }, + + create, I>>(base?: I): MsgAuthorizeCircuitBreaker { + return MsgAuthorizeCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgAuthorizeCircuitBreaker { + const message = createBaseMsgAuthorizeCircuitBreaker(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.permissions = (object.permissions !== undefined && object.permissions !== null) + ? Permissions.fromPartial(object.permissions) + : undefined; + return message; + }, +}; + +function createBaseMsgAuthorizeCircuitBreakerResponse(): MsgAuthorizeCircuitBreakerResponse { + return { success: false }; +} + +export const MsgAuthorizeCircuitBreakerResponse: MessageFns = { + encode(message: MsgAuthorizeCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAuthorizeCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgAuthorizeCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgAuthorizeCircuitBreakerResponse { + return MsgAuthorizeCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgAuthorizeCircuitBreakerResponse { + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +function createBaseMsgTripCircuitBreaker(): MsgTripCircuitBreaker { + return { authority: "", msgTypeUrls: [] }; +} + +export const MsgTripCircuitBreaker: MessageFns = { + encode(message: MsgTripCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgTripCircuitBreaker { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgTripCircuitBreaker): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): MsgTripCircuitBreaker { + return MsgTripCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgTripCircuitBreaker { + const message = createBaseMsgTripCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgTripCircuitBreakerResponse(): MsgTripCircuitBreakerResponse { + return { success: false }; +} + +export const MsgTripCircuitBreakerResponse: MessageFns = { + encode(message: MsgTripCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgTripCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgTripCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>(base?: I): MsgTripCircuitBreakerResponse { + return MsgTripCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgTripCircuitBreakerResponse { + const message = createBaseMsgTripCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +function createBaseMsgResetCircuitBreaker(): MsgResetCircuitBreaker { + return { authority: "", msgTypeUrls: [] }; +} + +export const MsgResetCircuitBreaker: MessageFns = { + encode(message: MsgResetCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgResetCircuitBreaker { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgResetCircuitBreaker): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): MsgResetCircuitBreaker { + return MsgResetCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgResetCircuitBreaker { + const message = createBaseMsgResetCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgResetCircuitBreakerResponse(): MsgResetCircuitBreakerResponse { + return { success: false }; +} + +export const MsgResetCircuitBreakerResponse: MessageFns = { + encode(message: MsgResetCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgResetCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgResetCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>(base?: I): MsgResetCircuitBreakerResponse { + return MsgResetCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgResetCircuitBreakerResponse { + const message = createBaseMsgResetCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +/** Msg defines the circuit Msg service. */ +export interface Msg { + /** + * AuthorizeCircuitBreaker allows a super-admin to grant (or revoke) another + * account's circuit breaker permissions. + */ + AuthorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise; + /** TripCircuitBreaker pauses processing of Msg's in the state machine. */ + TripCircuitBreaker(request: MsgTripCircuitBreaker): Promise; + /** + * ResetCircuitBreaker resumes processing of Msg's in the state machine that + * have been been paused using TripCircuitBreaker. + */ + ResetCircuitBreaker(request: MsgResetCircuitBreaker): Promise; +} + +export const MsgServiceName = "cosmos.circuit.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 || MsgServiceName; + this.rpc = rpc; + this.AuthorizeCircuitBreaker = this.AuthorizeCircuitBreaker.bind(this); + this.TripCircuitBreaker = this.TripCircuitBreaker.bind(this); + this.ResetCircuitBreaker = this.ResetCircuitBreaker.bind(this); + } + AuthorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise { + const data = MsgAuthorizeCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizeCircuitBreaker", data); + return promise.then((data) => MsgAuthorizeCircuitBreakerResponse.decode(new BinaryReader(data))); + } + + TripCircuitBreaker(request: MsgTripCircuitBreaker): Promise { + const data = MsgTripCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "TripCircuitBreaker", data); + return promise.then((data) => MsgTripCircuitBreakerResponse.decode(new BinaryReader(data))); + } + + ResetCircuitBreaker(request: MsgResetCircuitBreaker): Promise { + const data = MsgResetCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "ResetCircuitBreaker", data); + return promise.then((data) => MsgResetCircuitBreakerResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/types.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/types.ts new file mode 100644 index 00000000..6810f76c --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/circuit/v1/types.ts @@ -0,0 +1,356 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** + * Permissions are the permissions that an account has to trip + * or reset the circuit breaker. + */ +export interface Permissions { + /** level is the level of permissions granted to this account. */ + level: Permissions_Level; + /** + * limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type + * URLs that the account can trip. It is an error to use limit_type_urls with + * a level other than LEVEL_SOME_MSGS. + */ + limitTypeUrls: string[]; +} + +/** Level is the permission level. */ +export enum Permissions_Level { + /** + * LEVEL_NONE_UNSPECIFIED - LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit + * breaker permissions. + */ + LEVEL_NONE_UNSPECIFIED = 0, + /** + * LEVEL_SOME_MSGS - LEVEL_SOME_MSGS indicates that the account will have permission to + * trip or reset the circuit breaker for some Msg type URLs. If this level + * is chosen, a non-empty list of Msg type URLs must be provided in + * limit_type_urls. + */ + LEVEL_SOME_MSGS = 1, + /** + * LEVEL_ALL_MSGS - LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit + * breaker for Msg's of all type URLs. + */ + LEVEL_ALL_MSGS = 2, + /** + * LEVEL_SUPER_ADMIN - LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker + * actions and can grant permissions to other accounts. + */ + LEVEL_SUPER_ADMIN = 3, + UNRECOGNIZED = -1, +} + +export function permissions_LevelFromJSON(object: any): Permissions_Level { + switch (object) { + case 0: + case "LEVEL_NONE_UNSPECIFIED": + return Permissions_Level.LEVEL_NONE_UNSPECIFIED; + case 1: + case "LEVEL_SOME_MSGS": + return Permissions_Level.LEVEL_SOME_MSGS; + case 2: + case "LEVEL_ALL_MSGS": + return Permissions_Level.LEVEL_ALL_MSGS; + case 3: + case "LEVEL_SUPER_ADMIN": + return Permissions_Level.LEVEL_SUPER_ADMIN; + case -1: + case "UNRECOGNIZED": + default: + return Permissions_Level.UNRECOGNIZED; + } +} + +export function permissions_LevelToJSON(object: Permissions_Level): string { + switch (object) { + case Permissions_Level.LEVEL_NONE_UNSPECIFIED: + return "LEVEL_NONE_UNSPECIFIED"; + case Permissions_Level.LEVEL_SOME_MSGS: + return "LEVEL_SOME_MSGS"; + case Permissions_Level.LEVEL_ALL_MSGS: + return "LEVEL_ALL_MSGS"; + case Permissions_Level.LEVEL_SUPER_ADMIN: + return "LEVEL_SUPER_ADMIN"; + case Permissions_Level.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** GenesisAccountPermissions is the account permissions for the circuit breaker in genesis */ +export interface GenesisAccountPermissions { + address: string; + permissions: Permissions | undefined; +} + +/** GenesisState is the state that must be provided at genesis. */ +export interface GenesisState { + accountPermissions: GenesisAccountPermissions[]; + disabledTypeUrls: string[]; +} + +function createBasePermissions(): Permissions { + return { level: 0, limitTypeUrls: [] }; +} + +export const Permissions: MessageFns = { + encode(message: Permissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.level !== 0) { + writer.uint32(8).int32(message.level); + } + for (const v of message.limitTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Permissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermissions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.level = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.limitTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Permissions { + return { + level: isSet(object.level) ? permissions_LevelFromJSON(object.level) : 0, + limitTypeUrls: globalThis.Array.isArray(object?.limitTypeUrls) + ? object.limitTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Permissions): unknown { + const obj: any = {}; + if (message.level !== 0) { + obj.level = permissions_LevelToJSON(message.level); + } + if (message.limitTypeUrls?.length) { + obj.limitTypeUrls = message.limitTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): Permissions { + return Permissions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Permissions { + const message = createBasePermissions(); + message.level = object.level ?? 0; + message.limitTypeUrls = object.limitTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGenesisAccountPermissions(): GenesisAccountPermissions { + return { address: "", permissions: undefined }; +} + +export const GenesisAccountPermissions: MessageFns = { + encode(message: GenesisAccountPermissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisAccountPermissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisAccountPermissions(); + 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 !== 18) { + break; + } + + message.permissions = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisAccountPermissions { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, + }; + }, + + toJSON(message: GenesisAccountPermissions): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.permissions !== undefined) { + obj.permissions = Permissions.toJSON(message.permissions); + } + return obj; + }, + + create, I>>(base?: I): GenesisAccountPermissions { + return GenesisAccountPermissions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisAccountPermissions { + const message = createBaseGenesisAccountPermissions(); + message.address = object.address ?? ""; + message.permissions = (object.permissions !== undefined && object.permissions !== null) + ? Permissions.fromPartial(object.permissions) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { accountPermissions: [], disabledTypeUrls: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accountPermissions) { + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.disabledTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.accountPermissions.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.disabledTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + accountPermissions: globalThis.Array.isArray(object?.accountPermissions) + ? object.accountPermissions.map((e: any) => GenesisAccountPermissions.fromJSON(e)) + : [], + disabledTypeUrls: globalThis.Array.isArray(object?.disabledTypeUrls) + ? object.disabledTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.accountPermissions?.length) { + obj.accountPermissions = message.accountPermissions.map((e) => GenesisAccountPermissions.toJSON(e)); + } + if (message.disabledTypeUrls?.length) { + obj.disabledTypeUrls = message.disabledTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.accountPermissions = object.accountPermissions?.map((e) => GenesisAccountPermissions.fromPartial(e)) || []; + message.disabledTypeUrls = object.disabledTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/module/v1/module.ts new file mode 100644 index 00000000..97a0d394 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.consensus.module.v1"; + +/** Module is the config object of the consensus module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/v1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/v1/query.ts new file mode 100644 index 00000000..3fe04bb9 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/v1/query.ts @@ -0,0 +1,180 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ConsensusParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponse { + /** + * params are the tendermint consensus params stored in the consensus module. + * Please note that `params.version` is not populated in this response, it is + * tracked separately in the x/upgrade module. + */ + params: ConsensusParams | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + ConsensusParams.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = ConsensusParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? ConsensusParams.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = ConsensusParams.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) + ? ConsensusParams.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/consensus module. */ + Params(request: QueryParamsRequest): Promise; +} + +export const QueryServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/v1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/v1/tx.ts new file mode 100644 index 00000000..c95b67fe --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/consensus/v1/tx.ts @@ -0,0 +1,266 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ABCIParams, BlockParams, EvidenceParams, ValidatorParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/consensus parameters to update. + * VersionsParams is not included in this Msg because it is tracked + * separarately in x/upgrade. + * + * NOTE: All parameters must be supplied. + */ + block: BlockParams | undefined; + evidence: EvidenceParams | undefined; + validator: + | ValidatorParams + | undefined; + /** Since: cosmos-sdk 0.50 */ + abci: ABCIParams | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", block: undefined, evidence: undefined, validator: undefined, abci: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + 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 ?? ""; + 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.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the consensus Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/consensus module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/module/v1/module.ts new file mode 100644 index 00000000..3ae9a625 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/module/v1/module.ts @@ -0,0 +1,117 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crisis.module.v1"; + +/** Module is the config object of the crisis module. */ +export interface Module { + /** fee_collector_name is the name of the FeeCollector ModuleAccount. */ + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts new file mode 100644 index 00000000..4ebe6590 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts @@ -0,0 +1,104 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + */ + constantFee: Coin | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { constantFee: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 26) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/v1beta1/tx.ts new file mode 100644 index 00000000..90d17bf8 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crisis/v1beta1/tx.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.crisis.v1beta1"; + +/** MsgVerifyInvariant represents a message to verify a particular invariance. */ +export interface MsgVerifyInvariant { + /** sender is the account address of private key to send coins to fee collector account. */ + sender: string; + /** name of the invariant module. */ + invariantModuleName: string; + /** invariant_route is the msg's invariant route. */ + invariantRoute: string; +} + +/** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ +export interface MsgVerifyInvariantResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** constant_fee defines the x/crisis parameter. */ + constantFee: Coin | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { + return { sender: "", invariantModuleName: "", invariantRoute: "" }; +} + +export const MsgVerifyInvariant: MessageFns = { + encode(message: MsgVerifyInvariant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.invariantModuleName !== "") { + writer.uint32(18).string(message.invariantModuleName); + } + if (message.invariantRoute !== "") { + writer.uint32(26).string(message.invariantRoute); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.invariantModuleName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.invariantRoute = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVerifyInvariant { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + invariantModuleName: isSet(object.invariantModuleName) ? globalThis.String(object.invariantModuleName) : "", + invariantRoute: isSet(object.invariantRoute) ? globalThis.String(object.invariantRoute) : "", + }; + }, + + toJSON(message: MsgVerifyInvariant): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.invariantModuleName !== "") { + obj.invariantModuleName = message.invariantModuleName; + } + if (message.invariantRoute !== "") { + obj.invariantRoute = message.invariantRoute; + } + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariant { + return MsgVerifyInvariant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVerifyInvariant { + const message = createBaseMsgVerifyInvariant(); + message.sender = object.sender ?? ""; + message.invariantModuleName = object.invariantModuleName ?? ""; + message.invariantRoute = object.invariantRoute ?? ""; + return message; + }, +}; + +function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { + return {}; +} + +export const MsgVerifyInvariantResponse: MessageFns = { + encode(_: MsgVerifyInvariantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVerifyInvariantResponse { + return {}; + }, + + toJSON(_: MsgVerifyInvariantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariantResponse { + return MsgVerifyInvariantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVerifyInvariantResponse { + const message = createBaseMsgVerifyInvariantResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", constantFee: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + 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 ?? ""; + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** VerifyInvariant defines a method to verify a particular invariant. */ + VerifyInvariant(request: MsgVerifyInvariant): Promise; + /** + * UpdateParams defines a governance operation for updating the x/crisis module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.crisis.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 || MsgServiceName; + this.rpc = rpc; + this.VerifyInvariant = this.VerifyInvariant.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/ed25519/keys.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 00000000..59fab7e6 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,193 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/ed25519/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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; +} + +/** + * 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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/hd/v1/hd.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/hd/v1/hd.ts new file mode 100644 index 00000000..55be1b9c --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/hd/v1/hd.ts @@ -0,0 +1,173 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/hd/v1/hd.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crypto.hd.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + coinType: 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 */ + addressIndex: number; +} + +function createBaseBIP44Params(): BIP44Params { + return { purpose: 0, coinType: 0, account: 0, change: false, addressIndex: 0 }; +} + +export const BIP44Params: MessageFns = { + encode(message: BIP44Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.purpose !== 0) { + writer.uint32(8).uint32(message.purpose); + } + if (message.coinType !== 0) { + writer.uint32(16).uint32(message.coinType); + } + if (message.account !== 0) { + writer.uint32(24).uint32(message.account); + } + if (message.change !== false) { + writer.uint32(32).bool(message.change); + } + if (message.addressIndex !== 0) { + writer.uint32(40).uint32(message.addressIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BIP44Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.purpose = reader.uint32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.coinType = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.account = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.change = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.addressIndex = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BIP44Params { + return { + purpose: isSet(object.purpose) ? globalThis.Number(object.purpose) : 0, + coinType: isSet(object.coinType) ? globalThis.Number(object.coinType) : 0, + account: isSet(object.account) ? globalThis.Number(object.account) : 0, + change: isSet(object.change) ? globalThis.Boolean(object.change) : false, + addressIndex: isSet(object.addressIndex) ? globalThis.Number(object.addressIndex) : 0, + }; + }, + + toJSON(message: BIP44Params): unknown { + const obj: any = {}; + if (message.purpose !== 0) { + obj.purpose = Math.round(message.purpose); + } + if (message.coinType !== 0) { + obj.coinType = Math.round(message.coinType); + } + if (message.account !== 0) { + obj.account = Math.round(message.account); + } + if (message.change !== false) { + obj.change = message.change; + } + if (message.addressIndex !== 0) { + obj.addressIndex = Math.round(message.addressIndex); + } + return obj; + }, + + create, I>>(base?: I): BIP44Params { + return BIP44Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BIP44Params { + const message = createBaseBIP44Params(); + message.purpose = object.purpose ?? 0; + message.coinType = object.coinType ?? 0; + message.account = object.account ?? 0; + message.change = object.change ?? false; + message.addressIndex = object.addressIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/keyring/v1/record.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/keyring/v1/record.ts new file mode 100644 index 00000000..d6e83b43 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/keyring/v1/record.ts @@ -0,0 +1,432 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/keyring/v1/record.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { BIP44Params } from "../../hd/v1/hd"; + +export const protobufPackage = "cosmos.crypto.keyring.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + pubKey: + | Any + | undefined; + /** local stores the private key locally. */ + local?: + | Record_Local + | undefined; + /** ledger stores the information about a Ledger key. */ + ledger?: + | Record_Ledger + | undefined; + /** Multi does not store any other information. */ + multi?: + | Record_Multi + | undefined; + /** Offline does not store any other information. */ + offline?: Record_Offline | undefined; +} + +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_Local { + privKey: Any | undefined; +} + +/** Ledger item */ +export interface Record_Ledger { + path: BIP44Params | undefined; +} + +/** Multi item */ +export interface Record_Multi { +} + +/** Offline item */ +export interface Record_Offline { +} + +function createBaseRecord(): Record { + return { name: "", pubKey: undefined, local: undefined, ledger: undefined, multi: undefined, offline: undefined }; +} + +export const Record: MessageFns = { + encode(message: Record, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.local !== undefined) { + Record_Local.encode(message.local, writer.uint32(26).fork()).join(); + } + if (message.ledger !== undefined) { + Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).join(); + } + if (message.multi !== undefined) { + Record_Multi.encode(message.multi, writer.uint32(42).fork()).join(); + } + if (message.offline !== undefined) { + Record_Offline.encode(message.offline, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.local = Record_Local.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.ledger = Record_Ledger.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.multi = Record_Multi.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.offline = Record_Offline.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : 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 = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.local !== undefined) { + obj.local = Record_Local.toJSON(message.local); + } + if (message.ledger !== undefined) { + obj.ledger = Record_Ledger.toJSON(message.ledger); + } + if (message.multi !== undefined) { + obj.multi = Record_Multi.toJSON(message.multi); + } + if (message.offline !== undefined) { + obj.offline = Record_Offline.toJSON(message.offline); + } + return obj; + }, + + create, I>>(base?: I): Record { + return Record.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record { + const message = createBaseRecord(); + message.name = object.name ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : 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 { privKey: undefined }; +} + +export const Record_Local: MessageFns = { + encode(message: Record_Local, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.privKey !== undefined) { + Any.encode(message.privKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Local { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.privKey = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record_Local { + return { privKey: isSet(object.privKey) ? Any.fromJSON(object.privKey) : undefined }; + }, + + toJSON(message: Record_Local): unknown { + const obj: any = {}; + if (message.privKey !== undefined) { + obj.privKey = Any.toJSON(message.privKey); + } + return obj; + }, + + create, I>>(base?: I): Record_Local { + return Record_Local.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record_Local { + const message = createBaseRecord_Local(); + message.privKey = (object.privKey !== undefined && object.privKey !== null) + ? Any.fromPartial(object.privKey) + : undefined; + return message; + }, +}; + +function createBaseRecord_Ledger(): Record_Ledger { + return { path: undefined }; +} + +export const Record_Ledger: MessageFns = { + encode(message: Record_Ledger, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined) { + BIP44Params.encode(message.path, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Ledger { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = BIP44Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.path !== undefined) { + obj.path = BIP44Params.toJSON(message.path); + } + return obj; + }, + + create, I>>(base?: I): Record_Ledger { + return Record_Ledger.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: Record_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Multi { + return {}; + }, + + toJSON(_: Record_Multi): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Multi { + return Record_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, +}; + +function createBaseRecord_Offline(): Record_Offline { + return {}; +} + +export const Record_Offline: MessageFns = { + encode(_: Record_Offline, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Offline { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Offline { + return {}; + }, + + toJSON(_: Record_Offline): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Offline { + return Record_Offline.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/multisig/keys.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/multisig/keys.ts new file mode 100644 index 00000000..3aacbfda --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + publicKeys: Any[]; +} + +function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { + return { threshold: 0, publicKeys: [] }; +} + +export const LegacyAminoPubKey: MessageFns = { + encode(message: LegacyAminoPubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.publicKeys) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LegacyAminoPubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.threshold = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKeys.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyAminoPubKey { + return { + threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0, + publicKeys: globalThis.Array.isArray(object?.publicKeys) + ? object.publicKeys.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LegacyAminoPubKey): unknown { + const obj: any = {}; + if (message.threshold !== 0) { + obj.threshold = Math.round(message.threshold); + } + if (message.publicKeys?.length) { + obj.publicKeys = message.publicKeys.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LegacyAminoPubKey { + return LegacyAminoPubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.publicKeys = object.publicKeys?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 00000000..4f9b99a2 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/v1beta1/multisig.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 { + extraBitsStored: number; + elems: Uint8Array; +} + +function createBaseMultiSignature(): MultiSignature { + return { signatures: [] }; +} + +export const MultiSignature: MessageFns = { + encode(message: MultiSignature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiSignature { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: MultiSignature): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MultiSignature { + return MultiSignature.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCompactBitArray(): CompactBitArray { + return { extraBitsStored: 0, elems: new Uint8Array(0) }; +} + +export const CompactBitArray: MessageFns = { + encode(message: CompactBitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompactBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.extraBitsStored = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.elems = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompactBitArray { + return { + extraBitsStored: isSet(object.extraBitsStored) ? globalThis.Number(object.extraBitsStored) : 0, + elems: isSet(object.elems) ? bytesFromBase64(object.elems) : new Uint8Array(0), + }; + }, + + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + if (message.extraBitsStored !== 0) { + obj.extraBitsStored = Math.round(message.extraBitsStored); + } + if (message.elems.length !== 0) { + obj.elems = base64FromBytes(message.elems); + } + return obj; + }, + + create, I>>(base?: I): CompactBitArray { + return CompactBitArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extraBitsStored = object.extraBitsStored ?? 0; + message.elems = object.elems ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/secp256k1/keys.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 00000000..7f79f331 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256k1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/secp256r1/keys.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 00000000..54922e63 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,191 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256r1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { secret: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.secret = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { secret: isSet(object.secret) ? bytesFromBase64(object.secret) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.secret.length !== 0) { + obj.secret = base64FromBytes(message.secret); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/module/v1/module.ts new file mode 100644 index 00000000..23f8378a --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.distribution.module.v1"; + +/** Module is the config object of the distribution module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..f23cc1d6 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1149 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/distribution.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled !== false) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? globalThis.String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? globalThis.String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? globalThis.String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? globalThis.Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled !== false) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards: MessageFns = { + encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: globalThis.Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? globalThis.Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 0; + return message; + }, +}; + +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { rewards: [], period: 0 }; +} + +export const ValidatorCurrentRewards: MessageFns = { + encode(message: ValidatorCurrentRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommission { + return { + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorAccumulatedCommission): unknown { + const obj: any = {}; + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent: MessageFns = { + encode(message: ValidatorSlashEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? globalThis.Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? globalThis.String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents: MessageFns = { + encode(message: ValidatorSlashEvents, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSlashEvents) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvents(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool: MessageFns = { + encode(message: FeePool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.communityPool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeePool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: globalThis.Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { title: "", description: "", recipient: "", amount: [] }; +} + +export const CommunityPoolSpendProposal: MessageFns = { + encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommunityPoolSpendProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo: MessageFns = { + encode(message: DelegatorStartingInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (message.height !== 0) { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? globalThis.Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? globalThis.String(object.stake) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward: MessageFns = { + encode(message: DelegationDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + reward: globalThis.Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + message.reward = object.reward?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { title: "", description: "", recipient: "", amount: "", deposit: "" }; +} + +export const CommunityPoolSpendProposalWithDeposit: MessageFns = { + encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposalWithDeposit { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + deposit: isSet(object.deposit) ? globalThis.String(object.deposit) : "", + }; + }, + + toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..16d378f9 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1000 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo: MessageFns = { + encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord: MessageFns = { + encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord: MessageFns = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.accumulated !== undefined) { + ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommissionRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord: MessageFns = { + encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + if (message.rewards !== undefined) { + ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord: MessageFns = { + encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.rewards !== undefined) { + ValidatorCurrentRewards.encode(message.rewards, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord: MessageFns = { + encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord: MessageFns = { + encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).join(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.validatorSlashEvents) { + ValidatorSlashEventRecord.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: globalThis.Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? globalThis.String(object.previousProposer) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: globalThis.Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: globalThis.Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: globalThis.Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: globalThis.Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..9d32e8cb --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1674 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest: MessageFns = { + encode(message: QueryValidatorDistributionInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse: MessageFns = { + encode(message: QueryValidatorDistributionInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + selfBondRewards: globalThis.Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { + return { rewards: undefined }; +} + +export const QueryValidatorOutstandingRewardsResponse: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rewards !== undefined) { + ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest: MessageFns = { + encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { + return { commission: undefined }; +} + +export const QueryValidatorCommissionResponse: MessageFns = { + encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commission !== undefined) { + ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest: MessageFns = { + encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? globalThis.Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? globalThis.Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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: MessageFns = { + encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.slashes) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesResponse { + return { + slashes: globalThis.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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest: MessageFns = { + encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { + return { rewards: [] }; +} + +export const QueryDelegationRewardsResponse: MessageFns = { + encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest: MessageFns = { + encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { + return { rewards: [], total: [] }; +} + +export const QueryDelegationTotalRewardsResponse: MessageFns = { + encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.total) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) + ? object.rewards.map((e: any) => DelegationDelegatorReward.fromJSON(e)) + : [], + total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationTotalRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [] }; +} + +export const QueryDelegatorValidatorsResponse: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} + +export const QueryCommunityPoolRequest: MessageFns = { + encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, +}; + +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { pool: [] }; +} + +export const QueryCommunityPoolResponse: MessageFns = { + encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommunityPoolResponse { + return { pool: globalThis.Array.isArray(object?.pool) ? object.pool.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryCommunityPoolResponse): unknown { + const obj: any = {}; + if (message.pool?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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 BinaryReader(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..bf362224 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1161 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress: MessageFns = { + encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} + +export const MsgSetWithdrawAddressResponse: MessageFns = { + encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward: MessageFns = { + encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return { amount: [] }; +} + +export const MsgWithdrawDelegatorRewardResponse: MessageFns = { + encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorRewardResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawDelegatorRewardResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission: MessageFns = { + encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return { amount: [] }; +} + +export const MsgWithdrawValidatorCommissionResponse: MessageFns = { + encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommissionResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MsgFundCommunityPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgFundCommunityPool { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: MsgFundCommunityPool): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend: MessageFns = { + encode(message: MsgCommunityPoolSpend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse: MessageFns = { + encode(_: MsgCommunityPoolSpendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool: MessageFns = { + encode(message: MsgDepositValidatorRewardsPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse: MessageFns = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(new BinaryReader(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/module/v1/module.ts new file mode 100644 index 00000000..f92e0da7 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.evidence.module.v1"; + +/** Module is the config object of the evidence module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts index 37699dd6..16d4bb94 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/evidence.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Timestamp } from "../../../google/protobuf/timestamp"; export const protobufPackage = "cosmos.evidence.v1beta1"; @@ -26,13 +31,13 @@ function createBaseEquivocation(): Equivocation { return { height: 0, time: undefined, power: 0, consensusAddress: "" }; } -export const Equivocation = { - encode(message: Equivocation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Equivocation: MessageFns = { + encode(message: Equivocation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.height !== 0) { writer.uint32(8).int64(message.height); } if (message.time !== undefined) { - Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); } if (message.power !== 0) { writer.uint32(24).int64(message.power); @@ -43,8 +48,8 @@ export const Equivocation = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Equivocation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Equivocation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEquivocation(); while (reader.pos < end) { @@ -55,7 +60,7 @@ export const Equivocation = { break; } - message.height = longToNumber(reader.int64() as Long); + message.height = longToNumber(reader.int64()); continue; case 2: if (tag !== 18) { @@ -69,7 +74,7 @@ export const Equivocation = { break; } - message.power = longToNumber(reader.int64() as Long); + message.power = longToNumber(reader.int64()); continue; case 4: if (tag !== 34) { @@ -82,17 +87,17 @@ export const Equivocation = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Equivocation { return { - height: isSet(object.height) ? Number(object.height) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, - power: isSet(object.power) ? Number(object.power) : 0, - consensusAddress: isSet(object.consensusAddress) ? String(object.consensusAddress) : "", + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + consensusAddress: isSet(object.consensusAddress) ? globalThis.String(object.consensusAddress) : "", }; }, @@ -126,29 +131,11 @@ export const Equivocation = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -157,7 +144,7 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; function toTimestamp(date: Date): Timestamp { - const seconds = date.getTime() / 1_000; + const seconds = Math.trunc(date.getTime() / 1_000); const nanos = (date.getTime() % 1_000) * 1_000_000; return { seconds, nanos }; } @@ -165,31 +152,39 @@ function toTimestamp(date: Date): Timestamp { function fromTimestamp(t: Timestamp): Date { let millis = (t.seconds || 0) * 1_000; millis += (t.nanos || 0) / 1_000_000; - return new Date(millis); + 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)); } } -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts index dc785701..5d6dc17a 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/genesis.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Any } from "../../../google/protobuf/any"; export const protobufPackage = "cosmos.evidence.v1beta1"; @@ -14,16 +20,16 @@ function createBaseGenesisState(): GenesisState { return { evidence: [] }; } -export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.evidence) { - Any.encode(v!, writer.uint32(10).fork()).ldelim(); + Any.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisState(); while (reader.pos < end) { @@ -40,13 +46,15 @@ export const GenesisState = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GenesisState { - return { evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [] }; + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + }; }, toJSON(message: GenesisState): unknown { @@ -70,10 +78,20 @@ 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; type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/query.ts index dcd6a410..41408c8a 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/query.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/query.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/query.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Any } from "../../../google/protobuf/any"; import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; @@ -52,8 +58,8 @@ function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { return { evidenceHash: new Uint8Array(0), hash: "" }; } -export const QueryEvidenceRequest = { - encode(message: QueryEvidenceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryEvidenceRequest: MessageFns = { + encode(message: QueryEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.evidenceHash.length !== 0) { writer.uint32(10).bytes(message.evidenceHash); } @@ -63,8 +69,8 @@ export const QueryEvidenceRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryEvidenceRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryEvidenceRequest(); while (reader.pos < end) { @@ -88,7 +94,7 @@ export const QueryEvidenceRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -96,7 +102,7 @@ export const QueryEvidenceRequest = { fromJSON(object: any): QueryEvidenceRequest { return { evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), - hash: isSet(object.hash) ? String(object.hash) : "", + hash: isSet(object.hash) ? globalThis.String(object.hash) : "", }; }, @@ -126,16 +132,16 @@ function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { return { evidence: undefined }; } -export const QueryEvidenceResponse = { - encode(message: QueryEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryEvidenceResponse: MessageFns = { + encode(message: QueryEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.evidence !== undefined) { - Any.encode(message.evidence, writer.uint32(10).fork()).ldelim(); + Any.encode(message.evidence, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryEvidenceResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryEvidenceResponse(); while (reader.pos < end) { @@ -152,7 +158,7 @@ export const QueryEvidenceResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -185,16 +191,16 @@ function createBaseQueryAllEvidenceRequest(): QueryAllEvidenceRequest { return { pagination: undefined }; } -export const QueryAllEvidenceRequest = { - encode(message: QueryAllEvidenceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllEvidenceRequest: MessageFns = { + encode(message: QueryAllEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEvidenceRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllEvidenceRequest(); while (reader.pos < end) { @@ -211,7 +217,7 @@ export const QueryAllEvidenceRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -244,19 +250,19 @@ function createBaseQueryAllEvidenceResponse(): QueryAllEvidenceResponse { return { evidence: [], pagination: undefined }; } -export const QueryAllEvidenceResponse = { - encode(message: QueryAllEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllEvidenceResponse: MessageFns = { + encode(message: QueryAllEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.evidence) { - Any.encode(v!, writer.uint32(10).fork()).ldelim(); + Any.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEvidenceResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllEvidenceResponse(); while (reader.pos < end) { @@ -280,14 +286,14 @@ export const QueryAllEvidenceResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAllEvidenceResponse { return { - evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, @@ -337,13 +343,13 @@ export class QueryClientImpl implements Query { 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(_m0.Reader.create(data))); + return promise.then((data) => QueryEvidenceResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryAllEvidenceResponse.decode(new BinaryReader(data))); } } @@ -351,30 +357,11 @@ interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -384,21 +371,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -409,3 +397,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/tx.ts index 936453b4..04c14d2d 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/tx.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/evidence/v1beta1/tx.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/tx.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Any } from "../../../google/protobuf/any"; export const protobufPackage = "cosmos.evidence.v1beta1"; @@ -25,19 +31,19 @@ function createBaseMsgSubmitEvidence(): MsgSubmitEvidence { return { submitter: "", evidence: undefined }; } -export const MsgSubmitEvidence = { - encode(message: MsgSubmitEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSubmitEvidence: MessageFns = { + encode(message: MsgSubmitEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.submitter !== "") { writer.uint32(10).string(message.submitter); } if (message.evidence !== undefined) { - Any.encode(message.evidence, writer.uint32(18).fork()).ldelim(); + Any.encode(message.evidence, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitEvidence { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitEvidence(); while (reader.pos < end) { @@ -61,14 +67,14 @@ export const MsgSubmitEvidence = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgSubmitEvidence { return { - submitter: isSet(object.submitter) ? String(object.submitter) : "", + submitter: isSet(object.submitter) ? globalThis.String(object.submitter) : "", evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined, }; }, @@ -101,16 +107,16 @@ function createBaseMsgSubmitEvidenceResponse(): MsgSubmitEvidenceResponse { return { hash: new Uint8Array(0) }; } -export const MsgSubmitEvidenceResponse = { - encode(message: MsgSubmitEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSubmitEvidenceResponse: MessageFns = { + encode(message: MsgSubmitEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitEvidenceResponse(); while (reader.pos < end) { @@ -127,7 +133,7 @@ export const MsgSubmitEvidenceResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -175,7 +181,7 @@ export class MsgClientImpl implements Msg { 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(_m0.Reader.create(data))); + return promise.then((data) => MsgSubmitEvidenceResponse.decode(new BinaryReader(data))); } } @@ -183,30 +189,11 @@ interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -216,21 +203,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -241,3 +229,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/module/v1/module.ts new file mode 100644 index 00000000..386f9d26 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.feegrant.module.v1"; + +/** Module is the config object of the feegrant module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts new file mode 100644 index 00000000..9c002d76 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/feegrant.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 coins + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowance { + /** + * spend_limit specifies the maximum amount of coins that can be spent + * by this allowance and will be updated as coins are spent. If it is + * empty, there is no spend limit and any amount of coins can be spent. + */ + spendLimit: Coin[]; + /** expiration specifies an optional time when this allowance expires */ + expiration: Date | undefined; +} + +/** + * 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 + | undefined; + /** + * period specifies the time duration in which period_spend_limit coins can + * be spent before that allowance is reset + */ + period: + | Duration + | undefined; + /** + * period_spend_limit specifies the maximum number of coins that can be spent + * in the period + */ + periodSpendLimit: Coin[]; + /** period_can_spend is the number of coins left to be spent before the period_reset time */ + periodCanSpend: 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 + */ + periodReset: Date | undefined; +} + +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowance { + /** allowance can be any of basic and periodic fee allowance. */ + allowance: + | Any + | undefined; + /** allowed_messages are the messages for which the grantee has the access. */ + allowedMessages: 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 | undefined; +} + +function createBaseBasicAllowance(): BasicAllowance { + return { spendLimit: [], expiration: undefined }; +} + +export const BasicAllowance: MessageFns = { + encode(message: BasicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BasicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BasicAllowance { + return { + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: BasicAllowance): unknown { + const obj: any = {}; + if (message.spendLimit?.length) { + obj.spendLimit = message.spendLimit.map((e) => Coin.toJSON(e)); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): BasicAllowance { + return BasicAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBasePeriodicAllowance(): PeriodicAllowance { + return { basic: undefined, period: undefined, periodSpendLimit: [], periodCanSpend: [], periodReset: undefined }; +} + +export const PeriodicAllowance: MessageFns = { + encode(message: PeriodicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.basic !== undefined) { + BasicAllowance.encode(message.basic, writer.uint32(10).fork()).join(); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(18).fork()).join(); + } + for (const v of message.periodSpendLimit) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.periodCanSpend) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.periodReset !== undefined) { + Timestamp.encode(toTimestamp(message.periodReset), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.basic = BasicAllowance.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.period = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.periodSpendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.periodCanSpend.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.periodReset = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + periodSpendLimit: globalThis.Array.isArray(object?.periodSpendLimit) + ? object.periodSpendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + periodCanSpend: globalThis.Array.isArray(object?.periodCanSpend) + ? object.periodCanSpend.map((e: any) => Coin.fromJSON(e)) + : [], + periodReset: isSet(object.periodReset) ? fromJsonTimestamp(object.periodReset) : undefined, + }; + }, + + toJSON(message: PeriodicAllowance): unknown { + const obj: any = {}; + if (message.basic !== undefined) { + obj.basic = BasicAllowance.toJSON(message.basic); + } + if (message.period !== undefined) { + obj.period = Duration.toJSON(message.period); + } + if (message.periodSpendLimit?.length) { + obj.periodSpendLimit = message.periodSpendLimit.map((e) => Coin.toJSON(e)); + } + if (message.periodCanSpend?.length) { + obj.periodCanSpend = message.periodCanSpend.map((e) => Coin.toJSON(e)); + } + if (message.periodReset !== undefined) { + obj.periodReset = message.periodReset.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): PeriodicAllowance { + return PeriodicAllowance.fromPartial(base ?? ({} as any)); + }, + 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.periodSpendLimit = object.periodSpendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.periodCanSpend = object.periodCanSpend?.map((e) => Coin.fromPartial(e)) || []; + message.periodReset = object.periodReset ?? undefined; + return message; + }, +}; + +function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { + return { allowance: undefined, allowedMessages: [] }; +} + +export const AllowedMsgAllowance: MessageFns = { + encode(message: AllowedMsgAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(10).fork()).join(); + } + for (const v of message.allowedMessages) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AllowedMsgAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowedMessages.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AllowedMsgAllowance { + return { + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + allowedMessages: globalThis.Array.isArray(object?.allowedMessages) + ? object.allowedMessages.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: AllowedMsgAllowance): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + if (message.allowedMessages?.length) { + obj.allowedMessages = message.allowedMessages; + } + return obj; + }, + + create, I>>(base?: I): AllowedMsgAllowance { + return AllowedMsgAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + message.allowedMessages = object.allowedMessages?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGrant(): Grant { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const Grant: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Grant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts new file mode 100644 index 00000000..14bfd526 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + allowances: globalThis.Array.isArray(object?.allowances) + ? object.allowances.map((e: any) => Grant.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.allowances?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 00000000..3f0c781d --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,586 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterResponse { + /** allowances that have been issued by the granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { + return { granter: "", grantee: "" }; +} + +export const QueryAllowanceRequest: MessageFns = { + encode(message: QueryAllowanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: QueryAllowanceRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceRequest { + return QueryAllowanceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Grant.encode(message.allowance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowance = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceResponse { + return { allowance: isSet(object.allowance) ? Grant.fromJSON(object.allowance) : undefined }; + }, + + toJSON(message: QueryAllowanceResponse): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Grant.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceResponse { + return QueryAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesRequest { + return QueryAllowancesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesResponse { + return { + allowances: globalThis.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?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesResponse { + return QueryAllowancesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesByGranterRequest { + return QueryAllowancesByGranterRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterResponse { + return { + allowances: globalThis.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?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAllowancesByGranterResponse { + return QueryAllowancesByGranterResponse.fromPartial(base ?? ({} as any)); + }, + 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 granted allwance to the grantee by the granter. */ + Allowance(request: QueryAllowanceRequest): Promise; + /** Allowances returns all the grants for the given grantee address. */ + Allowances(request: QueryAllowancesRequest): Promise; + /** + * AllowancesByGranter returns all the grants given by an address + * + * Since: cosmos-sdk 0.46 + */ + AllowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; +} + +export const QueryServiceName = "cosmos.feegrant.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 00000000..052862c2 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,490 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 { +} + +/** + * MsgPruneAllowances prunes expired fee allowances. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowances { + /** pruner is the address of the user pruning expired allowances. */ + pruner: string; +} + +/** + * MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowancesResponse { +} + +function createBaseMsgGrantAllowance(): MsgGrantAllowance { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const MsgGrantAllowance: MessageFns = { + encode(message: MsgGrantAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrantAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: MsgGrantAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowance { + return MsgGrantAllowance.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantAllowanceResponse { + return {}; + }, + + toJSON(_: MsgGrantAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { + return { granter: "", grantee: "" }; +} + +export const MsgRevokeAllowance: MessageFns = { + encode(message: MsgRevokeAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevokeAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: MsgRevokeAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowance { + return MsgRevokeAllowance.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeAllowanceResponse { + return {}; + }, + + toJSON(_: MsgRevokeAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgPruneAllowances(): MsgPruneAllowances { + return { pruner: "" }; +} + +export const MsgPruneAllowances: MessageFns = { + encode(message: MsgPruneAllowances, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pruner !== "") { + writer.uint32(10).string(message.pruner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pruner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgPruneAllowances { + return { pruner: isSet(object.pruner) ? globalThis.String(object.pruner) : "" }; + }, + + toJSON(message: MsgPruneAllowances): unknown { + const obj: any = {}; + if (message.pruner !== "") { + obj.pruner = message.pruner; + } + return obj; + }, + + create, I>>(base?: I): MsgPruneAllowances { + return MsgPruneAllowances.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgPruneAllowances { + const message = createBaseMsgPruneAllowances(); + message.pruner = object.pruner ?? ""; + return message; + }, +}; + +function createBaseMsgPruneAllowancesResponse(): MsgPruneAllowancesResponse { + return {}; +} + +export const MsgPruneAllowancesResponse: MessageFns = { + encode(_: MsgPruneAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgPruneAllowancesResponse { + return {}; + }, + + toJSON(_: MsgPruneAllowancesResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgPruneAllowancesResponse { + return MsgPruneAllowancesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgPruneAllowancesResponse { + const message = createBaseMsgPruneAllowancesResponse(); + 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; + /** + * PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + * + * Since cosmos-sdk 0.50 + */ + PruneAllowances(request: MsgPruneAllowances): Promise; +} + +export const MsgServiceName = "cosmos.feegrant.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 || MsgServiceName; + this.rpc = rpc; + this.GrantAllowance = this.GrantAllowance.bind(this); + this.RevokeAllowance = this.RevokeAllowance.bind(this); + this.PruneAllowances = this.PruneAllowances.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 BinaryReader(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 BinaryReader(data))); + } + + PruneAllowances(request: MsgPruneAllowances): Promise { + const data = MsgPruneAllowances.encode(request).finish(); + const promise = this.rpc.request(this.service, "PruneAllowances", data); + return promise.then((data) => MsgPruneAllowancesResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/genutil/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/genutil/module/v1/module.ts new file mode 100644 index 00000000..a7da77b1 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/genutil/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.module.v1"; + +/** Module is the config object for the genutil module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts new file mode 100644 index 00000000..11bd3193 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.v1beta1"; + +/** GenesisState defines the raw genesis transaction in JSON. */ +export interface GenesisState { + /** gen_txs defines the genesis transactions. */ + genTxs: Uint8Array[]; +} + +function createBaseGenesisState(): GenesisState { + return { genTxs: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.genTxs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.genTxs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + genTxs: globalThis.Array.isArray(object?.genTxs) ? object.genTxs.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.genTxs?.length) { + obj.genTxs = message.genTxs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.genTxs = object.genTxs?.map((e) => e) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/module/v1/module.ts new file mode 100644 index 00000000..d95ae5ed --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/module/v1/module.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.gov.module.v1"; + +/** Module is the config object of the gov module. */ +export interface Module { + /** + * max_metadata_len defines the maximum proposal metadata length. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { maxMetadataLen: 0, authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMetadataLen !== 0) { + writer.uint32(8).uint64(message.maxMetadataLen); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxMetadataLen = object.maxMetadataLen ?? 0; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/genesis.ts new file mode 100644 index 00000000..d6adbe5f --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/genesis.ts @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Deposit, DepositParams, Params, 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. */ + startingProposalId: number; + /** 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[]; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: + | Params + | undefined; + /** + * The constitution allows builders to lay a foundation and define purpose. + * This is an immutable string set in genesis. + * There are no amendments, to go outside of scope, just fork. + * constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. + * + * Since: cosmos-sdk 0.50 + */ + constitution: string; + portId: string; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + params: undefined, + constitution: "", + portId: "", + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(66).fork()).join(); + } + if (message.constitution !== "") { + writer.uint32(74).string(message.constitution); + } + if (message.portId !== "") { + writer.uint32(82).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.constitution = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.constitution = object.constitution ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/gov.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/gov.ts new file mode 100644 index 00000000..8b77a89a --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/gov.ts @@ -0,0 +1,2031 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines an encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + /** + * PROPOSAL_STATUS_TALLY_PERIOD - PROPOSAL_STATUS_TALLY_PERIOD defines a proposal status during the tally + * period. + */ + PROPOSAL_STATUS_TALLY_PERIOD = 6, + 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 6: + case "PROPOSAL_STATUS_TALLY_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_TALLY_PERIOD; + 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.PROPOSAL_STATUS_TALLY_PERIOD: + return "PROPOSAL_STATUS_TALLY_PERIOD"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** id defines the unique id of the proposal. */ + id: number; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: Any[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; + /** + * expedited defines if the proposal is expedited + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; + /** + * failed_reason defines the reason why the proposal failed + * + * Since: cosmos-sdk 0.50 + */ + failedReason: string; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** decryption key is used to decrypt the encrypted votes during the tally phase */ + decryptionKey: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes_count is the number of yes votes on a proposal. */ + yesCount: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstainCount: string; + /** no_count is the number of no votes on a proposal. */ + noCount: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + noWithVetoCount: string; + /** encrypted_count is the number of encrypted votes on a proposal. */ + encryptedCount: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOption[]; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + */ + metadata: string; + encryptedVoteData: string; +} + +/** + * DepositParams defines the params for deposits on governance proposals. + * + * @deprecated + */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** + * VotingParams defines the params for voting on governance proposals. + * + * @deprecated + */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** + * TallyParams defines the params for tallying votes on governance proposals. + * + * @deprecated + */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; +} + +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface Params { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: + | Duration + | undefined; + /** Duration of the voting period. */ + votingPeriod: + | Duration + | undefined; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + minInitialDepositRatio: string; + /** + * The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelRatio: string; + /** + * The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + * If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelDest: string; + /** + * Duration of the voting period of an expedited proposal. + * + * Since: cosmos-sdk 0.50 + */ + expeditedVotingPeriod: + | Duration + | undefined; + /** + * Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. + * + * Since: cosmos-sdk 0.50 + */ + expeditedThreshold: string; + /** Minimum expedited deposit for a proposal to enter voting period. */ + expeditedMinDeposit: Coin[]; + /** burn deposits if a proposal does not meet quorum */ + burnVoteQuorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burnProposalDepositPrevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burnVoteVeto: boolean; + /** + * The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + * Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + * required. + * + * Since: cosmos-sdk 0.50 + */ + minDepositRatio: string; + /** Duration of the voting period. */ + maxTallyPeriod: Duration | undefined; + trustedCounterParties: TrustedCounterParty[]; + channelId: string; + isSourceChain: boolean; +} + +export interface DecryptedVoteOption { + /** option defines the vote option. */ + option: VoteOption; + randomNo: number; +} + +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + messages: [], + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + metadata: "", + title: "", + summary: "", + proposer: "", + expedited: false, + failedReason: "", + hasEncryptedVotes: false, + identity: "", + pubkey: "", + decryptionKey: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(90).string(message.title); + } + if (message.summary !== "") { + writer.uint32(98).string(message.summary); + } + if (message.proposer !== "") { + writer.uint32(106).string(message.proposer); + } + if (message.expedited !== false) { + writer.uint32(112).bool(message.expedited); + } + if (message.failedReason !== "") { + writer.uint32(122).string(message.failedReason); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(128).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(138).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(146).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(154).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.metadata = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.title = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.summary = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.proposer = reader.string(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.expedited = reader.bool(); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.failedReason = reader.string(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.identity = reader.string(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.pubkey = reader.string(); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(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, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + failedReason: isSet(object.failedReason) ? globalThis.String(object.failedReason) : "", + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(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.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + if (message.failedReason !== "") { + obj.failedReason = message.failedReason; + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + 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; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.proposer = object.proposer ?? ""; + message.expedited = object.expedited ?? false; + message.failedReason = object.failedReason ?? ""; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "", encryptedCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + if (message.encryptedCount !== "") { + writer.uint32(42).string(message.encryptedCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + encryptedCount: isSet(object.encryptedCount) ? globalThis.String(object.encryptedCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + if (message.encryptedCount !== "") { + obj.encryptedCount = message.encryptedCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + message.encryptedCount = object.encryptedCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", options: [], metadata: "", encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(42).string(message.metadata); + } + if (message.encryptedVoteData !== "") { + writer.uint32(50).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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) : "", + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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; + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: "", threshold: "", vetoThreshold: "" }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(26).string(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + 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 ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + minDeposit: [], + maxDepositPeriod: undefined, + votingPeriod: undefined, + quorum: "", + threshold: "", + vetoThreshold: "", + minInitialDepositRatio: "", + proposalCancelRatio: "", + proposalCancelDest: "", + expeditedVotingPeriod: undefined, + expeditedThreshold: "", + expeditedMinDeposit: [], + burnVoteQuorum: false, + burnProposalDepositPrevote: false, + burnVoteVeto: false, + minDepositRatio: "", + maxTallyPeriod: undefined, + trustedCounterParties: [], + channelId: "", + isSourceChain: false, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(26).fork()).join(); + } + if (message.quorum !== "") { + writer.uint32(34).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(42).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(50).string(message.vetoThreshold); + } + if (message.minInitialDepositRatio !== "") { + writer.uint32(58).string(message.minInitialDepositRatio); + } + if (message.proposalCancelRatio !== "") { + writer.uint32(66).string(message.proposalCancelRatio); + } + if (message.proposalCancelDest !== "") { + writer.uint32(74).string(message.proposalCancelDest); + } + if (message.expeditedVotingPeriod !== undefined) { + Duration.encode(message.expeditedVotingPeriod, writer.uint32(82).fork()).join(); + } + if (message.expeditedThreshold !== "") { + writer.uint32(90).string(message.expeditedThreshold); + } + for (const v of message.expeditedMinDeposit) { + Coin.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.burnVoteQuorum !== false) { + writer.uint32(104).bool(message.burnVoteQuorum); + } + if (message.burnProposalDepositPrevote !== false) { + writer.uint32(112).bool(message.burnProposalDepositPrevote); + } + if (message.burnVoteVeto !== false) { + writer.uint32(120).bool(message.burnVoteVeto); + } + if (message.minDepositRatio !== "") { + writer.uint32(130).string(message.minDepositRatio); + } + if (message.maxTallyPeriod !== undefined) { + Duration.encode(message.maxTallyPeriod, writer.uint32(138).fork()).join(); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(146).fork()).join(); + } + if (message.channelId !== "") { + writer.uint32(154).string(message.channelId); + } + if (message.isSourceChain !== false) { + writer.uint32(160).bool(message.isSourceChain); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.quorum = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.threshold = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.minInitialDepositRatio = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposalCancelRatio = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.proposalCancelDest = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.expeditedVotingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.expeditedThreshold = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.expeditedMinDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.burnVoteQuorum = reader.bool(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.burnProposalDepositPrevote = reader.bool(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.burnVoteVeto = reader.bool(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.minDepositRatio = reader.string(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.maxTallyPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.channelId = reader.string(); + continue; + case 20: + if (tag !== 160) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + minInitialDepositRatio: isSet(object.minInitialDepositRatio) + ? globalThis.String(object.minInitialDepositRatio) + : "", + proposalCancelRatio: isSet(object.proposalCancelRatio) ? globalThis.String(object.proposalCancelRatio) : "", + proposalCancelDest: isSet(object.proposalCancelDest) ? globalThis.String(object.proposalCancelDest) : "", + expeditedVotingPeriod: isSet(object.expeditedVotingPeriod) + ? Duration.fromJSON(object.expeditedVotingPeriod) + : undefined, + expeditedThreshold: isSet(object.expeditedThreshold) ? globalThis.String(object.expeditedThreshold) : "", + expeditedMinDeposit: globalThis.Array.isArray(object?.expeditedMinDeposit) + ? object.expeditedMinDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + burnVoteQuorum: isSet(object.burnVoteQuorum) ? globalThis.Boolean(object.burnVoteQuorum) : false, + burnProposalDepositPrevote: isSet(object.burnProposalDepositPrevote) + ? globalThis.Boolean(object.burnProposalDepositPrevote) + : false, + burnVoteVeto: isSet(object.burnVoteVeto) ? globalThis.Boolean(object.burnVoteVeto) : false, + minDepositRatio: isSet(object.minDepositRatio) ? globalThis.String(object.minDepositRatio) : "", + maxTallyPeriod: isSet(object.maxTallyPeriod) ? Duration.fromJSON(object.maxTallyPeriod) : undefined, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + if (message.minInitialDepositRatio !== "") { + obj.minInitialDepositRatio = message.minInitialDepositRatio; + } + if (message.proposalCancelRatio !== "") { + obj.proposalCancelRatio = message.proposalCancelRatio; + } + if (message.proposalCancelDest !== "") { + obj.proposalCancelDest = message.proposalCancelDest; + } + if (message.expeditedVotingPeriod !== undefined) { + obj.expeditedVotingPeriod = Duration.toJSON(message.expeditedVotingPeriod); + } + if (message.expeditedThreshold !== "") { + obj.expeditedThreshold = message.expeditedThreshold; + } + if (message.expeditedMinDeposit?.length) { + obj.expeditedMinDeposit = message.expeditedMinDeposit.map((e) => Coin.toJSON(e)); + } + if (message.burnVoteQuorum !== false) { + obj.burnVoteQuorum = message.burnVoteQuorum; + } + if (message.burnProposalDepositPrevote !== false) { + obj.burnProposalDepositPrevote = message.burnProposalDepositPrevote; + } + if (message.burnVoteVeto !== false) { + obj.burnVoteVeto = message.burnVoteVeto; + } + if (message.minDepositRatio !== "") { + obj.minDepositRatio = message.minDepositRatio; + } + if (message.maxTallyPeriod !== undefined) { + obj.maxTallyPeriod = Duration.toJSON(message.maxTallyPeriod); + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + message.minInitialDepositRatio = object.minInitialDepositRatio ?? ""; + message.proposalCancelRatio = object.proposalCancelRatio ?? ""; + message.proposalCancelDest = object.proposalCancelDest ?? ""; + message.expeditedVotingPeriod = + (object.expeditedVotingPeriod !== undefined && object.expeditedVotingPeriod !== null) + ? Duration.fromPartial(object.expeditedVotingPeriod) + : undefined; + message.expeditedThreshold = object.expeditedThreshold ?? ""; + message.expeditedMinDeposit = object.expeditedMinDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.burnVoteQuorum = object.burnVoteQuorum ?? false; + message.burnProposalDepositPrevote = object.burnProposalDepositPrevote ?? false; + message.burnVoteVeto = object.burnVoteVeto ?? false; + message.minDepositRatio = object.minDepositRatio ?? ""; + message.maxTallyPeriod = (object.maxTallyPeriod !== undefined && object.maxTallyPeriod !== null) + ? Duration.fromPartial(object.maxTallyPeriod) + : undefined; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.channelId = object.channelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + return message; + }, +}; + +function createBaseDecryptedVoteOption(): DecryptedVoteOption { + return { option: 0, randomNo: 0 }; +} + +export const DecryptedVoteOption: MessageFns = { + encode(message: DecryptedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.randomNo !== 0) { + writer.uint32(16).int64(message.randomNo); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.randomNo = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + randomNo: isSet(object.randomNo) ? globalThis.Number(object.randomNo) : 0, + }; + }, + + toJSON(message: DecryptedVoteOption): unknown { + const obj: any = {}; + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.randomNo !== 0) { + obj.randomNo = Math.round(message.randomNo); + } + return obj; + }, + + create, I>>(base?: I): DecryptedVoteOption { + return DecryptedVoteOption.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptedVoteOption { + const message = createBaseDecryptedVoteOption(); + message.option = object.option ?? 0; + message.randomNo = object.randomNo ?? 0; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/query.ts new file mode 100644 index 00000000..54a6bef2 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/query.ts @@ -0,0 +1,1575 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + Deposit, + DepositParams, + Params, + Proposal, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyParams, + TallyResult, + Vote, + VotingParams, +} from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryConstitutionRequest is the request type for the Query/Constitution RPC method */ +export interface QueryConstitutionRequest { +} + +/** QueryConstitutionResponse is the response type for the Query/Constitution RPC method */ +export interface QueryConstitutionResponse { + constitution: string; +} + +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + /** proposal is the requested governance proposal. */ + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: Params | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryConstitutionRequest(): QueryConstitutionRequest { + return {}; +} + +export const QueryConstitutionRequest: MessageFns = { + encode(_: QueryConstitutionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConstitutionRequest { + return {}; + }, + + toJSON(_: QueryConstitutionRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConstitutionRequest { + return QueryConstitutionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConstitutionRequest { + const message = createBaseQueryConstitutionRequest(); + return message; + }, +}; + +function createBaseQueryConstitutionResponse(): QueryConstitutionResponse { + return { constitution: "" }; +} + +export const QueryConstitutionResponse: MessageFns = { + encode(message: QueryConstitutionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constitution !== "") { + writer.uint32(10).string(message.constitution); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.constitution = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConstitutionResponse { + return { constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "" }; + }, + + toJSON(message: QueryConstitutionResponse): unknown { + const obj: any = {}; + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + return obj; + }, + + create, I>>(base?: I): QueryConstitutionResponse { + return QueryConstitutionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryConstitutionResponse { + const message = createBaseQueryConstitutionResponse(); + message.constitution = object.constitution ?? ""; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined, params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + 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.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Constitution queries the chain's constitution. */ + Constitution(request: QueryConstitutionRequest): Promise; + /** 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 on 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 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 || QueryServiceName; + this.rpc = rpc; + this.Constitution = this.Constitution.bind(this); + 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); + } + Constitution(request: QueryConstitutionRequest): Promise { + const data = QueryConstitutionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Constitution", data); + return promise.then((data) => QueryConstitutionResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/tx.ts new file mode 100644 index 00000000..9f8156b7 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1/tx.ts @@ -0,0 +1,1531 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params, VoteOption, voteOptionFromJSON, voteOptionToJSON, WeightedVoteOption } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages: Any[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * expedited defines if the proposal is expedited or not + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContent { + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** authority must be the gov module address. */ + authority: string; +} + +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse { +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata: string; +} + +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse { +} + +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCancelProposal is the Msg/CancelProposal request type. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** canceled_time is the time when proposal is canceled. */ + canceledTime: + | Date + | undefined; + /** canceled_height defines the block height at which the proposal is canceled. */ + canceledHeight: number; +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { messages: [], initialDeposit: [], proposer: "", metadata: "", title: "", summary: "", expedited: false }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.summary !== "") { + writer.uint32(50).string(message.summary); + } + if (message.expedited !== false) { + writer.uint32(56).bool(message.expedited); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.title = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.summary = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expedited = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + 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)) || []; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.expedited = object.expedited ?? false; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { content: undefined, authority: "" }; +} + +export const MsgExecLegacyContent: MessageFns = { + encode(message: MsgExecLegacyContent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecLegacyContent { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: MsgExecLegacyContent): unknown { + const obj: any = {}; + 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) + ? Any.fromPartial(object.content) + : undefined; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} + +export const MsgExecLegacyContentResponse: MessageFns = { + encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgExecLegacyContentResponse { + return {}; + }, + + toJSON(_: MsgExecLegacyContentResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "" }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "", metadata: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [], metadata: "" }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCancelProposal(): MsgCancelProposal { + return { proposalId: 0, proposer: "" }; +} + +export const MsgCancelProposal: MessageFns = { + encode(message: MsgCancelProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.proposer !== "") { + writer.uint32(18).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgCancelProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposal { + return MsgCancelProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposal { + const message = createBaseMsgCancelProposal(); + message.proposalId = object.proposalId ?? 0; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgCancelProposalResponse(): MsgCancelProposalResponse { + return { proposalId: 0, canceledTime: undefined, canceledHeight: 0 }; +} + +export const MsgCancelProposalResponse: MessageFns = { + encode(message: MsgCancelProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.canceledTime !== undefined) { + Timestamp.encode(toTimestamp(message.canceledTime), writer.uint32(18).fork()).join(); + } + if (message.canceledHeight !== 0) { + writer.uint32(24).uint64(message.canceledHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.canceledTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.canceledHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposalResponse { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + canceledTime: isSet(object.canceledTime) ? fromJsonTimestamp(object.canceledTime) : undefined, + canceledHeight: isSet(object.canceledHeight) ? globalThis.Number(object.canceledHeight) : 0, + }; + }, + + toJSON(message: MsgCancelProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.canceledTime !== undefined) { + obj.canceledTime = message.canceledTime.toISOString(); + } + if (message.canceledHeight !== 0) { + obj.canceledHeight = Math.round(message.canceledHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposalResponse { + return MsgCancelProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposalResponse { + const message = createBaseMsgCancelProposalResponse(); + message.proposalId = object.proposalId ?? 0; + message.canceledTime = object.canceledTime ?? undefined; + message.canceledHeight = object.canceledHeight ?? 0; + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given the messages. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + */ + ExecLegacyContent(request: MsgExecLegacyContent): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): Promise; + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; + /** + * UpdateParams defines a governance operation for updating the x/gov module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CancelProposal defines a method to cancel governance proposal + * + * Since: cosmos-sdk 0.50 + */ + CancelProposal(request: MsgCancelProposal): 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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.ExecLegacyContent = this.ExecLegacyContent.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.CancelProposal = this.CancelProposal.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelProposal(request: MsgCancelProposal): Promise { + const data = MsgCancelProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelProposal", data); + return promise.then((data) => MsgCancelProposalResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 00000000..f70b4ccf --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,234 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + startingProposalId: number; + /** 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[]; + /** deposit_params defines all the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** voting_params defines all the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** tally_params defines all the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/gov.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 00000000..b58fe54c --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1356 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines a encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** aggregated keyshare is used to decrypt the encrypted votes during the tally phase */ + aggrKeyshare: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + noWithVeto: string; + /** encrypted is the number of encrypted votes on a proposal. */ + encrypted: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + * + * @deprecated + */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOption[]; + encryptedVoteData: string; +} + +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: Uint8Array; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: Uint8Array; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: Uint8Array; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseTextProposal(): TextProposal { + return { title: "", description: "" }; +} + +export const TextProposal: MessageFns = { + encode(message: TextProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TextProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: TextProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): TextProposal { + return TextProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + proposalId: 0, + content: undefined, + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + hasEncryptedVotes: false, + identity: "", + pubkey: "", + aggrKeyshare: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(80).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(90).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(98).string(message.pubkey); + } + if (message.aggrKeyshare !== "") { + writer.uint32(106).string(message.aggrKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.identity = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.pubkey = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.aggrKeyshare = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + aggrKeyshare: isSet(object.aggrKeyshare) ? globalThis.String(object.aggrKeyshare) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.aggrKeyshare !== "") { + obj.aggrKeyshare = message.aggrKeyshare; + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.proposalId = object.proposalId ?? 0; + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.aggrKeyshare = object.aggrKeyshare ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes: "", abstain: "", no: "", noWithVeto: "", encrypted: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yes !== "") { + writer.uint32(10).string(message.yes); + } + if (message.abstain !== "") { + writer.uint32(18).string(message.abstain); + } + if (message.no !== "") { + writer.uint32(26).string(message.no); + } + if (message.noWithVeto !== "") { + writer.uint32(34).string(message.noWithVeto); + } + if (message.encrypted !== "") { + writer.uint32(42).string(message.encrypted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yes = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstain = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.no = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVeto = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encrypted = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes: isSet(object.yes) ? globalThis.String(object.yes) : "", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "", + no: isSet(object.no) ? globalThis.String(object.no) : "", + noWithVeto: isSet(object.noWithVeto) ? globalThis.String(object.noWithVeto) : "", + encrypted: isSet(object.encrypted) ? globalThis.String(object.encrypted) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yes !== "") { + obj.yes = message.yes; + } + if (message.abstain !== "") { + obj.abstain = message.abstain; + } + if (message.no !== "") { + obj.no = message.no; + } + if (message.noWithVeto !== "") { + obj.noWithVeto = message.noWithVeto; + } + if (message.encrypted !== "") { + obj.encrypted = message.encrypted; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.noWithVeto = object.noWithVeto ?? ""; + message.encrypted = object.encrypted ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, options: [], encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.encryptedVoteData !== "") { + writer.uint32(42).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: new Uint8Array(0), threshold: new Uint8Array(0), vetoThreshold: new Uint8Array(0) }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + writer.uint32(26).bytes(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? bytesFromBase64(object.quorum) : new Uint8Array(0), + threshold: isSet(object.threshold) ? bytesFromBase64(object.threshold) : new Uint8Array(0), + vetoThreshold: isSet(object.vetoThreshold) ? bytesFromBase64(object.vetoThreshold) : new Uint8Array(0), + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum.length !== 0) { + obj.quorum = base64FromBytes(message.quorum); + } + if (message.threshold.length !== 0) { + obj.threshold = base64FromBytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + obj.vetoThreshold = base64FromBytes(message.vetoThreshold); + } + 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 ?? new Uint8Array(0); + message.threshold = object.threshold ?? new Uint8Array(0); + message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/query.ts new file mode 100644 index 00000000..1e13f7d3 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1413 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** deposit_params defines the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** tally_params defines the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? 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 on proposalID, depositor address. */ + 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 const QueryServiceName = "cosmos.gov.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 00000000..85994854 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,880 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the proposal's content. */ + content: + | Any + | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + 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 defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { content: undefined, initialDeposit: [], proposer: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [] }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgVoteWeighted { + return MsgVoteWeighted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): 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 const MsgServiceName = "cosmos.gov.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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/module/v1/module.ts new file mode 100644 index 00000000..fbcfb65d --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/module/v1/module.ts @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../../../google/protobuf/duration"; + +export const protobufPackage = "cosmos.group.module.v1"; + +/** Module is the config object of the group module. */ +export interface Module { + /** + * max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + * to execute the proposal. + */ + maxExecutionPeriod: + | Duration + | undefined; + /** + * max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; +} + +function createBaseModule(): Module { + return { maxExecutionPeriod: undefined, maxMetadataLen: 0 }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxExecutionPeriod !== undefined) { + Duration.encode(message.maxExecutionPeriod, writer.uint32(10).fork()).join(); + } + if (message.maxMetadataLen !== 0) { + writer.uint32(16).uint64(message.maxMetadataLen); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxExecutionPeriod: isSet(object.maxExecutionPeriod) ? Duration.fromJSON(object.maxExecutionPeriod) : undefined, + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxExecutionPeriod !== undefined) { + obj.maxExecutionPeriod = Duration.toJSON(message.maxExecutionPeriod); + } + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxExecutionPeriod = (object.maxExecutionPeriod !== undefined && object.maxExecutionPeriod !== null) + ? Duration.fromPartial(object.maxExecutionPeriod) + : undefined; + message.maxMetadataLen = object.maxMetadataLen ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/events.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/events.ts new file mode 100644 index 00000000..6a221d4e --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/events.ts @@ -0,0 +1,780 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/events.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyResult, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** 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. */ + proposalId: number; +} + +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposal { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVote { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExec { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** result is the proposal execution result. */ + result: ProposalExecutorResult; + /** logs contains error logs in case the execution result is FAILURE. */ + logs: string; +} + +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroup { + /** group_id is the unique ID of the group. */ + groupId: number; + /** address is the account address of the group member. */ + address: string; +} + +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPruned { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). */ + status: ProposalStatus; + /** tally_result is the proposal tally result (when applicable). */ + tallyResult: TallyResult | undefined; +} + +function createBaseEventCreateGroup(): EventCreateGroup { + return { groupId: 0 }; +} + +export const EventCreateGroup: MessageFns = { + encode(message: EventCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventCreateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroup { + return EventCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroup { + const message = createBaseEventCreateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventUpdateGroup(): EventUpdateGroup { + return { groupId: 0 }; +} + +export const EventUpdateGroup: MessageFns = { + encode(message: EventUpdateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventUpdateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroup { + return EventUpdateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { + return { address: "" }; +} + +export const EventCreateGroupPolicy: MessageFns = { + encode(message: EventCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroupPolicy { + return EventCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { + return { address: "" }; +} + +export const EventUpdateGroupPolicy: MessageFns = { + encode(message: EventUpdateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventUpdateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroupPolicy { + return EventUpdateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventSubmitProposal(): EventSubmitProposal { + return { proposalId: 0 }; +} + +export const EventSubmitProposal: MessageFns = { + encode(message: EventSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSubmitProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventSubmitProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventSubmitProposal { + return EventSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventWithdrawProposal(): EventWithdrawProposal { + return { proposalId: 0 }; +} + +export const EventWithdrawProposal: MessageFns = { + encode(message: EventWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventWithdrawProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventWithdrawProposal { + return EventWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventVote(): EventVote { + return { proposalId: 0 }; +} + +export const EventVote: MessageFns = { + encode(message: EventVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventVote { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventVote { + return EventVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventVote { + const message = createBaseEventVote(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventExec(): EventExec { + return { proposalId: 0, result: 0, logs: "" }; +} + +export const EventExec: MessageFns = { + encode(message: EventExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + if (message.logs !== "") { + writer.uint32(26).string(message.logs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.logs = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0, + logs: isSet(object.logs) ? globalThis.String(object.logs) : "", + }; + }, + + toJSON(message: EventExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + if (message.logs !== "") { + obj.logs = message.logs; + } + return obj; + }, + + create, I>>(base?: I): EventExec { + return EventExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventExec { + const message = createBaseEventExec(); + message.proposalId = object.proposalId ?? 0; + message.result = object.result ?? 0; + message.logs = object.logs ?? ""; + return message; + }, +}; + +function createBaseEventLeaveGroup(): EventLeaveGroup { + return { groupId: 0, address: "" }; +} + +export const EventLeaveGroup: MessageFns = { + encode(message: EventLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventLeaveGroup { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: EventLeaveGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventLeaveGroup { + return EventLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + message.groupId = object.groupId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventProposalPruned(): EventProposalPruned { + return { proposalId: 0, status: 0, tallyResult: undefined }; +} + +export const EventProposalPruned: MessageFns = { + encode(message: EventProposalPruned, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.tallyResult !== undefined) { + TallyResult.encode(message.tallyResult, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventProposalPruned { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventProposalPruned(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.status = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventProposalPruned { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + tallyResult: isSet(object.tallyResult) ? TallyResult.fromJSON(object.tallyResult) : undefined, + }; + }, + + toJSON(message: EventProposalPruned): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.tallyResult !== undefined) { + obj.tallyResult = TallyResult.toJSON(message.tallyResult); + } + return obj; + }, + + create, I>>(base?: I): EventProposalPruned { + return EventProposalPruned.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventProposalPruned { + const message = createBaseEventProposalPruned(); + message.proposalId = object.proposalId ?? 0; + message.status = object.status ?? 0; + message.tallyResult = (object.tallyResult !== undefined && object.tallyResult !== null) + ? TallyResult.fromPartial(object.tallyResult) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/genesis.ts new file mode 100644 index 00000000..b2d21dd4 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/genesis.ts @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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. + */ + groupSeq: number; + /** groups is the list of groups info. */ + groups: GroupInfo[]; + /** group_members is the list of groups members. */ + groupMembers: GroupMember[]; + /** + * group_policy_seq is the group policy table orm.Sequence, + * it is used to generate the next group policy account address. + */ + groupPolicySeq: number; + /** group_policies is the list of group policies info. */ + groupPolicies: GroupPolicyInfo[]; + /** + * proposal_seq is the proposal table orm.Sequence, + * it is used to get the next proposal ID. + */ + proposalSeq: number; + /** proposals is the list of proposals. */ + proposals: Proposal[]; + /** votes is the list of votes. */ + votes: Vote[]; +} + +function createBaseGenesisState(): GenesisState { + return { + groupSeq: 0, + groups: [], + groupMembers: [], + groupPolicySeq: 0, + groupPolicies: [], + proposalSeq: 0, + proposals: [], + votes: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupSeq !== 0) { + writer.uint32(8).uint64(message.groupSeq); + } + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.groupMembers) { + GroupMember.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.groupPolicySeq !== 0) { + writer.uint32(32).uint64(message.groupPolicySeq); + } + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.proposalSeq !== 0) { + writer.uint32(48).uint64(message.proposalSeq); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.groupSeq = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMembers.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.groupPolicySeq = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.proposalSeq = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + groupSeq: isSet(object.groupSeq) ? globalThis.Number(object.groupSeq) : 0, + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + groupMembers: globalThis.Array.isArray(object?.groupMembers) + ? object.groupMembers.map((e: any) => GroupMember.fromJSON(e)) + : [], + groupPolicySeq: isSet(object.groupPolicySeq) ? globalThis.Number(object.groupPolicySeq) : 0, + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + proposalSeq: isSet(object.proposalSeq) ? globalThis.Number(object.proposalSeq) : 0, + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.groupSeq !== 0) { + obj.groupSeq = Math.round(message.groupSeq); + } + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.groupMembers?.length) { + obj.groupMembers = message.groupMembers.map((e) => GroupMember.toJSON(e)); + } + if (message.groupPolicySeq !== 0) { + obj.groupPolicySeq = Math.round(message.groupPolicySeq); + } + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.proposalSeq !== 0) { + obj.proposalSeq = Math.round(message.proposalSeq); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.groupSeq = object.groupSeq ?? 0; + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.groupMembers = object.groupMembers?.map((e) => GroupMember.fromPartial(e)) || []; + message.groupPolicySeq = object.groupPolicySeq ?? 0; + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.proposalSeq = object.proposalSeq ?? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/query.ts new file mode 100644 index 00000000..d64f831a --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/query.ts @@ -0,0 +1,2395 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, TallyResult, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequest { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponse { + /** info is the GroupInfo of the group. */ + info: GroupInfo | undefined; +} + +/** 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 of the group policy. */ + info: GroupPolicyInfo | undefined; +} + +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequest { + /** group_id is the unique ID of the group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequest { + /** group_id is the unique ID of the group policy's group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponse { + /** group_policies are the group policies info associated with the provided group. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponse { + /** group_policies are the group policies info with provided admin. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponse { + /** proposal is the proposal info. */ + proposal: Proposal | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequest { + /** proposal_id is the unique id of a proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +/** + * QueryGroupsRequest is the Query/Groups request type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryGroupsResponse is the Query/Groups response type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsResponse { + /** `groups` is all the groups present in state. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { + return { groupId: 0 }; +} + +export const QueryGroupInfoRequest: MessageFns = { + encode(message: QueryGroupInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoRequest { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: QueryGroupInfoRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoRequest { + return QueryGroupInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { + return { info: undefined }; +} + +export const QueryGroupInfoResponse: MessageFns = { + encode(message: QueryGroupInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoResponse { + return { info: isSet(object.info) ? GroupInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoResponse { + return QueryGroupInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupPolicyInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryGroupPolicyInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoRequest { + return QueryGroupPolicyInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { + return { info: undefined }; +} + +export const QueryGroupPolicyInfoResponse: MessageFns = { + encode(message: QueryGroupPolicyInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupPolicyInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoResponse { + return { info: isSet(object.info) ? GroupPolicyInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupPolicyInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupPolicyInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoResponse { + return QueryGroupPolicyInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupMembersRequest: MessageFns = { + encode(message: QueryGroupMembersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupMembersRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersRequest { + return QueryGroupMembersRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + message.groupId = object.groupId ?? 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: MessageFns = { + encode(message: QueryGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.members) { + GroupMember.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.members.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersResponse { + return { + members: globalThis.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?.length) { + obj.members = message.members.map((e) => GroupMember.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersResponse { + return QueryGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminRequest { + return QueryGroupsByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminResponse { + return QueryGroupsByAdminResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupRequest: MessageFns = { + encode(message: QueryGroupPoliciesByGroupRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupRequest { + return QueryGroupPoliciesByGroupRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + message.groupId = object.groupId ?? 0; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { + return { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupResponse: MessageFns = { + encode(message: QueryGroupPoliciesByGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupResponse { + return QueryGroupPoliciesByGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.groupPolicies = object.groupPolicies?.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: MessageFns = { + encode(message: QueryGroupPoliciesByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminRequest { + return QueryGroupPoliciesByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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 { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByAdminResponse: MessageFns = { + encode(message: QueryGroupPoliciesByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminResponse { + return QueryGroupPoliciesByAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { + return { address: "", pagination: undefined }; +} + +export const QueryProposalsByGroupPolicyRequest: MessageFns = { + encode(message: QueryProposalsByGroupPolicyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsByGroupPolicyRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyRequest { + return QueryProposalsByGroupPolicyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryProposalsByGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyResponse { + return { + 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: QueryProposalsByGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyResponse { + return QueryProposalsByGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, voter: "" }; +} + +export const QueryVoteByProposalVoterRequest: MessageFns = { + encode(message: QueryVoteByProposalVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteByProposalVoterRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + return obj; + }, + + create, I>>(base?: I): QueryVoteByProposalVoterRequest { + return QueryVoteByProposalVoterRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { + return { vote: undefined }; +} + +export const QueryVoteByProposalVoterResponse: MessageFns = { + encode(message: QueryVoteByProposalVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteByProposalVoterResponse): unknown { + const obj: any = {}; + if (message.vote !== undefined) { + obj.vote = Vote.toJSON(message.vote); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVoteByProposalVoterResponse { + return QueryVoteByProposalVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesByProposalRequest: MessageFns = { + encode(message: QueryVotesByProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalRequest { + return QueryVotesByProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesByProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalResponse { + return { + 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: QueryVotesByProposalResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalResponse { + return QueryVotesByProposalResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voter !== "") { + writer.uint32(10).string(message.voter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.voter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterRequest { + return { + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByVoterRequest): unknown { + const obj: any = {}; + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterRequest { + return QueryVotesByVoterRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterResponse { + return { + 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: QueryVotesByVoterResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterResponse { + return QueryVotesByVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByMemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberRequest { + return QueryGroupsByMemberRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberResponse { + return QueryGroupsByMemberResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsRequest(): QueryGroupsRequest { + return { pagination: undefined }; +} + +export const QueryGroupsRequest: MessageFns = { + encode(message: QueryGroupsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGroupsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsRequest { + return QueryGroupsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsRequest { + const message = createBaseQueryGroupsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsResponse(): QueryGroupsResponse { + return { groups: [], pagination: undefined }; +} + +export const QueryGroupsResponse: MessageFns = { + encode(message: QueryGroupsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsResponse { + return { + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsResponse): unknown { + const obj: any = {}; + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsResponse { + return QueryGroupsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsResponse { + const message = createBaseQueryGroupsResponse(); + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : 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 by group id. */ + 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; + /** GroupPoliciesByAdmin 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 id. */ + 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 returns the tally result of a proposal. If the proposal is + * still in voting period, then this query computes the current tally state, + * which might not be final. On the other hand, if the proposal is final, + * then it simply returns the `final_tally_result` state stored in the + * proposal itself. + */ + TallyResult(request: QueryTallyResultRequest): Promise; + /** + * Groups queries all groups in state. + * + * Since: cosmos-sdk 0.47.1 + */ + Groups(request: QueryGroupsRequest): Promise; +} + +export const QueryServiceName = "cosmos.group.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 || QueryServiceName; + 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); + this.Groups = this.Groups.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + Groups(request: QueryGroupsRequest): Promise { + const data = QueryGroupsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Groups", data); + return promise.then((data) => QueryGroupsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/tx.ts new file mode 100644 index 00000000..006eb292 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/tx.ts @@ -0,0 +1,2576 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { + MemberRequest, + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + VoteOption, + voteOptionFromJSON, + voteOptionToJSON, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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: MemberRequest[]; + /** 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. */ + groupId: number; +} + +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembers { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + memberUpdates: MemberRequest[]; +} + +/** 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. */ + groupId: number; + /** new_admin is the group new admin account address. */ + newAdmin: 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. */ + groupId: number; + /** 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. */ + groupId: number; + /** metadata is any arbitrary metadata attached to the group policy. */ + metadata: string; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of the group policy. */ + groupPolicyAddress: string; + /** new_admin is the new group policy admin. */ + newAdmin: string; +} + +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponse { +} + +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicy { + /** admin is the account address of the group and group policy admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequest[]; + /** group_metadata is any arbitrary metadata attached to the group. */ + groupMetadata: string; + /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ + groupPolicyMetadata: string; + /** + * group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + * and group policy admin. + */ + groupPolicyAsAdmin: boolean; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponse { + /** group_id is the unique ID of the newly created group with policy. */ + groupId: number; + /** group_policy_address is the account address of the newly created group policy. */ + groupPolicyAddress: string; +} + +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** decision_policy is the updated group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** metadata is the group policy metadata to be updated. */ + metadata: string; +} + +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponse { +} + +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposal { + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * proposers are the account addresses of the proposers. + * Proposers signatures will be counted as yes votes. + */ + proposers: string[]; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * exec defines the mode of execution of the proposal, + * whether it should be executed immediately on creation or not. + * If so, proposers signatures are considered as Yes votes. + */ + exec: Exec; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal is the unique ID of the proposal. */ + proposalId: number; +} + +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposal { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** 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. */ + proposalId: number; + /** voter is the voter account address. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} + +/** 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. */ + proposalId: number; + /** executor is the account address used to execute the proposal. */ + executor: string; +} + +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponse { + /** result is the final result of the proposal execution. */ + result: ProposalExecutorResult; +} + +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroup { + /** address is the account address of the group member. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponse { +} + +function createBaseMsgCreateGroup(): MsgCreateGroup { + return { admin: "", members: [], metadata: "" }; +} + +export const MsgCreateGroup: MessageFns = { + encode(message: MsgCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroup { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgCreateGroup): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroup { + return MsgCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { + return { groupId: 0 }; +} + +export const MsgCreateGroupResponse: MessageFns = { + encode(message: MsgCreateGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupResponse { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: MsgCreateGroupResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupResponse { + return MsgCreateGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { + return { admin: "", groupId: 0, memberUpdates: [] }; +} + +export const MsgUpdateGroupMembers: MessageFns = { + encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + for (const v of message.memberUpdates) { + MemberRequest.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.memberUpdates.push(MemberRequest.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMembers { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + memberUpdates: globalThis.Array.isArray(object?.memberUpdates) + ? object.memberUpdates.map((e: any) => MemberRequest.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgUpdateGroupMembers): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.memberUpdates?.length) { + obj.memberUpdates = message.memberUpdates.map((e) => MemberRequest.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.memberUpdates = object.memberUpdates?.map((e) => MemberRequest.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { + return {}; +} + +export const MsgUpdateGroupMembersResponse: MessageFns = { + encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMembersResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMembersResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { + return { admin: "", groupId: 0, newAdmin: "" }; +} + +export const MsgUpdateGroupAdmin: MessageFns = { + encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { + return {}; +} + +export const MsgUpdateGroupAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { + return { admin: "", groupId: 0, metadata: "" }; +} + +export const MsgUpdateGroupMetadata: MessageFns = { + encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { + return {}; +} + +export const MsgUpdateGroupMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { + return { admin: "", groupId: 0, metadata: "", decisionPolicy: undefined }; +} + +export const MsgCreateGroupPolicy: MessageFns = { + encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { + return { address: "" }; +} + +export const MsgCreateGroupPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicyResponse { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: MsgCreateGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { + return { admin: "", groupPolicyAddress: "", newAdmin: "" }; +} + +export const MsgUpdateGroupPolicyAdmin: MessageFns = { + encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { + return {}; +} + +export const MsgUpdateGroupPolicyAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { + return { + admin: "", + members: [], + groupMetadata: "", + groupPolicyMetadata: "", + groupPolicyAsAdmin: false, + decisionPolicy: undefined, + }; +} + +export const MsgCreateGroupWithPolicy: MessageFns = { + encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.groupMetadata !== "") { + writer.uint32(26).string(message.groupMetadata); + } + if (message.groupPolicyMetadata !== "") { + writer.uint32(34).string(message.groupPolicyMetadata); + } + if (message.groupPolicyAsAdmin !== false) { + writer.uint32(40).bool(message.groupPolicyAsAdmin); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMetadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.groupPolicyMetadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.groupPolicyAsAdmin = reader.bool(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + groupMetadata: isSet(object.groupMetadata) ? globalThis.String(object.groupMetadata) : "", + groupPolicyMetadata: isSet(object.groupPolicyMetadata) ? globalThis.String(object.groupPolicyMetadata) : "", + groupPolicyAsAdmin: isSet(object.groupPolicyAsAdmin) ? globalThis.Boolean(object.groupPolicyAsAdmin) : false, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupWithPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.groupMetadata !== "") { + obj.groupMetadata = message.groupMetadata; + } + if (message.groupPolicyMetadata !== "") { + obj.groupPolicyMetadata = message.groupPolicyMetadata; + } + if (message.groupPolicyAsAdmin !== false) { + obj.groupPolicyAsAdmin = message.groupPolicyAsAdmin; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.groupMetadata = object.groupMetadata ?? ""; + message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; + message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { + return { groupId: 0, groupPolicyAddress: "" }; +} + +export const MsgCreateGroupWithPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicyResponse { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + }; + }, + + toJSON(message: MsgCreateGroupWithPolicyResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + message.groupId = object.groupId ?? 0; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { + return { admin: "", groupPolicyAddress: "", decisionPolicy: undefined }; +} + +export const MsgUpdateGroupPolicyDecisionPolicy: MessageFns = { + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyDecisionPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; +} + +export const MsgUpdateGroupPolicyDecisionPolicyResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { + return { admin: "", groupPolicyAddress: "", metadata: "" }; +} + +export const MsgUpdateGroupPolicyMetadata: MessageFns = { + encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { + return {}; +} + +export const MsgUpdateGroupPolicyMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, +}; + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { groupPolicyAddress: "", proposers: [], metadata: "", messages: [], exec: 0, title: "", summary: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupPolicyAddress !== "") { + writer.uint32(10).string(message.groupPolicyAddress); + } + for (const v of message.proposers) { + writer.uint32(18).string(v!); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + if (message.title !== "") { + writer.uint32(50).string(message.title); + } + if (message.summary !== "") { + writer.uint32(58).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.title = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.metadata = object.metadata ?? ""; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.exec = object.exec ?? 0; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { + return { proposalId: 0, address: "" }; +} + +export const MsgWithdrawProposal: MessageFns = { + encode(message: MsgWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: MsgWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposal { + return MsgWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { + return {}; +} + +export const MsgWithdrawProposalResponse: MessageFns = { + encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgWithdrawProposalResponse { + return {}; + }, + + toJSON(_: MsgWithdrawProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "", exec: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { proposalId: 0, executor: "" }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.executor !== "") { + writer.uint32(18).string(message.executor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.executor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + executor: isSet(object.executor) ? globalThis.String(object.executor) : "", + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.executor !== "") { + obj.executor = message.executor; + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.proposalId = object.proposalId ?? 0; + message.executor = object.executor ?? ""; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { result: 0 }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroup(): MsgLeaveGroup { + return { address: "", groupId: 0 }; +} + +export const MsgLeaveGroup: MessageFns = { + encode(message: MsgLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgLeaveGroup { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + }; + }, + + toJSON(message: MsgLeaveGroup): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroup { + return MsgLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { + return {}; +} + +export const MsgLeaveGroupResponse: MessageFns = { + encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgLeaveGroupResponse { + return {}; + }, + + toJSON(_: MsgLeaveGroupResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.fromPartial(base ?? ({} as any)); + }, + 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 withdraws 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 const MsgServiceName = "cosmos.group.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/types.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/types.ts new file mode 100644 index 00000000..3f7a9e54 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/group/v1/types.ts @@ -0,0 +1,1799 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given proposal. */ +export enum VoteOption { + /** + * VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will + * return an error. + */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} + +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} + +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus defines proposal statuses. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when submitted. */ + PROPOSAL_STATUS_SUBMITTED = 1, + /** + * PROPOSAL_STATUS_ACCEPTED - Final status of a proposal when the final tally is done and the outcome + * passes the group policy's decision policy. + */ + PROPOSAL_STATUS_ACCEPTED = 2, + /** + * PROPOSAL_STATUS_REJECTED - Final status of a proposal when the final tally is done and the outcome + * is rejected by the group policy's decision policy. + */ + PROPOSAL_STATUS_REJECTED = 3, + /** + * PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group policy is modified before the + * final tally. + */ + PROPOSAL_STATUS_ABORTED = 4, + /** + * PROPOSAL_STATUS_WITHDRAWN - A proposal can be withdrawn before the voting start time by the owner. + * When this happens the final status is Withdrawn. + */ + PROPOSAL_STATUS_WITHDRAWN = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_SUBMITTED": + return ProposalStatus.PROPOSAL_STATUS_SUBMITTED; + case 2: + case "PROPOSAL_STATUS_ACCEPTED": + return ProposalStatus.PROPOSAL_STATUS_ACCEPTED; + case 3: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 4: + case "PROPOSAL_STATUS_ABORTED": + return ProposalStatus.PROPOSAL_STATUS_ABORTED; + case 5: + case "PROPOSAL_STATUS_WITHDRAWN": + return ProposalStatus.PROPOSAL_STATUS_WITHDRAWN; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_SUBMITTED: + return "PROPOSAL_STATUS_SUBMITTED"; + case ProposalStatus.PROPOSAL_STATUS_ACCEPTED: + return "PROPOSAL_STATUS_ACCEPTED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return "PROPOSAL_STATUS_ABORTED"; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return "PROPOSAL_STATUS_WITHDRAWN"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalExecutorResult defines types of proposal executor results. */ +export enum ProposalExecutorResult { + /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ + PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0, + /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ + PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1, + /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ + PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2, + /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ + PROPOSAL_EXECUTOR_RESULT_FAILURE = 3, + UNRECOGNIZED = -1, +} + +export function proposalExecutorResultFromJSON(object: any): ProposalExecutorResult { + switch (object) { + case 0: + case "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; + case 1: + case "PROPOSAL_EXECUTOR_RESULT_NOT_RUN": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN; + case 2: + case "PROPOSAL_EXECUTOR_RESULT_SUCCESS": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS; + case 3: + case "PROPOSAL_EXECUTOR_RESULT_FAILURE": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE; + case -1: + case "UNRECOGNIZED": + default: + return ProposalExecutorResult.UNRECOGNIZED; + } +} + +export function proposalExecutorResultToJSON(object: ProposalExecutorResult): string { + switch (object) { + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: + return "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN: + return "PROPOSAL_EXECUTOR_RESULT_NOT_RUN"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS: + return "PROPOSAL_EXECUTOR_RESULT_SUCCESS"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE: + return "PROPOSAL_EXECUTOR_RESULT_FAILURE"; + case ProposalExecutorResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface Member { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + addedAt: Date | undefined; +} + +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequest { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; +} + +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicy { + /** + * threshold is the minimum weighted sum of `YES` votes that must be met or + * exceeded for a proposal to succeed. + */ + threshold: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicy { + /** + * percentage is the minimum percentage of the weighted sum of `YES` votes must + * meet for a proposal to succeed. + */ + percentage: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindows { + /** + * voting_period is the duration from submission of a proposal to the end of voting period + * Within this times votes can be submitted with MsgVote. + */ + votingPeriod: + | Duration + | undefined; + /** + * min_execution_period is the minimum duration after the proposal submission + * where members can start sending MsgExec. This means that the window for + * sending a MsgExec transaction is: + * `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + * where max_execution_period is a app-specific config, defined in the keeper. + * If not set, min_execution_period will default to 0. + * + * Please make sure to set a `min_execution_period` that is smaller than + * `voting_period + max_execution_period`, or else the above execution window + * is empty, meaning that all proposals created with this decision policy + * won't be able to be executed. + */ + minExecutionPeriod: Duration | undefined; +} + +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfo { + /** id is the unique ID of the group. */ + id: number; + /** admin is the account address of the group's admin. */ + admin: string; + /** + * metadata is any arbitrary metadata to attached to the group. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 + */ + metadata: string; + /** + * version is used to track changes to a group's membership structure that + * would break existing proposals. Whenever any members weight is changed, + * or any member is added or removed this version is incremented and will + * cause proposals based on older versions of this group to fail + */ + version: number; + /** total_weight is the sum of the group members' weights. */ + totalWeight: string; + /** created_at is a timestamp specifying when a group was created. */ + createdAt: Date | undefined; +} + +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMember { + /** group_id is the unique ID of the group. */ + groupId: number; + /** member is the member data. */ + member: Member | undefined; +} + +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfo { + /** address is the account address of group policy. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** admin is the account address of the group admin. */ + admin: string; + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ + metadata: string; + /** + * version is used to track changes to a group's GroupPolicyInfo structure that + * would create a different result on a running proposal. + */ + version: number; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: + | Any + | undefined; + /** created_at is a timestamp specifying when a group policy was created. */ + createdAt: Date | undefined; +} + +/** + * 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: number; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ + metadata: string; + /** proposers are the account addresses of the proposers. */ + proposers: string[]; + /** submit_time is a timestamp specifying when a proposal was submitted. */ + submitTime: + | Date + | undefined; + /** + * group_version tracks the version of the group at proposal submission. + * This field is here for informational purposes only. + */ + groupVersion: number; + /** + * group_policy_version tracks the version of the group policy at proposal submission. + * When a decision policy is changed, existing proposals from previous policy + * versions will become invalid with the `ABORTED` status. + * This field is here for informational purposes only. + */ + groupPolicyVersion: number; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option. It is empty at submission, and only + * populated after tallying, at voting period end or at proposal execution, + * whichever happens first. + */ + finalTallyResult: + | TallyResult + | undefined; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successful MsgExec is called before (to execute a proposal whose + * tally is successful before the voting period ends), tallying will be done + * at this point, and the `final_tally_result`and `status` fields will be + * accordingly updated. + */ + votingPeriodEnd: + | Date + | undefined; + /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ + executorResult: ProposalExecutorResult; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResult { + /** yes_count is the weighted sum of yes votes. */ + yesCount: string; + /** abstain_count is the weighted sum of abstainers. */ + abstainCount: string; + /** no_count is the weighted sum of no votes. */ + noCount: string; + /** no_with_veto_count is the weighted sum of veto. */ + noWithVetoCount: string; +} + +/** Vote represents a vote for a proposal.string metadata */ +export interface Vote { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** voter is the account address of the voter. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 + */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submitTime: Date | undefined; +} + +function createBaseMember(): Member { + return { address: "", weight: "", metadata: "", addedAt: undefined }; +} + +export const Member: MessageFns = { + encode(message: Member, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.addedAt !== undefined) { + Timestamp.encode(toTimestamp(message.addedAt), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Member { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.addedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Member { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + addedAt: isSet(object.addedAt) ? fromJsonTimestamp(object.addedAt) : undefined, + }; + }, + + toJSON(message: Member): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.addedAt !== undefined) { + obj.addedAt = message.addedAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Member { + return Member.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Member { + const message = createBaseMember(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + message.addedAt = object.addedAt ?? undefined; + return message; + }, +}; + +function createBaseMemberRequest(): MemberRequest { + return { address: "", weight: "", metadata: "" }; +} + +export const MemberRequest: MessageFns = { + encode(message: MemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MemberRequest { + return MemberRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MemberRequest { + const message = createBaseMemberRequest(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { + return { threshold: "", windows: undefined }; +} + +export const ThresholdDecisionPolicy: MessageFns = { + encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== "") { + writer.uint32(10).string(message.threshold); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseThresholdDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.threshold = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ThresholdDecisionPolicy { + return { + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: ThresholdDecisionPolicy): unknown { + const obj: any = {}; + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: PercentageDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.percentage !== "") { + writer.uint32(10).string(message.percentage); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePercentageDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.percentage = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PercentageDecisionPolicy { + return { + percentage: isSet(object.percentage) ? globalThis.String(object.percentage) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: PercentageDecisionPolicy): unknown { + const obj: any = {}; + if (message.percentage !== "") { + obj.percentage = message.percentage; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): PercentageDecisionPolicy { + return PercentageDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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 { votingPeriod: undefined, minExecutionPeriod: undefined }; +} + +export const DecisionPolicyWindows: MessageFns = { + encode(message: DecisionPolicyWindows, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + if (message.minExecutionPeriod !== undefined) { + Duration.encode(message.minExecutionPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecisionPolicyWindows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecisionPolicyWindows { + return { + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + minExecutionPeriod: isSet(object.minExecutionPeriod) ? Duration.fromJSON(object.minExecutionPeriod) : undefined, + }; + }, + + toJSON(message: DecisionPolicyWindows): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.minExecutionPeriod !== undefined) { + obj.minExecutionPeriod = Duration.toJSON(message.minExecutionPeriod); + } + return obj; + }, + + create, I>>(base?: I): DecisionPolicyWindows { + return DecisionPolicyWindows.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.minExecutionPeriod = (object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null) + ? Duration.fromPartial(object.minExecutionPeriod) + : undefined; + return message; + }, +}; + +function createBaseGroupInfo(): GroupInfo { + return { id: 0, admin: "", metadata: "", version: 0, totalWeight: "", createdAt: undefined }; +} + +export const GroupInfo: MessageFns = { + encode(message: GroupInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.totalWeight !== "") { + writer.uint32(42).string(message.totalWeight); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.admin = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.totalWeight = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupInfo { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + totalWeight: isSet(object.totalWeight) ? globalThis.String(object.totalWeight) : "", + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupInfo): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.totalWeight !== "") { + obj.totalWeight = message.totalWeight; + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupInfo { + return GroupInfo.fromPartial(base ?? ({} as any)); + }, + 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.totalWeight = object.totalWeight ?? ""; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseGroupMember(): GroupMember { + return { groupId: 0, member: undefined }; +} + +export const GroupMember: MessageFns = { + encode(message: GroupMember, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.member !== undefined) { + Member.encode(message.member, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.member = Member.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupMember { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + member: isSet(object.member) ? Member.fromJSON(object.member) : undefined, + }; + }, + + toJSON(message: GroupMember): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.member !== undefined) { + obj.member = Member.toJSON(message.member); + } + return obj; + }, + + create, I>>(base?: I): GroupMember { + return GroupMember.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupMember { + const message = createBaseGroupMember(); + message.groupId = object.groupId ?? 0; + message.member = (object.member !== undefined && object.member !== null) + ? Member.fromPartial(object.member) + : undefined; + return message; + }, +}; + +function createBaseGroupPolicyInfo(): GroupPolicyInfo { + return { + address: "", + groupId: 0, + admin: "", + metadata: "", + version: 0, + decisionPolicy: undefined, + createdAt: undefined, + }; +} + +export const GroupPolicyInfo: MessageFns = { + encode(message: GroupPolicyInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.version !== 0) { + writer.uint32(40).uint64(message.version); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupPolicyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.admin = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupPolicyInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupPolicyInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupPolicyInfo { + return GroupPolicyInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version ?? 0; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + groupPolicyAddress: "", + metadata: "", + proposers: [], + submitTime: undefined, + groupVersion: 0, + groupPolicyVersion: 0, + status: 0, + finalTallyResult: undefined, + votingPeriodEnd: undefined, + executorResult: 0, + messages: [], + title: "", + summary: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.proposers) { + writer.uint32(34).string(v!); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.groupVersion !== 0) { + writer.uint32(48).uint64(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + writer.uint32(56).uint64(message.groupPolicyVersion); + } + if (message.status !== 0) { + writer.uint32(64).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(74).fork()).join(); + } + if (message.votingPeriodEnd !== undefined) { + Timestamp.encode(toTimestamp(message.votingPeriodEnd), writer.uint32(82).fork()).join(); + } + if (message.executorResult !== 0) { + writer.uint32(88).int32(message.executorResult); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.title !== "") { + writer.uint32(106).string(message.title); + } + if (message.summary !== "") { + writer.uint32(114).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.groupVersion = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.groupPolicyVersion = longToNumber(reader.uint64()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.status = reader.int32() as any; + continue; + case 9: + if (tag !== 74) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.votingPeriodEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.executorResult = reader.int32() as any; + continue; + case 12: + if (tag !== 98) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.title = reader.string(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + groupVersion: isSet(object.groupVersion) ? globalThis.Number(object.groupVersion) : 0, + groupPolicyVersion: isSet(object.groupPolicyVersion) ? globalThis.Number(object.groupPolicyVersion) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + votingPeriodEnd: isSet(object.votingPeriodEnd) ? fromJsonTimestamp(object.votingPeriodEnd) : undefined, + executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : 0, + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.groupVersion !== 0) { + obj.groupVersion = Math.round(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + obj.groupPolicyVersion = Math.round(message.groupPolicyVersion); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.votingPeriodEnd !== undefined) { + obj.votingPeriodEnd = message.votingPeriodEnd.toISOString(); + } + if (message.executorResult !== 0) { + obj.executorResult = proposalExecutorResultToJSON(message.executorResult); + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + 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; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.submitTime = object.submitTime ?? undefined; + message.groupVersion = object.groupVersion ?? 0; + message.groupPolicyVersion = object.groupPolicyVersion ?? 0; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; + message.executorResult = object.executorResult ?? 0; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, metadata: "", submitTime: undefined }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.submitTime = object.submitTime ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/module/v1/module.ts new file mode 100644 index 00000000..233c0dd3 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.module.v1"; + +/** Module is the config object of the mint module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 00000000..d5580d2d --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,124 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** params defines all the parameters of the module. */ + params: Params | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { minter: undefined, params: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.minter = Minter.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.minter !== undefined) { + obj.minter = Minter.toJSON(message.minter); + } + 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.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/mint.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 00000000..c9b14ff0 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,285 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/mint.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** Minter represents the minting state. */ +export interface Minter { + /** current annual inflation rate */ + inflation: string; + /** current annual expected provisions */ + annualProvisions: string; +} + +/** Params defines the parameters for the x/mint module. */ +export interface Params { + /** type of coin to mint */ + mintDenom: string; + /** maximum annual change in inflation rate */ + inflationRateChange: string; + /** maximum inflation rate */ + inflationMax: string; + /** minimum inflation rate */ + inflationMin: string; + /** goal of percent bonded atoms */ + goalBonded: string; + /** expected blocks per year */ + blocksPerYear: number; +} + +function createBaseMinter(): Minter { + return { inflation: "", annualProvisions: "" }; +} + +export const Minter: MessageFns = { + encode(message: Minter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation !== "") { + writer.uint32(10).string(message.inflation); + } + if (message.annualProvisions !== "") { + writer.uint32(18).string(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Minter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.annualProvisions = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Minter { + return { + inflation: isSet(object.inflation) ? globalThis.String(object.inflation) : "", + annualProvisions: isSet(object.annualProvisions) ? globalThis.String(object.annualProvisions) : "", + }; + }, + + toJSON(message: Minter): unknown { + const obj: any = {}; + if (message.inflation !== "") { + obj.inflation = message.inflation; + } + if (message.annualProvisions !== "") { + obj.annualProvisions = message.annualProvisions; + } + return obj; + }, + + create, I>>(base?: I): Minter { + return Minter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Minter { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annualProvisions = object.annualProvisions ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + mintDenom: "", + inflationRateChange: "", + inflationMax: "", + inflationMin: "", + goalBonded: "", + blocksPerYear: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mintDenom !== "") { + writer.uint32(10).string(message.mintDenom); + } + if (message.inflationRateChange !== "") { + writer.uint32(18).string(message.inflationRateChange); + } + if (message.inflationMax !== "") { + writer.uint32(26).string(message.inflationMax); + } + if (message.inflationMin !== "") { + writer.uint32(34).string(message.inflationMin); + } + if (message.goalBonded !== "") { + writer.uint32(42).string(message.goalBonded); + } + if (message.blocksPerYear !== 0) { + writer.uint32(48).uint64(message.blocksPerYear); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.mintDenom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.inflationRateChange = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.inflationMax = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.inflationMin = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.goalBonded = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.blocksPerYear = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + mintDenom: isSet(object.mintDenom) ? globalThis.String(object.mintDenom) : "", + inflationRateChange: isSet(object.inflationRateChange) ? globalThis.String(object.inflationRateChange) : "", + inflationMax: isSet(object.inflationMax) ? globalThis.String(object.inflationMax) : "", + inflationMin: isSet(object.inflationMin) ? globalThis.String(object.inflationMin) : "", + goalBonded: isSet(object.goalBonded) ? globalThis.String(object.goalBonded) : "", + blocksPerYear: isSet(object.blocksPerYear) ? globalThis.Number(object.blocksPerYear) : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.mintDenom !== "") { + obj.mintDenom = message.mintDenom; + } + if (message.inflationRateChange !== "") { + obj.inflationRateChange = message.inflationRateChange; + } + if (message.inflationMax !== "") { + obj.inflationMax = message.inflationMax; + } + if (message.inflationMin !== "") { + obj.inflationMin = message.inflationMin; + } + if (message.goalBonded !== "") { + obj.goalBonded = message.goalBonded; + } + if (message.blocksPerYear !== 0) { + obj.blocksPerYear = Math.round(message.blocksPerYear); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.mintDenom = object.mintDenom ?? ""; + message.inflationRateChange = object.inflationRateChange ?? ""; + message.inflationMax = object.inflationMax ?? ""; + message.inflationMin = object.inflationMin ?? ""; + message.goalBonded = object.goalBonded ?? ""; + message.blocksPerYear = object.blocksPerYear ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/query.ts new file mode 100644 index 00000000..c90cf9db --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,450 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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. */ + annualProvisions: Uint8Array; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryInflationRequest(): QueryInflationRequest { + return {}; +} + +export const QueryInflationRequest: MessageFns = { + encode(_: QueryInflationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryInflationRequest { + return {}; + }, + + toJSON(_: QueryInflationRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryInflationRequest { + return QueryInflationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, +}; + +function createBaseQueryInflationResponse(): QueryInflationResponse { + return { inflation: new Uint8Array(0) }; +} + +export const QueryInflationResponse: MessageFns = { + encode(message: QueryInflationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryInflationResponse { + return { inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array(0) }; + }, + + toJSON(message: QueryInflationResponse): unknown { + const obj: any = {}; + if (message.inflation.length !== 0) { + obj.inflation = base64FromBytes(message.inflation); + } + return obj; + }, + + create, I>>(base?: I): QueryInflationResponse { + return QueryInflationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { + return {}; +} + +export const QueryAnnualProvisionsRequest: MessageFns = { + encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAnnualProvisionsRequest { + return {}; + }, + + toJSON(_: QueryAnnualProvisionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { + return { annualProvisions: new Uint8Array(0) }; +} + +export const QueryAnnualProvisionsResponse: MessageFns = { + encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.annualProvisions.length !== 0) { + writer.uint32(10).bytes(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.annualProvisions = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAnnualProvisionsResponse { + return { + annualProvisions: isSet(object.annualProvisions) ? bytesFromBase64(object.annualProvisions) : new Uint8Array(0), + }; + }, + + toJSON(message: QueryAnnualProvisionsResponse): unknown { + const obj: any = {}; + if (message.annualProvisions.length !== 0) { + obj.annualProvisions = base64FromBytes(message.annualProvisions); + } + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annualProvisions = object.annualProvisions ?? new Uint8Array(0); + 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 const QueryServiceName = "cosmos.mint.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/tx.ts new file mode 100644 index 00000000..c3d6285e --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/mint/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./mint"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/mint parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/mint Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/mint module + * parameters. The authority is defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.mint.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/msg/textual/v1/textual.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/msg/textual/v1/textual.ts new file mode 100644 index 00000000..cb8b705c --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/msg/textual/v1/textual.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/textual/v1/textual.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.textual.v1"; diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/module/v1/module.ts new file mode 100644 index 00000000..6a444831 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.nft.module.v1"; + +/** Module is the config object of the nft module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/event.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/event.ts new file mode 100644 index 00000000..81e4fb5e --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/event.ts @@ -0,0 +1,349 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** EventSend is emitted on Msg/Send */ +export interface EventSend { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} + +/** EventMint is emitted on Mint */ +export interface EventMint { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} + +/** EventBurn is emitted on Burn */ +export interface EventBurn { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} + +function createBaseEventSend(): EventSend { + return { classId: "", id: "", sender: "", receiver: "" }; +} + +export const EventSend: MessageFns = { + encode(message: EventSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + 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: BinaryReader | Uint8Array, length?: number): EventSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.receiver = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSend { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", + }; + }, + + toJSON(message: EventSend): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + + create, I>>(base?: I): EventSend { + return EventSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSend { + const message = createBaseEventSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseEventMint(): EventMint { + return { classId: "", id: "", owner: "" }; +} + +export const EventMint: MessageFns = { + encode(message: EventMint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventMint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventMint { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: EventMint): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): EventMint { + return EventMint.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventMint { + const message = createBaseEventMint(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseEventBurn(): EventBurn { + return { classId: "", id: "", owner: "" }; +} + +export const EventBurn: MessageFns = { + encode(message: EventBurn, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventBurn { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventBurn { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: EventBurn): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): EventBurn { + return EventBurn.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventBurn { + const message = createBaseEventBurn(); + message.classId = object.classId ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/genesis.ts new file mode 100644 index 00000000..e310a55d --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/genesis.ts @@ -0,0 +1,200 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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[]; + /** entry defines all nft owned by a person. */ + 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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + Entry.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.classes.push(Class.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(Entry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + classes: globalThis.Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => Entry.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.classes?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => Entry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Entry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Entry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.owner = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Entry { + return { + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + nfts: globalThis.Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + }; + }, + + toJSON(message: Entry): unknown { + const obj: any = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Entry { + return Entry.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/nft.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/nft.ts new file mode 100644 index 00000000..bbfc88c2 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/nft.ts @@ -0,0 +1,336 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/nft.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 */ + uriHash: string; + /** data is the app specific metadata of the NFT class. Optional */ + data: Any | undefined; +} + +/** NFT defines the NFT. */ +export interface NFT { + /** class_id associated with the NFT, similar to the contract address of ERC721 */ + classId: 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 */ + uriHash: string; + /** data is an app specific data of the NFT. Optional */ + data: Any | undefined; +} + +function createBaseClass(): Class { + return { id: "", name: "", symbol: "", description: "", uri: "", uriHash: "", data: undefined }; +} + +export const Class: MessageFns = { + encode(message: Class, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.uriHash !== "") { + writer.uint32(50).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Class { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.symbol = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.description = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.uri = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.uriHash = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Class { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: Class): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): Class { + return Class.fromPartial(base ?? ({} as any)); + }, + 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.uriHash = object.uriHash ?? ""; + message.data = (object.data !== undefined && object.data !== null) ? Any.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseNFT(): NFT { + return { classId: "", id: "", uri: "", uriHash: "", data: undefined }; +} + +export const NFT: MessageFns = { + encode(message: NFT, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.uri !== "") { + writer.uint32(26).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(34).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NFT { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.uri = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.uriHash = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NFT { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: NFT): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): NFT { + return NFT.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NFT { + const message = createBaseNFT(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/query.ts new file mode 100644 index 00000000..869693cd --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/query.ts @@ -0,0 +1,1152 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; +} + +/** QueryBalanceResponse is the response type for the Query/Balance RPC method */ +export interface QueryBalanceResponse { + /** amount is the number of all NFTs of a given class owned by the owner */ + amount: number; +} + +/** QueryOwnerRequest is the request type for the Query/Owner RPC method */ +export interface QueryOwnerRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} + +/** QueryOwnerResponse is the response type for the Query/Owner RPC method */ +export interface QueryOwnerResponse { + /** owner is the owner address of the nft */ + owner: string; +} + +/** QuerySupplyRequest is the request type for the Query/Supply RPC method */ +export interface QuerySupplyRequest { + /** class_id associated with the nft */ + classId: string; +} + +/** QuerySupplyResponse is the response type for the Query/Supply RPC method */ +export interface QuerySupplyResponse { + /** amount is the number of all NFTs from the given class */ + amount: number; +} + +/** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ +export interface QueryNFTsRequest { + /** class_id associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ +export interface QueryNFTsResponse { + /** NFT defines the NFT */ + nfts: NFT[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryNFTRequest is the request type for the Query/NFT RPC method */ +export interface QueryNFTRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} + +/** QueryNFTResponse is the response type for the Query/NFT RPC method */ +export interface QueryNFTResponse { + /** owner is the owner address of the nft */ + nft: NFT | undefined; +} + +/** QueryClassRequest is the request type for the Query/Class RPC method */ +export interface QueryClassRequest { + /** class_id associated with the nft */ + classId: string; +} + +/** QueryClassResponse is the response type for the Query/Class RPC method */ +export interface QueryClassResponse { + /** class defines the class of the nft type. */ + class: Class | undefined; +} + +/** QueryClassesRequest is the request type for the Query/Classes RPC method */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryClassesResponse is the response type for the Query/Classes RPC method */ +export interface QueryClassesResponse { + /** class defines the class of the nft type. */ + classes: Class[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { classId: "", owner: "" }; +} + +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.classId = object.classId ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { amount: 0 }; +} + +export const QueryBalanceResponse: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.amount = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; + +function createBaseQueryOwnerRequest(): QueryOwnerRequest { + return { classId: "", id: "" }; +} + +export const QueryOwnerRequest: MessageFns = { + encode(message: QueryOwnerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryOwnerRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: QueryOwnerRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): QueryOwnerRequest { + return QueryOwnerRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryOwnerRequest { + const message = createBaseQueryOwnerRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryOwnerResponse(): QueryOwnerResponse { + return { owner: "" }; +} + +export const QueryOwnerResponse: MessageFns = { + encode(message: QueryOwnerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryOwnerResponse { + return { owner: isSet(object.owner) ? globalThis.String(object.owner) : "" }; + }, + + toJSON(message: QueryOwnerResponse): unknown { + const obj: any = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): QueryOwnerResponse { + return QueryOwnerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryOwnerResponse { + const message = createBaseQueryOwnerResponse(); + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyRequest(): QuerySupplyRequest { + return { classId: "" }; +} + +export const QuerySupplyRequest: MessageFns = { + encode(message: QuerySupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyRequest { + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; + }, + + toJSON(message: QuerySupplyRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyRequest { + return QuerySupplyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyRequest { + const message = createBaseQuerySupplyRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyResponse(): QuerySupplyResponse { + return { amount: 0 }; +} + +export const QuerySupplyResponse: MessageFns = { + encode(message: QuerySupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.amount = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyResponse { + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; + }, + + toJSON(message: QuerySupplyResponse): unknown { + const obj: any = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyResponse { + return QuerySupplyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyResponse { + const message = createBaseQuerySupplyResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; + +function createBaseQueryNFTsRequest(): QueryNFTsRequest { + return { classId: "", owner: "", pagination: undefined }; +} + +export const QueryNFTsRequest: MessageFns = { + encode(message: QueryNFTsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.owner = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTsRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryNFTsRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTsRequest { + return QueryNFTsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryNFTsRequest { + const message = createBaseQueryNFTsRequest(); + message.classId = object.classId ?? ""; + 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: MessageFns = { + encode(message: QueryNFTsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTsResponse { + return { + nfts: globalThis.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?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTsResponse { + return QueryNFTsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { classId: "", id: "" }; +} + +export const QueryNFTRequest: MessageFns = { + encode(message: QueryNFTRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: QueryNFTRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): QueryNFTRequest { + return QueryNFTRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryNFTRequest { + const message = createBaseQueryNFTRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryNFTResponse(): QueryNFTResponse { + return { nft: undefined }; +} + +export const QueryNFTResponse: MessageFns = { + encode(message: QueryNFTResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nft !== undefined) { + NFT.encode(message.nft, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.nft = NFT.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTResponse { + return { nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined }; + }, + + toJSON(message: QueryNFTResponse): unknown { + const obj: any = {}; + if (message.nft !== undefined) { + obj.nft = NFT.toJSON(message.nft); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTResponse { + return QueryNFTResponse.fromPartial(base ?? ({} as any)); + }, + 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 { classId: "" }; +} + +export const QueryClassRequest: MessageFns = { + encode(message: QueryClassRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassRequest { + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; + }, + + toJSON(message: QueryClassRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + + create, I>>(base?: I): QueryClassRequest { + return QueryClassRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryClassRequest { + const message = createBaseQueryClassRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; + +function createBaseQueryClassResponse(): QueryClassResponse { + return { class: undefined }; +} + +export const QueryClassResponse: MessageFns = { + encode(message: QueryClassResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.class !== undefined) { + Class.encode(message.class, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.class = Class.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassResponse { + return { class: isSet(object.class) ? Class.fromJSON(object.class) : undefined }; + }, + + toJSON(message: QueryClassResponse): unknown { + const obj: any = {}; + if (message.class !== undefined) { + obj.class = Class.toJSON(message.class); + } + return obj; + }, + + create, I>>(base?: I): QueryClassResponse { + return QueryClassResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryClassesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryClassesRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryClassesRequest { + return QueryClassesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryClassesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classes.push(Class.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassesResponse { + return { + classes: globalThis.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?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryClassesResponse { + return QueryClassesResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.nft.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/tx.ts new file mode 100644 index 00000000..63ad423f --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/nft/v1beta1/tx.ts @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 */ + classId: 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 { classId: "", id: "", sender: "", receiver: "" }; +} + +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + 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: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.receiver = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + 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 const MsgServiceName = "cosmos.nft.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 || MsgServiceName; + 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts new file mode 100644 index 00000000..053430b5 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts @@ -0,0 +1,82 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/module/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.module.v1alpha1"; + +/** + * Module defines the ORM module which adds providers to the app container for + * ORM ModuleDB's and in the future will automatically register query + * services for modules that use the ORM. + */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts new file mode 100644 index 00000000..da9a277e --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts @@ -0,0 +1,911 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/query/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Duration } from "../../../../google/protobuf/duration"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { PageRequest, PageResponse } from "../../../base/query/v1beta1/pagination"; + +export const protobufPackage = "cosmos.orm.query.v1alpha1"; + +/** GetRequest is the Query/Get request type. */ +export interface GetRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. If it is non-empty, it must + * refer to an unique index. + */ + index: string; + /** + * values are the values of the fields corresponding to the requested index. + * There must be as many values provided as there are fields in the index and + * these values must correspond to the index field types. + */ + values: IndexValue[]; +} + +/** GetResponse is the Query/Get response type. */ +export interface GetResponse { + /** + * result is the result of the get query. If no value is found, the gRPC + * status code NOT_FOUND will be returned. + */ + result: Any | undefined; +} + +/** ListRequest is the Query/List request type. */ +export interface ListRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. + */ + index: string; + /** prefix defines a prefix query. */ + prefix?: + | ListRequest_Prefix + | undefined; + /** range defines a range query. */ + range?: + | ListRequest_Range + | undefined; + /** pagination is the pagination request. */ + pagination: PageRequest | undefined; +} + +/** Prefix specifies the arguments to a prefix query. */ +export interface ListRequest_Prefix { + /** + * values specifies the index values for the prefix query. + * It is valid to special a partial prefix with fewer values than + * the number of fields in the index. + */ + values: IndexValue[]; +} + +/** Range specifies the arguments to a range query. */ +export interface ListRequest_Range { + /** + * start specifies the starting index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + start: IndexValue[]; + /** + * end specifies the inclusive ending index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + end: IndexValue[]; +} + +/** ListResponse is the Query/List response type. */ +export interface ListResponse { + /** results are the results of the query. */ + results: Any[]; + /** pagination is the pagination response. */ + pagination: PageResponse | undefined; +} + +/** IndexValue represents the value of a field in an ORM index expression. */ +export interface IndexValue { + /** + * uint specifies a value for an uint32, fixed32, uint64, or fixed64 + * index field. + */ + uint?: + | number + | undefined; + /** + * int64 specifies a value for an int32, sfixed32, int64, or sfixed64 + * index field. + */ + int?: + | number + | undefined; + /** str specifies a value for a string index field. */ + str?: + | string + | undefined; + /** bytes specifies a value for a bytes index field. */ + bytes?: + | Uint8Array + | undefined; + /** enum specifies a value for an enum index field. */ + enum?: + | string + | undefined; + /** bool specifies a value for a bool index field. */ + bool?: + | boolean + | undefined; + /** timestamp specifies a value for a timestamp index field. */ + timestamp?: + | Date + | undefined; + /** duration specifies a value for a duration index field. */ + duration?: Duration | undefined; +} + +function createBaseGetRequest(): GetRequest { + return { messageName: "", index: "", values: [] }; +} + +export const GetRequest: MessageFns = { + encode(message: GetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: GetRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GetRequest { + return GetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetRequest { + const message = createBaseGetRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetResponse(): GetResponse { + return { result: undefined }; +} + +export const GetResponse: MessageFns = { + encode(message: GetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== undefined) { + Any.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.result = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetResponse { + return { result: isSet(object.result) ? Any.fromJSON(object.result) : undefined }; + }, + + toJSON(message: GetResponse): unknown { + const obj: any = {}; + if (message.result !== undefined) { + obj.result = Any.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): GetResponse { + return GetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetResponse { + const message = createBaseGetResponse(); + message.result = (object.result !== undefined && object.result !== null) + ? Any.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseListRequest(): ListRequest { + return { messageName: "", index: "", prefix: undefined, range: undefined, pagination: undefined }; +} + +export const ListRequest: MessageFns = { + encode(message: ListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + if (message.prefix !== undefined) { + ListRequest_Prefix.encode(message.prefix, writer.uint32(26).fork()).join(); + } + if (message.range !== undefined) { + ListRequest_Range.encode(message.range, writer.uint32(34).fork()).join(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.prefix = ListRequest_Prefix.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.range = ListRequest_Range.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + prefix: isSet(object.prefix) ? ListRequest_Prefix.fromJSON(object.prefix) : undefined, + range: isSet(object.range) ? ListRequest_Range.fromJSON(object.range) : undefined, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.prefix !== undefined) { + obj.prefix = ListRequest_Prefix.toJSON(message.prefix); + } + if (message.range !== undefined) { + obj.range = ListRequest_Range.toJSON(message.range); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListRequest { + return ListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest { + const message = createBaseListRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.prefix = (object.prefix !== undefined && object.prefix !== null) + ? ListRequest_Prefix.fromPartial(object.prefix) + : undefined; + message.range = (object.range !== undefined && object.range !== null) + ? ListRequest_Range.fromPartial(object.range) + : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseListRequest_Prefix(): ListRequest_Prefix { + return { values: [] }; +} + +export const ListRequest_Prefix: MessageFns = { + encode(message: ListRequest_Prefix, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Prefix { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Prefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Prefix { + return { + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Prefix): unknown { + const obj: any = {}; + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Prefix { + return ListRequest_Prefix.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Prefix { + const message = createBaseListRequest_Prefix(); + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListRequest_Range(): ListRequest_Range { + return { start: [], end: [] }; +} + +export const ListRequest_Range: MessageFns = { + encode(message: ListRequest_Range, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.start) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.end) { + IndexValue.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Range { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Range(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.start.push(IndexValue.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.end.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Range { + return { + start: globalThis.Array.isArray(object?.start) ? object.start.map((e: any) => IndexValue.fromJSON(e)) : [], + end: globalThis.Array.isArray(object?.end) ? object.end.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Range): unknown { + const obj: any = {}; + if (message.start?.length) { + obj.start = message.start.map((e) => IndexValue.toJSON(e)); + } + if (message.end?.length) { + obj.end = message.end.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Range { + return ListRequest_Range.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Range { + const message = createBaseListRequest_Range(); + message.start = object.start?.map((e) => IndexValue.fromPartial(e)) || []; + message.end = object.end?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListResponse(): ListResponse { + return { results: [], pagination: undefined }; +} + +export const ListResponse: MessageFns = { + encode(message: ListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListResponse { + return ListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListResponse { + const message = createBaseListResponse(); + message.results = object.results?.map((e) => Any.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseIndexValue(): IndexValue { + return { + uint: undefined, + int: undefined, + str: undefined, + bytes: undefined, + enum: undefined, + bool: undefined, + timestamp: undefined, + duration: undefined, + }; +} + +export const IndexValue: MessageFns = { + encode(message: IndexValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uint !== undefined) { + writer.uint32(8).uint64(message.uint); + } + if (message.int !== undefined) { + writer.uint32(16).int64(message.int); + } + if (message.str !== undefined) { + writer.uint32(26).string(message.str); + } + if (message.bytes !== undefined) { + writer.uint32(34).bytes(message.bytes); + } + if (message.enum !== undefined) { + writer.uint32(42).string(message.enum); + } + if (message.bool !== undefined) { + writer.uint32(48).bool(message.bool); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(58).fork()).join(); + } + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.uint = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.int = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.str = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.enum = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.bool = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.duration = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexValue { + return { + uint: isSet(object.uint) ? globalThis.Number(object.uint) : undefined, + int: isSet(object.int) ? globalThis.Number(object.int) : undefined, + str: isSet(object.str) ? globalThis.String(object.str) : undefined, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : undefined, + enum: isSet(object.enum) ? globalThis.String(object.enum) : undefined, + bool: isSet(object.bool) ? globalThis.Boolean(object.bool) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + }; + }, + + toJSON(message: IndexValue): unknown { + const obj: any = {}; + if (message.uint !== undefined) { + obj.uint = Math.round(message.uint); + } + if (message.int !== undefined) { + obj.int = Math.round(message.int); + } + if (message.str !== undefined) { + obj.str = message.str; + } + if (message.bytes !== undefined) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.enum !== undefined) { + obj.enum = message.enum; + } + if (message.bool !== undefined) { + obj.bool = message.bool; + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.duration !== undefined) { + obj.duration = Duration.toJSON(message.duration); + } + return obj; + }, + + create, I>>(base?: I): IndexValue { + return IndexValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexValue { + const message = createBaseIndexValue(); + message.uint = object.uint ?? undefined; + message.int = object.int ?? undefined; + message.str = object.str ?? undefined; + message.bytes = object.bytes ?? undefined; + message.enum = object.enum ?? undefined; + message.bool = object.bool ?? undefined; + message.timestamp = object.timestamp ?? undefined; + message.duration = (object.duration !== undefined && object.duration !== null) + ? Duration.fromPartial(object.duration) + : undefined; + return message; + }, +}; + +/** Query is a generic gRPC service for querying ORM data. */ +export interface Query { + /** Get queries an ORM table against an unique index. */ + Get(request: GetRequest): Promise; + /** List queries an ORM table against an index. */ + List(request: ListRequest): Promise; +} + +export const QueryServiceName = "cosmos.orm.query.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Get = this.Get.bind(this); + this.List = this.List.bind(this); + } + Get(request: GetRequest): Promise { + const data = GetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Get", data); + return promise.then((data) => GetResponse.decode(new BinaryReader(data))); + } + + List(request: ListRequest): Promise { + const data = ListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "List", data); + return promise.then((data) => ListResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/v1/orm.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/v1/orm.ts new file mode 100644 index 00000000..e13476dc --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/v1/orm.ts @@ -0,0 +1,444 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1/orm.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1"; + +/** TableDescriptor describes an ORM table. */ +export interface TableDescriptor { + /** primary_key defines the primary key for the table. */ + primaryKey: + | PrimaryKeyDescriptor + | undefined; + /** 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 is encoded such that values with only seconds occupy 6 bytes, + * values including nanos occupy 9 bytes, and nil values occupy 1 byte. When iterating, nil + * values will always be ordered last. Seconds and nanos values must conform to the officially + * specified ranges of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z and 0 to 999,999,999 respectively. + * - google.protobuf.Duration is 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. + */ + autoIncrement: 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 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 { primaryKey: undefined, index: [], id: 0 }; +} + +export const TableDescriptor: MessageFns = { + encode(message: TableDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.primaryKey !== undefined) { + PrimaryKeyDescriptor.encode(message.primaryKey, writer.uint32(10).fork()).join(); + } + for (const v of message.index) { + SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.id !== 0) { + writer.uint32(24).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TableDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.primaryKey = PrimaryKeyDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index.push(SecondaryIndexDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TableDescriptor { + return { + primaryKey: isSet(object.primaryKey) ? PrimaryKeyDescriptor.fromJSON(object.primaryKey) : undefined, + index: globalThis.Array.isArray(object?.index) + ? object.index.map((e: any) => SecondaryIndexDescriptor.fromJSON(e)) + : [], + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + }; + }, + + toJSON(message: TableDescriptor): unknown { + const obj: any = {}; + if (message.primaryKey !== undefined) { + obj.primaryKey = PrimaryKeyDescriptor.toJSON(message.primaryKey); + } + if (message.index?.length) { + obj.index = message.index.map((e) => SecondaryIndexDescriptor.toJSON(e)); + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): TableDescriptor { + return TableDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TableDescriptor { + const message = createBaseTableDescriptor(); + message.primaryKey = (object.primaryKey !== undefined && object.primaryKey !== null) + ? PrimaryKeyDescriptor.fromPartial(object.primaryKey) + : undefined; + message.index = object.index?.map((e) => SecondaryIndexDescriptor.fromPartial(e)) || []; + message.id = object.id ?? 0; + return message; + }, +}; + +function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { + return { fields: "", autoIncrement: false }; +} + +export const PrimaryKeyDescriptor: MessageFns = { + encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.autoIncrement !== false) { + writer.uint32(16).bool(message.autoIncrement); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrimaryKeyDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.autoIncrement = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrimaryKeyDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + autoIncrement: isSet(object.autoIncrement) ? globalThis.Boolean(object.autoIncrement) : false, + }; + }, + + toJSON(message: PrimaryKeyDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.autoIncrement !== false) { + obj.autoIncrement = message.autoIncrement; + } + return obj; + }, + + create, I>>(base?: I): PrimaryKeyDescriptor { + return PrimaryKeyDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrimaryKeyDescriptor { + const message = createBasePrimaryKeyDescriptor(); + message.fields = object.fields ?? ""; + message.autoIncrement = object.autoIncrement ?? false; + return message; + }, +}; + +function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { + return { fields: "", id: 0, unique: false }; +} + +export const SecondaryIndexDescriptor: MessageFns = { + encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.id !== 0) { + writer.uint32(16).uint32(message.id); + } + if (message.unique !== false) { + writer.uint32(24).bool(message.unique); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecondaryIndexDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.id = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.unique = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecondaryIndexDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + unique: isSet(object.unique) ? globalThis.Boolean(object.unique) : false, + }; + }, + + toJSON(message: SecondaryIndexDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.unique !== false) { + obj.unique = message.unique; + } + return obj; + }, + + create, I>>(base?: I): SecondaryIndexDescriptor { + return SecondaryIndexDescriptor.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: SingletonDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SingletonDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SingletonDescriptor { + return { id: isSet(object.id) ? globalThis.Number(object.id) : 0 }; + }, + + toJSON(message: SingletonDescriptor): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): SingletonDescriptor { + return SingletonDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/v1alpha1/schema.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/v1alpha1/schema.ts new file mode 100644 index 00000000..e326c1bc --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/orm/v1alpha1/schema.ts @@ -0,0 +1,316 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1alpha1/schema.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1alpha1"; + +/** StorageType */ +export enum StorageType { + /** + * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent storage where all + * data is stored in the regular Merkle-tree backed KV-store. + */ + 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, + 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 -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.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptor { + schemaFile: 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. + */ + protoFileName: 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. + */ + storageType: StorageType; +} + +function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { + return { schemaFile: [], prefix: new Uint8Array(0) }; +} + +export const ModuleSchemaDescriptor: MessageFns = { + encode(message: ModuleSchemaDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.schemaFile) { + ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.schemaFile.push(ModuleSchemaDescriptor_FileEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.prefix = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor { + return { + schemaFile: globalThis.Array.isArray(object?.schemaFile) + ? object.schemaFile.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)) + : [], + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0), + }; + }, + + toJSON(message: ModuleSchemaDescriptor): unknown { + const obj: any = {}; + if (message.schemaFile?.length) { + obj.schemaFile = message.schemaFile.map((e) => ModuleSchemaDescriptor_FileEntry.toJSON(e)); + } + if (message.prefix.length !== 0) { + obj.prefix = base64FromBytes(message.prefix); + } + return obj; + }, + + create, I>>(base?: I): ModuleSchemaDescriptor { + return ModuleSchemaDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schemaFile = object.schemaFile?.map((e) => ModuleSchemaDescriptor_FileEntry.fromPartial(e)) || []; + message.prefix = object.prefix ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { + return { id: 0, protoFileName: "", storageType: 0 }; +} + +export const ModuleSchemaDescriptor_FileEntry: MessageFns = { + encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.protoFileName !== "") { + writer.uint32(18).string(message.protoFileName); + } + if (message.storageType !== 0) { + writer.uint32(24).int32(message.storageType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor_FileEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.protoFileName = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.storageType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor_FileEntry { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + protoFileName: isSet(object.protoFileName) ? globalThis.String(object.protoFileName) : "", + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : 0, + }; + }, + + toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.protoFileName !== "") { + obj.protoFileName = message.protoFileName; + } + if (message.storageType !== 0) { + obj.storageType = storageTypeToJSON(message.storageType); + } + return obj; + }, + + create, I>>( + base?: I, + ): ModuleSchemaDescriptor_FileEntry { + return ModuleSchemaDescriptor_FileEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + message.id = object.id ?? 0; + message.protoFileName = object.protoFileName ?? ""; + message.storageType = object.storageType ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/params/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/params/module/v1/module.ts new file mode 100644 index 00000000..731379ce --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/params/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.params.module.v1"; + +/** Module is the config object of the params module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/params/v1beta1/params.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/params/v1beta1/params.ts new file mode 100644 index 00000000..24070188 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/params/v1beta1/params.ts @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: MessageFns = { + encode(message: ParameterChangeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParameterChangeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changes.push(ParamChange.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParameterChangeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + changes: globalThis.Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [], + }; + }, + + toJSON(message: ParameterChangeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.changes?.length) { + obj.changes = message.changes.map((e) => ParamChange.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ParameterChangeProposal { + return ParameterChangeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ParamChange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ParamChange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParamChange { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: ParamChange): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ParamChange { + return ParamChange.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/params/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/params/v1beta1/query.ts new file mode 100644 index 00000000..d45f57cd --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/params/v1beta1/query.ts @@ -0,0 +1,433 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesRequest { +} + +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesResponse { + subspaces: Subspace[]; +} + +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface Subspace { + subspace: string; + keys: string[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { subspace: "", key: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.param !== undefined) { + ParamChange.encode(message.param, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.param = ParamChange.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.param !== undefined) { + obj.param = ParamChange.toJSON(message.param); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QuerySubspacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QuerySubspacesRequest { + return {}; + }, + + toJSON(_: QuerySubspacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QuerySubspacesRequest { + return QuerySubspacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, +}; + +function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { + return { subspaces: [] }; +} + +export const QuerySubspacesResponse: MessageFns = { + encode(message: QuerySubspacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.subspaces) { + Subspace.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspaces.push(Subspace.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySubspacesResponse { + return { + subspaces: globalThis.Array.isArray(object?.subspaces) + ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QuerySubspacesResponse): unknown { + const obj: any = {}; + if (message.subspaces?.length) { + obj.subspaces = message.subspaces.map((e) => Subspace.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QuerySubspacesResponse { + return QuerySubspacesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Subspace, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + for (const v of message.keys) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Subspace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keys.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Subspace { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: Subspace): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.keys?.length) { + obj.keys = message.keys; + } + return obj; + }, + + create, I>>(base?: I): Subspace { + return Subspace.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + Subspaces(request: QuerySubspacesRequest): Promise; +} + +export const QueryServiceName = "cosmos.params.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/query/v1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/query/v1/query.ts new file mode 100644 index 00000000..bcdfc76d --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/query/v1/query.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/query/v1/query.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.query.v1"; diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/reflection/v1/reflection.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/reflection/v1/reflection.ts new file mode 100644 index 00000000..0962d0d1 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/reflection/v1/reflection.ts @@ -0,0 +1,178 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/reflection/v1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { FileDescriptorProto } from "../../../google/protobuf/descriptor"; + +export const protobufPackage = "cosmos.reflection.v1"; + +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequest { +} + +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponse { + /** files is the file descriptors. */ + files: FileDescriptorProto[]; +} + +function createBaseFileDescriptorsRequest(): FileDescriptorsRequest { + return {}; +} + +export const FileDescriptorsRequest: MessageFns = { + encode(_: FileDescriptorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): FileDescriptorsRequest { + return {}; + }, + + toJSON(_: FileDescriptorsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): FileDescriptorsRequest { + return FileDescriptorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): FileDescriptorsRequest { + const message = createBaseFileDescriptorsRequest(); + return message; + }, +}; + +function createBaseFileDescriptorsResponse(): FileDescriptorsResponse { + return { files: [] }; +} + +export const FileDescriptorsResponse: MessageFns = { + encode(message: FileDescriptorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.files) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.files.push(FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileDescriptorsResponse { + return { + files: globalThis.Array.isArray(object?.files) + ? object.files.map((e: any) => FileDescriptorProto.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileDescriptorsResponse): unknown { + const obj: any = {}; + if (message.files?.length) { + obj.files = message.files.map((e) => FileDescriptorProto.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FileDescriptorsResponse { + return FileDescriptorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileDescriptorsResponse { + const message = createBaseFileDescriptorsResponse(); + message.files = object.files?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +/** + * Package cosmos.reflection.v1 provides support for inspecting protobuf + * file descriptors. + */ +export interface ReflectionService { + /** + * FileDescriptors queries all the file descriptors in the app in order + * to enable easier generation of dynamic clients. + */ + FileDescriptors(request: FileDescriptorsRequest): Promise; +} + +export const ReflectionServiceServiceName = "cosmos.reflection.v1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + this.rpc = rpc; + this.FileDescriptors = this.FileDescriptors.bind(this); + } + FileDescriptors(request: FileDescriptorsRequest): Promise { + const data = FileDescriptorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FileDescriptors", data); + return promise.then((data) => FileDescriptorsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/module/v1/module.ts new file mode 100644 index 00000000..bf27cfd0 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.slashing.module.v1"; + +/** Module is the config object of the slashing module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts new file mode 100644 index 00000000..958b6870 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signingInfos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missedBlocks: 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. */ + validatorSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * 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. */ + missedBlocks: MissedBlock[]; +} + +/** MissedBlock contains height and missed status as boolean. */ +export interface MissedBlock { + /** index is the height at which the block was missed. */ + index: number; + /** missed is the missed status. */ + missed: boolean; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, signingInfos: [], missedBlocks: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.signingInfos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.missedBlocks) { + ValidatorMissedBlocks.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signingInfos.push(SigningInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.missedBlocks.push(ValidatorMissedBlocks.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signingInfos: globalThis.Array.isArray(object?.signingInfos) + ? object.signingInfos.map((e: any) => SigningInfo.fromJSON(e)) + : [], + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.signingInfos?.length) { + obj.signingInfos = message.signingInfos.map((e) => SigningInfo.toJSON(e)); + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => ValidatorMissedBlocks.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) + ? Params.fromPartial(object.params) + : undefined; + message.signingInfos = object.signingInfos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missedBlocks = object.missedBlocks?.map((e) => ValidatorMissedBlocks.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningInfo(): SigningInfo { + return { address: "", validatorSigningInfo: undefined }; +} + +export const SigningInfo: MessageFns = { + encode(message: SigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.validatorSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.validatorSigningInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + validatorSigningInfo: isSet(object.validatorSigningInfo) + ? ValidatorSigningInfo.fromJSON(object.validatorSigningInfo) + : undefined, + }; + }, + + toJSON(message: SigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.validatorSigningInfo !== undefined) { + obj.validatorSigningInfo = ValidatorSigningInfo.toJSON(message.validatorSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): SigningInfo { + return SigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningInfo { + const message = createBaseSigningInfo(); + message.address = object.address ?? ""; + message.validatorSigningInfo = (object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.validatorSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { + return { address: "", missedBlocks: [] }; +} + +export const ValidatorMissedBlocks: MessageFns = { + encode(message: ValidatorMissedBlocks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.missedBlocks) { + MissedBlock.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorMissedBlocks { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.missedBlocks.push(MissedBlock.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlocks { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => MissedBlock.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorMissedBlocks): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => MissedBlock.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorMissedBlocks { + return ValidatorMissedBlocks.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorMissedBlocks { + const message = createBaseValidatorMissedBlocks(); + message.address = object.address ?? ""; + message.missedBlocks = object.missedBlocks?.map((e) => MissedBlock.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMissedBlock(): MissedBlock { + return { index: 0, missed: false }; +} + +export const MissedBlock: MessageFns = { + encode(message: MissedBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).int64(message.index); + } + if (message.missed !== false) { + writer.uint32(16).bool(message.missed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MissedBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.missed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MissedBlock { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + missed: isSet(object.missed) ? globalThis.Boolean(object.missed) : false, + }; + }, + + toJSON(message: MissedBlock): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.missed !== false) { + obj.missed = message.missed; + } + return obj; + }, + + create, I>>(base?: I): MissedBlock { + return MissedBlock.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 00000000..bc78c27e --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,481 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoRequest { + /** cons_address is the address to query signing info of */ + consAddress: 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 */ + valSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosRequest { + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { + return { consAddress: "" }; +} + +export const QuerySigningInfoRequest: MessageFns = { + encode(message: QuerySigningInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consAddress !== "") { + writer.uint32(10).string(message.consAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.consAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoRequest { + return { consAddress: isSet(object.consAddress) ? globalThis.String(object.consAddress) : "" }; + }, + + toJSON(message: QuerySigningInfoRequest): unknown { + const obj: any = {}; + if (message.consAddress !== "") { + obj.consAddress = message.consAddress; + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoRequest { + return QuerySigningInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoRequest { + const message = createBaseQuerySigningInfoRequest(); + message.consAddress = object.consAddress ?? ""; + return message; + }, +}; + +function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { + return { valSigningInfo: undefined }; +} + +export const QuerySigningInfoResponse: MessageFns = { + encode(message: QuerySigningInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.valSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.valSigningInfo, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.valSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoResponse { + return { + valSigningInfo: isSet(object.valSigningInfo) ? ValidatorSigningInfo.fromJSON(object.valSigningInfo) : undefined, + }; + }, + + toJSON(message: QuerySigningInfoResponse): unknown { + const obj: any = {}; + if (message.valSigningInfo !== undefined) { + obj.valSigningInfo = ValidatorSigningInfo.toJSON(message.valSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoResponse { + return QuerySigningInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoResponse { + const message = createBaseQuerySigningInfoResponse(); + message.valSigningInfo = (object.valSigningInfo !== undefined && object.valSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.valSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { + return { pagination: undefined }; +} + +export const QuerySigningInfosRequest: MessageFns = { + encode(message: QuerySigningInfosRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QuerySigningInfosRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosRequest { + return QuerySigningInfosRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySigningInfosResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.info) { + ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info.push(ValidatorSigningInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosResponse { + return { + info: globalThis.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?.length) { + obj.info = message.info.map((e) => ValidatorSigningInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosResponse { + return QuerySigningInfosResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.slashing.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts new file mode 100644 index 00000000..06f87d05 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts @@ -0,0 +1,411 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/slashing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 un-jailed */ + startHeight: number; + /** + * Index which is incremented every time a validator is bonded in a block and + * _may_ have signed a pre-commit or not. This in conjunction with the + * signed_blocks_window param determines the index in the missed block bitmap. + */ + indexOffset: number; + /** Timestamp until which the validator is jailed due to liveness downtime. */ + jailedUntil: + | Date + | undefined; + /** + * 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 misbehavior. + */ + tombstoned: boolean; + /** + * A counter of missed (unsigned) blocks. It is used to avoid unnecessary + * reads in the missed block bitmap. + */ + missedBlocksCounter: number; +} + +/** Params represents the parameters used for by the slashing module. */ +export interface Params { + signedBlocksWindow: number; + minSignedPerWindow: Uint8Array; + downtimeJailDuration: Duration | undefined; + slashFractionDoubleSign: Uint8Array; + slashFractionDowntime: Uint8Array; +} + +function createBaseValidatorSigningInfo(): ValidatorSigningInfo { + return { + address: "", + startHeight: 0, + indexOffset: 0, + jailedUntil: undefined, + tombstoned: false, + missedBlocksCounter: 0, + }; +} + +export const ValidatorSigningInfo: MessageFns = { + encode(message: ValidatorSigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.startHeight !== 0) { + writer.uint32(16).int64(message.startHeight); + } + if (message.indexOffset !== 0) { + writer.uint32(24).int64(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + Timestamp.encode(toTimestamp(message.jailedUntil), writer.uint32(34).fork()).join(); + } + if (message.tombstoned !== false) { + writer.uint32(40).bool(message.tombstoned); + } + if (message.missedBlocksCounter !== 0) { + writer.uint32(48).int64(message.missedBlocksCounter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.indexOffset = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.jailedUntil = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.tombstoned = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.missedBlocksCounter = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + startHeight: isSet(object.startHeight) ? globalThis.Number(object.startHeight) : 0, + indexOffset: isSet(object.indexOffset) ? globalThis.Number(object.indexOffset) : 0, + jailedUntil: isSet(object.jailedUntil) ? fromJsonTimestamp(object.jailedUntil) : undefined, + tombstoned: isSet(object.tombstoned) ? globalThis.Boolean(object.tombstoned) : false, + missedBlocksCounter: isSet(object.missedBlocksCounter) ? globalThis.Number(object.missedBlocksCounter) : 0, + }; + }, + + toJSON(message: ValidatorSigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.startHeight !== 0) { + obj.startHeight = Math.round(message.startHeight); + } + if (message.indexOffset !== 0) { + obj.indexOffset = Math.round(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + obj.jailedUntil = message.jailedUntil.toISOString(); + } + if (message.tombstoned !== false) { + obj.tombstoned = message.tombstoned; + } + if (message.missedBlocksCounter !== 0) { + obj.missedBlocksCounter = Math.round(message.missedBlocksCounter); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSigningInfo { + return ValidatorSigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSigningInfo { + const message = createBaseValidatorSigningInfo(); + message.address = object.address ?? ""; + message.startHeight = object.startHeight ?? 0; + message.indexOffset = object.indexOffset ?? 0; + message.jailedUntil = object.jailedUntil ?? undefined; + message.tombstoned = object.tombstoned ?? false; + message.missedBlocksCounter = object.missedBlocksCounter ?? 0; + return message; + }, +}; + +function createBaseParams(): Params { + return { + signedBlocksWindow: 0, + minSignedPerWindow: new Uint8Array(0), + downtimeJailDuration: undefined, + slashFractionDoubleSign: new Uint8Array(0), + slashFractionDowntime: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedBlocksWindow !== 0) { + writer.uint32(8).int64(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + writer.uint32(18).bytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + Duration.encode(message.downtimeJailDuration, writer.uint32(26).fork()).join(); + } + if (message.slashFractionDoubleSign.length !== 0) { + writer.uint32(34).bytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + writer.uint32(42).bytes(message.slashFractionDowntime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.signedBlocksWindow = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minSignedPerWindow = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.downtimeJailDuration = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.slashFractionDoubleSign = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionDowntime = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + signedBlocksWindow: isSet(object.signedBlocksWindow) ? globalThis.Number(object.signedBlocksWindow) : 0, + minSignedPerWindow: isSet(object.minSignedPerWindow) + ? bytesFromBase64(object.minSignedPerWindow) + : new Uint8Array(0), + downtimeJailDuration: isSet(object.downtimeJailDuration) + ? Duration.fromJSON(object.downtimeJailDuration) + : undefined, + slashFractionDoubleSign: isSet(object.slashFractionDoubleSign) + ? bytesFromBase64(object.slashFractionDoubleSign) + : new Uint8Array(0), + slashFractionDowntime: isSet(object.slashFractionDowntime) + ? bytesFromBase64(object.slashFractionDowntime) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.signedBlocksWindow !== 0) { + obj.signedBlocksWindow = Math.round(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + obj.minSignedPerWindow = base64FromBytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + obj.downtimeJailDuration = Duration.toJSON(message.downtimeJailDuration); + } + if (message.slashFractionDoubleSign.length !== 0) { + obj.slashFractionDoubleSign = base64FromBytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + obj.slashFractionDowntime = base64FromBytes(message.slashFractionDowntime); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.signedBlocksWindow = object.signedBlocksWindow ?? 0; + message.minSignedPerWindow = object.minSignedPerWindow ?? new Uint8Array(0); + message.downtimeJailDuration = (object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null) + ? Duration.fromPartial(object.downtimeJailDuration) + : undefined; + message.slashFractionDoubleSign = object.slashFractionDoubleSign ?? new Uint8Array(0); + message.slashFractionDowntime = object.slashFractionDowntime ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/tx.ts new file mode 100644 index 00000000..54377079 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/slashing/v1beta1/tx.ts @@ -0,0 +1,333 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./slashing"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** MsgUnjail defines the Msg/Unjail request type */ +export interface MsgUnjail { + validatorAddr: string; +} + +/** MsgUnjailResponse defines the Msg/Unjail response type */ +export interface MsgUnjailResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/slashing parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUnjail(): MsgUnjail { + return { validatorAddr: "" }; +} + +export const MsgUnjail: MessageFns = { + encode(message: MsgUnjail, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjail { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnjail { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: MsgUnjail): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): MsgUnjail { + return MsgUnjail.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnjail { + const message = createBaseMsgUnjail(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseMsgUnjailResponse(): MsgUnjailResponse { + return {}; +} + +export const MsgUnjailResponse: MessageFns = { + encode(_: MsgUnjailResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjailResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjailResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnjailResponse { + return {}; + }, + + toJSON(_: MsgUnjailResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnjailResponse { + return MsgUnjailResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnjailResponse { + const message = createBaseMsgUnjailResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/slashing module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.slashing.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 || MsgServiceName; + this.rpc = rpc; + this.Unjail = this.Unjail.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/module/v1/module.ts new file mode 100644 index 00000000..7f8fe4b9 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/module/v1/module.ts @@ -0,0 +1,157 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.staking.module.v1"; + +/** Module is the config object of the staking module. */ +export interface Module { + /** + * hooks_order specifies the order of staking hooks and should be a list + * of module names which provide a staking hooks instance. If no order is + * provided, then hooks will be applied in alphabetical order of module names. + */ + hooksOrder: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** bech32_prefix_validator is the bech32 validator prefix for the app. */ + bech32PrefixValidator: string; + /** bech32_prefix_consensus is the bech32 consensus node prefix for the app. */ + bech32PrefixConsensus: string; +} + +function createBaseModule(): Module { + return { hooksOrder: [], authority: "", bech32PrefixValidator: "", bech32PrefixConsensus: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.hooksOrder) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + if (message.bech32PrefixValidator !== "") { + writer.uint32(26).string(message.bech32PrefixValidator); + } + if (message.bech32PrefixConsensus !== "") { + writer.uint32(34).string(message.bech32PrefixConsensus); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.hooksOrder.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bech32PrefixValidator = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bech32PrefixConsensus = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + hooksOrder: globalThis.Array.isArray(object?.hooksOrder) + ? object.hooksOrder.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + bech32PrefixValidator: isSet(object.bech32PrefixValidator) ? globalThis.String(object.bech32PrefixValidator) : "", + bech32PrefixConsensus: isSet(object.bech32PrefixConsensus) ? globalThis.String(object.bech32PrefixConsensus) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.hooksOrder?.length) { + obj.hooksOrder = message.hooksOrder; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.bech32PrefixValidator !== "") { + obj.bech32PrefixValidator = message.bech32PrefixValidator; + } + if (message.bech32PrefixConsensus !== "") { + obj.bech32PrefixConsensus = message.bech32PrefixConsensus; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.hooksOrder = object.hooksOrder?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.bech32PrefixValidator = object.bech32PrefixValidator ?? ""; + message.bech32PrefixConsensus = object.bech32PrefixConsensus ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/authz.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 00000000..b989d692 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,301 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION - AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION defines an authorization type for Msg/MsgCancelUnbondingDelegation */ + AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION = 4, + 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 4: + case "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION": + return AuthorizationType.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION; + 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.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION: + return "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION"; + 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. + */ + maxTokens: + | Coin + | undefined; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allowList?: + | StakeAuthorization_Validators + | undefined; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + denyList?: + | StakeAuthorization_Validators + | undefined; + /** authorization_type defines one of AuthorizationType. */ + authorizationType: AuthorizationType; +} + +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_Validators { + address: string[]; +} + +function createBaseStakeAuthorization(): StakeAuthorization { + return { maxTokens: undefined, allowList: undefined, denyList: undefined, authorizationType: 0 }; +} + +export const StakeAuthorization: MessageFns = { + encode(message: StakeAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTokens !== undefined) { + Coin.encode(message.maxTokens, writer.uint32(10).fork()).join(); + } + if (message.allowList !== undefined) { + StakeAuthorization_Validators.encode(message.allowList, writer.uint32(18).fork()).join(); + } + if (message.denyList !== undefined) { + StakeAuthorization_Validators.encode(message.denyList, writer.uint32(26).fork()).join(); + } + if (message.authorizationType !== 0) { + writer.uint32(32).int32(message.authorizationType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxTokens = Coin.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.denyList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.authorizationType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization { + return { + maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, + allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, + denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, + authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : 0, + }; + }, + + toJSON(message: StakeAuthorization): unknown { + const obj: any = {}; + if (message.maxTokens !== undefined) { + obj.maxTokens = Coin.toJSON(message.maxTokens); + } + if (message.allowList !== undefined) { + obj.allowList = StakeAuthorization_Validators.toJSON(message.allowList); + } + if (message.denyList !== undefined) { + obj.denyList = StakeAuthorization_Validators.toJSON(message.denyList); + } + if (message.authorizationType !== 0) { + obj.authorizationType = authorizationTypeToJSON(message.authorizationType); + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization { + return StakeAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeAuthorization { + const message = createBaseStakeAuthorization(); + message.maxTokens = (object.maxTokens !== undefined && object.maxTokens !== null) + ? Coin.fromPartial(object.maxTokens) + : undefined; + message.allowList = (object.allowList !== undefined && object.allowList !== null) + ? StakeAuthorization_Validators.fromPartial(object.allowList) + : undefined; + message.denyList = (object.denyList !== undefined && object.denyList !== null) + ? StakeAuthorization_Validators.fromPartial(object.denyList) + : undefined; + message.authorizationType = object.authorizationType ?? 0; + return message; + }, +}; + +function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { + return { address: [] }; +} + +export const StakeAuthorization_Validators: MessageFns = { + encode(message: StakeAuthorization_Validators, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.address) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization_Validators { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization_Validators { + return { + address: globalThis.Array.isArray(object?.address) ? object.address.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: StakeAuthorization_Validators): unknown { + const obj: any = {}; + if (message.address?.length) { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization_Validators { + return StakeAuthorization_Validators.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/genesis.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 00000000..8c967ba2 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,367 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of related to deposit. */ + params: + | Params + | undefined; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + lastTotalPower: Uint8Array; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + lastValidatorPowers: LastValidatorPower[]; + /** validators 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. */ + unbondingDelegations: UnbondingDelegation[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: Redelegation[]; + /** exported defines a bool to identify whether the chain dealing with exported or initialized genesis. */ + 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: number; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + lastTotalPower: new Uint8Array(0), + lastValidatorPowers: [], + validators: [], + delegations: [], + unbondingDelegations: [], + redelegations: [], + exported: false, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.lastTotalPower.length !== 0) { + writer.uint32(18).bytes(message.lastTotalPower); + } + for (const v of message.lastValidatorPowers) { + LastValidatorPower.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.delegations) { + Delegation.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.unbondingDelegations) { + UnbondingDelegation.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.redelegations) { + Redelegation.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.exported !== false) { + writer.uint32(64).bool(message.exported); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lastTotalPower = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.lastValidatorPowers.push(LastValidatorPower.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delegations.push(Delegation.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.unbondingDelegations.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.redelegations.push(Redelegation.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.exported = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + lastTotalPower: isSet(object.lastTotalPower) ? bytesFromBase64(object.lastTotalPower) : new Uint8Array(0), + lastValidatorPowers: globalThis.Array.isArray(object?.lastValidatorPowers) + ? object.lastValidatorPowers.map((e: any) => LastValidatorPower.fromJSON(e)) + : [], + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + delegations: globalThis.Array.isArray(object?.delegations) + ? object.delegations.map((e: any) => Delegation.fromJSON(e)) + : [], + unbondingDelegations: globalThis.Array.isArray(object?.unbondingDelegations) + ? object.unbondingDelegations.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + redelegations: globalThis.Array.isArray(object?.redelegations) + ? object.redelegations.map((e: any) => Redelegation.fromJSON(e)) + : [], + exported: isSet(object.exported) ? globalThis.Boolean(object.exported) : false, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.lastTotalPower.length !== 0) { + obj.lastTotalPower = base64FromBytes(message.lastTotalPower); + } + if (message.lastValidatorPowers?.length) { + obj.lastValidatorPowers = message.lastValidatorPowers.map((e) => LastValidatorPower.toJSON(e)); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.delegations?.length) { + obj.delegations = message.delegations.map((e) => Delegation.toJSON(e)); + } + if (message.unbondingDelegations?.length) { + obj.unbondingDelegations = message.unbondingDelegations.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.redelegations?.length) { + obj.redelegations = message.redelegations.map((e) => Redelegation.toJSON(e)); + } + if (message.exported !== false) { + obj.exported = message.exported; + } + 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) + ? Params.fromPartial(object.params) + : undefined; + message.lastTotalPower = object.lastTotalPower ?? new Uint8Array(0); + message.lastValidatorPowers = object.lastValidatorPowers?.map((e) => LastValidatorPower.fromPartial(e)) || []; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.delegations = object.delegations?.map((e) => Delegation.fromPartial(e)) || []; + message.unbondingDelegations = object.unbondingDelegations?.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: MessageFns = { + encode(message: LastValidatorPower, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LastValidatorPower { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LastValidatorPower { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: LastValidatorPower): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): LastValidatorPower { + return LastValidatorPower.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LastValidatorPower { + const message = createBaseLastValidatorPower(); + message.address = object.address ?? ""; + message.power = object.power ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/query.ts new file mode 100644 index 00000000..ef8f2dc7 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,2495 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponse { + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegationResponse: DelegationResponse | undefined; +} + +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond: UnbondingDelegation | undefined; +} + +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** src_validator_addr defines the validator address to redelegate from. */ + srcValidatorAddr: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dstValidatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponse { + redelegationResponses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: number; +} + +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist: HistoricalInfo | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { status: "", pagination: undefined }; +} + +export const QueryValidatorsRequest: MessageFns = { + encode(message: QueryValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.status = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsRequest { + return { + status: isSet(object.status) ? globalThis.String(object.status) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsRequest): unknown { + const obj: any = {}; + if (message.status !== "") { + obj.status = message.status; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsRequest { + return QueryValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsResponse { + return QueryValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "" }; +} + +export const QueryValidatorRequest: MessageFns = { + encode(message: QueryValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorRequest { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: QueryValidatorRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorRequest { + return QueryValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { validator: undefined }; +} + +export const QueryValidatorResponse: MessageFns = { + encode(message: QueryValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorResponse { + return QueryValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorDelegationsRequest: MessageFns = { + encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryValidatorDelegationsResponse: MessageFns = { + encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegationRequest: MessageFns = { + encode(message: QueryDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRequest { + return QueryDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { delegationResponse: undefined }; +} + +export const QueryDelegationResponse: MessageFns = { + encode(message: QueryDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegationResponse !== undefined) { + DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponse = DelegationResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationResponse { + return { + delegationResponse: isSet(object.delegationResponse) + ? DelegationResponse.fromJSON(object.delegationResponse) + : undefined, + }; + }, + + toJSON(message: QueryDelegationResponse): unknown { + const obj: any = {}; + if (message.delegationResponse !== undefined) { + obj.delegationResponse = DelegationResponse.toJSON(message.delegationResponse); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationResponse { + return QueryDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegationResponse = (object.delegationResponse !== undefined && object.delegationResponse !== null) + ? DelegationResponse.fromPartial(object.delegationResponse) + : undefined; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryUnbondingDelegationRequest: MessageFns = { + encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryUnbondingDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { unbond: undefined }; +} + +export const QueryUnbondingDelegationResponse: MessageFns = { + encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbond = UnbondingDelegation.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationResponse { + return { unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined }; + }, + + toJSON(message: QueryUnbondingDelegationResponse): unknown { + const obj: any = {}; + if (message.unbond !== undefined) { + obj.unbond = UnbondingDelegation.toJSON(message.unbond); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryDelegatorDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { delegatorAddr: "", srcValidatorAddr: "", dstValidatorAddr: "", pagination: undefined }; +} + +export const QueryRedelegationsRequest: MessageFns = { + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.srcValidatorAddr !== "") { + writer.uint32(18).string(message.srcValidatorAddr); + } + if (message.dstValidatorAddr !== "") { + writer.uint32(26).string(message.dstValidatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.srcValidatorAddr = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.dstValidatorAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + srcValidatorAddr: isSet(object.srcValidatorAddr) ? globalThis.String(object.srcValidatorAddr) : "", + dstValidatorAddr: isSet(object.dstValidatorAddr) ? globalThis.String(object.dstValidatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.srcValidatorAddr !== "") { + obj.srcValidatorAddr = message.srcValidatorAddr; + } + if (message.dstValidatorAddr !== "") { + obj.dstValidatorAddr = message.dstValidatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsRequest { + return QueryRedelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.srcValidatorAddr = object.srcValidatorAddr ?? ""; + message.dstValidatorAddr = object.dstValidatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { redelegationResponses: [], pagination: undefined }; +} + +export const QueryRedelegationsResponse: MessageFns = { + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.redelegationResponses) { + RedelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationResponses.push(RedelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsResponse { + return { + redelegationResponses: globalThis.Array.isArray(object?.redelegationResponses) + ? object.redelegationResponses.map((e: any) => RedelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsResponse): unknown { + const obj: any = {}; + if (message.redelegationResponses?.length) { + obj.redelegationResponses = message.redelegationResponses.map((e) => RedelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsResponse { + return QueryRedelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegationResponses?.map((e) => RedelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + 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: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegatorValidatorRequest: MessageFns = { + encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegatorValidatorRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { validator: undefined }; +} + +export const QueryDelegatorValidatorResponse: MessageFns = { + encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryDelegatorValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryHistoricalInfoRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { hist: undefined }; +} + +export const QueryHistoricalInfoResponse: MessageFns = { + encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hist = HistoricalInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoResponse { + return { hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined }; + }, + + toJSON(message: QueryHistoricalInfoResponse): unknown { + const obj: any = {}; + if (message.hist !== undefined) { + obj.hist = HistoricalInfo.toJSON(message.hist); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPoolRequest { + return {}; + }, + + toJSON(_: QueryPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPoolRequest { + return QueryPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, +}; + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +export const QueryPoolResponse: MessageFns = { + encode(message: QueryPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pool = Pool.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + if (message.pool !== undefined) { + obj.pool = Pool.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) ? Pool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Validators(request: QueryValidatorsRequest): Promise; + /** Validator queries validator info for given validator address. */ + Validator(request: QueryValidatorRequest): Promise; + /** + * ValidatorDelegations queries delegate info for given validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + ValidatorDelegations(request: QueryValidatorDelegationsRequest): Promise; + /** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; + /** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorUnbondingDelegations( + request: QueryDelegatorUnbondingDelegationsRequest, + ): Promise; + /** + * Redelegations queries redelegations of given address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Redelegations(request: QueryRedelegationsRequest): Promise; + /** + * DelegatorValidators queries all validators info for given delegator + * address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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 const QueryServiceName = "cosmos.staking.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/staking.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 00000000..7ea20d02 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,2506 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/staking.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { ValidatorUpdate } from "../../../tendermint/abci/types"; +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"; + } +} + +/** Infraction indicates the infraction a validator commited. */ +export enum Infraction { + /** INFRACTION_UNSPECIFIED - UNSPECIFIED defines an empty infraction. */ + INFRACTION_UNSPECIFIED = 0, + /** INFRACTION_DOUBLE_SIGN - DOUBLE_SIGN defines a validator that double-signs a block. */ + INFRACTION_DOUBLE_SIGN = 1, + /** INFRACTION_DOWNTIME - DOWNTIME defines a validator that missed signing too many blocks. */ + INFRACTION_DOWNTIME = 2, + UNRECOGNIZED = -1, +} + +export function infractionFromJSON(object: any): Infraction { + switch (object) { + case 0: + case "INFRACTION_UNSPECIFIED": + return Infraction.INFRACTION_UNSPECIFIED; + case 1: + case "INFRACTION_DOUBLE_SIGN": + return Infraction.INFRACTION_DOUBLE_SIGN; + case 2: + case "INFRACTION_DOWNTIME": + return Infraction.INFRACTION_DOWNTIME; + case -1: + case "UNRECOGNIZED": + default: + return Infraction.UNRECOGNIZED; + } +} + +export function infractionToJSON(object: Infraction): string { + switch (object) { + case Infraction.INFRACTION_UNSPECIFIED: + return "INFRACTION_UNSPECIFIED"; + case Infraction.INFRACTION_DOUBLE_SIGN: + return "INFRACTION_DOUBLE_SIGN"; + case Infraction.INFRACTION_DOWNTIME: + return "INFRACTION_DOWNTIME"; + case Infraction.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfo { + header: Header | undefined; + 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. */ + maxRate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + maxChangeRate: 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. */ + commissionRates: + | CommissionRates + | undefined; + /** update_time is the last time the commission rate was changed. */ + updateTime: Date | undefined; +} + +/** Description defines a validator description. */ +export interface Description { + /** moniker defines a human-readable name for the validator. */ + moniker: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity: string; + /** website defines an optional website link. */ + website: string; + /** security_contact defines an optional email for security contact. */ + securityContact: string; + /** details define other optional details. */ + details: string; +} + +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface Validator { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operatorAddress: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensusPubkey: + | Any + | undefined; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegatorShares: string; + /** description defines the description terms for the validator. */ + description: + | Description + | undefined; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbondingHeight: number; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbondingTime: + | Date + | undefined; + /** commission defines the commission parameters. */ + commission: + | Commission + | undefined; + /** + * min_self_delegation is the validator's self declared minimum self delegation. + * + * Since: cosmos-sdk 0.46 + */ + minSelfDelegation: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbondingIds: number[]; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: 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 encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** shares define the delegation shares received. */ + shares: string; +} + +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegation { + /** delegator_address is the encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} + +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; + /** completion_time is the unix time for unbonding completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initialBalance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creationHeight: number; + /** completion_time defines the unix time for redelegation completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the initial balance when redelegation started. */ + initialBalance: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + sharesDst: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface Redelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegatorAddress: string; + /** validator_src_address is the validator redelegation source operator address. */ + validatorSrcAddress: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validatorDstAddress: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntry[]; +} + +/** Params defines the parameters for the x/staking module. */ +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbondingTime: + | Duration + | undefined; + /** max_validators is the maximum number of validators. */ + maxValidators: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + maxEntries: number; + /** historical_entries is the number of historical entries to persist. */ + historicalEntries: number; + /** bond_denom defines the bondable coin denomination. */ + bondDenom: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + minCommissionRate: string; +} + +/** + * 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 | undefined; + balance: Coin | undefined; +} + +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponse { + redelegationEntry: RedelegationEntry | undefined; + 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 | undefined; + entries: RedelegationEntryResponse[]; +} + +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface Pool { + notBondedTokens: string; + bondedTokens: string; +} + +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdates { + updates: ValidatorUpdate[]; +} + +function createBaseHistoricalInfo(): HistoricalInfo { + return { header: undefined, valset: [] }; +} + +export const HistoricalInfo: MessageFns = { + encode(message: HistoricalInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + for (const v of message.valset) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoricalInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.valset.push(Validator.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HistoricalInfo { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + valset: globalThis.Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [], + }; + }, + + toJSON(message: HistoricalInfo): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.valset?.length) { + obj.valset = message.valset.map((e) => Validator.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HistoricalInfo { + return HistoricalInfo.fromPartial(base ?? ({} as any)); + }, + 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: "", maxRate: "", maxChangeRate: "" }; +} + +export const CommissionRates: MessageFns = { + encode(message: CommissionRates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.maxRate !== "") { + writer.uint32(18).string(message.maxRate); + } + if (message.maxChangeRate !== "") { + writer.uint32(26).string(message.maxChangeRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rate = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxRate = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.maxChangeRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommissionRates { + return { + rate: isSet(object.rate) ? globalThis.String(object.rate) : "", + maxRate: isSet(object.maxRate) ? globalThis.String(object.maxRate) : "", + maxChangeRate: isSet(object.maxChangeRate) ? globalThis.String(object.maxChangeRate) : "", + }; + }, + + toJSON(message: CommissionRates): unknown { + const obj: any = {}; + if (message.rate !== "") { + obj.rate = message.rate; + } + if (message.maxRate !== "") { + obj.maxRate = message.maxRate; + } + if (message.maxChangeRate !== "") { + obj.maxChangeRate = message.maxChangeRate; + } + return obj; + }, + + create, I>>(base?: I): CommissionRates { + return CommissionRates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.maxRate = object.maxRate ?? ""; + message.maxChangeRate = object.maxChangeRate ?? ""; + return message; + }, +}; + +function createBaseCommission(): Commission { + return { commissionRates: undefined, updateTime: undefined }; +} + +export const Commission: MessageFns = { + encode(message: Commission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commissionRates !== undefined) { + CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).join(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commissionRates = CommissionRates.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commission { + return { + commissionRates: isSet(object.commissionRates) ? CommissionRates.fromJSON(object.commissionRates) : undefined, + updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, + }; + }, + + toJSON(message: Commission): unknown { + const obj: any = {}; + if (message.commissionRates !== undefined) { + obj.commissionRates = CommissionRates.toJSON(message.commissionRates); + } + if (message.updateTime !== undefined) { + obj.updateTime = message.updateTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Commission { + return Commission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commission { + const message = createBaseCommission(); + message.commissionRates = (object.commissionRates !== undefined && object.commissionRates !== null) + ? CommissionRates.fromPartial(object.commissionRates) + : undefined; + message.updateTime = object.updateTime ?? undefined; + return message; + }, +}; + +function createBaseDescription(): Description { + return { moniker: "", identity: "", website: "", securityContact: "", details: "" }; +} + +export const Description: MessageFns = { + encode(message: Description, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.securityContact !== "") { + writer.uint32(34).string(message.securityContact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Description { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moniker = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.website = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.securityContact = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.details = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Description { + return { + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + securityContact: isSet(object.securityContact) ? globalThis.String(object.securityContact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", + }; + }, + + toJSON(message: Description): unknown { + const obj: any = {}; + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.securityContact !== "") { + obj.securityContact = message.securityContact; + } + if (message.details !== "") { + obj.details = message.details; + } + return obj; + }, + + create, I>>(base?: I): Description { + return Description.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.securityContact = object.securityContact ?? ""; + message.details = object.details ?? ""; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { + operatorAddress: "", + consensusPubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegatorShares: "", + description: undefined, + unbondingHeight: 0, + unbondingTime: undefined, + commission: undefined, + minSelfDelegation: "", + unbondingOnHoldRefCount: 0, + unbondingIds: [], + }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + if (message.consensusPubkey !== undefined) { + Any.encode(message.consensusPubkey, writer.uint32(18).fork()).join(); + } + if (message.jailed !== false) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegatorShares !== "") { + writer.uint32(50).string(message.delegatorShares); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).join(); + } + if (message.unbondingHeight !== 0) { + writer.uint32(64).int64(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + Timestamp.encode(toTimestamp(message.unbondingTime), writer.uint32(74).fork()).join(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(90).string(message.minSelfDelegation); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(96).int64(message.unbondingOnHoldRefCount); + } + writer.uint32(106).fork(); + for (const v of message.unbondingIds) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.consensusPubkey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.jailed = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.status = reader.int32() as any; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.tokens = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.delegatorShares = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.unbondingHeight = longToNumber(reader.int64()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.unbondingTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.commission = Commission.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + case 13: + if (tag === 104) { + message.unbondingIds.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 106) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.unbondingIds.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, + jailed: isSet(object.jailed) ? globalThis.Boolean(object.jailed) : false, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + tokens: isSet(object.tokens) ? globalThis.String(object.tokens) : "", + delegatorShares: isSet(object.delegatorShares) ? globalThis.String(object.delegatorShares) : "", + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + unbondingHeight: isSet(object.unbondingHeight) ? globalThis.Number(object.unbondingHeight) : 0, + unbondingTime: isSet(object.unbondingTime) ? fromJsonTimestamp(object.unbondingTime) : undefined, + commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + unbondingIds: globalThis.Array.isArray(object?.unbondingIds) + ? object.unbondingIds.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.consensusPubkey !== undefined) { + obj.consensusPubkey = Any.toJSON(message.consensusPubkey); + } + if (message.jailed !== false) { + obj.jailed = message.jailed; + } + if (message.status !== 0) { + obj.status = bondStatusToJSON(message.status); + } + if (message.tokens !== "") { + obj.tokens = message.tokens; + } + if (message.delegatorShares !== "") { + obj.delegatorShares = message.delegatorShares; + } + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.unbondingHeight !== 0) { + obj.unbondingHeight = Math.round(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + obj.unbondingTime = message.unbondingTime.toISOString(); + } + if (message.commission !== undefined) { + obj.commission = Commission.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + if (message.unbondingIds?.length) { + obj.unbondingIds = message.unbondingIds.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.operatorAddress = object.operatorAddress ?? ""; + message.consensusPubkey = (object.consensusPubkey !== undefined && object.consensusPubkey !== null) + ? Any.fromPartial(object.consensusPubkey) + : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegatorShares = object.delegatorShares ?? ""; + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.unbondingHeight = object.unbondingHeight ?? 0; + message.unbondingTime = object.unbondingTime ?? undefined; + message.commission = (object.commission !== undefined && object.commission !== null) + ? Commission.fromPartial(object.commission) + : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + message.unbondingIds = object.unbondingIds?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValAddresses(): ValAddresses { + return { addresses: [] }; +} + +export const ValAddresses: MessageFns = { + encode(message: ValAddresses, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addresses.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValAddresses { + return { + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValAddresses): unknown { + const obj: any = {}; + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + return obj; + }, + + create, I>>(base?: I): ValAddresses { + return ValAddresses.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDVPair(): DVPair { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const DVPair: MessageFns = { + encode(message: DVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPair { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: DVPair): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): DVPair { + return DVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPair { + const message = createBaseDVPair(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseDVPairs(): DVPairs { + return { pairs: [] }; +} + +export const DVPairs: MessageFns = { + encode(message: DVPairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pairs.push(DVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] }; + }, + + toJSON(message: DVPairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => DVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVPairs { + return DVPairs.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map((e) => DVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDVVTriplet(): DVVTriplet { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" }; +} + +export const DVVTriplet: MessageFns = { + encode(message: DVVTriplet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplet { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + }; + }, + + toJSON(message: DVVTriplet): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + return obj; + }, + + create, I>>(base?: I): DVVTriplet { + return DVVTriplet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + return message; + }, +}; + +function createBaseDVVTriplets(): DVVTriplets { + return { triplets: [] }; +} + +export const DVVTriplets: MessageFns = { + encode(message: DVVTriplets, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.triplets.push(DVVTriplet.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplets { + return { + triplets: globalThis.Array.isArray(object?.triplets) + ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DVVTriplets): unknown { + const obj: any = {}; + if (message.triplets?.length) { + obj.triplets = message.triplets.map((e) => DVVTriplet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVVTriplets { + return DVVTriplets.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map((e) => DVVTriplet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDelegation(): Delegation { + return { delegatorAddress: "", validatorAddress: "", shares: "" }; +} + +export const Delegation: MessageFns = { + encode(message: Delegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Delegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.shares = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Delegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + shares: isSet(object.shares) ? globalThis.String(object.shares) : "", + }; + }, + + toJSON(message: Delegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.shares !== "") { + obj.shares = message.shares; + } + return obj; + }, + + create, I>>(base?: I): Delegation { + return Delegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Delegation { + const message = createBaseDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.shares = object.shares ?? ""; + return message; + }, +}; + +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", entries: [] }; +} + +export const UnbondingDelegation: MessageFns = { + encode(message: UnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: UnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => UnbondingDelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegation { + return UnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + balance: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const UnbondingDelegationEntry: MessageFns = { + encode(message: UnbondingDelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: UnbondingDelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.balance !== "") { + obj.balance = message.balance; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegationEntry { + return UnbondingDelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.balance = object.balance ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegationEntry(): RedelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + sharesDst: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const RedelegationEntry: MessageFns = { + encode(message: RedelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.sharesDst !== "") { + writer.uint32(34).string(message.sharesDst); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sharesDst = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + sharesDst: isSet(object.sharesDst) ? globalThis.String(object.sharesDst) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.sharesDst !== "") { + obj.sharesDst = message.sharesDst; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntry { + return RedelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.sharesDst = object.sharesDst ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegation(): Redelegation { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", entries: [] }; +} + +export const Redelegation: MessageFns = { + encode(message: Redelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Redelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Redelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Redelegation { + return Redelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Redelegation { + const message = createBaseRedelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.entries = object.entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + unbondingTime: undefined, + maxValidators: 0, + maxEntries: 0, + historicalEntries: 0, + bondDenom: "", + minCommissionRate: "", + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbondingTime !== undefined) { + Duration.encode(message.unbondingTime, writer.uint32(10).fork()).join(); + } + if (message.maxValidators !== 0) { + writer.uint32(16).uint32(message.maxValidators); + } + if (message.maxEntries !== 0) { + writer.uint32(24).uint32(message.maxEntries); + } + if (message.historicalEntries !== 0) { + writer.uint32(32).uint32(message.historicalEntries); + } + if (message.bondDenom !== "") { + writer.uint32(42).string(message.bondDenom); + } + if (message.minCommissionRate !== "") { + writer.uint32(50).string(message.minCommissionRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingTime = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxValidators = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxEntries = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.historicalEntries = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bondDenom = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.minCommissionRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbondingTime: isSet(object.unbondingTime) ? Duration.fromJSON(object.unbondingTime) : undefined, + maxValidators: isSet(object.maxValidators) ? globalThis.Number(object.maxValidators) : 0, + maxEntries: isSet(object.maxEntries) ? globalThis.Number(object.maxEntries) : 0, + historicalEntries: isSet(object.historicalEntries) ? globalThis.Number(object.historicalEntries) : 0, + bondDenom: isSet(object.bondDenom) ? globalThis.String(object.bondDenom) : "", + minCommissionRate: isSet(object.minCommissionRate) ? globalThis.String(object.minCommissionRate) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.unbondingTime !== undefined) { + obj.unbondingTime = Duration.toJSON(message.unbondingTime); + } + if (message.maxValidators !== 0) { + obj.maxValidators = Math.round(message.maxValidators); + } + if (message.maxEntries !== 0) { + obj.maxEntries = Math.round(message.maxEntries); + } + if (message.historicalEntries !== 0) { + obj.historicalEntries = Math.round(message.historicalEntries); + } + if (message.bondDenom !== "") { + obj.bondDenom = message.bondDenom; + } + if (message.minCommissionRate !== "") { + obj.minCommissionRate = message.minCommissionRate; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbondingTime = (object.unbondingTime !== undefined && object.unbondingTime !== null) + ? Duration.fromPartial(object.unbondingTime) + : undefined; + message.maxValidators = object.maxValidators ?? 0; + message.maxEntries = object.maxEntries ?? 0; + message.historicalEntries = object.historicalEntries ?? 0; + message.bondDenom = object.bondDenom ?? ""; + message.minCommissionRate = object.minCommissionRate ?? ""; + return message; + }, +}; + +function createBaseDelegationResponse(): DelegationResponse { + return { delegation: undefined, balance: undefined }; +} + +export const DelegationResponse: MessageFns = { + encode(message: DelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegation !== undefined) { + Delegation.encode(message.delegation, writer.uint32(10).fork()).join(); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegation = Delegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.delegation !== undefined) { + obj.delegation = Delegation.toJSON(message.delegation); + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DelegationResponse { + return DelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { redelegationEntry: undefined, balance: "" }; +} + +export const RedelegationEntryResponse: MessageFns = { + encode(message: RedelegationEntryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegationEntry !== undefined) { + RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).join(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationEntry = RedelegationEntry.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntryResponse { + return { + redelegationEntry: isSet(object.redelegationEntry) + ? RedelegationEntry.fromJSON(object.redelegationEntry) + : undefined, + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + }; + }, + + toJSON(message: RedelegationEntryResponse): unknown { + const obj: any = {}; + if (message.redelegationEntry !== undefined) { + obj.redelegationEntry = RedelegationEntry.toJSON(message.redelegationEntry); + } + if (message.balance !== "") { + obj.balance = message.balance; + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntryResponse { + return RedelegationEntryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegationEntry = (object.redelegationEntry !== undefined && object.redelegationEntry !== null) + ? RedelegationEntry.fromPartial(object.redelegationEntry) + : undefined; + message.balance = object.balance ?? ""; + return message; + }, +}; + +function createBaseRedelegationResponse(): RedelegationResponse { + return { redelegation: undefined, entries: [] }; +} + +export const RedelegationResponse: MessageFns = { + encode(message: RedelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegation !== undefined) { + Redelegation.encode(message.redelegation, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + RedelegationEntryResponse.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegation = Redelegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(RedelegationEntryResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationResponse { + return { + redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RedelegationResponse): unknown { + const obj: any = {}; + if (message.redelegation !== undefined) { + obj.redelegation = Redelegation.toJSON(message.redelegation); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntryResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RedelegationResponse { + return RedelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { notBondedTokens: "", bondedTokens: "" }; +} + +export const Pool: MessageFns = { + encode(message: Pool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.notBondedTokens !== "") { + writer.uint32(10).string(message.notBondedTokens); + } + if (message.bondedTokens !== "") { + writer.uint32(18).string(message.bondedTokens); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.notBondedTokens = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bondedTokens = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pool { + return { + notBondedTokens: isSet(object.notBondedTokens) ? globalThis.String(object.notBondedTokens) : "", + bondedTokens: isSet(object.bondedTokens) ? globalThis.String(object.bondedTokens) : "", + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + if (message.notBondedTokens !== "") { + obj.notBondedTokens = message.notBondedTokens; + } + if (message.bondedTokens !== "") { + obj.bondedTokens = message.bondedTokens; + } + return obj; + }, + + create, I>>(base?: I): Pool { + return Pool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.notBondedTokens = object.notBondedTokens ?? ""; + message.bondedTokens = object.bondedTokens ?? ""; + return message; + }, +}; + +function createBaseValidatorUpdates(): ValidatorUpdates { + return { updates: [] }; +} + +export const ValidatorUpdates: MessageFns = { + encode(message: ValidatorUpdates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdates { + return { + updates: globalThis.Array.isArray(object?.updates) + ? object.updates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorUpdates): unknown { + const obj: any = {}; + if (message.updates?.length) { + obj.updates = message.updates.map((e) => ValidatorUpdate.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdates { + return ValidatorUpdates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 00000000..06be4ca4 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,1403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { CommissionRates, Description, Params } from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidator { + description: Description | undefined; + commission: CommissionRates | undefined; + minSelfDelegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + * + * @deprecated + */ + delegatorAddress: string; + validatorAddress: string; + pubkey: Any | undefined; + value: Coin | undefined; +} + +/** 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 | undefined; + validatorAddress: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commissionRate: string; + minSelfDelegation: string; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; + amount: Coin | undefined; +} + +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponse { + completionTime: Date | undefined; +} + +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponse { + completionTime: + | Date + | undefined; + /** + * amount returns the amount of undelegated coins + * + * Since: cosmos-sdk 0.50 + */ + amount: Coin | undefined; +} + +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegation { + delegatorAddress: string; + validatorAddress: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: + | Coin + | undefined; + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; +} + +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: undefined, + commission: undefined, + minSelfDelegation: "", + delegatorAddress: "", + validatorAddress: "", + pubkey: undefined, + value: undefined, + }; +} + +export const MsgCreateValidator: MessageFns = { + encode(message: MsgCreateValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.commission !== undefined) { + CommissionRates.encode(message.commission, writer.uint32(18).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(26).string(message.minSelfDelegation); + } + if (message.delegatorAddress !== "") { + writer.uint32(34).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(42).string(message.validatorAddress); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(50).fork()).join(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commission = CommissionRates.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.pubkey = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + 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 = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.commission !== undefined) { + obj.commission = CommissionRates.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.pubkey !== undefined) { + obj.pubkey = Any.toJSON(message.pubkey); + } + if (message.value !== undefined) { + obj.value = Coin.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateValidator { + return MsgCreateValidator.fromPartial(base ?? ({} as any)); + }, + 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.minSelfDelegation = object.minSelfDelegation ?? ""; + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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: MessageFns = { + encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateValidatorResponse { + return {}; + }, + + toJSON(_: MsgCreateValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, +}; + +function createBaseMsgEditValidator(): MsgEditValidator { + return { description: undefined, validatorAddress: "", commissionRate: "", minSelfDelegation: "" }; +} + +export const MsgEditValidator: MessageFns = { + encode(message: MsgEditValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.commissionRate !== "") { + writer.uint32(26).string(message.commissionRate); + } + if (message.minSelfDelegation !== "") { + writer.uint32(34).string(message.minSelfDelegation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commissionRate = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + commissionRate: isSet(object.commissionRate) ? globalThis.String(object.commissionRate) : "", + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + }; + }, + + toJSON(message: MsgEditValidator): unknown { + const obj: any = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.commissionRate !== "") { + obj.commissionRate = message.commissionRate; + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + return obj; + }, + + create, I>>(base?: I): MsgEditValidator { + return MsgEditValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.validatorAddress = object.validatorAddress ?? ""; + message.commissionRate = object.commissionRate ?? ""; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, +}; + +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} + +export const MsgEditValidatorResponse: MessageFns = { + encode(_: MsgEditValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgEditValidatorResponse { + return {}; + }, + + toJSON(_: MsgEditValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgEditValidatorResponse { + return MsgEditValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, +}; + +function createBaseMsgDelegate(): MsgDelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgDelegate: MessageFns = { + encode(message: MsgDelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgDelegate { + return MsgDelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +export const MsgDelegateResponse: MessageFns = { + encode(_: MsgDelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDelegateResponse { + return MsgDelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", amount: undefined }; +} + +export const MsgBeginRedelegate: MessageFns = { + encode(message: MsgBeginRedelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgBeginRedelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegate { + return MsgBeginRedelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { completionTime: undefined }; +} + +export const MsgBeginRedelegateResponse: MessageFns = { + encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegateResponse { + return { completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined }; + }, + + toJSON(message: MsgBeginRedelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + return message; + }, +}; + +function createBaseMsgUndelegate(): MsgUndelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgUndelegate: MessageFns = { + encode(message: MsgUndelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegate { + return MsgUndelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { completionTime: undefined, amount: undefined }; +} + +export const MsgUndelegateResponse: MessageFns = { + encode(message: MsgUndelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegateResponse { + return { + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegateResponse { + return MsgUndelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegation(): MsgCancelUnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", amount: undefined, creationHeight: 0 }; +} + +export const MsgCancelUnbondingDelegation: MessageFns = { + encode(message: MsgCancelUnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + if (message.creationHeight !== 0) { + writer.uint32(32).int64(message.creationHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelUnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + }; + }, + + toJSON(message: MsgCancelUnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelUnbondingDelegation { + return MsgCancelUnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelUnbondingDelegation { + const message = createBaseMsgCancelUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + message.creationHeight = object.creationHeight ?? 0; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegationResponse(): MsgCancelUnbondingDelegationResponse { + return {}; +} + +export const MsgCancelUnbondingDelegationResponse: MessageFns = { + encode(_: MsgCancelUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelUnbondingDelegationResponse { + return {}; + }, + + toJSON(_: MsgCancelUnbondingDelegationResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCancelUnbondingDelegationResponse { + return MsgCancelUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCancelUnbondingDelegationResponse { + const message = createBaseMsgCancelUnbondingDelegationResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + * and delegate back to previous validator. + * + * Since: cosmos-sdk 0.46 + */ + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise; + /** + * UpdateParams defines an operation for updating the x/staking module + * parameters. + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.staking.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 || MsgServiceName; + 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); + this.CancelUnbondingDelegation = this.CancelUnbondingDelegation.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise { + const data = MsgCancelUnbondingDelegation.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelUnbondingDelegation", data); + return promise.then((data) => MsgCancelUnbondingDelegationResponse.decode(new BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts new file mode 100644 index 00000000..15cd0546 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts @@ -0,0 +1,202 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/internal/kv/v1beta1/kv.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.internal.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: MessageFns = { + encode(message: Pairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + Pair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pairs.push(Pair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => Pair.fromJSON(e)) : [] }; + }, + + toJSON(message: Pairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => Pair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Pairs { + return Pairs.fromPartial(base ?? ({} as any)); + }, + 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(0), value: new Uint8Array(0) }; +} + +export const Pair: MessageFns = { + encode(message: Pair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pair { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Pair): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Pair { + return Pair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pair { + const message = createBasePair(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts new file mode 100644 index 00000000..6763ba8c --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts @@ -0,0 +1,728 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/snapshots/v1/snapshot.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.snapshots.v1"; + +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface Snapshot { + height: number; + format: number; + chunks: number; + hash: Uint8Array; + metadata: Metadata | undefined; +} + +/** Metadata contains SDK-specific snapshot metadata. */ +export interface Metadata { + /** SHA-256 chunk hashes */ + chunkHashes: Uint8Array[]; +} + +/** + * SnapshotItem is an item contained in a rootmulti.Store snapshot. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotItem { + store?: SnapshotStoreItem | undefined; + iavl?: SnapshotIAVLItem | undefined; + extension?: SnapshotExtensionMeta | undefined; + extensionPayload?: SnapshotExtensionPayload | undefined; +} + +/** + * SnapshotStoreItem contains metadata about a snapshotted store. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotStoreItem { + name: string; +} + +/** + * SnapshotIAVLItem is an exported IAVL node. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotIAVLItem { + key: Uint8Array; + value: Uint8Array; + /** version is block height */ + version: number; + /** height is depth of the tree. */ + height: number; +} + +/** + * SnapshotExtensionMeta contains metadata about an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionMeta { + name: string; + format: number; +} + +/** + * SnapshotExtensionPayload contains payloads of an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionPayload { + payload: Uint8Array; +} + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: undefined }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { chunkHashes: [] }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.chunkHashes) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunkHashes.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + chunkHashes: globalThis.Array.isArray(object?.chunkHashes) + ? object.chunkHashes.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.chunkHashes?.length) { + obj.chunkHashes = message.chunkHashes.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.chunkHashes = object.chunkHashes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSnapshotItem(): SnapshotItem { + return { store: undefined, iavl: undefined, extension: undefined, extensionPayload: undefined }; +} + +export const SnapshotItem: MessageFns = { + encode(message: SnapshotItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.store !== undefined) { + SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).join(); + } + if (message.iavl !== undefined) { + SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).join(); + } + if (message.extension !== undefined) { + SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).join(); + } + if (message.extensionPayload !== undefined) { + SnapshotExtensionPayload.encode(message.extensionPayload, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.store = SnapshotStoreItem.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionPayload = SnapshotExtensionPayload.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + extensionPayload: isSet(object.extensionPayload) + ? SnapshotExtensionPayload.fromJSON(object.extensionPayload) + : undefined, + }; + }, + + toJSON(message: SnapshotItem): unknown { + const obj: any = {}; + if (message.store !== undefined) { + obj.store = SnapshotStoreItem.toJSON(message.store); + } + if (message.iavl !== undefined) { + obj.iavl = SnapshotIAVLItem.toJSON(message.iavl); + } + if (message.extension !== undefined) { + obj.extension = SnapshotExtensionMeta.toJSON(message.extension); + } + if (message.extensionPayload !== undefined) { + obj.extensionPayload = SnapshotExtensionPayload.toJSON(message.extensionPayload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotItem { + return SnapshotItem.fromPartial(base ?? ({} as any)); + }, + 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.extensionPayload = (object.extensionPayload !== undefined && object.extensionPayload !== null) + ? SnapshotExtensionPayload.fromPartial(object.extensionPayload) + : undefined; + return message; + }, +}; + +function createBaseSnapshotStoreItem(): SnapshotStoreItem { + return { name: "" }; +} + +export const SnapshotStoreItem: MessageFns = { + encode(message: SnapshotStoreItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotStoreItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotStoreItem { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: SnapshotStoreItem): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): SnapshotStoreItem { + return SnapshotStoreItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { + return { key: new Uint8Array(0), value: new Uint8Array(0), version: 0, height: 0 }; +} + +export const SnapshotIAVLItem: MessageFns = { + encode(message: SnapshotIAVLItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.version !== 0) { + writer.uint32(24).int64(message.version); + } + if (message.height !== 0) { + writer.uint32(32).int32(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotIAVLItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.height = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotIAVLItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: SnapshotIAVLItem): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): SnapshotIAVLItem { + return SnapshotIAVLItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.version = object.version ?? 0; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { + return { name: "", format: 0 }; +} + +export const SnapshotExtensionMeta: MessageFns = { + encode(message: SnapshotExtensionMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionMeta { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + }; + }, + + toJSON(message: SnapshotExtensionMeta): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionMeta { + return SnapshotExtensionMeta.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SnapshotExtensionPayload: MessageFns = { + encode(message: SnapshotExtensionPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.payload = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionPayload { + return { payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(0) }; + }, + + toJSON(message: SnapshotExtensionPayload): unknown { + const obj: any = {}; + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionPayload { + return SnapshotExtensionPayload.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + message.payload = object.payload ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/streaming/abci/grpc.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/streaming/abci/grpc.ts new file mode 100644 index 00000000..4e0a2d5d --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/streaming/abci/grpc.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/streaming/abci/grpc.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../../tendermint/abci/types"; +import { StoreKVPair } from "../../v1beta1/listening"; + +export const protobufPackage = "cosmos.store.streaming.abci"; + +/** ListenEndBlockRequest is the request type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockRequest { + req: RequestFinalizeBlock | undefined; + res: ResponseFinalizeBlock | undefined; +} + +/** ListenEndBlockResponse is the response type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockResponse { +} + +/** ListenCommitRequest is the request type for the ListenCommit RPC method */ +export interface ListenCommitRequest { + /** explicitly pass in block height as ResponseCommit does not contain this info */ + blockHeight: number; + res: ResponseCommit | undefined; + changeSet: StoreKVPair[]; +} + +/** ListenCommitResponse is the response type for the ListenCommit RPC method */ +export interface ListenCommitResponse { +} + +function createBaseListenFinalizeBlockRequest(): ListenFinalizeBlockRequest { + return { req: undefined, res: undefined }; +} + +export const ListenFinalizeBlockRequest: MessageFns = { + encode(message: ListenFinalizeBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.req !== undefined) { + RequestFinalizeBlock.encode(message.req, writer.uint32(10).fork()).join(); + } + if (message.res !== undefined) { + ResponseFinalizeBlock.encode(message.res, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.req = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenFinalizeBlockRequest { + return { + req: isSet(object.req) ? RequestFinalizeBlock.fromJSON(object.req) : undefined, + res: isSet(object.res) ? ResponseFinalizeBlock.fromJSON(object.res) : undefined, + }; + }, + + toJSON(message: ListenFinalizeBlockRequest): unknown { + const obj: any = {}; + if (message.req !== undefined) { + obj.req = RequestFinalizeBlock.toJSON(message.req); + } + if (message.res !== undefined) { + obj.res = ResponseFinalizeBlock.toJSON(message.res); + } + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockRequest { + return ListenFinalizeBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenFinalizeBlockRequest { + const message = createBaseListenFinalizeBlockRequest(); + message.req = (object.req !== undefined && object.req !== null) + ? RequestFinalizeBlock.fromPartial(object.req) + : undefined; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseFinalizeBlock.fromPartial(object.res) + : undefined; + return message; + }, +}; + +function createBaseListenFinalizeBlockResponse(): ListenFinalizeBlockResponse { + return {}; +} + +export const ListenFinalizeBlockResponse: MessageFns = { + encode(_: ListenFinalizeBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenFinalizeBlockResponse { + return {}; + }, + + toJSON(_: ListenFinalizeBlockResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockResponse { + return ListenFinalizeBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenFinalizeBlockResponse { + const message = createBaseListenFinalizeBlockResponse(); + return message; + }, +}; + +function createBaseListenCommitRequest(): ListenCommitRequest { + return { blockHeight: 0, res: undefined, changeSet: [] }; +} + +export const ListenCommitRequest: MessageFns = { + encode(message: ListenCommitRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + if (message.res !== undefined) { + ResponseCommit.encode(message.res, writer.uint32(18).fork()).join(); + } + for (const v of message.changeSet) { + StoreKVPair.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changeSet.push(StoreKVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenCommitRequest { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + res: isSet(object.res) ? ResponseCommit.fromJSON(object.res) : undefined, + changeSet: globalThis.Array.isArray(object?.changeSet) + ? object.changeSet.map((e: any) => StoreKVPair.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListenCommitRequest): unknown { + const obj: any = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.res !== undefined) { + obj.res = ResponseCommit.toJSON(message.res); + } + if (message.changeSet?.length) { + obj.changeSet = message.changeSet.map((e) => StoreKVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListenCommitRequest { + return ListenCommitRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenCommitRequest { + const message = createBaseListenCommitRequest(); + message.blockHeight = object.blockHeight ?? 0; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseCommit.fromPartial(object.res) + : undefined; + message.changeSet = object.changeSet?.map((e) => StoreKVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListenCommitResponse(): ListenCommitResponse { + return {}; +} + +export const ListenCommitResponse: MessageFns = { + encode(_: ListenCommitResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenCommitResponse { + return {}; + }, + + toJSON(_: ListenCommitResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenCommitResponse { + return ListenCommitResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenCommitResponse { + const message = createBaseListenCommitResponse(); + return message; + }, +}; + +/** ABCIListenerService is the service for the BaseApp ABCIListener interface */ +export interface ABCIListenerService { + /** ListenFinalizeBlock is the corresponding endpoint for ABCIListener.ListenEndBlock */ + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise; + /** ListenCommit is the corresponding endpoint for ABCIListener.ListenCommit */ + ListenCommit(request: ListenCommitRequest): Promise; +} + +export const ABCIListenerServiceServiceName = "cosmos.store.streaming.abci.ABCIListenerService"; +export class ABCIListenerServiceClientImpl implements ABCIListenerService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIListenerServiceServiceName; + this.rpc = rpc; + this.ListenFinalizeBlock = this.ListenFinalizeBlock.bind(this); + this.ListenCommit = this.ListenCommit.bind(this); + } + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise { + const data = ListenFinalizeBlockRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenFinalizeBlock", data); + return promise.then((data) => ListenFinalizeBlockResponse.decode(new BinaryReader(data))); + } + + ListenCommit(request: ListenCommitRequest): Promise { + const data = ListenCommitRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenCommit", data); + return promise.then((data) => ListenCommitResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/v1beta1/commit_info.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/v1beta1/commit_info.ts new file mode 100644 index 00000000..17c74706 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/v1beta1/commit_info.ts @@ -0,0 +1,363 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/commit_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.store.v1beta1"; + +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfo { + version: number; + storeInfos: StoreInfo[]; + timestamp: Date | undefined; +} + +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfo { + name: string; + commitId: CommitID | undefined; +} + +/** + * CommitID defines the commitment information when a specific store is + * committed. + */ +export interface CommitID { + version: number; + hash: Uint8Array; +} + +function createBaseCommitInfo(): CommitInfo { + return { version: 0, storeInfos: [], timestamp: undefined }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== 0) { + writer.uint32(8).int64(message.version); + } + for (const v of message.storeInfos) { + StoreInfo.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.storeInfos.push(StoreInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + storeInfos: globalThis.Array.isArray(object?.storeInfos) + ? object.storeInfos.map((e: any) => StoreInfo.fromJSON(e)) + : [], + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.storeInfos?.length) { + obj.storeInfos = message.storeInfos.map((e) => StoreInfo.toJSON(e)); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.version = object.version ?? 0; + message.storeInfos = object.storeInfos?.map((e) => StoreInfo.fromPartial(e)) || []; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseStoreInfo(): StoreInfo { + return { name: "", commitId: undefined }; +} + +export const StoreInfo: MessageFns = { + encode(message: StoreInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.commitId !== undefined) { + CommitID.encode(message.commitId, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commitId = CommitID.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + commitId: isSet(object.commitId) ? CommitID.fromJSON(object.commitId) : undefined, + }; + }, + + toJSON(message: StoreInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.commitId !== undefined) { + obj.commitId = CommitID.toJSON(message.commitId); + } + return obj; + }, + + create, I>>(base?: I): StoreInfo { + return StoreInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreInfo { + const message = createBaseStoreInfo(); + message.name = object.name ?? ""; + message.commitId = (object.commitId !== undefined && object.commitId !== null) + ? CommitID.fromPartial(object.commitId) + : undefined; + return message; + }, +}; + +function createBaseCommitID(): CommitID { + return { version: 0, hash: new Uint8Array(0) }; +} + +export const CommitID: MessageFns = { + encode(message: CommitID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): CommitID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitID { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitID): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): CommitID { + return CommitID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitID { + const message = createBaseCommitID(); + message.version = object.version ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/v1beta1/listening.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/v1beta1/listening.ts new file mode 100644 index 00000000..73eb4288 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/store/v1beta1/listening.ts @@ -0,0 +1,294 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/listening.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../tendermint/abci/types"; + +export const protobufPackage = "cosmos.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 */ + storeKey: string; + /** true indicates a delete operation, false indicates a set operation */ + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} + +/** + * BlockMetadata contains all the abci event data of a block + * the file streamer dump them into files together with the state changes. + */ +export interface BlockMetadata { + responseCommit: ResponseCommit | undefined; + requestFinalizeBlock: + | RequestFinalizeBlock + | undefined; + /** TODO: should we renumber this? */ + responseFinalizeBlock: ResponseFinalizeBlock | undefined; +} + +function createBaseStoreKVPair(): StoreKVPair { + return { storeKey: "", delete: false, key: new Uint8Array(0), value: new Uint8Array(0) }; +} + +export const StoreKVPair: MessageFns = { + encode(message: StoreKVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.storeKey !== "") { + writer.uint32(10).string(message.storeKey); + } + if (message.delete !== false) { + 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: BinaryReader | Uint8Array, length?: number): StoreKVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.storeKey = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.delete = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.key = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKVPair { + return { + storeKey: isSet(object.storeKey) ? globalThis.String(object.storeKey) : "", + delete: isSet(object.delete) ? globalThis.Boolean(object.delete) : false, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: StoreKVPair): unknown { + const obj: any = {}; + if (message.storeKey !== "") { + obj.storeKey = message.storeKey; + } + if (message.delete !== false) { + obj.delete = message.delete; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): StoreKVPair { + return StoreKVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKVPair { + const message = createBaseStoreKVPair(); + message.storeKey = object.storeKey ?? ""; + message.delete = object.delete ?? false; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseBlockMetadata(): BlockMetadata { + return { responseCommit: undefined, requestFinalizeBlock: undefined, responseFinalizeBlock: undefined }; +} + +export const BlockMetadata: MessageFns = { + encode(message: BlockMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.responseCommit !== undefined) { + ResponseCommit.encode(message.responseCommit, writer.uint32(50).fork()).join(); + } + if (message.requestFinalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.requestFinalizeBlock, writer.uint32(58).fork()).join(); + } + if (message.responseFinalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.responseFinalizeBlock, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + if (tag !== 50) { + break; + } + + message.responseCommit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestFinalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.responseFinalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMetadata { + return { + responseCommit: isSet(object.responseCommit) ? ResponseCommit.fromJSON(object.responseCommit) : undefined, + requestFinalizeBlock: isSet(object.requestFinalizeBlock) + ? RequestFinalizeBlock.fromJSON(object.requestFinalizeBlock) + : undefined, + responseFinalizeBlock: isSet(object.responseFinalizeBlock) + ? ResponseFinalizeBlock.fromJSON(object.responseFinalizeBlock) + : undefined, + }; + }, + + toJSON(message: BlockMetadata): unknown { + const obj: any = {}; + if (message.responseCommit !== undefined) { + obj.responseCommit = ResponseCommit.toJSON(message.responseCommit); + } + if (message.requestFinalizeBlock !== undefined) { + obj.requestFinalizeBlock = RequestFinalizeBlock.toJSON(message.requestFinalizeBlock); + } + if (message.responseFinalizeBlock !== undefined) { + obj.responseFinalizeBlock = ResponseFinalizeBlock.toJSON(message.responseFinalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): BlockMetadata { + return BlockMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMetadata { + const message = createBaseBlockMetadata(); + message.responseCommit = (object.responseCommit !== undefined && object.responseCommit !== null) + ? ResponseCommit.fromPartial(object.responseCommit) + : undefined; + message.requestFinalizeBlock = (object.requestFinalizeBlock !== undefined && object.requestFinalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.requestFinalizeBlock) + : undefined; + message.responseFinalizeBlock = + (object.responseFinalizeBlock !== undefined && object.responseFinalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.responseFinalizeBlock) + : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/config/v1/config.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/config/v1/config.ts new file mode 100644 index 00000000..aa780391 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/config/v1/config.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/config/v1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.tx.config.v1"; + +/** Config is the config object of the x/auth/tx package. */ +export interface Config { + /** + * skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipAnteHandler: boolean; + /** + * skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipPostHandler: boolean; +} + +function createBaseConfig(): Config { + return { skipAnteHandler: false, skipPostHandler: false }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.skipAnteHandler !== false) { + writer.uint32(8).bool(message.skipAnteHandler); + } + if (message.skipPostHandler !== false) { + writer.uint32(16).bool(message.skipPostHandler); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.skipAnteHandler = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.skipPostHandler = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + skipAnteHandler: isSet(object.skipAnteHandler) ? globalThis.Boolean(object.skipAnteHandler) : false, + skipPostHandler: isSet(object.skipPostHandler) ? globalThis.Boolean(object.skipPostHandler) : false, + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.skipAnteHandler !== false) { + obj.skipAnteHandler = message.skipAnteHandler; + } + if (message.skipPostHandler !== false) { + obj.skipPostHandler = message.skipPostHandler; + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.skipAnteHandler = object.skipAnteHandler ?? false; + message.skipPostHandler = object.skipPostHandler ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 00000000..35f6e628 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,620 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/signing/v1beta1/signing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + * + * Since: cosmos-sdk 0.50 + */ + SIGN_MODE_TEXTUAL = 2, + /** + * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses + * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not + * require signers signing over other signers' `signer_info`. + * + * Since: cosmos-sdk 0.46 + */ + SIGN_MODE_DIRECT_AUX = 3, + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future. + */ + SIGN_MODE_LEGACY_AMINO_JSON = 127, + /** + * SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + * SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + * + * Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + * but is not implemented on the SDK by default. To enable EIP-191, you need + * to pass a custom `TxConfig` that has an implementation of + * `SignModeHandler` for EIP-191. The SDK may decide to fully support + * EIP-191 in the future. + * + * Since: cosmos-sdk 0.45.2 + */ + SIGN_MODE_EIP_191 = 191, + UNRECOGNIZED = -1, +} + +export function signModeFromJSON(object: any): SignMode { + switch (object) { + case 0: + case "SIGN_MODE_UNSPECIFIED": + return SignMode.SIGN_MODE_UNSPECIFIED; + case 1: + case "SIGN_MODE_DIRECT": + return SignMode.SIGN_MODE_DIRECT; + case 2: + case "SIGN_MODE_TEXTUAL": + return SignMode.SIGN_MODE_TEXTUAL; + case 3: + case "SIGN_MODE_DIRECT_AUX": + return SignMode.SIGN_MODE_DIRECT_AUX; + case 127: + case "SIGN_MODE_LEGACY_AMINO_JSON": + return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + case 191: + case "SIGN_MODE_EIP_191": + return SignMode.SIGN_MODE_EIP_191; + case -1: + case "UNRECOGNIZED": + default: + return SignMode.UNRECOGNIZED; + } +} + +export function signModeToJSON(object: SignMode): string { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return "SIGN_MODE_UNSPECIFIED"; + case SignMode.SIGN_MODE_DIRECT: + return "SIGN_MODE_DIRECT"; + case SignMode.SIGN_MODE_TEXTUAL: + return "SIGN_MODE_TEXTUAL"; + case SignMode.SIGN_MODE_DIRECT_AUX: + return "SIGN_MODE_DIRECT_AUX"; + case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: + return "SIGN_MODE_LEGACY_AMINO_JSON"; + case SignMode.SIGN_MODE_EIP_191: + return "SIGN_MODE_EIP_191"; + case SignMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} + +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + publicKey: Any | undefined; + data: + | SignatureDescriptor_Data + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_Data[]; +} + +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { signatures: [] }; +} + +export const SignatureDescriptors: MessageFns = { + encode(message: SignatureDescriptors, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptors(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptors { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptors): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptors { + return SignatureDescriptors.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map((e) => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { publicKey: undefined, data: undefined, sequence: 0 }; +} + +export const SignatureDescriptor: MessageFns = { + encode(message: SignatureDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + data: isSet(object.data) ? SignatureDescriptor_Data.fromJSON(object.data) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.data !== undefined) { + obj.data = SignatureDescriptor_Data.toJSON(message.data); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor { + return SignatureDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.data = (object.data !== undefined && object.data !== null) + ? SignatureDescriptor_Data.fromPartial(object.data) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { + return { single: undefined, multi: undefined }; +} + +export const SignatureDescriptor_Data: MessageFns = { + encode(message: SignatureDescriptor_Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = SignatureDescriptor_Data_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = SignatureDescriptor_Data_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data { + return SignatureDescriptor_Data.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SignatureDescriptor_Data_Single: MessageFns = { + encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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(0), + }; + }, + + toJSON(message: SignatureDescriptor_Data_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { + return { bitarray: undefined, signatures: [] }; +} + +export const SignatureDescriptor_Data_Multi: MessageFns = { + encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.signatures) { + SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor_Data_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptor_Data_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor_Data.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/v1beta1/service.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/v1beta1/service.ts new file mode 100644 index 00000000..411f1dc2 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,1855 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 - DEPRECATED: use BROADCAST_MODE_SYNC instead, + * BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + * + * @deprecated + */ + 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. + * Deprecated post v0.47.x: use query instead, which should contain a valid + * events query. + * + * @deprecated + */ + events: string[]; + /** + * pagination defines a pagination for the request. + * Deprecated post v0.46.x: use page and limit instead. + * + * @deprecated + */ + pagination: PageRequest | undefined; + orderBy: OrderBy; + /** + * page is the page number to query, starts at 1. If not provided, will + * default to first page. + */ + page: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * query defines the transaction event query that is proxied to Tendermint's + * TxSearch RPC method. The query must be valid. + * + * Since cosmos-sdk 0.50 + */ + query: string; +} + +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponse { + /** txs is the list of queried transactions. */ + txs: Tx[]; + /** tx_responses is the list of queried TxResponses. */ + txResponses: TxResponse[]; + /** + * pagination defines a pagination for the response. + * Deprecated post v0.46.x: use total instead. + * + * @deprecated + */ + pagination: + | PageResponse + | undefined; + /** total is total number of results available */ + total: number; +} + +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; + mode: BroadcastMode; +} + +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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 + | undefined; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + txBytes: 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. */ + gasInfo: + | GasInfo + | undefined; + /** result is the result of the simulation. */ + result: Result | undefined; +} + +/** + * 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 + | undefined; + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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: number; + /** pagination defines a pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponse { + /** txs are the transactions in the block. */ + txs: Tx[]; + blockId: BlockID | undefined; + block: + | Block + | undefined; + /** pagination defines a pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; +} + +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponse { + /** tx is the decoded transaction. */ + tx: Tx | undefined; +} + +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequest { + /** tx is the transaction to encode. */ + tx: Tx | undefined; +} + +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponse { + /** tx_bytes is the encoded transaction bytes. */ + txBytes: Uint8Array; +} + +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequest { + aminoJson: string; +} + +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponse { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequest { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponse { + aminoJson: string; +} + +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { events: [], pagination: undefined, orderBy: 0, page: 0, limit: 0, query: "" }; +} + +export const GetTxsEventRequest: MessageFns = { + encode(message: GetTxsEventRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.orderBy !== 0) { + writer.uint32(24).int32(message.orderBy); + } + if (message.page !== 0) { + writer.uint32(32).uint64(message.page); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + if (message.query !== "") { + writer.uint32(50).string(message.query); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.orderBy = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.page = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventRequest { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0, + page: isSet(object.page) ? globalThis.Number(object.page) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + query: isSet(object.query) ? globalThis.String(object.query) : "", + }; + }, + + toJSON(message: GetTxsEventRequest): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.orderBy !== 0) { + obj.orderBy = orderByToJSON(message.orderBy); + } + if (message.page !== 0) { + obj.page = Math.round(message.page); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.query !== "") { + obj.query = message.query; + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventRequest { + return GetTxsEventRequest.fromPartial(base ?? ({} as any)); + }, + 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.orderBy = object.orderBy ?? 0; + message.page = object.page ?? 0; + message.limit = object.limit ?? 0; + message.query = object.query ?? ""; + return message; + }, +}; + +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { txs: [], txResponses: [], pagination: undefined, total: 0 }; +} + +export const GetTxsEventResponse: MessageFns = { + encode(message: GetTxsEventResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResponses) { + TxResponse.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + if (message.total !== 0) { + writer.uint32(32).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponses.push(TxResponse.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + txResponses: globalThis.Array.isArray(object?.txResponses) + ? object.txResponses.map((e: any) => TxResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: GetTxsEventResponse): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.txResponses?.length) { + obj.txResponses = message.txResponses.map((e) => TxResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventResponse { + return GetTxsEventResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.txResponses = object.txResponses?.map((e) => TxResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.total = object.total ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { txBytes: new Uint8Array(0), mode: 0 }; +} + +export const BroadcastTxRequest: MessageFns = { + encode(message: BroadcastTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxRequest { + return { + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0, + }; + }, + + toJSON(message: BroadcastTxRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + if (message.mode !== 0) { + obj.mode = broadcastModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxRequest { + return BroadcastTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + message.mode = object.mode ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { txResponse: undefined }; +} + +export const BroadcastTxResponse: MessageFns = { + encode(message: BroadcastTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxResponse { + return { txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined }; + }, + + toJSON(message: BroadcastTxResponse): unknown { + const obj: any = {}; + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxResponse { + return BroadcastTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseSimulateRequest(): SimulateRequest { + return { tx: undefined, txBytes: new Uint8Array(0) }; +} + +export const SimulateRequest: MessageFns = { + encode(message: SimulateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txBytes.length !== 0) { + writer.uint32(18).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateRequest { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + }; + }, + + toJSON(message: SimulateRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): SimulateRequest { + return SimulateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSimulateResponse(): SimulateResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulateResponse: MessageFns = { + encode(message: SimulateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulateResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulateResponse { + return SimulateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateResponse { + const message = createBaseSimulateResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseGetTxRequest(): GetTxRequest { + return { hash: "" }; +} + +export const GetTxRequest: MessageFns = { + encode(message: GetTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxRequest { + return { hash: isSet(object.hash) ? globalThis.String(object.hash) : "" }; + }, + + toJSON(message: GetTxRequest): unknown { + const obj: any = {}; + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): GetTxRequest { + return GetTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseGetTxResponse(): GetTxResponse { + return { tx: undefined, txResponse: undefined }; +} + +export const GetTxResponse: MessageFns = { + encode(message: GetTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxResponse { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined, + }; + }, + + toJSON(message: GetTxResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): GetTxResponse { + return GetTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { height: 0, pagination: undefined }; +} + +export const GetBlockWithTxsRequest: MessageFns = { + encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.fromPartial(base ?? ({} as any)); + }, + 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: [], blockId: undefined, block: undefined, pagination: undefined }; +} + +export const GetBlockWithTxsResponse: MessageFns = { + encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(18).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(26).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : 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?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseTxDecodeRequest(): TxDecodeRequest { + return { txBytes: new Uint8Array(0) }; +} + +export const TxDecodeRequest: MessageFns = { + encode(message: TxDecodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeRequest { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeRequest { + return TxDecodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeResponse(): TxDecodeResponse { + return { tx: undefined }; +} + +export const TxDecodeResponse: MessageFns = { + encode(message: TxDecodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeResponse { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxDecodeResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeResponse { + return TxDecodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeRequest(): TxEncodeRequest { + return { tx: undefined }; +} + +export const TxEncodeRequest: MessageFns = { + encode(message: TxEncodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeRequest { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxEncodeRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeRequest { + return TxEncodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeResponse(): TxEncodeResponse { + return { txBytes: new Uint8Array(0) }; +} + +export const TxEncodeResponse: MessageFns = { + encode(message: TxEncodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeResponse { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeResponse): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeResponse { + return TxEncodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxEncodeAminoRequest(): TxEncodeAminoRequest { + return { aminoJson: "" }; +} + +export const TxEncodeAminoRequest: MessageFns = { + encode(message: TxEncodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoRequest { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxEncodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoRequest { + return TxEncodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, +}; + +function createBaseTxEncodeAminoResponse(): TxEncodeAminoResponse { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxEncodeAminoResponse: MessageFns = { + encode(message: TxEncodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoResponse { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoResponse { + return TxEncodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoRequest(): TxDecodeAminoRequest { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxDecodeAminoRequest: MessageFns = { + encode(message: TxDecodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoRequest { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoRequest { + return TxDecodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoResponse(): TxDecodeAminoResponse { + return { aminoJson: "" }; +} + +export const TxDecodeAminoResponse: MessageFns = { + encode(message: TxDecodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoResponse { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxDecodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoResponse { + return TxDecodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + message.aminoJson = object.aminoJson ?? ""; + 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; + /** + * TxDecode decodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxDecode(request: TxDecodeRequest): Promise; + /** + * TxEncode encodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxEncode(request: TxEncodeRequest): Promise; + /** + * TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. + * + * Since: cosmos-sdk 0.47 + */ + TxEncodeAmino(request: TxEncodeAminoRequest): Promise; + /** + * TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. + * + * Since: cosmos-sdk 0.47 + */ + TxDecodeAmino(request: TxDecodeAminoRequest): Promise; +} + +export const ServiceServiceName = "cosmos.tx.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.TxDecode = this.TxDecode.bind(this); + this.TxEncode = this.TxEncode.bind(this); + this.TxEncodeAmino = this.TxEncodeAmino.bind(this); + this.TxDecodeAmino = this.TxDecodeAmino.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + TxDecode(request: TxDecodeRequest): Promise { + const data = TxDecodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecode", data); + return promise.then((data) => TxDecodeResponse.decode(new BinaryReader(data))); + } + + TxEncode(request: TxEncodeRequest): Promise { + const data = TxEncodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncode", data); + return promise.then((data) => TxEncodeResponse.decode(new BinaryReader(data))); + } + + TxEncodeAmino(request: TxEncodeAminoRequest): Promise { + const data = TxEncodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncodeAmino", data); + return promise.then((data) => TxEncodeAminoResponse.decode(new BinaryReader(data))); + } + + TxDecodeAmino(request: TxDecodeAminoRequest): Promise { + const data = TxDecodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecodeAmino", data); + return promise.then((data) => TxDecodeAminoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 00000000..f2c427d1 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,1615 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + authInfo: + | AuthInfo + | undefined; + /** + * 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. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + authInfoBytes: Uint8Array; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} + +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDoc { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + authInfoBytes: Uint8Array; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chainId: string; + /** account_number is the account number of the account in state */ + accountNumber: number; +} + +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAux { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** public_key is the public key of the signing account. */ + publicKey: + | Any + | undefined; + /** + * chain_id is the identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker. + */ + chainId: string; + /** account_number is the account number of the account in state. */ + accountNumber: number; + /** sequence is the sequence number of the signing account. */ + sequence: number; + /** + * tips have been depreacted and should not be used + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBody { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages: Any[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeoutHeight: number; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extensionOptions: Any[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + nonCriticalExtensionOptions: Any[]; +} + +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfo { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signerInfos: SignerInfo[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee: + | Fee + | undefined; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + * + * Since: cosmos-sdk 0.46 + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfo { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + publicKey: + | Any + | undefined; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + modeInfo: + | ModeInfo + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + modeInfos: 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 + */ + gasLimit: number; + /** + * 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 + * + * @deprecated + */ +export interface Tip { + /** amount is the amount of the tip */ + amount: Coin[]; + /** tipper is the address of the account paying for the tip */ + tipper: string; +} + +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerData { + /** + * address is the bech32-encoded address of the auxiliary signer. If using + * AuxSignerData across different chains, the bech32 prefix of the target + * chain (where the final transaction is broadcasted) should be used. + */ + address: string; + /** + * sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + * signs. Note: we use the same sign doc even if we're signing with + * LEGACY_AMINO_JSON. + */ + signDoc: + | SignDocDirectAux + | undefined; + /** 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, authInfo: undefined, signatures: [] }; +} + +export const Tx: MessageFns = { + encode(message: Tx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).join(); + } + if (message.authInfo !== undefined) { + AuthInfo.encode(message.authInfo, writer.uint32(18).fork()).join(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.body = TxBody.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfo = AuthInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tx { + return { + body: isSet(object.body) ? TxBody.fromJSON(object.body) : undefined, + authInfo: isSet(object.authInfo) ? AuthInfo.fromJSON(object.authInfo) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Tx): unknown { + const obj: any = {}; + if (message.body !== undefined) { + obj.body = TxBody.toJSON(message.body); + } + if (message.authInfo !== undefined) { + obj.authInfo = AuthInfo.toJSON(message.authInfo); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Tx { + return Tx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Tx { + const message = createBaseTx(); + message.body = (object.body !== undefined && object.body !== null) ? TxBody.fromPartial(object.body) : undefined; + message.authInfo = (object.authInfo !== undefined && object.authInfo !== null) + ? AuthInfo.fromPartial(object.authInfo) + : undefined; + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTxRaw(): TxRaw { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), signatures: [] }; +} + +export const TxRaw: MessageFns = { + encode(message: TxRaw, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRaw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxRaw { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: TxRaw): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): TxRaw { + return TxRaw.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxRaw { + const message = createBaseTxRaw(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSignDoc(): SignDoc { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), chainId: "", accountNumber: 0 }; +} + +export const SignDoc: MessageFns = { + encode(message: SignDoc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDoc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDoc { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + }; + }, + + toJSON(message: SignDoc): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + return obj; + }, + + create, I>>(base?: I): SignDoc { + return SignDoc.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDoc { + const message = createBaseSignDoc(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 0; + return message; + }, +}; + +function createBaseSignDocDirectAux(): SignDocDirectAux { + return { + bodyBytes: new Uint8Array(0), + publicKey: undefined, + chainId: "", + accountNumber: 0, + sequence: 0, + tip: undefined, + }; +} + +export const SignDocDirectAux: MessageFns = { + encode(message: SignDocDirectAux, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(18).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(40).uint64(message.sequence); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDocDirectAux(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDocDirectAux { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined, + }; + }, + + toJSON(message: SignDocDirectAux): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): SignDocDirectAux { + return SignDocDirectAux.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 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: "", timeoutHeight: 0, extensionOptions: [], nonCriticalExtensionOptions: [] }; +} + +export const TxBody: MessageFns = { + encode(message: TxBody, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (message.timeoutHeight !== 0) { + writer.uint32(24).uint64(message.timeoutHeight); + } + for (const v of message.extensionOptions) { + Any.encode(v!, writer.uint32(8186).fork()).join(); + } + for (const v of message.nonCriticalExtensionOptions) { + Any.encode(v!, writer.uint32(16378).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.memo = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.timeoutHeight = longToNumber(reader.uint64()); + continue; + case 1023: + if (tag !== 8186) { + break; + } + + message.extensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + case 2047: + if (tag !== 16378) { + break; + } + + message.nonCriticalExtensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxBody { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + memo: isSet(object.memo) ? globalThis.String(object.memo) : "", + timeoutHeight: isSet(object.timeoutHeight) ? globalThis.Number(object.timeoutHeight) : 0, + extensionOptions: globalThis.Array.isArray(object?.extensionOptions) + ? object.extensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + nonCriticalExtensionOptions: globalThis.Array.isArray(object?.nonCriticalExtensionOptions) + ? object.nonCriticalExtensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.memo !== "") { + obj.memo = message.memo; + } + if (message.timeoutHeight !== 0) { + obj.timeoutHeight = Math.round(message.timeoutHeight); + } + if (message.extensionOptions?.length) { + obj.extensionOptions = message.extensionOptions.map((e) => Any.toJSON(e)); + } + if (message.nonCriticalExtensionOptions?.length) { + obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxBody { + return TxBody.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeoutHeight = object.timeoutHeight ?? 0; + message.extensionOptions = object.extensionOptions?.map((e) => Any.fromPartial(e)) || []; + message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAuthInfo(): AuthInfo { + return { signerInfos: [], fee: undefined, tip: undefined }; +} + +export const AuthInfo: MessageFns = { + encode(message: AuthInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signerInfos) { + SignerInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fee !== undefined) { + Fee.encode(message.fee, writer.uint32(18).fork()).join(); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signerInfos.push(SignerInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fee = Fee.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthInfo { + return { + signerInfos: globalThis.Array.isArray(object?.signerInfos) + ? object.signerInfos.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.signerInfos?.length) { + obj.signerInfos = message.signerInfos.map((e) => SignerInfo.toJSON(e)); + } + if (message.fee !== undefined) { + obj.fee = Fee.toJSON(message.fee); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): AuthInfo { + return AuthInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signerInfos?.map((e) => SignerInfo.fromPartial(e)) || []; + message.fee = (object.fee !== undefined && object.fee !== null) ? Fee.fromPartial(object.fee) : undefined; + message.tip = (object.tip !== undefined && object.tip !== null) ? Tip.fromPartial(object.tip) : undefined; + return message; + }, +}; + +function createBaseSignerInfo(): SignerInfo { + return { publicKey: undefined, modeInfo: undefined, sequence: 0 }; +} + +export const SignerInfo: MessageFns = { + encode(message: SignerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.modeInfo !== undefined) { + ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfo = ModeInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignerInfo { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + modeInfo: isSet(object.modeInfo) ? ModeInfo.fromJSON(object.modeInfo) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.modeInfo !== undefined) { + obj.modeInfo = ModeInfo.toJSON(message.modeInfo); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignerInfo { + return SignerInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignerInfo { + const message = createBaseSignerInfo(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.modeInfo = (object.modeInfo !== undefined && object.modeInfo !== null) + ? ModeInfo.fromPartial(object.modeInfo) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModeInfo(): ModeInfo { + return { single: undefined, multi: undefined }; +} + +export const ModeInfo: MessageFns = { + encode(message: ModeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + ModeInfo_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = ModeInfo_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = ModeInfo_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = ModeInfo_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = ModeInfo_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo { + return ModeInfo.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ModeInfo_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Single { + return { mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; + }, + + toJSON(message: ModeInfo_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Single { + return ModeInfo_Single.fromPartial(base ?? ({} as any)); + }, + 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, modeInfos: [] }; +} + +export const ModeInfo_Multi: MessageFns = { + encode(message: ModeInfo_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.modeInfos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfos.push(ModeInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + modeInfos: globalThis.Array.isArray(object?.modeInfos) + ? object.modeInfos.map((e: any) => ModeInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModeInfo_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.modeInfos?.length) { + obj.modeInfos = message.modeInfos.map((e) => ModeInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Multi { + return ModeInfo_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + message.bitarray = (object.bitarray !== undefined && object.bitarray !== null) + ? CompactBitArray.fromPartial(object.bitarray) + : undefined; + message.modeInfos = object.modeInfos?.map((e) => ModeInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFee(): Fee { + return { amount: [], gasLimit: 0, payer: "", granter: "" }; +} + +export const Fee: MessageFns = { + encode(message: Fee, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.gasLimit !== 0) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.payer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.granter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Fee { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + gasLimit: isSet(object.gasLimit) ? globalThis.Number(object.gasLimit) : 0, + payer: isSet(object.payer) ? globalThis.String(object.payer) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + }; + }, + + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.gasLimit !== 0) { + obj.gasLimit = Math.round(message.gasLimit); + } + if (message.payer !== "") { + obj.payer = message.payer; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + return obj; + }, + + create, I>>(base?: I): Fee { + return Fee.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.gasLimit = object.gasLimit ?? 0; + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, +}; + +function createBaseTip(): Tip { + return { amount: [], tipper: "" }; +} + +export const Tip: MessageFns = { + encode(message: Tip, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.tipper !== "") { + writer.uint32(18).string(message.tipper); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tip { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTip(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tipper = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tip { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + tipper: isSet(object.tipper) ? globalThis.String(object.tipper) : "", + }; + }, + + toJSON(message: Tip): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.tipper !== "") { + obj.tipper = message.tipper; + } + return obj; + }, + + create, I>>(base?: I): Tip { + return Tip.fromPartial(base ?? ({} as any)); + }, + 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: "", signDoc: undefined, mode: 0, sig: new Uint8Array(0) }; +} + +export const AuxSignerData: MessageFns = { + encode(message: AuxSignerData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.signDoc !== undefined) { + SignDocDirectAux.encode(message.signDoc, writer.uint32(18).fork()).join(); + } + if (message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + if (message.sig.length !== 0) { + writer.uint32(34).bytes(message.sig); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuxSignerData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signDoc = SignDocDirectAux.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sig = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuxSignerData { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array(0), + }; + }, + + toJSON(message: AuxSignerData): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.signDoc !== undefined) { + obj.signDoc = SignDocDirectAux.toJSON(message.signDoc); + } + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.sig.length !== 0) { + obj.sig = base64FromBytes(message.sig); + } + return obj; + }, + + create, I>>(base?: I): AuxSignerData { + return AuxSignerData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuxSignerData { + const message = createBaseAuxSignerData(); + message.address = object.address ?? ""; + message.signDoc = (object.signDoc !== undefined && object.signDoc !== null) + ? SignDocDirectAux.fromPartial(object.signDoc) + : undefined; + message.mode = object.mode ?? 0; + message.sig = object.sig ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/module/v1/module.ts new file mode 100644 index 00000000..2bec3886 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.upgrade.module.v1"; + +/** Module is the config object of the upgrade module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/query.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 00000000..39cddba7 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,811 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * 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: number; +} + +/** + * 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 + */ + lastHeight: number; +} + +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + * + * @deprecated + */ +export interface QueryUpgradedConsensusStateResponse { + /** Since: cosmos-sdk 0.43 */ + upgradedConsensusState: 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 + */ + moduleName: 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. */ + moduleVersions: 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: MessageFns = { + encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCurrentPlanRequest { + return {}; + }, + + toJSON(_: QueryCurrentPlanRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, +}; + +function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { + return { plan: undefined }; +} + +export const QueryCurrentPlanResponse: MessageFns = { + encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCurrentPlanResponse { + return { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; + }, + + toJSON(message: QueryCurrentPlanResponse): unknown { + const obj: any = {}; + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryAppliedPlanRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { + return { height: 0 }; +} + +export const QueryAppliedPlanResponse: MessageFns = { + encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryAppliedPlanResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return { lastHeight: 0 }; +} + +export const QueryUpgradedConsensusStateRequest: MessageFns = { + encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.lastHeight !== 0) { + writer.uint32(8).int64(message.lastHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.lastHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateRequest { + return { lastHeight: isSet(object.lastHeight) ? globalThis.Number(object.lastHeight) : 0 }; + }, + + toJSON(message: QueryUpgradedConsensusStateRequest): unknown { + const obj: any = {}; + if (message.lastHeight !== 0) { + obj.lastHeight = Math.round(message.lastHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + message.lastHeight = object.lastHeight ?? 0; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { upgradedConsensusState: new Uint8Array(0) }; +} + +export const QueryUpgradedConsensusStateResponse: MessageFns = { + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.upgradedConsensusState.length !== 0) { + writer.uint32(18).bytes(message.upgradedConsensusState); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.upgradedConsensusState = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: isSet(object.upgradedConsensusState) + ? bytesFromBase64(object.upgradedConsensusState) + : new Uint8Array(0), + }; + }, + + toJSON(message: QueryUpgradedConsensusStateResponse): unknown { + const obj: any = {}; + if (message.upgradedConsensusState.length !== 0) { + obj.upgradedConsensusState = base64FromBytes(message.upgradedConsensusState); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgradedConsensusState = object.upgradedConsensusState ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { + return { moduleName: "" }; +} + +export const QueryModuleVersionsRequest: MessageFns = { + encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsRequest { + return { moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "" }; + }, + + toJSON(message: QueryModuleVersionsRequest): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + message.moduleName = object.moduleName ?? ""; + return message; + }, +}; + +function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { + return { moduleVersions: [] }; +} + +export const QueryModuleVersionsResponse: MessageFns = { + encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.moduleVersions) { + ModuleVersion.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.moduleVersions.push(ModuleVersion.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsResponse { + return { + moduleVersions: globalThis.Array.isArray(object?.moduleVersions) + ? object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryModuleVersionsResponse): unknown { + const obj: any = {}; + if (message.moduleVersions?.length) { + obj.moduleVersions = message.moduleVersions.map((e) => ModuleVersion.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.moduleVersions = object.moduleVersions?.map((e) => ModuleVersion.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { + return {}; +} + +export const QueryAuthorityRequest: MessageFns = { + encode(_: QueryAuthorityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAuthorityRequest { + return {}; + }, + + toJSON(_: QueryAuthorityRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAuthorityRequest { + return QueryAuthorityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAuthorityRequest { + const message = createBaseQueryAuthorityRequest(); + return message; + }, +}; + +function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { + return { address: "" }; +} + +export const QueryAuthorityResponse: MessageFns = { + encode(message: QueryAuthorityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorityResponse { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAuthorityResponse): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorityResponse { + return QueryAuthorityResponse.fromPartial(base ?? ({} as any)); + }, + 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 + * + * Since: cosmos-sdk 0.46 + */ + Authority(request: QueryAuthorityRequest): Promise; +} + +export const QueryServiceName = "cosmos.upgrade.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts new file mode 100644 index 00000000..48e7cf58 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts @@ -0,0 +1,337 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Plan } from "./upgrade"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgrade { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** plan is the upgrade plan. */ + plan: Plan | undefined; +} + +/** + * 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 that controls the module (defaults to x/gov unless overwritten). */ + 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: MessageFns = { + encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSoftwareUpgrade { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: MsgSoftwareUpgrade): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgSoftwareUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSoftwareUpgradeResponse { + return {}; + }, + + toJSON(_: MsgSoftwareUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSoftwareUpgradeResponse { + const message = createBaseMsgSoftwareUpgradeResponse(); + return message; + }, +}; + +function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { + return { authority: "" }; +} + +export const MsgCancelUpgrade: MessageFns = { + encode(message: MsgCancelUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelUpgrade { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: MsgCancelUpgrade): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): MsgCancelUpgrade { + return MsgCancelUpgrade.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelUpgrade { + const message = createBaseMsgCancelUpgrade(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { + return {}; +} + +export const MsgCancelUpgradeResponse: MessageFns = { + encode(_: MsgCancelUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelUpgradeResponse { + return {}; + }, + + toJSON(_: MsgCancelUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.fromPartial(base ?? ({} as any)); + }, + 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 + * approved software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + CancelUpgrade(request: MsgCancelUpgrade): Promise; +} + +export const MsgServiceName = "cosmos.upgrade.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 00000000..30096c1f --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,513 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/upgrade.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** The height at which the upgrade must be performed. */ + height: number; + /** + * Any application specific upgrade info to be included on-chain + * such as a git commit that validators could automatically upgrade to + */ + info: string; + /** + * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + * moved to the IBC module in the sub module 02-client. + * If this field is not empty, an error will be thrown. + * + * @deprecated + */ + upgradedClientState: Any | undefined; +} + +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + * + * @deprecated + */ +export interface SoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; + /** plan of the proposal */ + plan: Plan | undefined; +} + +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + * + * @deprecated + */ +export interface CancelSoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; +} + +/** + * 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: number; +} + +function createBasePlan(): Plan { + return { name: "", time: undefined, height: 0, info: "", upgradedClientState: undefined }; +} + +export const Plan: MessageFns = { + encode(message: Plan, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Plan { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.upgradedClientState = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Plan { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + info: isSet(object.info) ? globalThis.String(object.info) : "", + upgradedClientState: isSet(object.upgradedClientState) ? Any.fromJSON(object.upgradedClientState) : undefined, + }; + }, + + toJSON(message: Plan): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.upgradedClientState !== undefined) { + obj.upgradedClientState = Any.toJSON(message.upgradedClientState); + } + return obj; + }, + + create, I>>(base?: I): Plan { + return Plan.fromPartial(base ?? ({} as any)); + }, + 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.upgradedClientState = (object.upgradedClientState !== undefined && object.upgradedClientState !== null) + ? Any.fromPartial(object.upgradedClientState) + : undefined; + return message; + }, +}; + +function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { + return { title: "", description: "", plan: undefined }; +} + +export const SoftwareUpgradeProposal: MessageFns = { + encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: SoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CancelSoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: CancelSoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ModuleVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.version !== 0) { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleVersion { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: ModuleVersion): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): ModuleVersion { + return ModuleVersion.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/module/v1/module.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/module/v1/module.ts new file mode 100644 index 00000000..99609e8c --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.vesting.module.v1"; + +/** Module is the config object of the vesting module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/v1beta1/tx.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 00000000..034b0314 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,628 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + fromAddress: string; + toAddress: string; + amount: Coin[]; + /** end of vesting as unix time (in seconds). */ + endTime: number; + delayed: boolean; +} + +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponse { +} + +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; +} + +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponse { +} + +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccount { + fromAddress: string; + toAddress: string; + /** start of vesting as unix time (in seconds). */ + startTime: number; + vestingPeriods: Period[]; +} + +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponse { +} + +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { fromAddress: "", toAddress: "", amount: [], endTime: 0, delayed: false }; +} + +export const MsgCreateVestingAccount: MessageFns = { + encode(message: MsgCreateVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(32).int64(message.endTime); + } + if (message.delayed !== false) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.delayed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + delayed: isSet(object.delayed) ? globalThis.Boolean(object.delayed) : false, + }; + }, + + toJSON(message: MsgCreateVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + if (message.delayed !== false) { + obj.delayed = message.delayed; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccount { + return MsgCreateVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + message.delayed = object.delayed ?? false; + return message; + }, +}; + +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} + +export const MsgCreateVestingAccountResponse: MessageFns = { + encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreateVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgCreatePermanentLockedAccount: MessageFns = { + encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePermanentLockedAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCreatePermanentLockedAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { + return {}; +} + +export const MsgCreatePermanentLockedAccountResponse: MessageFns = { + encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePermanentLockedAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { + return { fromAddress: "", toAddress: "", startTime: 0, vestingPeriods: [] }; +} + +export const MsgCreatePeriodicVestingAccount: MessageFns = { + encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + if (message.startTime !== 0) { + writer.uint32(24).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePeriodicVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreatePeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { + return {}; +} + +export const MsgCreatePeriodicVestingAccountResponse: MessageFns = { + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePeriodicVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + CreatePermanentLockedAccount( + request: MsgCreatePermanentLockedAccount, + ): Promise; + /** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * + * Since: cosmos-sdk 0.46 + */ + CreatePeriodicVestingAccount( + request: MsgCreatePeriodicVestingAccount, + ): Promise; +} + +export const MsgServiceName = "cosmos.vesting.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 00000000..0fe13459 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,610 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/vesting.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + baseAccount: BaseAccount | undefined; + originalVesting: Coin[]; + delegatedFree: Coin[]; + delegatedVesting: Coin[]; + /** Vesting end time, as unix timestamp (in seconds). */ + endTime: number; +} + +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccount { + baseVestingAccount: + | BaseVestingAccount + | undefined; + /** Vesting start time, as unix timestamp (in seconds). */ + startTime: number; +} + +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; +} + +/** Period defines a length of time and amount of coins that will vest. */ +export interface Period { + /** Period duration in seconds. */ + length: number; + amount: Coin[]; +} + +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; + startTime: number; + vestingPeriods: 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 { + baseVestingAccount: BaseVestingAccount | undefined; +} + +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { baseAccount: undefined, originalVesting: [], delegatedFree: [], delegatedVesting: [], endTime: 0 }; +} + +export const BaseVestingAccount: MessageFns = { + encode(message: BaseVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + for (const v of message.originalVesting) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatedFree) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.delegatedVesting) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(40).int64(message.endTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.originalVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatedFree.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatedVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseVestingAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + originalVesting: globalThis.Array.isArray(object?.originalVesting) + ? object.originalVesting.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedFree: globalThis.Array.isArray(object?.delegatedFree) + ? object.delegatedFree.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedVesting: globalThis.Array.isArray(object?.delegatedVesting) + ? object.delegatedVesting.map((e: any) => Coin.fromJSON(e)) + : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + }; + }, + + toJSON(message: BaseVestingAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.originalVesting?.length) { + obj.originalVesting = message.originalVesting.map((e) => Coin.toJSON(e)); + } + if (message.delegatedFree?.length) { + obj.delegatedFree = message.delegatedFree.map((e) => Coin.toJSON(e)); + } + if (message.delegatedVesting?.length) { + obj.delegatedVesting = message.delegatedVesting.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + return obj; + }, + + create, I>>(base?: I): BaseVestingAccount { + return BaseVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.originalVesting = object.originalVesting?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedFree = object.delegatedFree?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedVesting = object.delegatedVesting?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + return message; + }, +}; + +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { baseVestingAccount: undefined, startTime: 0 }; +} + +export const ContinuousVestingAccount: MessageFns = { + encode(message: ContinuousVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContinuousVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + }; + }, + + toJSON(message: ContinuousVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + return obj; + }, + + create, I>>(base?: I): ContinuousVestingAccount { + return ContinuousVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + return message; + }, +}; + +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { baseVestingAccount: undefined }; +} + +export const DelayedVestingAccount: MessageFns = { + encode(message: DelayedVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelayedVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: DelayedVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): DelayedVestingAccount { + return DelayedVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +function createBasePeriod(): Period { + return { length: 0, amount: [] }; +} + +export const Period: MessageFns = { + encode(message: Period, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.length !== 0) { + writer.uint32(8).int64(message.length); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Period { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.length = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Period { + return { + length: isSet(object.length) ? globalThis.Number(object.length) : 0, + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Period): unknown { + const obj: any = {}; + if (message.length !== 0) { + obj.length = Math.round(message.length); + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Period { + return Period.fromPartial(base ?? ({} as any)); + }, + 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 { baseVestingAccount: undefined, startTime: 0, vestingPeriods: [] }; +} + +export const PeriodicVestingAccount: MessageFns = { + encode(message: PeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeriodicVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PeriodicVestingAccount { + return PeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { baseVestingAccount: undefined }; +} + +export const PermanentLockedAccount: MessageFns = { + encode(message: PermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PermanentLockedAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: PermanentLockedAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): PermanentLockedAccount { + return PermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.evidence.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.evidence.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.evidence.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.evidence.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.evidence.v1beta1/types/google/api/http.ts b/ts-client/cosmos.evidence.v1beta1/types/google/api/http.ts index 9010600b..d3390802 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,94 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} + * This enables an HTTP REST to gRPC mapping as below: * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: - * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` - * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` - * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. - * - * For HTTP method kinds which allow a request body, the `body` field + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +134,10 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +147,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +159,14 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +188,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC + * HTTP | gRPC * -----|----- * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` - * - * # Rules for HTTP mapping - * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: - * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. - * - * The syntax of the path template is as follows: + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +224,115 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +346,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +383,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +419,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +438,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +470,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +491,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +500,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +586,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +668,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +679,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +704,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +741,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; @@ -673,3 +753,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/any.ts b/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/any.ts index f4abfdf9..24b86540 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/any.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/any.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/any.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -28,6 +34,10 @@ 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. * @@ -111,7 +121,8 @@ export interface Any { * * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. * * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. @@ -125,8 +136,8 @@ function createBaseAny(): Any { return { typeUrl: "", value: new Uint8Array(0) }; } -export const Any = { - encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Any: MessageFns = { + encode(message: Any, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.typeUrl !== "") { writer.uint32(10).string(message.typeUrl); } @@ -136,8 +147,8 @@ export const Any = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Any { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAny(); while (reader.pos < end) { @@ -161,14 +172,14 @@ export const Any = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Any { return { - typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), }; }, @@ -195,30 +206,11 @@ export const Any = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -228,21 +220,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -253,3 +246,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..b7d4af33 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,106 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +112,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +133,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +142,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +178,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +193,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,33 +312,40 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** @@ -163,7 +371,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +398,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +529,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +544,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +561,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +573,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +607,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +657,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +667,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,13 +678,17 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** * 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 @@ -469,8 +697,10 @@ export interface FileOptions { * However, an extension field still accepts non-UTF-8 byte sequences. * This option has no effect on when used with the lite runtime. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +708,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +723,83 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: boolean | undefined; + phpGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,21 +871,31 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** + * 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. + * * Whether the message is an automatically generated map entry type for the * maps field. * @@ -647,12 +913,31 @@ export interface MessageOptions { * 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. + */ + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. * - * 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. + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated */ - mapEntry: boolean; + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -661,18 +946,26 @@ 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release -- sorry, we'll try to include + * other types in a future version! */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +979,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -715,17 +1010,46 @@ export interface FieldOptions { * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. + * + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1057,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1144,150 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1297,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1337,39 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1381,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1453,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,51 +1474,341 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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. +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + NONE = 1, + VERIFY = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 1: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: Edition | undefined; + features?: FeatureSet | undefined; +} + +/** + * 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. @@ -1010,8 +1822,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition occurs. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1879,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1900,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1925,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2020,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2063,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2082,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2226,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) + : [], + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2309,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2339,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2359,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2394,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2475,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2571,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2617,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2664,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2700,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2737,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2771,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2821,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,6 +2839,134 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; + return message; + }, +}; + +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; +} + +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; return message; }, }; @@ -1915,46 +2987,46 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { }; } -export const FieldDescriptorProto = { - encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(24).int32(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { writer.uint32(32).int32(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { writer.uint32(40).int32(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { writer.uint32(50).string(message.typeName); } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { writer.uint32(18).string(message.extendee); } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { writer.uint32(58).string(message.defaultValue); } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { writer.uint32(72).int32(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3113,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3198,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3234,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3274,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3294,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3340,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3402,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3438,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3480,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3526,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3571,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3617,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3671,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3747,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2736,7 +3817,7 @@ function createBaseFileOptions(): FileOptions { pyGenericServices: false, phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3825,84 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { writer.uint32(336).bool(message.phpGenericServices); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2963,6 +4048,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4066,37 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + phpGenericServices: isSet(object.phpGenericServices) ? globalThis.Boolean(object.phpGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4104,69 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { obj.phpGenericServices = message.phpGenericServices; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3094,7 +4190,7 @@ export const FileOptions = { message.pyGenericServices = object.pyGenericServices ?? false; message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4198,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4212,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4281,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4306,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4333,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4368,81 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4476,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4497,51 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4553,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4561,22 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4584,42 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,32 +4635,124 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; +} + +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptions_EditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: FieldOptions_EditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; + return message; + }, +}; + function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; + return { features: undefined, uninterpretedOption: [] }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3417,14 +4764,15 @@ export const OneofOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3432,6 +4780,9 @@ export const OneofOptions = { toJSON(message: OneofOptions): unknown { const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3443,31 +4794,48 @@ export const OneofOptions = { }, fromPartial, I>>(object: I): OneofOptions { const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { writer.uint32(16).bool(message.allowAlias); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumOptions(); while (reader.pos < end) { @@ -3487,6 +4855,20 @@ export const EnumOptions = { message.deprecated = reader.bool(); continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3498,16 +4880,20 @@ export const EnumOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumOptions { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3515,12 +4901,20 @@ export const EnumOptions = { toJSON(message: EnumOptions): unknown { const obj: any = {}; - if (message.allowAlias === true) { + if (message.allowAlias !== undefined && message.allowAlias !== false) { obj.allowAlias = message.allowAlias; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3534,28 +4928,38 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { deprecated: false, features: undefined, debugRedact: false, uninterpretedOption: [] }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +4972,20 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +4997,17 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5015,15 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5036,47 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5095,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5112,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5129,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5139,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5180,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5198,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5218,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5240,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5260,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5312,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5346,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5370,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5411,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5447,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5464,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5481,337 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, features: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +5828,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +5863,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +5887,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +5953,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +5978,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6008,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6034,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6066,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6136,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6167,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6191,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6210,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6233,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/timestamp.ts b/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/timestamp.ts index 560af8a4..c7ff7f50 100644 --- a/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/timestamp.ts +++ b/ts-client/cosmos.evidence.v1beta1/types/google/protobuf/timestamp.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/timestamp.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -92,7 +97,7 @@ export const protobufPackage = "google.protobuf"; * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use * the Joda Time's [`ISODateTimeFormat.dateTime()`]( - * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() * ) to obtain a formatter capable of generating timestamps in this format. */ export interface Timestamp { @@ -115,8 +120,8 @@ function createBaseTimestamp(): Timestamp { return { seconds: 0, nanos: 0 }; } -export const Timestamp = { - encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Timestamp: MessageFns = { + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -126,8 +131,8 @@ export const Timestamp = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTimestamp(); while (reader.pos < end) { @@ -138,7 +143,7 @@ export const Timestamp = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -151,15 +156,15 @@ export const Timestamp = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Timestamp { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -185,29 +190,11 @@ export const Timestamp = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -215,18 +202,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/route-name.eta b/ts-client/cosmos.evidence.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/abci/types.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/abci/types.ts new file mode 100644 index 00000000..c4e0902e --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/abci/types.ts @@ -0,0 +1,5925 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/abci/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { ConsensusParams } from "../types/params"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON } from "../types/validator"; + +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 MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1, +} + +export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} + +export function misbehaviorTypeToJSON(object: MisbehaviorType): string { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Request { + echo?: RequestEcho | undefined; + flush?: RequestFlush | undefined; + info?: RequestInfo | undefined; + initChain?: RequestInitChain | undefined; + query?: RequestQuery | undefined; + checkTx?: RequestCheckTx | undefined; + commit?: RequestCommit | undefined; + listSnapshots?: RequestListSnapshots | undefined; + offerSnapshot?: RequestOfferSnapshot | undefined; + loadSnapshotChunk?: RequestLoadSnapshotChunk | undefined; + applySnapshotChunk?: RequestApplySnapshotChunk | undefined; + prepareProposal?: RequestPrepareProposal | undefined; + processProposal?: RequestProcessProposal | undefined; + extendVote?: RequestExtendVote | undefined; + verifyVoteExtension?: RequestVerifyVoteExtension | undefined; + finalizeBlock?: RequestFinalizeBlock | undefined; +} + +export interface RequestEcho { + message: string; +} + +export interface RequestFlush { +} + +export interface RequestInfo { + version: string; + blockVersion: number; + p2pVersion: number; + abciVersion: string; +} + +export interface RequestInitChain { + time: Date | undefined; + chainId: string; + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appStateBytes: Uint8Array; + initialHeight: number; +} + +export interface RequestQuery { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} + +export interface RequestCommit { +} + +/** lists available snapshots */ +export interface RequestListSnapshots { +} + +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot: + | Snapshot + | undefined; + /** light client-verified app hash for snapshot height */ + appHash: Uint8Array; +} + +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: number; + format: number; + chunk: number; +} + +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} + +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: number; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit: ExtendedCommitInfo | undefined; + misbehavior: Misbehavior[]; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} + +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Extends a vote with application-injected data */ +export interface RequestExtendVote { + /** the hash of the block that this vote may be referring to */ + hash: Uint8Array; + /** the height of the extended vote */ + height: number; + /** info of the block that this vote may be referring to */ + time: Date | undefined; + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Verify the vote extension */ +export interface RequestVerifyVoteExtension { + /** the hash of the block that this received vote corresponds to */ + hash: Uint8Array; + /** the validator that signed the vote extension */ + validatorAddress: Uint8Array; + height: number; + voteExtension: Uint8Array; +} + +export interface RequestFinalizeBlock { + txs: Uint8Array[]; + decidedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the decided block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +export interface Response { + exception?: ResponseException | undefined; + echo?: ResponseEcho | undefined; + flush?: ResponseFlush | undefined; + info?: ResponseInfo | undefined; + initChain?: ResponseInitChain | undefined; + query?: ResponseQuery | undefined; + checkTx?: ResponseCheckTx | undefined; + commit?: ResponseCommit | undefined; + listSnapshots?: ResponseListSnapshots | undefined; + offerSnapshot?: ResponseOfferSnapshot | undefined; + loadSnapshotChunk?: ResponseLoadSnapshotChunk | undefined; + applySnapshotChunk?: ResponseApplySnapshotChunk | undefined; + prepareProposal?: ResponsePrepareProposal | undefined; + processProposal?: ResponseProcessProposal | undefined; + extendVote?: ResponseExtendVote | undefined; + verifyVoteExtension?: ResponseVerifyVoteExtension | undefined; + finalizeBlock?: ResponseFinalizeBlock | undefined; +} + +/** nondeterministic */ +export interface ResponseException { + error: string; +} + +export interface ResponseEcho { + message: string; +} + +export interface ResponseFlush { +} + +export interface ResponseInfo { + data: string; + version: string; + appVersion: number; + lastBlockHeight: number; + lastBlockAppHash: Uint8Array; +} + +export interface ResponseInitChain { + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appHash: Uint8Array; +} + +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + events: Event[]; + codespace: string; +} + +export interface ResponseCommit { + retainHeight: number; +} + +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 */ + refetchChunks: number[]; + /** Chunk senders to reject and ban */ + rejectSenders: 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"; + } +} + +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} + +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} + +export enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} + +export function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseExtendVote { + voteExtension: Uint8Array; +} + +export interface ResponseVerifyVoteExtension { + status: ResponseVerifyVoteExtension_VerifyStatus; +} + +export enum ResponseVerifyVoteExtension_VerifyStatus { + UNKNOWN = 0, + ACCEPT = 1, + /** + * REJECT - Rejecting the vote extension will reject the entire precommit by the sender. + * Incorrectly implementing this thus has liveness implications as it may affect + * CometBFT's ability to receive 2/3+ valid votes to finalize the block. + * Honest nodes should never be rejected. + */ + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseVerifyVoteExtension_VerifyStatusFromJSON( + object: any, +): ResponseVerifyVoteExtension_VerifyStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseVerifyVoteExtension_VerifyStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseVerifyVoteExtension_VerifyStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED; + } +} + +export function responseVerifyVoteExtension_VerifyStatusToJSON( + object: ResponseVerifyVoteExtension_VerifyStatus, +): string { + switch (object) { + case ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseVerifyVoteExtension_VerifyStatus.ACCEPT: + return "ACCEPT"; + case ResponseVerifyVoteExtension_VerifyStatus.REJECT: + return "REJECT"; + case ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseFinalizeBlock { + /** set of block events emmitted as part of executing the block */ + events: Event[]; + /** + * the result of executing each transaction including the events + * the particular transction emitted. This should match the order + * of the transactions delivered in the block itself + */ + txResults: ExecTxResult[]; + /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ + validatorUpdates: ValidatorUpdate[]; + /** updates to the consensus params, if any. */ + consensusParamUpdates: + | ConsensusParams + | undefined; + /** + * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + * deterministic. It is up to the application to decide which algorithm to use. + */ + appHash: Uint8Array; +} + +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} + +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} + +/** + * Event allows application developers to attach additional information to + * ResponseFinalizeBlock and ResponseCheckTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} + +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} + +/** + * ExecTxResult contains results of executing one individual transaction. + * + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted + */ +export interface ExecTxResult { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + /** nondeterministic */ + events: Event[]; + codespace: string; +} + +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: number; + index: number; + tx: Uint8Array; + result: ExecTxResult | undefined; +} + +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: number; +} + +export interface ValidatorUpdate { + pubKey: PublicKey | undefined; + power: number; +} + +export interface VoteInfo { + validator: Validator | undefined; + blockIdFlag: BlockIDFlag; +} + +export interface ExtendedVoteInfo { + /** The validator that sent the vote. */ + validator: + | Validator + | undefined; + /** Non-deterministic extension provided by the sending validator's application. */ + voteExtension: Uint8Array; + /** Vote extension signature created by CometBFT */ + extensionSignature: Uint8Array; + /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ + blockIdFlag: BlockIDFlag; +} + +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator: + | Validator + | undefined; + /** The height when the offense occurred */ + height: number; + /** The corresponding time where the offense occurred */ + time: + | Date + | undefined; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + totalVotingPower: number; +} + +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: number; + /** 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, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Request: MessageFns = { + encode(message: Request, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.echo !== undefined) { + RequestEcho.encode(message.echo, writer.uint32(10).fork()).join(); + } + if (message.flush !== undefined) { + RequestFlush.encode(message.flush, writer.uint32(18).fork()).join(); + } + if (message.info !== undefined) { + RequestInfo.encode(message.info, writer.uint32(26).fork()).join(); + } + if (message.initChain !== undefined) { + RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).join(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).join(); + } + if (message.checkTx !== undefined) { + RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).join(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).join(); + } + if (message.listSnapshots !== undefined) { + RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.prepareProposal !== undefined) { + RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).join(); + } + if (message.processProposal !== undefined) { + RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).join(); + } + if (message.extendVote !== undefined) { + RequestExtendVote.encode(message.extendVote, writer.uint32(146).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + RequestVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(154).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.finalizeBlock, writer.uint32(162).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Request { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.echo = RequestEcho.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.flush = RequestFlush.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.info = RequestInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.initChain = RequestInitChain.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = RequestQuery.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.commit = RequestCommit.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.extendVote = RequestExtendVote.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.verifyVoteExtension = RequestVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.finalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? RequestInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? RequestCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? RequestListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? RequestOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? RequestPrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? RequestProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? RequestExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? RequestVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? RequestFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Request): unknown { + const obj: any = {}; + if (message.echo !== undefined) { + obj.echo = RequestEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = RequestFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = RequestInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = RequestInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = RequestQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = RequestCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = RequestCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = RequestListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = RequestOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = RequestPrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = RequestProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = RequestExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = RequestVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = RequestFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Request { + return Request.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? RequestInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? RequestQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? RequestCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? RequestCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? RequestListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? RequestPrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? RequestProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? RequestExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? RequestVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseRequestEcho(): RequestEcho { + return { message: "" }; +} + +export const RequestEcho: MessageFns = { + encode(message: RequestEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: RequestEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): RequestEcho { + return RequestEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseRequestFlush(): RequestFlush { + return {}; +} + +export const RequestFlush: MessageFns = { + encode(_: RequestFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestFlush { + return {}; + }, + + toJSON(_: RequestFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestFlush { + return RequestFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, +}; + +function createBaseRequestInfo(): RequestInfo { + return { version: "", blockVersion: 0, p2pVersion: 0, abciVersion: "" }; +} + +export const RequestInfo: MessageFns = { + encode(message: RequestInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.blockVersion !== 0) { + writer.uint32(16).uint64(message.blockVersion); + } + if (message.p2pVersion !== 0) { + writer.uint32(24).uint64(message.p2pVersion); + } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockVersion = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.p2pVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.abciVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo { + return { + version: isSet(object.version) ? globalThis.String(object.version) : "", + blockVersion: isSet(object.blockVersion) ? globalThis.Number(object.blockVersion) : 0, + p2pVersion: isSet(object.p2pVersion) ? globalThis.Number(object.p2pVersion) : 0, + abciVersion: isSet(object.abciVersion) ? globalThis.String(object.abciVersion) : "", + }; + }, + + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + if (message.version !== "") { + obj.version = message.version; + } + if (message.blockVersion !== 0) { + obj.blockVersion = Math.round(message.blockVersion); + } + if (message.p2pVersion !== 0) { + obj.p2pVersion = Math.round(message.p2pVersion); + } + if (message.abciVersion !== "") { + obj.abciVersion = message.abciVersion; + } + return obj; + }, + + create, I>>(base?: I): RequestInfo { + return RequestInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = object.blockVersion ?? 0; + message.p2pVersion = object.p2pVersion ?? 0; + message.abciVersion = object.abciVersion ?? ""; + return message; + }, +}; + +function createBaseRequestInitChain(): RequestInitChain { + return { + time: undefined, + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(0), + initialHeight: 0, + }; +} + +export const RequestInitChain: MessageFns = { + encode(message: RequestInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appStateBytes = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.initialHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInitChain { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appStateBytes: isSet(object.appStateBytes) ? bytesFromBase64(object.appStateBytes) : new Uint8Array(0), + initialHeight: isSet(object.initialHeight) ? globalThis.Number(object.initialHeight) : 0, + }; + }, + + toJSON(message: RequestInitChain): unknown { + const obj: any = {}; + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appStateBytes.length !== 0) { + obj.appStateBytes = base64FromBytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + obj.initialHeight = Math.round(message.initialHeight); + } + return obj; + }, + + create, I>>(base?: I): RequestInitChain { + return RequestInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(0); + message.initialHeight = object.initialHeight ?? 0; + return message; + }, +}; + +function createBaseRequestQuery(): RequestQuery { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const RequestQuery: MessageFns = { + encode(message: RequestQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestQuery { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: RequestQuery): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): RequestQuery { + return RequestQuery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseRequestCheckTx(): RequestCheckTx { + return { tx: new Uint8Array(0), type: 0 }; +} + +export const RequestCheckTx: MessageFns = { + encode(message: RequestCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestCheckTx { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + + toJSON(message: RequestCheckTx): unknown { + const obj: any = {}; + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.type !== 0) { + obj.type = checkTxTypeToJSON(message.type); + } + return obj; + }, + + create, I>>(base?: I): RequestCheckTx { + return RequestCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(0); + message.type = object.type ?? 0; + return message; + }, +}; + +function createBaseRequestCommit(): RequestCommit { + return {}; +} + +export const RequestCommit: MessageFns = { + encode(_: RequestCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestCommit { + return {}; + }, + + toJSON(_: RequestCommit): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestCommit { + return RequestCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, +}; + +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} + +export const RequestListSnapshots: MessageFns = { + encode(_: RequestListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestListSnapshots { + return {}; + }, + + toJSON(_: RequestListSnapshots): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestListSnapshots { + return RequestListSnapshots.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; + +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { snapshot: undefined, appHash: new Uint8Array(0) }; +} + +export const RequestOfferSnapshot: MessageFns = { + encode(message: RequestOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshot = Snapshot.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestOfferSnapshot { + return { + snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestOfferSnapshot): unknown { + const obj: any = {}; + if (message.snapshot !== undefined) { + obj.snapshot = Snapshot.toJSON(message.snapshot); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): RequestOfferSnapshot { + return RequestOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) + ? Snapshot.fromPartial(object.snapshot) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { height: 0, format: 0, chunk: 0 }; +} + +export const RequestLoadSnapshotChunk: MessageFns = { + encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunk = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestLoadSnapshotChunk { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunk: isSet(object.chunk) ? globalThis.Number(object.chunk) : 0, + }; + }, + + toJSON(message: RequestLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunk !== 0) { + obj.chunk = Math.round(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + 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(0), sender: "" }; +} + +export const RequestApplySnapshotChunk: MessageFns = { + encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chunk = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestApplySnapshotChunk { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0), + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + }; + }, + + toJSON(message: RequestApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + if (message.sender !== "") { + obj.sender = message.sender; + } + return obj; + }, + + create, I>>(base?: I): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(0); + message.sender = object.sender ?? ""; + return message; + }, +}; + +function createBaseRequestPrepareProposal(): RequestPrepareProposal { + return { + maxTxBytes: 0, + txs: [], + localLastCommit: undefined, + misbehavior: [], + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestPrepareProposal: MessageFns = { + encode(message: RequestPrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTxBytes !== 0) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v!); + } + if (message.localLastCommit !== undefined) { + ExtendedCommitInfo.encode(message.localLastCommit, writer.uint32(26).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxTxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.localLastCommit = ExtendedCommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrepareProposal { + return { + maxTxBytes: isSet(object.maxTxBytes) ? globalThis.Number(object.maxTxBytes) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + localLastCommit: isSet(object.localLastCommit) ? ExtendedCommitInfo.fromJSON(object.localLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestPrepareProposal): unknown { + const obj: any = {}; + if (message.maxTxBytes !== 0) { + obj.maxTxBytes = Math.round(message.maxTxBytes); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.localLastCommit !== undefined) { + obj.localLastCommit = ExtendedCommitInfo.toJSON(message.localLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestPrepareProposal { + return RequestPrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = object.maxTxBytes ?? 0; + message.txs = object.txs?.map((e) => e) || []; + message.localLastCommit = (object.localLastCommit !== undefined && object.localLastCommit !== null) + ? ExtendedCommitInfo.fromPartial(object.localLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestProcessProposal(): RequestProcessProposal { + return { + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestProcessProposal: MessageFns = { + encode(message: RequestProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestProcessProposal { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestProcessProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestProcessProposal { + return RequestProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestExtendVote(): RequestExtendVote { + return { + hash: new Uint8Array(0), + height: 0, + time: undefined, + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestExtendVote: MessageFns = { + encode(message: RequestExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(26).fork()).join(); + } + for (const v of message.txs) { + writer.uint32(34).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(42).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestExtendVote { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestExtendVote): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestExtendVote { + return RequestExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestExtendVote { + const message = createBaseRequestExtendVote(); + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestVerifyVoteExtension(): RequestVerifyVoteExtension { + return { hash: new Uint8Array(0), validatorAddress: new Uint8Array(0), height: 0, voteExtension: new Uint8Array(0) }; +} + +export const RequestVerifyVoteExtension: MessageFns = { + encode(message: RequestVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.voteExtension.length !== 0) { + writer.uint32(34).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestVerifyVoteExtension { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + message.hash = object.hash ?? new Uint8Array(0); + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestFinalizeBlock(): RequestFinalizeBlock { + return { + txs: [], + decidedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestFinalizeBlock: MessageFns = { + encode(message: RequestFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.decidedLastCommit !== undefined) { + CommitInfo.encode(message.decidedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decidedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestFinalizeBlock { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + decidedLastCommit: isSet(object.decidedLastCommit) ? CommitInfo.fromJSON(object.decidedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestFinalizeBlock): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.decidedLastCommit !== undefined) { + obj.decidedLastCommit = CommitInfo.toJSON(message.decidedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestFinalizeBlock { + return RequestFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map((e) => e) || []; + message.decidedLastCommit = (object.decidedLastCommit !== undefined && object.decidedLastCommit !== null) + ? CommitInfo.fromPartial(object.decidedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Response: MessageFns = { + encode(message: Response, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).join(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).join(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).join(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + if (message.initChain !== undefined) { + ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).join(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).join(); + } + if (message.checkTx !== undefined) { + ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).join(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).join(); + } + if (message.listSnapshots !== undefined) { + ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).join(); + } + if (message.prepareProposal !== undefined) { + ResponsePrepareProposal.encode(message.prepareProposal, writer.uint32(138).fork()).join(); + } + if (message.processProposal !== undefined) { + ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).join(); + } + if (message.extendVote !== undefined) { + ResponseExtendVote.encode(message.extendVote, writer.uint32(154).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + ResponseVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(162).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.finalizeBlock, writer.uint32(170).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exception = ResponseException.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.echo = ResponseEcho.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.flush = ResponseFlush.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = ResponseInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.initChain = ResponseInitChain.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.query = ResponseQuery.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.commit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.listSnapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.offerSnapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.applySnapshotChunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.prepareProposal = ResponsePrepareProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.processProposal = ResponseProcessProposal.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.extendVote = ResponseExtendVote.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.verifyVoteExtension = ResponseVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.finalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? ResponseInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? ResponseQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? ResponseCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? ResponseCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? ResponseListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? ResponseOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? ResponsePrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? ResponseProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? ResponseExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? ResponseVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? ResponseFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + if (message.exception !== undefined) { + obj.exception = ResponseException.toJSON(message.exception); + } + if (message.echo !== undefined) { + obj.echo = ResponseEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = ResponseFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = ResponseInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = ResponseInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = ResponseQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = ResponseCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = ResponseCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = ResponseListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = ResponseOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = ResponsePrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = ResponseProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = ResponseExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = ResponseVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = ResponseFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Response { + return Response.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? ResponseInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ResponseQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? ResponseCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? ResponseCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? ResponseListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? ResponsePrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? ResponseProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? ResponseExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? ResponseVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseResponseException(): ResponseException { + return { error: "" }; +} + +export const ResponseException: MessageFns = { + encode(message: ResponseException, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.error = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseException { + return { error: isSet(object.error) ? globalThis.String(object.error) : "" }; + }, + + toJSON(message: ResponseException): unknown { + const obj: any = {}; + if (message.error !== "") { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): ResponseException { + return ResponseException.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; + +function createBaseResponseEcho(): ResponseEcho { + return { message: "" }; +} + +export const ResponseEcho: MessageFns = { + encode(message: ResponseEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: ResponseEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ResponseEcho { + return ResponseEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseResponseFlush(): ResponseFlush { + return {}; +} + +export const ResponseFlush: MessageFns = { + encode(_: ResponseFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ResponseFlush { + return {}; + }, + + toJSON(_: ResponseFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ResponseFlush { + return ResponseFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, +}; + +function createBaseResponseInfo(): ResponseInfo { + return { data: "", version: "", appVersion: 0, lastBlockHeight: 0, lastBlockAppHash: new Uint8Array(0) }; +} + +export const ResponseInfo: MessageFns = { + encode(message: ResponseInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.appVersion !== 0) { + writer.uint32(24).uint64(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.appVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.lastBlockHeight = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockAppHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInfo { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + appVersion: isSet(object.appVersion) ? globalThis.Number(object.appVersion) : 0, + lastBlockHeight: isSet(object.lastBlockHeight) ? globalThis.Number(object.lastBlockHeight) : 0, + lastBlockAppHash: isSet(object.lastBlockAppHash) ? bytesFromBase64(object.lastBlockAppHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInfo): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.appVersion !== 0) { + obj.appVersion = Math.round(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + obj.lastBlockHeight = Math.round(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + obj.lastBlockAppHash = base64FromBytes(message.lastBlockAppHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInfo { + return ResponseInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = object.appVersion ?? 0; + message.lastBlockHeight = object.lastBlockHeight ?? 0; + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseInitChain(): ResponseInitChain { + return { consensusParams: undefined, validators: [], appHash: new Uint8Array(0) }; +} + +export const ResponseInitChain: MessageFns = { + encode(message: ResponseInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInitChain { + return { + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInitChain): unknown { + const obj: any = {}; + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInitChain { + return ResponseInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ResponseQuery: MessageFns = { + encode(message: ResponseQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseQuery { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseQuery): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseQuery { + return ResponseQuery.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCheckTx(): ResponseCheckTx { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ResponseCheckTx: MessageFns = { + encode(message: ResponseCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCheckTx { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseCheckTx): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseCheckTx { + return ResponseCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCommit(): ResponseCommit { + return { retainHeight: 0 }; +} + +export const ResponseCommit: MessageFns = { + encode(message: ResponseCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.retainHeight !== 0) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.retainHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCommit { + return { retainHeight: isSet(object.retainHeight) ? globalThis.Number(object.retainHeight) : 0 }; + }, + + toJSON(message: ResponseCommit): unknown { + const obj: any = {}; + if (message.retainHeight !== 0) { + obj.retainHeight = Math.round(message.retainHeight); + } + return obj; + }, + + create, I>>(base?: I): ResponseCommit { + return ResponseCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCommit { + const message = createBaseResponseCommit(); + message.retainHeight = object.retainHeight ?? 0; + return message; + }, +}; + +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { snapshots: [] }; +} + +export const ResponseListSnapshots: MessageFns = { + encode(message: ResponseListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshots.push(Snapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseListSnapshots { + return { + snapshots: globalThis.Array.isArray(object?.snapshots) + ? object.snapshots.map((e: any) => Snapshot.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ResponseListSnapshots): unknown { + const obj: any = {}; + if (message.snapshots?.length) { + obj.snapshots = message.snapshots.map((e) => Snapshot.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponseListSnapshots { + return ResponseListSnapshots.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ResponseOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseOfferSnapshot { + return { result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: ResponseOfferSnapshot): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseOfferSnapshot_ResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { chunk: new Uint8Array(0) }; +} + +export const ResponseLoadSnapshotChunk: MessageFns = { + encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunk = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseLoadSnapshotChunk { + return { chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { result: 0, refetchChunks: [], rejectSenders: [] }; +} + +export const ResponseApplySnapshotChunk: MessageFns = { + encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.join(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + case 2: + if (tag === 16) { + message.refetchChunks.push(reader.uint32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + + continue; + } + + break; + case 3: + if (tag !== 26) { + break; + } + + message.rejectSenders.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseApplySnapshotChunk { + return { + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + refetchChunks: globalThis.Array.isArray(object?.refetchChunks) + ? object.refetchChunks.map((e: any) => globalThis.Number(e)) + : [], + rejectSenders: globalThis.Array.isArray(object?.rejectSenders) + ? object.rejectSenders.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ResponseApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + } + if (message.refetchChunks?.length) { + obj.refetchChunks = message.refetchChunks.map((e) => Math.round(e)); + } + if (message.rejectSenders?.length) { + obj.rejectSenders = message.rejectSenders; + } + return obj; + }, + + create, I>>(base?: I): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map((e) => e) || []; + message.rejectSenders = object.rejectSenders?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponsePrepareProposal(): ResponsePrepareProposal { + return { txs: [] }; +} + +export const ResponsePrepareProposal: MessageFns = { + encode(message: ResponsePrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponsePrepareProposal { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: ResponsePrepareProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponsePrepareProposal { + return ResponsePrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { status: 0 }; +} + +export const ResponseProcessProposal: MessageFns = { + encode(message: ResponseProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseProcessProposal { + return { status: isSet(object.status) ? responseProcessProposal_ProposalStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseProcessProposal): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseProcessProposal_ProposalStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseProcessProposal { + return ResponseProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseExtendVote(): ResponseExtendVote { + return { voteExtension: new Uint8Array(0) }; +} + +export const ResponseExtendVote: MessageFns = { + encode(message: ResponseExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtension.length !== 0) { + writer.uint32(10).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseExtendVote { + return { voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseExtendVote): unknown { + const obj: any = {}; + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): ResponseExtendVote { + return ResponseExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseVerifyVoteExtension(): ResponseVerifyVoteExtension { + return { status: 0 }; +} + +export const ResponseVerifyVoteExtension: MessageFns = { + encode(message: ResponseVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseVerifyVoteExtension { + return { status: isSet(object.status) ? responseVerifyVoteExtension_VerifyStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseVerifyVoteExtension_VerifyStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseFinalizeBlock(): ResponseFinalizeBlock { + return { + events: [], + txResults: [], + validatorUpdates: [], + consensusParamUpdates: undefined, + appHash: new Uint8Array(0), + }; +} + +export const ResponseFinalizeBlock: MessageFns = { + encode(message: ResponseFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResults) { + ExecTxResult.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.validatorUpdates) { + ValidatorUpdate.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.consensusParamUpdates !== undefined) { + ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(34).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(42).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResults.push(ExecTxResult.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseFinalizeBlock { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + txResults: globalThis.Array.isArray(object?.txResults) + ? object.txResults.map((e: any) => ExecTxResult.fromJSON(e)) + : [], + validatorUpdates: globalThis.Array.isArray(object?.validatorUpdates) + ? object.validatorUpdates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + consensusParamUpdates: isSet(object.consensusParamUpdates) + ? ConsensusParams.fromJSON(object.consensusParamUpdates) + : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseFinalizeBlock): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.txResults?.length) { + obj.txResults = message.txResults.map((e) => ExecTxResult.toJSON(e)); + } + if (message.validatorUpdates?.length) { + obj.validatorUpdates = message.validatorUpdates.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.consensusParamUpdates !== undefined) { + obj.consensusParamUpdates = ConsensusParams.toJSON(message.consensusParamUpdates); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseFinalizeBlock { + return ResponseFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.txResults = object.txResults?.map((e) => ExecTxResult.fromPartial(e)) || []; + message.validatorUpdates = object.validatorUpdates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = + (object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null) + ? ConsensusParams.fromPartial(object.consensusParamUpdates) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommitInfo(): CommitInfo { + return { round: 0, votes: [] }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + VoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(VoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => VoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitInfo(): ExtendedCommitInfo { + return { round: 0, votes: [] }; +} + +export const ExtendedCommitInfo: MessageFns = { + encode(message: ExtendedCommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + ExtendedVoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => ExtendedVoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ExtendedCommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => ExtendedVoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitInfo { + return ExtendedCommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEvent(): Event { + return { type: "", attributes: [] }; +} + +export const Event: MessageFns = { + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + EventAttribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(EventAttribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Event { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => EventAttribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => EventAttribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + 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: "", value: "", index: false }; +} + +export const EventAttribute: MessageFns = { + encode(message: EventAttribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index !== false) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.index = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventAttribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + index: isSet(object.index) ? globalThis.Boolean(object.index) : false, + }; + }, + + toJSON(message: EventAttribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.index !== false) { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): EventAttribute { + return EventAttribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, +}; + +function createBaseExecTxResult(): ExecTxResult { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ExecTxResult: MessageFns = { + encode(message: ExecTxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecTxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecTxResult { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ExecTxResult): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ExecTxResult { + return ExecTxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecTxResult { + const message = createBaseExecTxResult(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseTxResult(): TxResult { + return { height: 0, index: 0, tx: new Uint8Array(0), result: undefined }; +} + +export const TxResult: MessageFns = { + encode(message: TxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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) { + ExecTxResult.encode(message.result, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tx = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.result = ExecTxResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + result: isSet(object.result) ? ExecTxResult.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.result !== undefined) { + obj.result = ExecTxResult.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): TxResult { + return TxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.height = object.height ?? 0; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(0); + message.result = (object.result !== undefined && object.result !== null) + ? ExecTxResult.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), power: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseValidatorUpdate(): ValidatorUpdate { + return { pubKey: undefined, power: 0 }; +} + +export const ValidatorUpdate: MessageFns = { + encode(message: ValidatorUpdate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdate { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: ValidatorUpdate): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdate { + return ValidatorUpdate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseVoteInfo(): VoteInfo { + return { validator: undefined, blockIdFlag: 0 }; +} + +export const VoteInfo: MessageFns = { + encode(message: VoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.blockIdFlag !== 0) { + writer.uint32(24).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: VoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): VoteInfo { + return VoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseExtendedVoteInfo(): ExtendedVoteInfo { + return { + validator: undefined, + voteExtension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + blockIdFlag: 0, + }; +} + +export const ExtendedVoteInfo: MessageFns = { + encode(message: ExtendedVoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(34).bytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + writer.uint32(40).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedVoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedVoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: ExtendedVoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): ExtendedVoteInfo { + return ExtendedVoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseMisbehavior(): Misbehavior { + return { type: 0, validator: undefined, height: 0, time: undefined, totalVotingPower: 0 }; +} + +export const Misbehavior: MessageFns = { + encode(message: Misbehavior, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Misbehavior { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Misbehavior { + return { + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: Misbehavior): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = misbehaviorTypeToJSON(message.type); + } + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): Misbehavior { + return Misbehavior.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Misbehavior { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: new Uint8Array(0) }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? bytesFromBase64(object.metadata) : new Uint8Array(0), + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata.length !== 0) { + obj.metadata = base64FromBytes(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = object.metadata ?? new Uint8Array(0); + return message; + }, +}; + +export interface ABCI { + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; + PrepareProposal(request: RequestPrepareProposal): Promise; + ProcessProposal(request: RequestProcessProposal): Promise; + ExtendVote(request: RequestExtendVote): Promise; + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise; + FinalizeBlock(request: RequestFinalizeBlock): Promise; +} + +export const ABCIServiceName = "tendermint.abci.ABCI"; +export class ABCIClientImpl implements ABCI { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIServiceName; + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.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.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + this.PrepareProposal = this.PrepareProposal.bind(this); + this.ProcessProposal = this.ProcessProposal.bind(this); + this.ExtendVote = this.ExtendVote.bind(this); + this.VerifyVoteExtension = this.VerifyVoteExtension.bind(this); + this.FinalizeBlock = this.FinalizeBlock.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + PrepareProposal(request: RequestPrepareProposal): Promise { + const data = RequestPrepareProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrepareProposal", data); + return promise.then((data) => ResponsePrepareProposal.decode(new BinaryReader(data))); + } + + ProcessProposal(request: RequestProcessProposal): Promise { + const data = RequestProcessProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "ProcessProposal", data); + return promise.then((data) => ResponseProcessProposal.decode(new BinaryReader(data))); + } + + ExtendVote(request: RequestExtendVote): Promise { + const data = RequestExtendVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExtendVote", data); + return promise.then((data) => ResponseExtendVote.decode(new BinaryReader(data))); + } + + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise { + const data = RequestVerifyVoteExtension.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifyVoteExtension", data); + return promise.then((data) => ResponseVerifyVoteExtension.decode(new BinaryReader(data))); + } + + FinalizeBlock(request: RequestFinalizeBlock): Promise { + const data = RequestFinalizeBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizeBlock", data); + return promise.then((data) => ResponseFinalizeBlock.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/crypto/keys.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/crypto/keys.ts new file mode 100644 index 00000000..f30b6751 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/crypto/keys.ts @@ -0,0 +1,140 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKey { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; +} + +function createBasePublicKey(): PublicKey { + return { ed25519: undefined, secp256k1: undefined }; +} + +export const PublicKey: MessageFns = { + encode(message: PublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ed25519 = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.secp256k1 = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.ed25519 !== undefined) { + obj.ed25519 = base64FromBytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + obj.secp256k1 = base64FromBytes(message.secp256k1); + } + return obj; + }, + + create, I>>(base?: I): PublicKey { + return PublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/crypto/proof.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/crypto/proof.ts new file mode 100644 index 00000000..2b470701 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/crypto/proof.ts @@ -0,0 +1,520 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/proof.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +export interface Proof { + total: number; + index: number; + leafHash: Uint8Array; + aunts: Uint8Array[]; +} + +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof: Proof | undefined; +} + +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, leafHash: new Uint8Array(0), aunts: [] }; +} + +export const Proof: MessageFns = { + encode(message: Proof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).int64(message.total); + } + if (message.index !== 0) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.leafHash = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aunts.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proof { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + leafHash: isSet(object.leafHash) ? bytesFromBase64(object.leafHash) : new Uint8Array(0), + aunts: globalThis.Array.isArray(object?.aunts) ? object.aunts.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Proof): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.leafHash.length !== 0) { + obj.leafHash = base64FromBytes(message.leafHash); + } + if (message.aunts?.length) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Proof { + return Proof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proof { + const message = createBaseProof(); + message.total = object.total ?? 0; + message.index = object.index ?? 0; + message.leafHash = object.leafHash ?? new Uint8Array(0); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValueOp(): ValueOp { + return { key: new Uint8Array(0), proof: undefined }; +} + +export const ValueOp: MessageFns = { + encode(message: ValueOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValueOp { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: ValueOp): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): ValueOp { + return ValueOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValueOp { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(0); + 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: MessageFns = { + encode(message: DominoOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.input = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.output = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DominoOp { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + input: isSet(object.input) ? globalThis.String(object.input) : "", + output: isSet(object.output) ? globalThis.String(object.output) : "", + }; + }, + + toJSON(message: DominoOp): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.input !== "") { + obj.input = message.input; + } + if (message.output !== "") { + obj.output = message.output; + } + return obj; + }, + + create, I>>(base?: I): DominoOp { + return DominoOp.fromPartial(base ?? ({} as any)); + }, + 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(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/libs/bits/types.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/libs/bits/types.ts new file mode 100644 index 00000000..e8ec9685 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/libs/bits/types.ts @@ -0,0 +1,137 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/libs/bits/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.libs.bits"; + +export interface BitArray { + bits: number; + elems: number[]; +} + +function createBaseBitArray(): BitArray { + return { bits: 0, elems: [] }; +} + +export const BitArray: MessageFns = { + encode(message: BitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bits !== 0) { + writer.uint32(8).int64(message.bits); + } + writer.uint32(18).fork(); + for (const v of message.elems) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.bits = longToNumber(reader.int64()); + continue; + case 2: + if (tag === 16) { + message.elems.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.elems.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BitArray { + return { + bits: isSet(object.bits) ? globalThis.Number(object.bits) : 0, + elems: globalThis.Array.isArray(object?.elems) ? object.elems.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: BitArray): unknown { + const obj: any = {}; + if (message.bits !== 0) { + obj.bits = Math.round(message.bits); + } + if (message.elems?.length) { + obj.elems = message.elems.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): BitArray { + return BitArray.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/p2p/types.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/p2p/types.ts new file mode 100644 index 00000000..4ea8187a --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/p2p/types.ts @@ -0,0 +1,528 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/p2p/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.p2p"; + +export interface NetAddress { + id: string; + ip: string; + port: number; +} + +export interface ProtocolVersion { + p2p: number; + block: number; + app: number; +} + +export interface DefaultNodeInfo { + protocolVersion: ProtocolVersion | undefined; + defaultNodeId: string; + listenAddr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other: DefaultNodeInfoOther | undefined; +} + +export interface DefaultNodeInfoOther { + txIndex: string; + rpcAddress: string; +} + +function createBaseNetAddress(): NetAddress { + return { id: "", ip: "", port: 0 }; +} + +export const NetAddress: MessageFns = { + encode(message: NetAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.ip !== "") { + writer.uint32(18).string(message.ip); + } + if (message.port !== 0) { + writer.uint32(24).uint32(message.port); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.ip = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.port = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NetAddress { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + ip: isSet(object.ip) ? globalThis.String(object.ip) : "", + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + }; + }, + + toJSON(message: NetAddress): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.ip !== "") { + obj.ip = message.ip; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + + create, I>>(base?: I): NetAddress { + return NetAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetAddress { + const message = createBaseNetAddress(); + message.id = object.id ?? ""; + message.ip = object.ip ?? ""; + message.port = object.port ?? 0; + return message; + }, +}; + +function createBaseProtocolVersion(): ProtocolVersion { + return { p2p: 0, block: 0, app: 0 }; +} + +export const ProtocolVersion: MessageFns = { + encode(message: ProtocolVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ProtocolVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.p2p = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProtocolVersion { + return { + p2p: isSet(object.p2p) ? globalThis.Number(object.p2p) : 0, + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: ProtocolVersion): unknown { + const obj: any = {}; + if (message.p2p !== 0) { + obj.p2p = Math.round(message.p2p); + } + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): ProtocolVersion { + return ProtocolVersion.fromPartial(base ?? ({} as any)); + }, + 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 createBaseDefaultNodeInfo(): DefaultNodeInfo { + return { + protocolVersion: undefined, + defaultNodeId: "", + listenAddr: "", + network: "", + version: "", + channels: new Uint8Array(0), + moniker: "", + other: undefined, + }; +} + +export const DefaultNodeInfo: MessageFns = { + encode(message: DefaultNodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocolVersion !== undefined) { + ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).join(); + } + if (message.defaultNodeId !== "") { + writer.uint32(18).string(message.defaultNodeId); + } + if (message.listenAddr !== "") { + writer.uint32(26).string(message.listenAddr); + } + 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) { + DefaultNodeInfoOther.encode(message.other, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protocolVersion = ProtocolVersion.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.defaultNodeId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.listenAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.network = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.version = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.channels = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.moniker = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.other = DefaultNodeInfoOther.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfo { + return { + protocolVersion: isSet(object.protocolVersion) ? ProtocolVersion.fromJSON(object.protocolVersion) : undefined, + defaultNodeId: isSet(object.defaultNodeId) ? globalThis.String(object.defaultNodeId) : "", + listenAddr: isSet(object.listenAddr) ? globalThis.String(object.listenAddr) : "", + network: isSet(object.network) ? globalThis.String(object.network) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + channels: isSet(object.channels) ? bytesFromBase64(object.channels) : new Uint8Array(0), + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + other: isSet(object.other) ? DefaultNodeInfoOther.fromJSON(object.other) : undefined, + }; + }, + + toJSON(message: DefaultNodeInfo): unknown { + const obj: any = {}; + if (message.protocolVersion !== undefined) { + obj.protocolVersion = ProtocolVersion.toJSON(message.protocolVersion); + } + if (message.defaultNodeId !== "") { + obj.defaultNodeId = message.defaultNodeId; + } + if (message.listenAddr !== "") { + obj.listenAddr = message.listenAddr; + } + if (message.network !== "") { + obj.network = message.network; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.channels.length !== 0) { + obj.channels = base64FromBytes(message.channels); + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.other !== undefined) { + obj.other = DefaultNodeInfoOther.toJSON(message.other); + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfo { + return DefaultNodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfo { + const message = createBaseDefaultNodeInfo(); + message.protocolVersion = (object.protocolVersion !== undefined && object.protocolVersion !== null) + ? ProtocolVersion.fromPartial(object.protocolVersion) + : undefined; + message.defaultNodeId = object.defaultNodeId ?? ""; + message.listenAddr = object.listenAddr ?? ""; + message.network = object.network ?? ""; + message.version = object.version ?? ""; + message.channels = object.channels ?? new Uint8Array(0); + message.moniker = object.moniker ?? ""; + message.other = (object.other !== undefined && object.other !== null) + ? DefaultNodeInfoOther.fromPartial(object.other) + : undefined; + return message; + }, +}; + +function createBaseDefaultNodeInfoOther(): DefaultNodeInfoOther { + return { txIndex: "", rpcAddress: "" }; +} + +export const DefaultNodeInfoOther: MessageFns = { + encode(message: DefaultNodeInfoOther, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txIndex !== "") { + writer.uint32(10).string(message.txIndex); + } + if (message.rpcAddress !== "") { + writer.uint32(18).string(message.rpcAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfoOther { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfoOther(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txIndex = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfoOther { + return { + txIndex: isSet(object.txIndex) ? globalThis.String(object.txIndex) : "", + rpcAddress: isSet(object.rpcAddress) ? globalThis.String(object.rpcAddress) : "", + }; + }, + + toJSON(message: DefaultNodeInfoOther): unknown { + const obj: any = {}; + if (message.txIndex !== "") { + obj.txIndex = message.txIndex; + } + if (message.rpcAddress !== "") { + obj.rpcAddress = message.rpcAddress; + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfoOther { + return DefaultNodeInfoOther.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfoOther { + const message = createBaseDefaultNodeInfoOther(); + message.txIndex = object.txIndex ?? ""; + message.rpcAddress = object.rpcAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/block.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/block.ts new file mode 100644 index 00000000..4fbb3c13 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/block.ts @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/block.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { EvidenceList } from "./evidence"; +import { Commit, Data, Header } from "./types"; + +export const protobufPackage = "tendermint.types"; + +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/evidence.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/evidence.ts new file mode 100644 index 00000000..9a2fc48b --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/evidence.ts @@ -0,0 +1,489 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/evidence.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { LightBlock, Vote } from "./types"; +import { Validator } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +export interface Evidence { + duplicateVoteEvidence?: DuplicateVoteEvidence | undefined; + lightClientAttackEvidence?: LightClientAttackEvidence | undefined; +} + +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidence { + voteA: Vote | undefined; + voteB: Vote | undefined; + totalVotingPower: number; + validatorPower: number; + timestamp: Date | undefined; +} + +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidence { + conflictingBlock: LightBlock | undefined; + commonHeight: number; + byzantineValidators: Validator[]; + totalVotingPower: number; + timestamp: Date | undefined; +} + +export interface EvidenceList { + evidence: Evidence[]; +} + +function createBaseEvidence(): Evidence { + return { duplicateVoteEvidence: undefined, lightClientAttackEvidence: undefined }; +} + +export const Evidence: MessageFns = { + encode(message: Evidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.duplicateVoteEvidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).join(); + } + if (message.lightClientAttackEvidence !== undefined) { + LightClientAttackEvidence.encode(message.lightClientAttackEvidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.duplicateVoteEvidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lightClientAttackEvidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + duplicateVoteEvidence: isSet(object.duplicateVoteEvidence) + ? DuplicateVoteEvidence.fromJSON(object.duplicateVoteEvidence) + : undefined, + lightClientAttackEvidence: isSet(object.lightClientAttackEvidence) + ? LightClientAttackEvidence.fromJSON(object.lightClientAttackEvidence) + : undefined, + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + if (message.duplicateVoteEvidence !== undefined) { + obj.duplicateVoteEvidence = DuplicateVoteEvidence.toJSON(message.duplicateVoteEvidence); + } + if (message.lightClientAttackEvidence !== undefined) { + obj.lightClientAttackEvidence = LightClientAttackEvidence.toJSON(message.lightClientAttackEvidence); + } + return obj; + }, + + create, I>>(base?: I): Evidence { + return Evidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.duplicateVoteEvidence = + (object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null) + ? DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) + : undefined; + message.lightClientAttackEvidence = + (object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null) + ? LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) + : undefined; + return message; + }, +}; + +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { voteA: undefined, voteB: undefined, totalVotingPower: 0, validatorPower: 0, timestamp: undefined }; +} + +export const DuplicateVoteEvidence: MessageFns = { + encode(message: DuplicateVoteEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteA !== undefined) { + Vote.encode(message.voteA, writer.uint32(10).fork()).join(); + } + if (message.voteB !== undefined) { + Vote.encode(message.voteB, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + writer.uint32(32).int64(message.validatorPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuplicateVoteEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteA = Vote.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voteB = Vote.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.validatorPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DuplicateVoteEvidence { + return { + voteA: isSet(object.voteA) ? Vote.fromJSON(object.voteA) : undefined, + voteB: isSet(object.voteB) ? Vote.fromJSON(object.voteB) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + validatorPower: isSet(object.validatorPower) ? globalThis.Number(object.validatorPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: DuplicateVoteEvidence): unknown { + const obj: any = {}; + if (message.voteA !== undefined) { + obj.voteA = Vote.toJSON(message.voteA); + } + if (message.voteB !== undefined) { + obj.voteB = Vote.toJSON(message.voteB); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + obj.validatorPower = Math.round(message.validatorPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.voteA = (object.voteA !== undefined && object.voteA !== null) ? Vote.fromPartial(object.voteA) : undefined; + message.voteB = (object.voteB !== undefined && object.voteB !== null) ? Vote.fromPartial(object.voteB) : undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.validatorPower = object.validatorPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflictingBlock: undefined, + commonHeight: 0, + byzantineValidators: [], + totalVotingPower: 0, + timestamp: undefined, + }; +} + +export const LightClientAttackEvidence: MessageFns = { + encode(message: LightClientAttackEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.conflictingBlock !== undefined) { + LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).join(); + } + if (message.commonHeight !== 0) { + writer.uint32(16).int64(message.commonHeight); + } + for (const v of message.byzantineValidators) { + Validator.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(32).int64(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightClientAttackEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.conflictingBlock = LightBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.commonHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.byzantineValidators.push(Validator.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightClientAttackEvidence { + return { + conflictingBlock: isSet(object.conflictingBlock) ? LightBlock.fromJSON(object.conflictingBlock) : undefined, + commonHeight: isSet(object.commonHeight) ? globalThis.Number(object.commonHeight) : 0, + byzantineValidators: globalThis.Array.isArray(object?.byzantineValidators) + ? object.byzantineValidators.map((e: any) => Validator.fromJSON(e)) + : [], + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: LightClientAttackEvidence): unknown { + const obj: any = {}; + if (message.conflictingBlock !== undefined) { + obj.conflictingBlock = LightBlock.toJSON(message.conflictingBlock); + } + if (message.commonHeight !== 0) { + obj.commonHeight = Math.round(message.commonHeight); + } + if (message.byzantineValidators?.length) { + obj.byzantineValidators = message.byzantineValidators.map((e) => Validator.toJSON(e)); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): LightClientAttackEvidence { + return LightClientAttackEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflictingBlock = (object.conflictingBlock !== undefined && object.conflictingBlock !== null) + ? LightBlock.fromPartial(object.conflictingBlock) + : undefined; + message.commonHeight = object.commonHeight ?? 0; + message.byzantineValidators = object.byzantineValidators?.map((e) => Validator.fromPartial(e)) || []; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseEvidenceList(): EvidenceList { + return { evidence: [] }; +} + +export const EvidenceList: MessageFns = { + encode(message: EvidenceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence.push(Evidence.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceList { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Evidence.fromJSON(e)) : [], + }; + }, + + toJSON(message: EvidenceList): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Evidence.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EvidenceList { + return EvidenceList.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/params.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/params.ts new file mode 100644 index 00000000..d4cc2b8a --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/params.ts @@ -0,0 +1,686 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; + evidence: EvidenceParams | undefined; + validator: ValidatorParams | undefined; + version: VersionParams | undefined; + abci: ABCIParams | undefined; +} + +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + maxBytes: number; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + maxGas: number; +} + +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + maxAgeNumBlocks: number; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + maxAgeDuration: + | Duration + | undefined; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + maxBytes: number; +} + +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pubKeyTypes: string[]; +} + +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app: number; +} + +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + blockMaxBytes: number; + blockMaxGas: number; +} + +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParams { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + voteExtensionsEnableHeight: number; +} + +function createBaseConsensusParams(): ConsensusParams { + return { block: undefined, evidence: undefined, validator: undefined, version: undefined, abci: undefined }; +} + +export const ConsensusParams: MessageFns = { + encode(message: ConsensusParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(10).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(26).fork()).join(); + } + if (message.version !== undefined) { + VersionParams.encode(message.version, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.version = VersionParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.version !== undefined) { + obj.version = VersionParams.toJSON(message.version); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + return obj; + }, + + create, I>>(base?: I): ConsensusParams { + return ConsensusParams.fromPartial(base ?? ({} as any)); + }, + 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; + message.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseBlockParams(): BlockParams { + return { maxBytes: 0, maxGas: 0 }; +} + +export const BlockParams: MessageFns = { + encode(message: BlockParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxBytes !== 0) { + writer.uint32(8).int64(message.maxBytes); + } + if (message.maxGas !== 0) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + maxGas: isSet(object.maxGas) ? globalThis.Number(object.maxGas) : 0, + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxGas !== 0) { + obj.maxGas = Math.round(message.maxGas); + } + return obj; + }, + + create, I>>(base?: I): BlockParams { + return BlockParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes ?? 0; + message.maxGas = object.maxGas ?? 0; + return message; + }, +}; + +function createBaseEvidenceParams(): EvidenceParams { + return { maxAgeNumBlocks: 0, maxAgeDuration: undefined, maxBytes: 0 }; +} + +export const EvidenceParams: MessageFns = { + encode(message: EvidenceParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxAgeNumBlocks !== 0) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).join(); + } + if (message.maxBytes !== 0) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxAgeNumBlocks = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxAgeDuration = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceParams { + return { + maxAgeNumBlocks: isSet(object.maxAgeNumBlocks) ? globalThis.Number(object.maxAgeNumBlocks) : 0, + maxAgeDuration: isSet(object.maxAgeDuration) ? Duration.fromJSON(object.maxAgeDuration) : undefined, + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + }; + }, + + toJSON(message: EvidenceParams): unknown { + const obj: any = {}; + if (message.maxAgeNumBlocks !== 0) { + obj.maxAgeNumBlocks = Math.round(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + obj.maxAgeDuration = Duration.toJSON(message.maxAgeDuration); + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + return obj; + }, + + create, I>>(base?: I): EvidenceParams { + return EvidenceParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EvidenceParams { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = object.maxAgeNumBlocks ?? 0; + message.maxAgeDuration = (object.maxAgeDuration !== undefined && object.maxAgeDuration !== null) + ? Duration.fromPartial(object.maxAgeDuration) + : undefined; + message.maxBytes = object.maxBytes ?? 0; + return message; + }, +}; + +function createBaseValidatorParams(): ValidatorParams { + return { pubKeyTypes: [] }; +} + +export const ValidatorParams: MessageFns = { + encode(message: ValidatorParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKeyTypes.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorParams { + return { + pubKeyTypes: globalThis.Array.isArray(object?.pubKeyTypes) + ? object.pubKeyTypes.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValidatorParams): unknown { + const obj: any = {}; + if (message.pubKeyTypes?.length) { + obj.pubKeyTypes = message.pubKeyTypes; + } + return obj; + }, + + create, I>>(base?: I): ValidatorParams { + return ValidatorParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVersionParams(): VersionParams { + return { app: 0 }; +} + +export const VersionParams: MessageFns = { + encode(message: VersionParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.app !== 0) { + writer.uint32(8).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionParams { + return { app: isSet(object.app) ? globalThis.Number(object.app) : 0 }; + }, + + toJSON(message: VersionParams): unknown { + const obj: any = {}; + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): VersionParams { + return VersionParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionParams { + const message = createBaseVersionParams(); + message.app = object.app ?? 0; + return message; + }, +}; + +function createBaseHashedParams(): HashedParams { + return { blockMaxBytes: 0, blockMaxGas: 0 }; +} + +export const HashedParams: MessageFns = { + encode(message: HashedParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockMaxBytes !== 0) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockMaxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockMaxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashedParams { + return { + blockMaxBytes: isSet(object.blockMaxBytes) ? globalThis.Number(object.blockMaxBytes) : 0, + blockMaxGas: isSet(object.blockMaxGas) ? globalThis.Number(object.blockMaxGas) : 0, + }; + }, + + toJSON(message: HashedParams): unknown { + const obj: any = {}; + if (message.blockMaxBytes !== 0) { + obj.blockMaxBytes = Math.round(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + obj.blockMaxGas = Math.round(message.blockMaxGas); + } + return obj; + }, + + create, I>>(base?: I): HashedParams { + return HashedParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HashedParams { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes ?? 0; + message.blockMaxGas = object.blockMaxGas ?? 0; + return message; + }, +}; + +function createBaseABCIParams(): ABCIParams { + return { voteExtensionsEnableHeight: 0 }; +} + +export const ABCIParams: MessageFns = { + encode(message: ABCIParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtensionsEnableHeight !== 0) { + writer.uint32(8).int64(message.voteExtensionsEnableHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.voteExtensionsEnableHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIParams { + return { + voteExtensionsEnableHeight: isSet(object.voteExtensionsEnableHeight) + ? globalThis.Number(object.voteExtensionsEnableHeight) + : 0, + }; + }, + + toJSON(message: ABCIParams): unknown { + const obj: any = {}; + if (message.voteExtensionsEnableHeight !== 0) { + obj.voteExtensionsEnableHeight = Math.round(message.voteExtensionsEnableHeight); + } + return obj; + }, + + create, I>>(base?: I): ABCIParams { + return ABCIParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIParams { + const message = createBaseABCIParams(); + message.voteExtensionsEnableHeight = object.voteExtensionsEnableHeight ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/types.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/types.ts new file mode 100644 index 00000000..85454a42 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/types.ts @@ -0,0 +1,2065 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON, ValidatorSet } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +/** 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 | undefined; +} + +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + partSetHeader: PartSetHeader | undefined; +} + +/** Header defines the structure of a block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** original proposer of the block */ + proposerAddress: Uint8Array; +} + +/** 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 or precommit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: number; + round: number; + /** zero if vote is nil. */ + blockId: BlockID | undefined; + timestamp: Date | undefined; + validatorAddress: Uint8Array; + validatorIndex: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ + signature: Uint8Array; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension: Uint8Array; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. + * Only valid for precommit messages. + */ + extensionSignature: Uint8Array; +} + +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: number; + round: number; + blockId: BlockID | undefined; + signatures: CommitSig[]; +} + +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface ExtendedCommit { + height: number; + round: number; + blockId: BlockID | undefined; + extendedSignatures: ExtendedCommitSig[]; +} + +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; + /** Vote extension data */ + extension: Uint8Array; + /** Vote extension signature */ + extensionSignature: Uint8Array; +} + +export interface Proposal { + type: SignedMsgType; + height: number; + round: number; + polRound: number; + blockId: BlockID | undefined; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface SignedHeader { + header: Header | undefined; + commit: Commit | undefined; +} + +export interface LightBlock { + signedHeader: SignedHeader | undefined; + validatorSet: ValidatorSet | undefined; +} + +export interface BlockMeta { + blockId: BlockID | undefined; + blockSize: number; + header: Header | undefined; + numTxs: number; +} + +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + rootHash: Uint8Array; + data: Uint8Array; + proof: Proof | undefined; +} + +function createBasePartSetHeader(): PartSetHeader { + return { total: 0, hash: new Uint8Array(0) }; +} + +export const PartSetHeader: MessageFns = { + encode(message: PartSetHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PartSetHeader { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: PartSetHeader): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): PartSetHeader { + return PartSetHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePart(): Part { + return { index: 0, bytes: new Uint8Array(0), proof: undefined }; +} + +export const Part: MessageFns = { + encode(message: Part, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Part { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Part { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: Part): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.bytes.length !== 0) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): Part { + return Part.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Part { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function createBaseBlockID(): BlockID { + return { hash: new Uint8Array(0), partSetHeader: undefined }; +} + +export const BlockID: MessageFns = { + encode(message: BlockID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.partSetHeader = PartSetHeader.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockID { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + partSetHeader: isSet(object.partSetHeader) ? PartSetHeader.fromJSON(object.partSetHeader) : undefined, + }; + }, + + toJSON(message: BlockID): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.partSetHeader !== undefined) { + obj.partSetHeader = PartSetHeader.toJSON(message.partSetHeader); + } + return obj; + }, + + create, I>>(base?: I): BlockID { + return BlockID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(0); + message.partSetHeader = (object.partSetHeader !== undefined && object.partSetHeader !== null) + ? PartSetHeader.fromPartial(object.partSetHeader) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseData(): Data { + return { txs: [] }; +} + +export const Data: MessageFns = { + encode(message: Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Data { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: Data): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Data { + return Data.fromPartial(base ?? ({} as any)); + }, + 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, + blockId: undefined, + timestamp: undefined, + validatorAddress: new Uint8Array(0), + validatorIndex: 0, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(74).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(82).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.validatorIndex = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.signature = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.extension = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + validatorIndex: isSet(object.validatorIndex) ? globalThis.Number(object.validatorIndex) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + obj.validatorIndex = Math.round(message.validatorIndex); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommit(): Commit { + return { height: 0, round: 0, blockId: undefined, signatures: [] }; +} + +export const Commit: MessageFns = { + encode(message: Commit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signatures.push(CommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => CommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Commit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => CommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Commit { + return Commit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commit { + const message = createBaseCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.signatures = object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommitSig(): CommitSig { + return { blockIdFlag: 0, validatorAddress: new Uint8Array(0), timestamp: undefined, signature: new Uint8Array(0) }; +} + +export const CommitSig: MessageFns = { + encode(message: CommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): CommitSig { + return CommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitSig { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseExtendedCommit(): ExtendedCommit { + return { height: 0, round: 0, blockId: undefined, extendedSignatures: [] }; +} + +export const ExtendedCommit: MessageFns = { + encode(message: ExtendedCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.extendedSignatures) { + ExtendedCommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extendedSignatures.push(ExtendedCommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + extendedSignatures: globalThis.Array.isArray(object?.extendedSignatures) + ? object.extendedSignatures.map((e: any) => ExtendedCommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ExtendedCommit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.extendedSignatures?.length) { + obj.extendedSignatures = message.extendedSignatures.map((e) => ExtendedCommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommit { + return ExtendedCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommit { + const message = createBaseExtendedCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.extendedSignatures = object.extendedSignatures?.map((e) => ExtendedCommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitSig(): ExtendedCommitSig { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(0), + timestamp: undefined, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const ExtendedCommitSig: MessageFns = { + encode(message: ExtendedCommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(42).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(50).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.extension = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: ExtendedCommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitSig { + return ExtendedCommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + type: 0, + height: 0, + round: 0, + polRound: 0, + blockId: undefined, + timestamp: undefined, + signature: new Uint8Array(0), + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(42).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.polRound = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + polRound: isSet(object.polRound) ? globalThis.Number(object.polRound) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.polRound !== 0) { + obj.polRound = Math.round(message.polRound); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignedHeader(): SignedHeader { + return { header: undefined, commit: undefined }; +} + +export const SignedHeader: MessageFns = { + encode(message: SignedHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.commit !== undefined) { + Commit.encode(message.commit, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.commit !== undefined) { + obj.commit = Commit.toJSON(message.commit); + } + return obj; + }, + + create, I>>(base?: I): SignedHeader { + return SignedHeader.fromPartial(base ?? ({} as any)); + }, + 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 { signedHeader: undefined, validatorSet: undefined }; +} + +export const LightBlock: MessageFns = { + encode(message: LightBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedHeader !== undefined) { + SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).join(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightBlock { + return { + signedHeader: isSet(object.signedHeader) ? SignedHeader.fromJSON(object.signedHeader) : undefined, + validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined, + }; + }, + + toJSON(message: LightBlock): unknown { + const obj: any = {}; + if (message.signedHeader !== undefined) { + obj.signedHeader = SignedHeader.toJSON(message.signedHeader); + } + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): LightBlock { + return LightBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightBlock { + const message = createBaseLightBlock(); + message.signedHeader = (object.signedHeader !== undefined && object.signedHeader !== null) + ? SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseBlockMeta(): BlockMeta { + return { blockId: undefined, blockSize: 0, header: undefined, numTxs: 0 }; +} + +export const BlockMeta: MessageFns = { + encode(message: BlockMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.blockSize !== 0) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).join(); + } + if (message.numTxs !== 0) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockSize = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numTxs = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMeta { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + blockSize: isSet(object.blockSize) ? globalThis.Number(object.blockSize) : 0, + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + numTxs: isSet(object.numTxs) ? globalThis.Number(object.numTxs) : 0, + }; + }, + + toJSON(message: BlockMeta): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.blockSize !== 0) { + obj.blockSize = Math.round(message.blockSize); + } + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.numTxs !== 0) { + obj.numTxs = Math.round(message.numTxs); + } + return obj; + }, + + create, I>>(base?: I): BlockMeta { + return BlockMeta.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMeta { + const message = createBaseBlockMeta(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.blockSize = object.blockSize ?? 0; + message.header = (object.header !== undefined && object.header !== null) + ? Header.fromPartial(object.header) + : undefined; + message.numTxs = object.numTxs ?? 0; + return message; + }, +}; + +function createBaseTxProof(): TxProof { + return { rootHash: new Uint8Array(0), data: new Uint8Array(0), proof: undefined }; +} + +export const TxProof: MessageFns = { + encode(message: TxProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rootHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxProof { + return { + rootHash: isSet(object.rootHash) ? bytesFromBase64(object.rootHash) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: TxProof): unknown { + const obj: any = {}; + if (message.rootHash.length !== 0) { + obj.rootHash = base64FromBytes(message.rootHash); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): TxProof { + return TxProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxProof { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/validator.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/validator.ts new file mode 100644 index 00000000..623b14d8 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/types/validator.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/validator.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PublicKey } from "../crypto/keys"; + +export const protobufPackage = "tendermint.types"; + +/** BlockIdFlag indicates which BlockID the signature is for */ +export enum BlockIDFlag { + /** BLOCK_ID_FLAG_UNKNOWN - indicates an error condition */ + BLOCK_ID_FLAG_UNKNOWN = 0, + /** BLOCK_ID_FLAG_ABSENT - the vote was not received */ + BLOCK_ID_FLAG_ABSENT = 1, + /** BLOCK_ID_FLAG_COMMIT - voted for the block that received the majority */ + BLOCK_ID_FLAG_COMMIT = 2, + /** BLOCK_ID_FLAG_NIL - voted for nil */ + 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"; + } +} + +export interface ValidatorSet { + validators: Validator[]; + proposer: Validator | undefined; + totalVotingPower: number; +} + +export interface Validator { + address: Uint8Array; + pubKey: PublicKey | undefined; + votingPower: number; + proposerPriority: number; +} + +export interface SimpleValidator { + pubKey: PublicKey | undefined; + votingPower: number; +} + +function createBaseValidatorSet(): ValidatorSet { + return { validators: [], proposer: undefined, totalVotingPower: 0 }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.proposer !== undefined) { + Validator.encode(message.proposer, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.proposer !== undefined) { + obj.proposer = Validator.toJSON(message.proposer); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + 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.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseSimpleValidator(): SimpleValidator { + return { pubKey: undefined, votingPower: 0 }; +} + +export const SimpleValidator: MessageFns = { + encode(message: SimpleValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimpleValidator { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + }; + }, + + toJSON(message: SimpleValidator): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + return obj; + }, + + create, I>>(base?: I): SimpleValidator { + return SimpleValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.evidence.v1beta1/types/tendermint/version/types.ts b/ts-client/cosmos.evidence.v1beta1/types/tendermint/version/types.ts new file mode 100644 index 00000000..7a4b2fa4 --- /dev/null +++ b/ts-client/cosmos.evidence.v1beta1/types/tendermint/version/types.ts @@ -0,0 +1,214 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/version/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: number; + 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: number; + app: number; +} + +function createBaseApp(): App { + return { protocol: 0, software: "" }; +} + +export const App: MessageFns = { + encode(message: App, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocol !== 0) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): App { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.protocol = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.software = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): App { + return { + protocol: isSet(object.protocol) ? globalThis.Number(object.protocol) : 0, + software: isSet(object.software) ? globalThis.String(object.software) : "", + }; + }, + + toJSON(message: App): unknown { + const obj: any = {}; + if (message.protocol !== 0) { + obj.protocol = Math.round(message.protocol); + } + if (message.software !== "") { + obj.software = message.software; + } + return obj; + }, + + create, I>>(base?: I): App { + return App.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Consensus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== 0) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== 0) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Consensus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Consensus { + return { + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: Consensus): unknown { + const obj: any = {}; + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): Consensus { + return Consensus.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/module.ts b/ts-client/cosmos.feegrant.v1beta1/module.ts index 73050946..5e04b270 100755 --- a/ts-client/cosmos.feegrant.v1beta1/module.ts +++ b/ts-client/cosmos.feegrant.v1beta1/module.ts @@ -6,32 +6,26 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { Grant } from "./types/cosmos/feegrant/v1beta1/feegrant"; import { MsgGrantAllowance } from "./types/cosmos/feegrant/v1beta1/tx"; -import { QueryAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/query"; -import { QueryAllowancesRequest } from "./types/cosmos/feegrant/v1beta1/query"; -import { MsgGrantAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/tx"; import { MsgRevokeAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/tx"; +import { MsgPruneAllowancesResponse } from "./types/cosmos/feegrant/v1beta1/tx"; +import { MsgGrantAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/tx"; import { MsgPruneAllowances } from "./types/cosmos/feegrant/v1beta1/tx"; -import { AllowedMsgAllowance } from "./types/cosmos/feegrant/v1beta1/feegrant"; -import { MsgRevokeAllowance } from "./types/cosmos/feegrant/v1beta1/tx"; import { PeriodicAllowance } from "./types/cosmos/feegrant/v1beta1/feegrant"; import { QueryAllowancesByGranterResponse } from "./types/cosmos/feegrant/v1beta1/query"; +import { Grant } from "./types/cosmos/feegrant/v1beta1/feegrant"; +import { MsgRevokeAllowance } from "./types/cosmos/feegrant/v1beta1/tx"; +import { QueryAllowanceRequest } from "./types/cosmos/feegrant/v1beta1/query"; +import { QueryAllowancesRequest } from "./types/cosmos/feegrant/v1beta1/query"; +import { QueryAllowancesResponse } from "./types/cosmos/feegrant/v1beta1/query"; +import { QueryAllowancesByGranterRequest } from "./types/cosmos/feegrant/v1beta1/query"; import { BasicAllowance } from "./types/cosmos/feegrant/v1beta1/feegrant"; import { GenesisState } from "./types/cosmos/feegrant/v1beta1/genesis"; -import { QueryAllowancesByGranterRequest } from "./types/cosmos/feegrant/v1beta1/query"; -import { QueryAllowancesResponse } from "./types/cosmos/feegrant/v1beta1/query"; -import { MsgPruneAllowancesResponse } from "./types/cosmos/feegrant/v1beta1/tx"; -import { QueryAllowanceRequest } from "./types/cosmos/feegrant/v1beta1/query"; - +import { AllowedMsgAllowance } from "./types/cosmos/feegrant/v1beta1/feegrant"; +import { QueryAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/query"; -export { Grant, MsgGrantAllowance, QueryAllowanceResponse, QueryAllowancesRequest, MsgGrantAllowanceResponse, MsgRevokeAllowanceResponse, MsgPruneAllowances, AllowedMsgAllowance, MsgRevokeAllowance, PeriodicAllowance, QueryAllowancesByGranterResponse, BasicAllowance, GenesisState, QueryAllowancesByGranterRequest, QueryAllowancesResponse, MsgPruneAllowancesResponse, QueryAllowanceRequest }; -type sendGrantParams = { - value: Grant, - fee?: StdFee, - memo?: string -}; +export { MsgGrantAllowance, MsgRevokeAllowanceResponse, MsgPruneAllowancesResponse, MsgGrantAllowanceResponse, MsgPruneAllowances, PeriodicAllowance, QueryAllowancesByGranterResponse, Grant, MsgRevokeAllowance, QueryAllowanceRequest, QueryAllowancesRequest, QueryAllowancesResponse, QueryAllowancesByGranterRequest, BasicAllowance, GenesisState, AllowedMsgAllowance, QueryAllowanceResponse }; type sendMsgGrantAllowanceParams = { value: MsgGrantAllowance, @@ -39,14 +33,14 @@ type sendMsgGrantAllowanceParams = { memo?: string }; -type sendQueryAllowanceResponseParams = { - value: QueryAllowanceResponse, +type sendMsgRevokeAllowanceResponseParams = { + value: MsgRevokeAllowanceResponse, fee?: StdFee, memo?: string }; -type sendQueryAllowancesRequestParams = { - value: QueryAllowancesRequest, +type sendMsgPruneAllowancesResponseParams = { + value: MsgPruneAllowancesResponse, fee?: StdFee, memo?: string }; @@ -57,50 +51,50 @@ type sendMsgGrantAllowanceResponseParams = { memo?: string }; -type sendMsgRevokeAllowanceResponseParams = { - value: MsgRevokeAllowanceResponse, +type sendMsgPruneAllowancesParams = { + value: MsgPruneAllowances, fee?: StdFee, memo?: string }; -type sendMsgPruneAllowancesParams = { - value: MsgPruneAllowances, +type sendPeriodicAllowanceParams = { + value: PeriodicAllowance, fee?: StdFee, memo?: string }; -type sendAllowedMsgAllowanceParams = { - value: AllowedMsgAllowance, +type sendQueryAllowancesByGranterResponseParams = { + value: QueryAllowancesByGranterResponse, fee?: StdFee, memo?: string }; -type sendMsgRevokeAllowanceParams = { - value: MsgRevokeAllowance, +type sendGrantParams = { + value: Grant, fee?: StdFee, memo?: string }; -type sendPeriodicAllowanceParams = { - value: PeriodicAllowance, +type sendMsgRevokeAllowanceParams = { + value: MsgRevokeAllowance, fee?: StdFee, memo?: string }; -type sendQueryAllowancesByGranterResponseParams = { - value: QueryAllowancesByGranterResponse, +type sendQueryAllowanceRequestParams = { + value: QueryAllowanceRequest, fee?: StdFee, memo?: string }; -type sendBasicAllowanceParams = { - value: BasicAllowance, +type sendQueryAllowancesRequestParams = { + value: QueryAllowancesRequest, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryAllowancesResponseParams = { + value: QueryAllowancesResponse, fee?: StdFee, memo?: string }; @@ -111,61 +105,51 @@ type sendQueryAllowancesByGranterRequestParams = { memo?: string }; -type sendQueryAllowancesResponseParams = { - value: QueryAllowancesResponse, +type sendBasicAllowanceParams = { + value: BasicAllowance, fee?: StdFee, memo?: string }; -type sendMsgPruneAllowancesResponseParams = { - value: MsgPruneAllowancesResponse, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendQueryAllowanceRequestParams = { - value: QueryAllowanceRequest, +type sendAllowedMsgAllowanceParams = { + value: AllowedMsgAllowance, fee?: StdFee, memo?: string }; - -type grantParams = { - value: Grant, +type sendQueryAllowanceResponseParams = { + value: QueryAllowanceResponse, + fee?: StdFee, + memo?: string }; + type msgGrantAllowanceParams = { value: MsgGrantAllowance, }; -type queryAllowanceResponseParams = { - value: QueryAllowanceResponse, +type msgRevokeAllowanceResponseParams = { + value: MsgRevokeAllowanceResponse, }; -type queryAllowancesRequestParams = { - value: QueryAllowancesRequest, +type msgPruneAllowancesResponseParams = { + value: MsgPruneAllowancesResponse, }; type msgGrantAllowanceResponseParams = { value: MsgGrantAllowanceResponse, }; -type msgRevokeAllowanceResponseParams = { - value: MsgRevokeAllowanceResponse, -}; - type msgPruneAllowancesParams = { value: MsgPruneAllowances, }; -type allowedMsgAllowanceParams = { - value: AllowedMsgAllowance, -}; - -type msgRevokeAllowanceParams = { - value: MsgRevokeAllowance, -}; - type periodicAllowanceParams = { value: PeriodicAllowance, }; @@ -174,28 +158,44 @@ type queryAllowancesByGranterResponseParams = { value: QueryAllowancesByGranterResponse, }; -type basicAllowanceParams = { - value: BasicAllowance, +type grantParams = { + value: Grant, }; -type genesisStateParams = { - value: GenesisState, +type msgRevokeAllowanceParams = { + value: MsgRevokeAllowance, }; -type queryAllowancesByGranterRequestParams = { - value: QueryAllowancesByGranterRequest, +type queryAllowanceRequestParams = { + value: QueryAllowanceRequest, +}; + +type queryAllowancesRequestParams = { + value: QueryAllowancesRequest, }; type queryAllowancesResponseParams = { value: QueryAllowancesResponse, }; -type msgPruneAllowancesResponseParams = { - value: MsgPruneAllowancesResponse, +type queryAllowancesByGranterRequestParams = { + value: QueryAllowancesByGranterRequest, }; -type queryAllowanceRequestParams = { - value: QueryAllowanceRequest, +type basicAllowanceParams = { + value: BasicAllowance, +}; + +type genesisStateParams = { + value: GenesisState, +}; + +type allowedMsgAllowanceParams = { + value: AllowedMsgAllowance, +}; + +type queryAllowanceResponseParams = { + value: QueryAllowanceResponse, }; @@ -228,20 +228,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendGrant({ value, fee, memo }: sendGrantParams): Promise { - if (!signer) { - throw new Error('TxClient:sendGrant: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.grant({ value: Grant.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendGrant: Could not broadcast Tx: '+ e.message) - } - }, - async sendMsgGrantAllowance({ value, fee, memo }: sendMsgGrantAllowanceParams): Promise { if (!signer) { throw new Error('TxClient:sendMsgGrantAllowance: Unable to sign Tx. Signer is not present.') @@ -256,31 +242,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryAllowanceResponse({ value, fee, memo }: sendQueryAllowanceResponseParams): Promise { + async sendMsgRevokeAllowanceResponse({ value, fee, memo }: sendMsgRevokeAllowanceResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllowanceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRevokeAllowanceResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllowanceResponse({ value: QueryAllowanceResponse.fromPartial(value) }) + let msg = this.msgRevokeAllowanceResponse({ value: MsgRevokeAllowanceResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllowanceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRevokeAllowanceResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllowancesRequest({ value, fee, memo }: sendQueryAllowancesRequestParams): Promise { + async sendMsgPruneAllowancesResponse({ value, fee, memo }: sendMsgPruneAllowancesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllowancesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPruneAllowancesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllowancesRequest({ value: QueryAllowancesRequest.fromPartial(value) }) + let msg = this.msgPruneAllowancesResponse({ value: MsgPruneAllowancesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllowancesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPruneAllowancesResponse: Could not broadcast Tx: '+ e.message) } }, @@ -298,115 +284,115 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgRevokeAllowanceResponse({ value, fee, memo }: sendMsgRevokeAllowanceResponseParams): Promise { + async sendMsgPruneAllowances({ value, fee, memo }: sendMsgPruneAllowancesParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRevokeAllowanceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPruneAllowances: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRevokeAllowanceResponse({ value: MsgRevokeAllowanceResponse.fromPartial(value) }) + let msg = this.msgPruneAllowances({ value: MsgPruneAllowances.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRevokeAllowanceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPruneAllowances: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPruneAllowances({ value, fee, memo }: sendMsgPruneAllowancesParams): Promise { + async sendPeriodicAllowance({ value, fee, memo }: sendPeriodicAllowanceParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPruneAllowances: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPeriodicAllowance: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPruneAllowances({ value: MsgPruneAllowances.fromPartial(value) }) + let msg = this.periodicAllowance({ value: PeriodicAllowance.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPruneAllowances: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPeriodicAllowance: Could not broadcast Tx: '+ e.message) } }, - async sendAllowedMsgAllowance({ value, fee, memo }: sendAllowedMsgAllowanceParams): Promise { + async sendQueryAllowancesByGranterResponse({ value, fee, memo }: sendQueryAllowancesByGranterResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendAllowedMsgAllowance: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllowancesByGranterResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.allowedMsgAllowance({ value: AllowedMsgAllowance.fromPartial(value) }) + let msg = this.queryAllowancesByGranterResponse({ value: QueryAllowancesByGranterResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAllowedMsgAllowance: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllowancesByGranterResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRevokeAllowance({ value, fee, memo }: sendMsgRevokeAllowanceParams): Promise { + async sendGrant({ value, fee, memo }: sendGrantParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRevokeAllowance: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGrant: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRevokeAllowance({ value: MsgRevokeAllowance.fromPartial(value) }) + let msg = this.grant({ value: Grant.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRevokeAllowance: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGrant: Could not broadcast Tx: '+ e.message) } }, - async sendPeriodicAllowance({ value, fee, memo }: sendPeriodicAllowanceParams): Promise { + async sendMsgRevokeAllowance({ value, fee, memo }: sendMsgRevokeAllowanceParams): Promise { if (!signer) { - throw new Error('TxClient:sendPeriodicAllowance: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRevokeAllowance: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.periodicAllowance({ value: PeriodicAllowance.fromPartial(value) }) + let msg = this.msgRevokeAllowance({ value: MsgRevokeAllowance.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPeriodicAllowance: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRevokeAllowance: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllowancesByGranterResponse({ value, fee, memo }: sendQueryAllowancesByGranterResponseParams): Promise { + async sendQueryAllowanceRequest({ value, fee, memo }: sendQueryAllowanceRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllowancesByGranterResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllowanceRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllowancesByGranterResponse({ value: QueryAllowancesByGranterResponse.fromPartial(value) }) + let msg = this.queryAllowanceRequest({ value: QueryAllowanceRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllowancesByGranterResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllowanceRequest: Could not broadcast Tx: '+ e.message) } }, - async sendBasicAllowance({ value, fee, memo }: sendBasicAllowanceParams): Promise { + async sendQueryAllowancesRequest({ value, fee, memo }: sendQueryAllowancesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendBasicAllowance: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllowancesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.basicAllowance({ value: BasicAllowance.fromPartial(value) }) + let msg = this.queryAllowancesRequest({ value: QueryAllowancesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendBasicAllowance: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllowancesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryAllowancesResponse({ value, fee, memo }: sendQueryAllowancesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllowancesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryAllowancesResponse({ value: QueryAllowancesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllowancesResponse: Could not broadcast Tx: '+ e.message) } }, @@ -424,57 +410,63 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryAllowancesResponse({ value, fee, memo }: sendQueryAllowancesResponseParams): Promise { + async sendBasicAllowance({ value, fee, memo }: sendBasicAllowanceParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllowancesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendBasicAllowance: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllowancesResponse({ value: QueryAllowancesResponse.fromPartial(value) }) + let msg = this.basicAllowance({ value: BasicAllowance.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllowancesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendBasicAllowance: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPruneAllowancesResponse({ value, fee, memo }: sendMsgPruneAllowancesResponseParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPruneAllowancesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPruneAllowancesResponse({ value: MsgPruneAllowancesResponse.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPruneAllowancesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllowanceRequest({ value, fee, memo }: sendQueryAllowanceRequestParams): Promise { + async sendAllowedMsgAllowance({ value, fee, memo }: sendAllowedMsgAllowanceParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllowanceRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAllowedMsgAllowance: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllowanceRequest({ value: QueryAllowanceRequest.fromPartial(value) }) + let msg = this.allowedMsgAllowance({ value: AllowedMsgAllowance.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllowanceRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAllowedMsgAllowance: Could not broadcast Tx: '+ e.message) } }, - - grant({ value }: grantParams): EncodeObject { - try { - return { typeUrl: "/cosmos.feegrant.v1beta1.Grant", value: Grant.fromPartial( value ) } + async sendQueryAllowanceResponse({ value, fee, memo }: sendQueryAllowanceResponseParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryAllowanceResponse: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryAllowanceResponse({ value: QueryAllowanceResponse.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:Grant: Could not create message: ' + e.message) + throw new Error('TxClient:sendQueryAllowanceResponse: Could not broadcast Tx: '+ e.message) } }, + msgGrantAllowance({ value }: msgGrantAllowanceParams): EncodeObject { try { return { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", value: MsgGrantAllowance.fromPartial( value ) } @@ -483,19 +475,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryAllowanceResponse({ value }: queryAllowanceResponseParams): EncodeObject { + msgRevokeAllowanceResponse({ value }: msgRevokeAllowanceResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", value: QueryAllowanceResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", value: MsgRevokeAllowanceResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllowanceResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRevokeAllowanceResponse: Could not create message: ' + e.message) } }, - queryAllowancesRequest({ value }: queryAllowancesRequestParams): EncodeObject { + msgPruneAllowancesResponse({ value }: msgPruneAllowancesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", value: QueryAllowancesRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse", value: MsgPruneAllowancesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllowancesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPruneAllowancesResponse: Could not create message: ' + e.message) } }, @@ -507,67 +499,67 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgRevokeAllowanceResponse({ value }: msgRevokeAllowanceResponseParams): EncodeObject { + msgPruneAllowances({ value }: msgPruneAllowancesParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", value: MsgRevokeAllowanceResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances", value: MsgPruneAllowances.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRevokeAllowanceResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPruneAllowances: Could not create message: ' + e.message) } }, - msgPruneAllowances({ value }: msgPruneAllowancesParams): EncodeObject { + periodicAllowance({ value }: periodicAllowanceParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances", value: MsgPruneAllowances.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", value: PeriodicAllowance.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPruneAllowances: Could not create message: ' + e.message) + throw new Error('TxClient:PeriodicAllowance: Could not create message: ' + e.message) } }, - allowedMsgAllowance({ value }: allowedMsgAllowanceParams): EncodeObject { + queryAllowancesByGranterResponse({ value }: queryAllowancesByGranterResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", value: AllowedMsgAllowance.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", value: QueryAllowancesByGranterResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AllowedMsgAllowance: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAllowancesByGranterResponse: Could not create message: ' + e.message) } }, - msgRevokeAllowance({ value }: msgRevokeAllowanceParams): EncodeObject { + grant({ value }: grantParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value: MsgRevokeAllowance.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.Grant", value: Grant.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRevokeAllowance: Could not create message: ' + e.message) + throw new Error('TxClient:Grant: Could not create message: ' + e.message) } }, - periodicAllowance({ value }: periodicAllowanceParams): EncodeObject { + msgRevokeAllowance({ value }: msgRevokeAllowanceParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", value: PeriodicAllowance.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value: MsgRevokeAllowance.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:PeriodicAllowance: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRevokeAllowance: Could not create message: ' + e.message) } }, - queryAllowancesByGranterResponse({ value }: queryAllowancesByGranterResponseParams): EncodeObject { + queryAllowanceRequest({ value }: queryAllowanceRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", value: QueryAllowancesByGranterResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", value: QueryAllowanceRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllowancesByGranterResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAllowanceRequest: Could not create message: ' + e.message) } }, - basicAllowance({ value }: basicAllowanceParams): EncodeObject { + queryAllowancesRequest({ value }: queryAllowancesRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", value: BasicAllowance.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", value: QueryAllowancesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:BasicAllowance: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAllowancesRequest: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryAllowancesResponse({ value }: queryAllowancesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", value: QueryAllowancesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAllowancesResponse: Could not create message: ' + e.message) } }, @@ -579,27 +571,35 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryAllowancesResponse({ value }: queryAllowancesResponseParams): EncodeObject { + basicAllowance({ value }: basicAllowanceParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", value: QueryAllowancesResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", value: BasicAllowance.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllowancesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:BasicAllowance: Could not create message: ' + e.message) } }, - msgPruneAllowancesResponse({ value }: msgPruneAllowancesResponseParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse", value: MsgPruneAllowancesResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPruneAllowancesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - queryAllowanceRequest({ value }: queryAllowanceRequestParams): EncodeObject { + allowedMsgAllowance({ value }: allowedMsgAllowanceParams): EncodeObject { try { - return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", value: QueryAllowanceRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", value: AllowedMsgAllowance.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllowanceRequest: Could not create message: ' + e.message) + throw new Error('TxClient:AllowedMsgAllowance: Could not create message: ' + e.message) + } + }, + + queryAllowanceResponse({ value }: queryAllowanceResponseParams): EncodeObject { + try { + return { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", value: QueryAllowanceResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryAllowanceResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.feegrant.v1beta1/registry.ts b/ts-client/cosmos.feegrant.v1beta1/registry.ts index 5334c7b9..15022f87 100755 --- a/ts-client/cosmos.feegrant.v1beta1/registry.ts +++ b/ts-client/cosmos.feegrant.v1beta1/registry.ts @@ -1,40 +1,40 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { Grant } from "./types/cosmos/feegrant/v1beta1/feegrant"; import { MsgGrantAllowance } from "./types/cosmos/feegrant/v1beta1/tx"; -import { QueryAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/query"; -import { QueryAllowancesRequest } from "./types/cosmos/feegrant/v1beta1/query"; -import { MsgGrantAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/tx"; import { MsgRevokeAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/tx"; +import { MsgPruneAllowancesResponse } from "./types/cosmos/feegrant/v1beta1/tx"; +import { MsgGrantAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/tx"; import { MsgPruneAllowances } from "./types/cosmos/feegrant/v1beta1/tx"; -import { AllowedMsgAllowance } from "./types/cosmos/feegrant/v1beta1/feegrant"; -import { MsgRevokeAllowance } from "./types/cosmos/feegrant/v1beta1/tx"; import { PeriodicAllowance } from "./types/cosmos/feegrant/v1beta1/feegrant"; import { QueryAllowancesByGranterResponse } from "./types/cosmos/feegrant/v1beta1/query"; +import { Grant } from "./types/cosmos/feegrant/v1beta1/feegrant"; +import { MsgRevokeAllowance } from "./types/cosmos/feegrant/v1beta1/tx"; +import { QueryAllowanceRequest } from "./types/cosmos/feegrant/v1beta1/query"; +import { QueryAllowancesRequest } from "./types/cosmos/feegrant/v1beta1/query"; +import { QueryAllowancesResponse } from "./types/cosmos/feegrant/v1beta1/query"; +import { QueryAllowancesByGranterRequest } from "./types/cosmos/feegrant/v1beta1/query"; import { BasicAllowance } from "./types/cosmos/feegrant/v1beta1/feegrant"; import { GenesisState } from "./types/cosmos/feegrant/v1beta1/genesis"; -import { QueryAllowancesByGranterRequest } from "./types/cosmos/feegrant/v1beta1/query"; -import { QueryAllowancesResponse } from "./types/cosmos/feegrant/v1beta1/query"; -import { MsgPruneAllowancesResponse } from "./types/cosmos/feegrant/v1beta1/tx"; -import { QueryAllowanceRequest } from "./types/cosmos/feegrant/v1beta1/query"; +import { AllowedMsgAllowance } from "./types/cosmos/feegrant/v1beta1/feegrant"; +import { QueryAllowanceResponse } from "./types/cosmos/feegrant/v1beta1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.feegrant.v1beta1.Grant", Grant], ["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], - ["/cosmos.feegrant.v1beta1.QueryAllowanceResponse", QueryAllowanceResponse], - ["/cosmos.feegrant.v1beta1.QueryAllowancesRequest", QueryAllowancesRequest], - ["/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", MsgGrantAllowanceResponse], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", MsgRevokeAllowanceResponse], + ["/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse", MsgPruneAllowancesResponse], + ["/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", MsgGrantAllowanceResponse], ["/cosmos.feegrant.v1beta1.MsgPruneAllowances", MsgPruneAllowances], - ["/cosmos.feegrant.v1beta1.AllowedMsgAllowance", AllowedMsgAllowance], - ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance], ["/cosmos.feegrant.v1beta1.PeriodicAllowance", PeriodicAllowance], ["/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", QueryAllowancesByGranterResponse], + ["/cosmos.feegrant.v1beta1.Grant", Grant], + ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance], + ["/cosmos.feegrant.v1beta1.QueryAllowanceRequest", QueryAllowanceRequest], + ["/cosmos.feegrant.v1beta1.QueryAllowancesRequest", QueryAllowancesRequest], + ["/cosmos.feegrant.v1beta1.QueryAllowancesResponse", QueryAllowancesResponse], + ["/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", QueryAllowancesByGranterRequest], ["/cosmos.feegrant.v1beta1.BasicAllowance", BasicAllowance], ["/cosmos.feegrant.v1beta1.GenesisState", GenesisState], - ["/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", QueryAllowancesByGranterRequest], - ["/cosmos.feegrant.v1beta1.QueryAllowancesResponse", QueryAllowancesResponse], - ["/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse", MsgPruneAllowancesResponse], - ["/cosmos.feegrant.v1beta1.QueryAllowanceRequest", QueryAllowanceRequest], + ["/cosmos.feegrant.v1beta1.AllowedMsgAllowance", AllowedMsgAllowance], + ["/cosmos.feegrant.v1beta1.QueryAllowanceResponse", QueryAllowanceResponse], ]; diff --git a/ts-client/cosmos.feegrant.v1beta1/types/amino/amino.ts b/ts-client/cosmos.feegrant.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts new file mode 100644 index 00000000..0dddf30c --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts @@ -0,0 +1,378 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/runtime/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.app.runtime.v1alpha1"; + +/** Module is the config object for the runtime module. */ +export interface Module { + /** app_name is the name of the app. */ + appName: string; + /** + * begin_blockers specifies the module names of begin blockers + * to call in the order in which they should be called. If this is left empty + * no begin blocker will be registered. + */ + beginBlockers: string[]; + /** + * end_blockers specifies the module names of the end blockers + * to call in the order in which they should be called. If this is left empty + * no end blocker will be registered. + */ + endBlockers: string[]; + /** + * init_genesis specifies the module names of init genesis functions + * to call in the order in which they should be called. If this is left empty + * no init genesis function will be registered. + */ + initGenesis: string[]; + /** + * export_genesis specifies the order in which to export module genesis data. + * If this is left empty, the init_genesis order will be used for export genesis + * if it is specified. + */ + exportGenesis: string[]; + /** + * override_store_keys is an optional list of overrides for the module store keys + * to be used in keeper construction. + */ + overrideStoreKeys: StoreKeyConfig[]; + /** + * order_migrations defines the order in which module migrations are performed. + * If this is left empty, it uses the default migration order. + * https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.0-alpha2/types/module#DefaultMigrationsOrder + */ + orderMigrations: string[]; + /** + * precommiters specifies the module names of the precommiters + * to call in the order in which they should be called. If this is left empty + * no precommit function will be registered. + */ + precommiters: string[]; + /** + * prepare_check_staters specifies the module names of the prepare_check_staters + * to call in the order in which they should be called. If this is left empty + * no preparecheckstate function will be registered. + */ + prepareCheckStaters: string[]; +} + +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfig { + /** name of the module to override the store key of */ + moduleName: string; + /** the kv store key to use instead of the module name. */ + kvStoreKey: string; +} + +function createBaseModule(): Module { + return { + appName: "", + beginBlockers: [], + endBlockers: [], + initGenesis: [], + exportGenesis: [], + overrideStoreKeys: [], + orderMigrations: [], + precommiters: [], + prepareCheckStaters: [], + }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + for (const v of message.beginBlockers) { + writer.uint32(18).string(v!); + } + for (const v of message.endBlockers) { + writer.uint32(26).string(v!); + } + for (const v of message.initGenesis) { + writer.uint32(34).string(v!); + } + for (const v of message.exportGenesis) { + writer.uint32(42).string(v!); + } + for (const v of message.overrideStoreKeys) { + StoreKeyConfig.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.orderMigrations) { + writer.uint32(58).string(v!); + } + for (const v of message.precommiters) { + writer.uint32(66).string(v!); + } + for (const v of message.prepareCheckStaters) { + writer.uint32(74).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.appName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.beginBlockers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.endBlockers.push(reader.string()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.initGenesis.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.exportGenesis.push(reader.string()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.overrideStoreKeys.push(StoreKeyConfig.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.orderMigrations.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.precommiters.push(reader.string()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.prepareCheckStaters.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + beginBlockers: globalThis.Array.isArray(object?.beginBlockers) + ? object.beginBlockers.map((e: any) => globalThis.String(e)) + : [], + endBlockers: globalThis.Array.isArray(object?.endBlockers) + ? object.endBlockers.map((e: any) => globalThis.String(e)) + : [], + initGenesis: globalThis.Array.isArray(object?.initGenesis) + ? object.initGenesis.map((e: any) => globalThis.String(e)) + : [], + exportGenesis: globalThis.Array.isArray(object?.exportGenesis) + ? object.exportGenesis.map((e: any) => globalThis.String(e)) + : [], + overrideStoreKeys: globalThis.Array.isArray(object?.overrideStoreKeys) + ? object.overrideStoreKeys.map((e: any) => StoreKeyConfig.fromJSON(e)) + : [], + orderMigrations: globalThis.Array.isArray(object?.orderMigrations) + ? object.orderMigrations.map((e: any) => globalThis.String(e)) + : [], + precommiters: globalThis.Array.isArray(object?.precommiters) + ? object.precommiters.map((e: any) => globalThis.String(e)) + : [], + prepareCheckStaters: globalThis.Array.isArray(object?.prepareCheckStaters) + ? object.prepareCheckStaters.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.beginBlockers?.length) { + obj.beginBlockers = message.beginBlockers; + } + if (message.endBlockers?.length) { + obj.endBlockers = message.endBlockers; + } + if (message.initGenesis?.length) { + obj.initGenesis = message.initGenesis; + } + if (message.exportGenesis?.length) { + obj.exportGenesis = message.exportGenesis; + } + if (message.overrideStoreKeys?.length) { + obj.overrideStoreKeys = message.overrideStoreKeys.map((e) => StoreKeyConfig.toJSON(e)); + } + if (message.orderMigrations?.length) { + obj.orderMigrations = message.orderMigrations; + } + if (message.precommiters?.length) { + obj.precommiters = message.precommiters; + } + if (message.prepareCheckStaters?.length) { + obj.prepareCheckStaters = message.prepareCheckStaters; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.appName = object.appName ?? ""; + message.beginBlockers = object.beginBlockers?.map((e) => e) || []; + message.endBlockers = object.endBlockers?.map((e) => e) || []; + message.initGenesis = object.initGenesis?.map((e) => e) || []; + message.exportGenesis = object.exportGenesis?.map((e) => e) || []; + message.overrideStoreKeys = object.overrideStoreKeys?.map((e) => StoreKeyConfig.fromPartial(e)) || []; + message.orderMigrations = object.orderMigrations?.map((e) => e) || []; + message.precommiters = object.precommiters?.map((e) => e) || []; + message.prepareCheckStaters = object.prepareCheckStaters?.map((e) => e) || []; + return message; + }, +}; + +function createBaseStoreKeyConfig(): StoreKeyConfig { + return { moduleName: "", kvStoreKey: "" }; +} + +export const StoreKeyConfig: MessageFns = { + encode(message: StoreKeyConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.kvStoreKey !== "") { + writer.uint32(18).string(message.kvStoreKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreKeyConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKeyConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.kvStoreKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKeyConfig { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + kvStoreKey: isSet(object.kvStoreKey) ? globalThis.String(object.kvStoreKey) : "", + }; + }, + + toJSON(message: StoreKeyConfig): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.kvStoreKey !== "") { + obj.kvStoreKey = message.kvStoreKey; + } + return obj; + }, + + create, I>>(base?: I): StoreKeyConfig { + return StoreKeyConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKeyConfig { + const message = createBaseStoreKeyConfig(); + message.moduleName = object.moduleName ?? ""; + message.kvStoreKey = object.kvStoreKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/config.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/config.ts new file mode 100644 index 00000000..da9f2893 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/config.ts @@ -0,0 +1,339 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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[]; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is global (not module specific). + */ + golangBindings: GolangBinding[]; +} + +/** 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 + | undefined; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is module specific. + */ + golangBindings: GolangBinding[]; +} + +/** GolangBinding is an explicit interface type to implementing type binding for dependency injection. */ +export interface GolangBinding { + /** interface_type is the interface type which will be bound to a specific implementation type */ + interfaceType: string; + /** implementation is the implementing type which will be supplied when an input of type interface is requested */ + implementation: string; +} + +function createBaseConfig(): Config { + return { modules: [], golangBindings: [] }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.modules) { + ModuleConfig.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.modules.push(ModuleConfig.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + modules: globalThis.Array.isArray(object?.modules) + ? object.modules.map((e: any) => ModuleConfig.fromJSON(e)) + : [], + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.modules?.length) { + obj.modules = message.modules.map((e) => ModuleConfig.toJSON(e)); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.modules = object.modules?.map((e) => ModuleConfig.fromPartial(e)) || []; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseModuleConfig(): ModuleConfig { + return { name: "", config: undefined, golangBindings: [] }; +} + +export const ModuleConfig: MessageFns = { + encode(message: ModuleConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.config !== undefined) { + Any.encode(message.config, writer.uint32(18).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.config = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleConfig { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + config: isSet(object.config) ? Any.fromJSON(object.config) : undefined, + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleConfig): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.config !== undefined) { + obj.config = Any.toJSON(message.config); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleConfig { + return ModuleConfig.fromPartial(base ?? ({} as any)); + }, + 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; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGolangBinding(): GolangBinding { + return { interfaceType: "", implementation: "" }; +} + +export const GolangBinding: MessageFns = { + encode(message: GolangBinding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceType !== "") { + writer.uint32(10).string(message.interfaceType); + } + if (message.implementation !== "") { + writer.uint32(18).string(message.implementation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GolangBinding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGolangBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.interfaceType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.implementation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GolangBinding { + return { + interfaceType: isSet(object.interfaceType) ? globalThis.String(object.interfaceType) : "", + implementation: isSet(object.implementation) ? globalThis.String(object.implementation) : "", + }; + }, + + toJSON(message: GolangBinding): unknown { + const obj: any = {}; + if (message.interfaceType !== "") { + obj.interfaceType = message.interfaceType; + } + if (message.implementation !== "") { + obj.implementation = message.implementation; + } + return obj; + }, + + create, I>>(base?: I): GolangBinding { + return GolangBinding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GolangBinding { + const message = createBaseGolangBinding(); + message.interfaceType = object.interfaceType ?? ""; + message.implementation = object.implementation ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/query.ts new file mode 100644 index 00000000..3a172979 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/app/v1alpha1/query.ts @@ -0,0 +1,174 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +function createBaseQueryConfigRequest(): QueryConfigRequest { + return {}; +} + +export const QueryConfigRequest: MessageFns = { + encode(_: QueryConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConfigRequest { + return {}; + }, + + toJSON(_: QueryConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConfigRequest { + return QueryConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConfigRequest { + const message = createBaseQueryConfigRequest(); + return message; + }, +}; + +function createBaseQueryConfigResponse(): QueryConfigResponse { + return { config: undefined }; +} + +export const QueryConfigResponse: MessageFns = { + encode(message: QueryConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + Config.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = Config.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConfigResponse { + return { config: isSet(object.config) ? Config.fromJSON(object.config) : undefined }; + }, + + toJSON(message: QueryConfigResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = Config.toJSON(message.config); + } + return obj; + }, + + create, I>>(base?: I): QueryConfigResponse { + return QueryConfigResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.app.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/module/v1/module.ts new file mode 100644 index 00000000..c426dc68 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/module/v1/module.ts @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.auth.module.v1"; + +/** Module is the config object for the auth module. */ +export interface Module { + /** bech32_prefix is the bech32 account prefix for the app. */ + bech32Prefix: string; + /** module_account_permissions are module account permissions. */ + moduleAccountPermissions: ModuleAccountPermission[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermission { + /** account is the name of the module. */ + account: string; + /** + * permissions are the permissions this module has. Currently recognized + * values are minter, burner and staking. + */ + permissions: string[]; +} + +function createBaseModule(): Module { + return { bech32Prefix: "", moduleAccountPermissions: [], authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + for (const v of message.moduleAccountPermissions) { + ModuleAccountPermission.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(26).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.moduleAccountPermissions.push(ModuleAccountPermission.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "", + moduleAccountPermissions: globalThis.Array.isArray(object?.moduleAccountPermissions) + ? object.moduleAccountPermissions.map((e: any) => ModuleAccountPermission.fromJSON(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + if (message.moduleAccountPermissions?.length) { + obj.moduleAccountPermissions = message.moduleAccountPermissions.map((e) => ModuleAccountPermission.toJSON(e)); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.bech32Prefix = object.bech32Prefix ?? ""; + message.moduleAccountPermissions = + object.moduleAccountPermissions?.map((e) => ModuleAccountPermission.fromPartial(e)) || []; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseModuleAccountPermission(): ModuleAccountPermission { + return { account: "", permissions: [] }; +} + +export const ModuleAccountPermission: MessageFns = { + encode(message: ModuleAccountPermission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + for (const v of message.permissions) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccountPermission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccountPermission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccountPermission { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccountPermission): unknown { + const obj: any = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccountPermission { + return ModuleAccountPermission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccountPermission { + const message = createBaseModuleAccountPermission(); + message.account = object.account ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/auth.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..4dd78b9e --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,517 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/auth.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + pubKey: Any | undefined; + accountNumber: number; + sequence: number; +} + +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + baseAccount: BaseAccount | undefined; + name: string; + permissions: string[]; +} + +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredential { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + moduleName: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivationKeys: Uint8Array[]; +} + +/** Params defines the parameters for the auth module. */ +export interface Params { + maxMemoCharacters: number; + txSigLimit: number; + txSizeCostPerByte: number; + sigVerifyCostEd25519: number; + sigVerifyCostSecp256k1: number; +} + +function createBaseBaseAccount(): BaseAccount { + return { address: "", pubKey: undefined, accountNumber: 0, sequence: 0 }; +} + +export const BaseAccount: MessageFns = { + encode(message: BaseAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.accountNumber !== 0) { + writer.uint32(24).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseAccount { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): BaseAccount { + return BaseAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.accountNumber = object.accountNumber ?? 0; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModuleAccount(): ModuleAccount { + return { baseAccount: undefined, name: "", permissions: [] }; +} + +export const ModuleAccount: MessageFns = { + encode(message: ModuleAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + for (const v of message.permissions) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + name: isSet(object.name) ? globalThis.String(object.name) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccount { + return ModuleAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccount { + const message = createBaseModuleAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseModuleCredential(): ModuleCredential { + return { moduleName: "", derivationKeys: [] }; +} + +export const ModuleCredential: MessageFns = { + encode(message: ModuleCredential, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + for (const v of message.derivationKeys) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleCredential { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.derivationKeys.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleCredential { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + derivationKeys: globalThis.Array.isArray(object?.derivationKeys) + ? object.derivationKeys.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: ModuleCredential): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.derivationKeys?.length) { + obj.derivationKeys = message.derivationKeys.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleCredential { + return ModuleCredential.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleCredential { + const message = createBaseModuleCredential(); + message.moduleName = object.moduleName ?? ""; + message.derivationKeys = object.derivationKeys?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + maxMemoCharacters: 0, + txSigLimit: 0, + txSizeCostPerByte: 0, + sigVerifyCostEd25519: 0, + sigVerifyCostSecp256k1: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMemoCharacters !== 0) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxMemoCharacters = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.txSigLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.txSizeCostPerByte = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sigVerifyCostEd25519 = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sigVerifyCostSecp256k1 = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + maxMemoCharacters: isSet(object.maxMemoCharacters) ? globalThis.Number(object.maxMemoCharacters) : 0, + txSigLimit: isSet(object.txSigLimit) ? globalThis.Number(object.txSigLimit) : 0, + txSizeCostPerByte: isSet(object.txSizeCostPerByte) ? globalThis.Number(object.txSizeCostPerByte) : 0, + sigVerifyCostEd25519: isSet(object.sigVerifyCostEd25519) ? globalThis.Number(object.sigVerifyCostEd25519) : 0, + sigVerifyCostSecp256k1: isSet(object.sigVerifyCostSecp256k1) + ? globalThis.Number(object.sigVerifyCostSecp256k1) + : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.maxMemoCharacters !== 0) { + obj.maxMemoCharacters = Math.round(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + obj.txSigLimit = Math.round(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + obj.txSizeCostPerByte = Math.round(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + obj.sigVerifyCostEd25519 = Math.round(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + obj.sigVerifyCostSecp256k1 = Math.round(message.sigVerifyCostSecp256k1); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.maxMemoCharacters = object.maxMemoCharacters ?? 0; + message.txSigLimit = object.txSigLimit ?? 0; + message.txSizeCostPerByte = object.txSizeCostPerByte ?? 0; + message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 ?? 0; + message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 00000000..d165dd08 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** accounts are the accounts present at genesis. */ + accounts: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, accounts: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.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) + ? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/query.ts new file mode 100644 index 00000000..e187ff09 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,1545 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { BaseAccount, 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} + +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account: Any | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequest { +} + +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponse { + accounts: Any[]; +} + +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequest { + name: string; +} + +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponse { + account: Any | undefined; +} + +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequest { +} + +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponse { + bech32Prefix: string; +} + +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequest { + addressBytes: Uint8Array; +} + +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponse { + addressString: string; +} + +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequest { + addressString: string; +} + +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponse { + addressBytes: Uint8Array; +} + +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequest { + /** + * Deprecated, use account_id instead + * + * id is the account number of the address to be queried. This field + * should have been an uint64 (like all account numbers), and will be + * updated to uint64 in a future version of the auth query. + * + * @deprecated + */ + id: number; + /** + * account_id is the account number of the address to be queried. + * + * Since: cosmos-sdk 0.47 + */ + accountId: number; +} + +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponse { + accountAddress: string; +} + +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequest { + /** address is the account address string. */ + address: string; +} + +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponse { + /** info is the account info which is represented by BaseAccount. */ + info: BaseAccount | undefined; +} + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsResponse { + return { + accounts: globalThis.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?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsResponse { + return QueryAccountsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { account: undefined }; +} + +export const QueryAccountResponse: MessageFns = { + encode(message: QueryAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryAccountResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountResponse { + return QueryAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { + return {}; +} + +export const QueryModuleAccountsRequest: MessageFns = { + encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryModuleAccountsRequest { + return {}; + }, + + toJSON(_: QueryModuleAccountsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, +}; + +function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { + return { accounts: [] }; +} + +export const QueryModuleAccountsResponse: MessageFns = { + encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryModuleAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameRequest(): QueryModuleAccountByNameRequest { + return { name: "" }; +} + +export const QueryModuleAccountByNameRequest: MessageFns = { + encode(message: QueryModuleAccountByNameRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryModuleAccountByNameRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountByNameRequest { + return QueryModuleAccountByNameRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameRequest { + const message = createBaseQueryModuleAccountByNameRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameResponse(): QueryModuleAccountByNameResponse { + return { account: undefined }; +} + +export const QueryModuleAccountByNameResponse: MessageFns = { + encode(message: QueryModuleAccountByNameResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryModuleAccountByNameResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryModuleAccountByNameResponse { + return QueryModuleAccountByNameResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameResponse { + const message = createBaseQueryModuleAccountByNameResponse(); + message.account = (object.account !== undefined && object.account !== null) + ? Any.fromPartial(object.account) + : undefined; + return message; + }, +}; + +function createBaseBech32PrefixRequest(): Bech32PrefixRequest { + return {}; +} + +export const Bech32PrefixRequest: MessageFns = { + encode(_: Bech32PrefixRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Bech32PrefixRequest { + return {}; + }, + + toJSON(_: Bech32PrefixRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Bech32PrefixRequest { + return Bech32PrefixRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, +}; + +function createBaseBech32PrefixResponse(): Bech32PrefixResponse { + return { bech32Prefix: "" }; +} + +export const Bech32PrefixResponse: MessageFns = { + encode(message: Bech32PrefixResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Bech32PrefixResponse { + return { bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "" }; + }, + + toJSON(message: Bech32PrefixResponse): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + return obj; + }, + + create, I>>(base?: I): Bech32PrefixResponse { + return Bech32PrefixResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + message.bech32Prefix = object.bech32Prefix ?? ""; + return message; + }, +}; + +function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressBytesToStringRequest: MessageFns = { + encode(message: AddressBytesToStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringRequest { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressBytesToStringRequest): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringRequest { + return AddressBytesToStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { + return { addressString: "" }; +} + +export const AddressBytesToStringResponse: MessageFns = { + encode(message: AddressBytesToStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringResponse { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressBytesToStringResponse): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringResponse { + return AddressBytesToStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { + return { addressString: "" }; +} + +export const AddressStringToBytesRequest: MessageFns = { + encode(message: AddressStringToBytesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesRequest { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressStringToBytesRequest): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesRequest { + return AddressStringToBytesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressStringToBytesResponse: MessageFns = { + encode(message: AddressStringToBytesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesResponse { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressStringToBytesResponse): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesResponse { + return AddressStringToBytesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAccountAddressByIDRequest(): QueryAccountAddressByIDRequest { + return { id: 0, accountId: 0 }; +} + +export const QueryAccountAddressByIDRequest: MessageFns = { + encode(message: QueryAccountAddressByIDRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int64(message.id); + } + if (message.accountId !== 0) { + writer.uint32(16).uint64(message.accountId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.accountId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDRequest { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0, + }; + }, + + toJSON(message: QueryAccountAddressByIDRequest): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.accountId !== 0) { + obj.accountId = Math.round(message.accountId); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDRequest { + return QueryAccountAddressByIDRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDRequest { + const message = createBaseQueryAccountAddressByIDRequest(); + message.id = object.id ?? 0; + message.accountId = object.accountId ?? 0; + return message; + }, +}; + +function createBaseQueryAccountAddressByIDResponse(): QueryAccountAddressByIDResponse { + return { accountAddress: "" }; +} + +export const QueryAccountAddressByIDResponse: MessageFns = { + encode(message: QueryAccountAddressByIDResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.accountAddress !== "") { + writer.uint32(10).string(message.accountAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accountAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDResponse { + return { accountAddress: isSet(object.accountAddress) ? globalThis.String(object.accountAddress) : "" }; + }, + + toJSON(message: QueryAccountAddressByIDResponse): unknown { + const obj: any = {}; + if (message.accountAddress !== "") { + obj.accountAddress = message.accountAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDResponse { + return QueryAccountAddressByIDResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDResponse { + const message = createBaseQueryAccountAddressByIDResponse(); + message.accountAddress = object.accountAddress ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoRequest(): QueryAccountInfoRequest { + return { address: "" }; +} + +export const QueryAccountInfoRequest: MessageFns = { + encode(message: QueryAccountInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoRequest { + return QueryAccountInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoResponse(): QueryAccountInfoResponse { + return { info: undefined }; +} + +export const QueryAccountInfoResponse: MessageFns = { + encode(message: QueryAccountInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + BaseAccount.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.info = BaseAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoResponse { + return { info: isSet(object.info) ? BaseAccount.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryAccountInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = BaseAccount.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoResponse { + return QueryAccountInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + message.info = (object.info !== undefined && object.info !== null) + ? BaseAccount.fromPartial(object.info) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Accounts returns all the existing accounts. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.43 + */ + Accounts(request: QueryAccountsRequest): Promise; + /** Account returns account details based on address. */ + Account(request: QueryAccountRequest): Promise; + /** + * AccountAddressByID returns account address based on account number. + * + * Since: cosmos-sdk 0.46.2 + */ + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise; + /** Params queries all parameters. */ + Params(request: QueryParamsRequest): Promise; + /** + * ModuleAccounts returns all the existing module accounts. + * + * Since: cosmos-sdk 0.46 + */ + ModuleAccounts(request: QueryModuleAccountsRequest): Promise; + /** ModuleAccountByName returns the module account info by module name */ + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise; + /** + * Bech32Prefix queries bech32Prefix + * + * Since: cosmos-sdk 0.46 + */ + Bech32Prefix(request: Bech32PrefixRequest): Promise; + /** + * AddressBytesToString converts Account Address bytes to string + * + * Since: cosmos-sdk 0.46 + */ + AddressBytesToString(request: AddressBytesToStringRequest): Promise; + /** + * AddressStringToBytes converts Address string to bytes + * + * Since: cosmos-sdk 0.46 + */ + AddressStringToBytes(request: AddressStringToBytesRequest): Promise; + /** + * AccountInfo queries account info which is common to all account types. + * + * Since: cosmos-sdk 0.47 + */ + AccountInfo(request: QueryAccountInfoRequest): Promise; +} + +export const QueryServiceName = "cosmos.auth.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 || QueryServiceName; + this.rpc = rpc; + this.Accounts = this.Accounts.bind(this); + this.Account = this.Account.bind(this); + this.AccountAddressByID = this.AccountAddressByID.bind(this); + this.Params = this.Params.bind(this); + this.ModuleAccounts = this.ModuleAccounts.bind(this); + this.ModuleAccountByName = this.ModuleAccountByName.bind(this); + this.Bech32Prefix = this.Bech32Prefix.bind(this); + this.AddressBytesToString = this.AddressBytesToString.bind(this); + this.AddressStringToBytes = this.AddressStringToBytes.bind(this); + this.AccountInfo = this.AccountInfo.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 BinaryReader(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 BinaryReader(data))); + } + + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise { + const data = QueryAccountAddressByIDRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountAddressByID", data); + return promise.then((data) => QueryAccountAddressByIDResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise { + const data = QueryModuleAccountByNameRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ModuleAccountByName", data); + return promise.then((data) => QueryModuleAccountByNameResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + AccountInfo(request: QueryAccountInfoRequest): Promise { + const data = QueryAccountInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountInfo", data); + return promise.then((data) => QueryAccountInfoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/tx.ts new file mode 100644 index 00000000..535a19af --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/auth/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./auth"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/auth parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/auth Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the x/auth module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.auth.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/module/v1/module.ts new file mode 100644 index 00000000..053622ff --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.authz.module.v1"; + +/** Module is the config object of the authz module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/authz.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 00000000..a3685068 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * time when the grant will expire and will be pruned. If null, then the grant + * doesn't have a time expiration (other conditions in `authorization` + * may apply to invalidate the grant) + */ + expiration: Date | undefined; +} + +/** + * GrantAuthorization extends a grant with both the addresses of the grantee and granter. + * It is used in genesis.proto and query.proto + */ +export interface GrantAuthorization { + granter: string; + grantee: string; + authorization: Any | undefined; + expiration: Date | undefined; +} + +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItem { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msgTypeUrls: string[]; +} + +function createBaseGenericAuthorization(): GenericAuthorization { + return { msg: "" }; +} + +export const GenericAuthorization: MessageFns = { + encode(message: GenericAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msg = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenericAuthorization { + return { msg: isSet(object.msg) ? globalThis.String(object.msg) : "" }; + }, + + toJSON(message: GenericAuthorization): unknown { + const obj: any = {}; + if (message.msg !== "") { + obj.msg = message.msg; + } + return obj; + }, + + create, I>>(base?: I): GenericAuthorization { + return GenericAuthorization.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: GrantAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(26).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantAuthorization { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.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 = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GrantAuthorization { + return GrantAuthorization.fromPartial(base ?? ({} as any)); + }, + 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 { msgTypeUrls: [] }; +} + +export const GrantQueueItem: MessageFns = { + encode(message: GrantQueueItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.msgTypeUrls) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantQueueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantQueueItem { + return { + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: GrantQueueItem): unknown { + const obj: any = {}; + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): GrantQueueItem { + return GrantQueueItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/event.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/event.ts new file mode 100644 index 00000000..42e74923 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,235 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 */ + msgTypeUrl: 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 */ + msgTypeUrl: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} + +function createBaseEventGrant(): EventGrant { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventGrant: MessageFns = { + encode(message: EventGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventGrant { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventGrant): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventGrant { + return EventGrant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventGrant { + const message = createBaseEventGrant(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseEventRevoke(): EventRevoke { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventRevoke: MessageFns = { + encode(message: EventRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventRevoke { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventRevoke): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventRevoke { + return EventRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventRevoke { + const message = createBaseEventRevoke(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 00000000..96e4d5bf --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorization) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.authorization.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + authorization: globalThis.Array.isArray(object?.authorization) + ? object.authorization.map((e: any) => GrantAuthorization.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.authorization?.length) { + obj.authorization = message.authorization.map((e) => GrantAuthorization.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/query.ts new file mode 100644 index 00000000..ef3cc0e5 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,629 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + msgTypeUrl: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryGrantsRequest(): QueryGrantsRequest { + return { granter: "", grantee: "", msgTypeUrl: "", pagination: undefined }; +} + +export const QueryGrantsRequest: MessageFns = { + encode(message: QueryGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsRequest { + return QueryGrantsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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: MessageFns = { + encode(message: QueryGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsResponse { + return QueryGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.authz.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 00000000..10bc628d --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,565 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse { +} + +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExec { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; +} + +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} + +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevoke { + granter: string; + grantee: string; + msgTypeUrl: string; +} + +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponse { +} + +function createBaseMsgGrant(): MsgGrant { + return { granter: "", grantee: "", grant: undefined }; +} + +export const MsgGrant: MessageFns = { + encode(message: MsgGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + Grant.encode(message.grant, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.grant = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined, + }; + }, + + toJSON(message: MsgGrant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.grant !== undefined) { + obj.grant = Grant.toJSON(message.grant); + } + return obj; + }, + + create, I>>(base?: I): MsgGrant { + return MsgGrant.fromPartial(base ?? ({} as any)); + }, + 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 createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} + +export const MsgGrantResponse: MessageFns = { + encode(_: MsgGrantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantResponse { + return {}; + }, + + toJSON(_: MsgGrantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantResponse { + return MsgGrantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { grantee: "", msgs: [] }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { results: [] }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgRevoke(): MsgRevoke { + return { granter: "", grantee: "", msgTypeUrl: "" }; +} + +export const MsgRevoke: MessageFns = { + encode(message: MsgRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevoke { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + }; + }, + + toJSON(message: MsgRevoke): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgRevoke { + return MsgRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} + +export const MsgRevokeResponse: MessageFns = { + encode(_: MsgRevokeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeResponse { + return {}; + }, + + toJSON(_: MsgRevokeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeResponse { + return MsgRevokeResponse.fromPartial(base ?? ({} as any)); + }, + 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 const MsgServiceName = "cosmos.authz.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/autocli/v1/options.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/autocli/v1/options.ts new file mode 100644 index 00000000..4ad6ac83 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/autocli/v1/options.ts @@ -0,0 +1,1019 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/options.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** ModuleOptions describes the CLI options for a Cosmos SDK module. */ +export interface ModuleOptions { + /** tx describes the tx commands for the module. */ + tx: + | ServiceCommandDescriptor + | undefined; + /** query describes the queries commands for the module. */ + query: ServiceCommandDescriptor | undefined; +} + +/** ServiceCommandDescriptor describes a CLI command based on a protobuf service. */ +export interface ServiceCommandDescriptor { + /** + * service is the fully qualified name of the protobuf service to build + * the command from. It can be left empty if sub_commands are used instead + * which may be the case if a module provides multiple tx and/or query services. + */ + service: string; + /** + * rpc_command_options are options for commands generated from rpc methods. + * If no options are specified for a given rpc method on the service, a + * command will be generated for that method with the default options. + */ + rpcCommandOptions: RpcCommandOptions[]; + /** + * sub_commands is a map of optional sub-commands for this command based on + * different protobuf services. The map key is used as the name of the + * sub-command. + */ + subCommands: { [key: string]: ServiceCommandDescriptor }; +} + +export interface ServiceCommandDescriptor_SubCommandsEntry { + key: string; + value: ServiceCommandDescriptor | undefined; +} + +/** + * RpcCommandOptions specifies options for commands generated from protobuf + * rpc methods. + */ +export interface RpcCommandOptions { + /** + * rpc_method is short name of the protobuf rpc method that this command is + * generated from. + */ + rpcMethod: string; + /** + * use is the one-line usage method. It also allows specifying an alternate + * name for the command as the first word of the usage text. + * + * By default the name of an rpc command is the kebab-case short name of the + * rpc method. + */ + use: string; + /** long is the long message shown in the 'help ' output. */ + long: string; + /** short is the short description shown in the 'help' output. */ + short: string; + /** example is examples of how to use the command. */ + example: string; + /** alias is an array of aliases that can be used instead of the first word in Use. */ + alias: string[]; + /** + * suggest_for is an array of command names for which this command will be suggested - + * similar to aliases but only suggests. + */ + suggestFor: string[]; + /** deprecated defines, if this command is deprecated and should print this string when used. */ + deprecated: string; + /** + * version defines the version for this command. If this value is non-empty and the command does not + * define a "version" flag, a "version" boolean flag will be added to the command and, if specified, + * will print content of the "Version" variable. A shorthand "v" flag will also be added if the + * command does not define one. + */ + version: string; + /** + * flag_options are options for flags generated from rpc request fields. + * By default all request fields are configured as flags. They can + * also be configured as positional args instead using positional_args. + */ + flagOptions: { [key: string]: FlagOptions }; + /** positional_args specifies positional arguments for the command. */ + positionalArgs: PositionalArgDescriptor[]; + /** skip specifies whether to skip this rpc method when generating commands. */ + skip: boolean; +} + +export interface RpcCommandOptions_FlagOptionsEntry { + key: string; + value: FlagOptions | undefined; +} + +/** + * FlagOptions are options for flags generated from rpc request fields. + * By default, all request fields are configured as flags based on the + * kebab-case name of the field. Fields can be turned into positional arguments + * instead by using RpcCommandOptions.positional_args. + */ +export interface FlagOptions { + /** name is an alternate name to use for the field flag. */ + name: string; + /** shorthand is a one-letter abbreviated flag. */ + shorthand: string; + /** usage is the help message. */ + usage: string; + /** default_value is the default value as text. */ + defaultValue: string; + /** deprecated is the usage text to show if this flag is deprecated. */ + deprecated: string; + /** shorthand_deprecated is the usage text to show if the shorthand of this flag is deprecated. */ + shorthandDeprecated: string; + /** hidden hides the flag from help/usage text */ + hidden: boolean; +} + +/** PositionalArgDescriptor describes a positional argument. */ +export interface PositionalArgDescriptor { + /** + * proto_field specifies the proto field to use as the positional arg. Any + * fields used as positional args will not have a flag generated. + */ + protoField: string; + /** + * varargs makes a positional parameter a varargs parameter. This can only be + * applied to last positional parameter and the proto_field must a repeated + * field. + */ + varargs: boolean; +} + +function createBaseModuleOptions(): ModuleOptions { + return { tx: undefined, query: undefined }; +} + +export const ModuleOptions: MessageFns = { + encode(message: ModuleOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + ServiceCommandDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.query !== undefined) { + ServiceCommandDescriptor.encode(message.query, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.query = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleOptions { + return { + tx: isSet(object.tx) ? ServiceCommandDescriptor.fromJSON(object.tx) : undefined, + query: isSet(object.query) ? ServiceCommandDescriptor.fromJSON(object.query) : undefined, + }; + }, + + toJSON(message: ModuleOptions): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = ServiceCommandDescriptor.toJSON(message.tx); + } + if (message.query !== undefined) { + obj.query = ServiceCommandDescriptor.toJSON(message.query); + } + return obj; + }, + + create, I>>(base?: I): ModuleOptions { + return ModuleOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleOptions { + const message = createBaseModuleOptions(); + message.tx = (object.tx !== undefined && object.tx !== null) + ? ServiceCommandDescriptor.fromPartial(object.tx) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ServiceCommandDescriptor.fromPartial(object.query) + : undefined; + return message; + }, +}; + +function createBaseServiceCommandDescriptor(): ServiceCommandDescriptor { + return { service: "", rpcCommandOptions: [], subCommands: {} }; +} + +export const ServiceCommandDescriptor: MessageFns = { + encode(message: ServiceCommandDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.service !== "") { + writer.uint32(10).string(message.service); + } + for (const v of message.rpcCommandOptions) { + RpcCommandOptions.encode(v!, writer.uint32(18).fork()).join(); + } + Object.entries(message.subCommands).forEach(([key, value]) => { + ServiceCommandDescriptor_SubCommandsEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.service = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcCommandOptions.push(RpcCommandOptions.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + const entry3 = ServiceCommandDescriptor_SubCommandsEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.subCommands[entry3.key] = entry3.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor { + return { + service: isSet(object.service) ? globalThis.String(object.service) : "", + rpcCommandOptions: globalThis.Array.isArray(object?.rpcCommandOptions) + ? object.rpcCommandOptions.map((e: any) => RpcCommandOptions.fromJSON(e)) + : [], + subCommands: isObject(object.subCommands) + ? Object.entries(object.subCommands).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + acc[key] = ServiceCommandDescriptor.fromJSON(value); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: ServiceCommandDescriptor): unknown { + const obj: any = {}; + if (message.service !== "") { + obj.service = message.service; + } + if (message.rpcCommandOptions?.length) { + obj.rpcCommandOptions = message.rpcCommandOptions.map((e) => RpcCommandOptions.toJSON(e)); + } + if (message.subCommands) { + const entries = Object.entries(message.subCommands); + if (entries.length > 0) { + obj.subCommands = {}; + entries.forEach(([k, v]) => { + obj.subCommands[k] = ServiceCommandDescriptor.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): ServiceCommandDescriptor { + return ServiceCommandDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceCommandDescriptor { + const message = createBaseServiceCommandDescriptor(); + message.service = object.service ?? ""; + message.rpcCommandOptions = object.rpcCommandOptions?.map((e) => RpcCommandOptions.fromPartial(e)) || []; + message.subCommands = Object.entries(object.subCommands ?? {}).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ServiceCommandDescriptor.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseServiceCommandDescriptor_SubCommandsEntry(): ServiceCommandDescriptor_SubCommandsEntry { + return { key: "", value: undefined }; +} + +export const ServiceCommandDescriptor_SubCommandsEntry: MessageFns = { + encode(message: ServiceCommandDescriptor_SubCommandsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ServiceCommandDescriptor.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor_SubCommandsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor_SubCommandsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ServiceCommandDescriptor.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ServiceCommandDescriptor_SubCommandsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ServiceCommandDescriptor.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + return ServiceCommandDescriptor_SubCommandsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ServiceCommandDescriptor.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseRpcCommandOptions(): RpcCommandOptions { + return { + rpcMethod: "", + use: "", + long: "", + short: "", + example: "", + alias: [], + suggestFor: [], + deprecated: "", + version: "", + flagOptions: {}, + positionalArgs: [], + skip: false, + }; +} + +export const RpcCommandOptions: MessageFns = { + encode(message: RpcCommandOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rpcMethod !== "") { + writer.uint32(10).string(message.rpcMethod); + } + if (message.use !== "") { + writer.uint32(18).string(message.use); + } + if (message.long !== "") { + writer.uint32(26).string(message.long); + } + if (message.short !== "") { + writer.uint32(34).string(message.short); + } + if (message.example !== "") { + writer.uint32(42).string(message.example); + } + for (const v of message.alias) { + writer.uint32(50).string(v!); + } + for (const v of message.suggestFor) { + writer.uint32(58).string(v!); + } + if (message.deprecated !== "") { + writer.uint32(66).string(message.deprecated); + } + if (message.version !== "") { + writer.uint32(74).string(message.version); + } + Object.entries(message.flagOptions).forEach(([key, value]) => { + RpcCommandOptions_FlagOptionsEntry.encode({ key: key as any, value }, writer.uint32(82).fork()).join(); + }); + for (const v of message.positionalArgs) { + PositionalArgDescriptor.encode(v!, writer.uint32(90).fork()).join(); + } + if (message.skip !== false) { + writer.uint32(96).bool(message.skip); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rpcMethod = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.use = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.long = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.short = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.example = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.alias.push(reader.string()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.suggestFor.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.deprecated = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.version = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + const entry10 = RpcCommandOptions_FlagOptionsEntry.decode(reader, reader.uint32()); + if (entry10.value !== undefined) { + message.flagOptions[entry10.key] = entry10.value; + } + continue; + case 11: + if (tag !== 90) { + break; + } + + message.positionalArgs.push(PositionalArgDescriptor.decode(reader, reader.uint32())); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.skip = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions { + return { + rpcMethod: isSet(object.rpcMethod) ? globalThis.String(object.rpcMethod) : "", + use: isSet(object.use) ? globalThis.String(object.use) : "", + long: isSet(object.long) ? globalThis.String(object.long) : "", + short: isSet(object.short) ? globalThis.String(object.short) : "", + example: isSet(object.example) ? globalThis.String(object.example) : "", + alias: globalThis.Array.isArray(object?.alias) ? object.alias.map((e: any) => globalThis.String(e)) : [], + suggestFor: globalThis.Array.isArray(object?.suggestFor) + ? object.suggestFor.map((e: any) => globalThis.String(e)) + : [], + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + flagOptions: isObject(object.flagOptions) + ? Object.entries(object.flagOptions).reduce<{ [key: string]: FlagOptions }>((acc, [key, value]) => { + acc[key] = FlagOptions.fromJSON(value); + return acc; + }, {}) + : {}, + positionalArgs: globalThis.Array.isArray(object?.positionalArgs) + ? object.positionalArgs.map((e: any) => PositionalArgDescriptor.fromJSON(e)) + : [], + skip: isSet(object.skip) ? globalThis.Boolean(object.skip) : false, + }; + }, + + toJSON(message: RpcCommandOptions): unknown { + const obj: any = {}; + if (message.rpcMethod !== "") { + obj.rpcMethod = message.rpcMethod; + } + if (message.use !== "") { + obj.use = message.use; + } + if (message.long !== "") { + obj.long = message.long; + } + if (message.short !== "") { + obj.short = message.short; + } + if (message.example !== "") { + obj.example = message.example; + } + if (message.alias?.length) { + obj.alias = message.alias; + } + if (message.suggestFor?.length) { + obj.suggestFor = message.suggestFor; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.flagOptions) { + const entries = Object.entries(message.flagOptions); + if (entries.length > 0) { + obj.flagOptions = {}; + entries.forEach(([k, v]) => { + obj.flagOptions[k] = FlagOptions.toJSON(v); + }); + } + } + if (message.positionalArgs?.length) { + obj.positionalArgs = message.positionalArgs.map((e) => PositionalArgDescriptor.toJSON(e)); + } + if (message.skip !== false) { + obj.skip = message.skip; + } + return obj; + }, + + create, I>>(base?: I): RpcCommandOptions { + return RpcCommandOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RpcCommandOptions { + const message = createBaseRpcCommandOptions(); + message.rpcMethod = object.rpcMethod ?? ""; + message.use = object.use ?? ""; + message.long = object.long ?? ""; + message.short = object.short ?? ""; + message.example = object.example ?? ""; + message.alias = object.alias?.map((e) => e) || []; + message.suggestFor = object.suggestFor?.map((e) => e) || []; + message.deprecated = object.deprecated ?? ""; + message.version = object.version ?? ""; + message.flagOptions = Object.entries(object.flagOptions ?? {}).reduce<{ [key: string]: FlagOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = FlagOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + message.positionalArgs = object.positionalArgs?.map((e) => PositionalArgDescriptor.fromPartial(e)) || []; + message.skip = object.skip ?? false; + return message; + }, +}; + +function createBaseRpcCommandOptions_FlagOptionsEntry(): RpcCommandOptions_FlagOptionsEntry { + return { key: "", value: undefined }; +} + +export const RpcCommandOptions_FlagOptionsEntry: MessageFns = { + encode(message: RpcCommandOptions_FlagOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + FlagOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions_FlagOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = FlagOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions_FlagOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? FlagOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: RpcCommandOptions_FlagOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = FlagOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): RpcCommandOptions_FlagOptionsEntry { + return RpcCommandOptions_FlagOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RpcCommandOptions_FlagOptionsEntry { + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? FlagOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseFlagOptions(): FlagOptions { + return { + name: "", + shorthand: "", + usage: "", + defaultValue: "", + deprecated: "", + shorthandDeprecated: "", + hidden: false, + }; +} + +export const FlagOptions: MessageFns = { + encode(message: FlagOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.shorthand !== "") { + writer.uint32(18).string(message.shorthand); + } + if (message.usage !== "") { + writer.uint32(26).string(message.usage); + } + if (message.defaultValue !== "") { + writer.uint32(34).string(message.defaultValue); + } + if (message.deprecated !== "") { + writer.uint32(50).string(message.deprecated); + } + if (message.shorthandDeprecated !== "") { + writer.uint32(58).string(message.shorthandDeprecated); + } + if (message.hidden !== false) { + writer.uint32(64).bool(message.hidden); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlagOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlagOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.shorthand = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.usage = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.defaultValue = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.deprecated = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.shorthandDeprecated = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.hidden = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FlagOptions { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + shorthand: isSet(object.shorthand) ? globalThis.String(object.shorthand) : "", + usage: isSet(object.usage) ? globalThis.String(object.usage) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + shorthandDeprecated: isSet(object.shorthandDeprecated) ? globalThis.String(object.shorthandDeprecated) : "", + hidden: isSet(object.hidden) ? globalThis.Boolean(object.hidden) : false, + }; + }, + + toJSON(message: FlagOptions): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.shorthand !== "") { + obj.shorthand = message.shorthand; + } + if (message.usage !== "") { + obj.usage = message.usage; + } + if (message.defaultValue !== "") { + obj.defaultValue = message.defaultValue; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.shorthandDeprecated !== "") { + obj.shorthandDeprecated = message.shorthandDeprecated; + } + if (message.hidden !== false) { + obj.hidden = message.hidden; + } + return obj; + }, + + create, I>>(base?: I): FlagOptions { + return FlagOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlagOptions { + const message = createBaseFlagOptions(); + message.name = object.name ?? ""; + message.shorthand = object.shorthand ?? ""; + message.usage = object.usage ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.deprecated = object.deprecated ?? ""; + message.shorthandDeprecated = object.shorthandDeprecated ?? ""; + message.hidden = object.hidden ?? false; + return message; + }, +}; + +function createBasePositionalArgDescriptor(): PositionalArgDescriptor { + return { protoField: "", varargs: false }; +} + +export const PositionalArgDescriptor: MessageFns = { + encode(message: PositionalArgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protoField !== "") { + writer.uint32(10).string(message.protoField); + } + if (message.varargs !== false) { + writer.uint32(16).bool(message.varargs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PositionalArgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePositionalArgDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protoField = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.varargs = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PositionalArgDescriptor { + return { + protoField: isSet(object.protoField) ? globalThis.String(object.protoField) : "", + varargs: isSet(object.varargs) ? globalThis.Boolean(object.varargs) : false, + }; + }, + + toJSON(message: PositionalArgDescriptor): unknown { + const obj: any = {}; + if (message.protoField !== "") { + obj.protoField = message.protoField; + } + if (message.varargs !== false) { + obj.varargs = message.varargs; + } + return obj; + }, + + create, I>>(base?: I): PositionalArgDescriptor { + return PositionalArgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PositionalArgDescriptor { + const message = createBasePositionalArgDescriptor(); + message.protoField = object.protoField ?? ""; + message.varargs = object.varargs ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/autocli/v1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/autocli/v1/query.ts new file mode 100644 index 00000000..5fcd821c --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/autocli/v1/query.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ModuleOptions } from "./options"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** AppOptionsRequest is the RemoteInfoService/AppOptions request type. */ +export interface AppOptionsRequest { +} + +/** AppOptionsResponse is the RemoteInfoService/AppOptions response type. */ +export interface AppOptionsResponse { + /** module_options is a map of module name to autocli module options. */ + moduleOptions: { [key: string]: ModuleOptions }; +} + +export interface AppOptionsResponse_ModuleOptionsEntry { + key: string; + value: ModuleOptions | undefined; +} + +function createBaseAppOptionsRequest(): AppOptionsRequest { + return {}; +} + +export const AppOptionsRequest: MessageFns = { + encode(_: AppOptionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): AppOptionsRequest { + return {}; + }, + + toJSON(_: AppOptionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): AppOptionsRequest { + return AppOptionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): AppOptionsRequest { + const message = createBaseAppOptionsRequest(); + return message; + }, +}; + +function createBaseAppOptionsResponse(): AppOptionsResponse { + return { moduleOptions: {} }; +} + +export const AppOptionsResponse: MessageFns = { + encode(message: AppOptionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.moduleOptions).forEach(([key, value]) => { + AppOptionsResponse_ModuleOptionsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = AppOptionsResponse_ModuleOptionsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.moduleOptions[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse { + return { + moduleOptions: isObject(object.moduleOptions) + ? Object.entries(object.moduleOptions).reduce<{ [key: string]: ModuleOptions }>((acc, [key, value]) => { + acc[key] = ModuleOptions.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: AppOptionsResponse): unknown { + const obj: any = {}; + if (message.moduleOptions) { + const entries = Object.entries(message.moduleOptions); + if (entries.length > 0) { + obj.moduleOptions = {}; + entries.forEach(([k, v]) => { + obj.moduleOptions[k] = ModuleOptions.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): AppOptionsResponse { + return AppOptionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AppOptionsResponse { + const message = createBaseAppOptionsResponse(); + message.moduleOptions = Object.entries(object.moduleOptions ?? {}).reduce<{ [key: string]: ModuleOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ModuleOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseAppOptionsResponse_ModuleOptionsEntry(): AppOptionsResponse_ModuleOptionsEntry { + return { key: "", value: undefined }; +} + +export const AppOptionsResponse_ModuleOptionsEntry: MessageFns = { + encode(message: AppOptionsResponse_ModuleOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ModuleOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse_ModuleOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ModuleOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse_ModuleOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ModuleOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: AppOptionsResponse_ModuleOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ModuleOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): AppOptionsResponse_ModuleOptionsEntry { + return AppOptionsResponse_ModuleOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): AppOptionsResponse_ModuleOptionsEntry { + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ModuleOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +/** + * RemoteInfoService provides clients with the information they need + * to build dynamically CLI clients for remote chains. + */ +export interface Query { + /** AppOptions returns the autocli options for all of the modules in an app. */ + AppOptions(request: AppOptionsRequest): Promise; +} + +export const QueryServiceName = "cosmos.autocli.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 || QueryServiceName; + this.rpc = rpc; + this.AppOptions = this.AppOptions.bind(this); + } + AppOptions(request: AppOptionsRequest): Promise { + const data = AppOptionsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AppOptions", data); + return promise.then((data) => AppOptionsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/module/v1/module.ts new file mode 100644 index 00000000..18dd6917 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/module/v1/module.ts @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.bank.module.v1"; + +/** Module is the config object of the bank module. */ +export interface Module { + /** + * blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving + * funds. If left empty it defaults to the list of account names supplied in the auth module configuration as + * module_account_permissions + */ + blockedModuleAccountsOverride: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** + * restrictions_order specifies the order of send restrictions and should be + * a list of module names which provide a send restriction instance. If no + * order is provided, then restrictions will be applied in alphabetical order + * of module names. + */ + restrictionsOrder: string[]; +} + +function createBaseModule(): Module { + return { blockedModuleAccountsOverride: [], authority: "", restrictionsOrder: [] }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.blockedModuleAccountsOverride) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + for (const v of message.restrictionsOrder) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockedModuleAccountsOverride.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.restrictionsOrder.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + blockedModuleAccountsOverride: globalThis.Array.isArray(object?.blockedModuleAccountsOverride) + ? object.blockedModuleAccountsOverride.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + restrictionsOrder: globalThis.Array.isArray(object?.restrictionsOrder) + ? object.restrictionsOrder.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.blockedModuleAccountsOverride?.length) { + obj.blockedModuleAccountsOverride = message.blockedModuleAccountsOverride; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.restrictionsOrder?.length) { + obj.restrictionsOrder = message.restrictionsOrder; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.blockedModuleAccountsOverride = object.blockedModuleAccountsOverride?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.restrictionsOrder = object.restrictionsOrder?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/authz.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 00000000..3437ed53 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,127 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + spendLimit: Coin[]; + /** + * allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + * granter. If omitted, any recipient is allowed. + * + * Since: cosmos-sdk 0.47 + */ + allowList: string[]; +} + +function createBaseSendAuthorization(): SendAuthorization { + return { spendLimit: [], allowList: [] }; +} + +export const SendAuthorization: MessageFns = { + encode(message: SendAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.allowList) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendAuthorization { + return { + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + allowList: globalThis.Array.isArray(object?.allowList) + ? object.allowList.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: SendAuthorization): unknown { + const obj: any = {}; + if (message.spendLimit?.length) { + obj.spendLimit = message.spendLimit.map((e) => Coin.toJSON(e)); + } + if (message.allowList?.length) { + obj.allowList = message.allowList; + } + return obj; + }, + + create, I>>(base?: I): SendAuthorization { + return SendAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.allowList = object.allowList?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/bank.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..92e997fb --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,755 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/bank.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** Params defines the parameters for the bank module. */ +export interface Params { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + * + * @deprecated + */ + sendEnabled: SendEnabled[]; + defaultSendEnabled: boolean; +} + +/** + * 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 */ + denomUnits: DenomUnit[]; + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ + base: string; + /** + * display indicates the suggested denom that should be + * displayed in clients. + */ + display: string; + /** + * name defines the name of the token (eg: Cosmos Atom) + * + * Since: cosmos-sdk 0.43 + */ + name: string; + /** + * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + * be the same as the display. + * + * Since: cosmos-sdk 0.43 + */ + symbol: string; + /** + * URI to a document (on or off-chain) that contains additional information. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uri: string; + /** + * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + * the document didn't change. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uriHash: string; +} + +function createBaseParams(): Params { + return { sendEnabled: [], defaultSendEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.defaultSendEnabled !== false) { + writer.uint32(16).bool(message.defaultSendEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.defaultSendEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + defaultSendEnabled: isSet(object.defaultSendEnabled) ? globalThis.Boolean(object.defaultSendEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.defaultSendEnabled !== false) { + obj.defaultSendEnabled = message.defaultSendEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.defaultSendEnabled = object.defaultSendEnabled ?? false; + return message; + }, +}; + +function createBaseSendEnabled(): SendEnabled { + return { denom: "", enabled: false }; +} + +export const SendEnabled: MessageFns = { + encode(message: SendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled !== false) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendEnabled { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false, + }; + }, + + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.enabled !== false) { + obj.enabled = message.enabled; + } + return obj; + }, + + create, I>>(base?: I): SendEnabled { + return SendEnabled.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Input, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Input { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Input { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Input): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Input { + return Input.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Output, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Output { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Output { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Output): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Output { + return Output.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Supply, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Supply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSupply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.total.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Supply { + return { total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: Supply): unknown { + const obj: any = {}; + if (message.total?.length) { + obj.total = message.total.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Supply { + return Supply.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomUnit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } + for (const v of message.aliases) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomUnit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.exponent = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.aliases.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomUnit { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + exponent: isSet(object.exponent) ? globalThis.Number(object.exponent) : 0, + aliases: globalThis.Array.isArray(object?.aliases) ? object.aliases.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.exponent !== 0) { + obj.exponent = Math.round(message.exponent); + } + if (message.aliases?.length) { + obj.aliases = message.aliases; + } + return obj; + }, + + create, I>>(base?: I): DenomUnit { + return DenomUnit.fromPartial(base ?? ({} as any)); + }, + 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: "", denomUnits: [], base: "", display: "", name: "", symbol: "", uri: "", uriHash: "" }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denomUnits) { + DenomUnit.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } + if (message.name !== "") { + writer.uint32(42).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(50).string(message.symbol); + } + if (message.uri !== "") { + writer.uint32(58).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(66).string(message.uriHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denomUnits.push(DenomUnit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.base = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.display = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.symbol = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.uri = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.uriHash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + description: isSet(object.description) ? globalThis.String(object.description) : "", + denomUnits: globalThis.Array.isArray(object?.denomUnits) + ? object.denomUnits.map((e: any) => DenomUnit.fromJSON(e)) + : [], + base: isSet(object.base) ? globalThis.String(object.base) : "", + display: isSet(object.display) ? globalThis.String(object.display) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.description !== "") { + obj.description = message.description; + } + if (message.denomUnits?.length) { + obj.denomUnits = message.denomUnits.map((e) => DenomUnit.toJSON(e)); + } + if (message.base !== "") { + obj.base = message.base; + } + if (message.display !== "") { + obj.display = message.display; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denomUnits = object.denomUnits?.map((e) => DenomUnit.fromPartial(e)) || []; + message.base = object.base ?? ""; + message.display = object.display ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 00000000..b9d9a434 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,270 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** 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 different coins. */ + denomMetadata: Metadata[]; + /** + * send_enabled defines the denoms where send is enabled or disabled. + * + * Since: cosmos-sdk 0.47 + */ + sendEnabled: SendEnabled[]; +} + +/** + * 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: [], denomMetadata: [], sendEnabled: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.balances) { + Balance.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.denomMetadata) { + Metadata.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balances.push(Balance.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.denomMetadata.push(Metadata.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + balances: globalThis.Array.isArray(object?.balances) ? object.balances.map((e: any) => Balance.fromJSON(e)) : [], + supply: globalThis.Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + denomMetadata: globalThis.Array.isArray(object?.denomMetadata) + ? object.denomMetadata.map((e: any) => Metadata.fromJSON(e)) + : [], + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Balance.toJSON(e)); + } + if (message.supply?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.denomMetadata?.length) { + obj.denomMetadata = message.denomMetadata.map((e) => Metadata.toJSON(e)); + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.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) + ? Params.fromPartial(object.params) + : undefined; + message.balances = object.balances?.map((e) => Balance.fromPartial(e)) || []; + message.supply = object.supply?.map((e) => Coin.fromPartial(e)) || []; + message.denomMetadata = object.denomMetadata?.map((e) => Metadata.fromPartial(e)) || []; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBalance(): Balance { + return { address: "", coins: [] }; +} + +export const Balance: MessageFns = { + encode(message: Balance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Balance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Balance { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Balance): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Balance { + return Balance.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/query.ts new file mode 100644 index 00000000..67edba9b --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,2382 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } 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 | undefined; +} + +/** 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 + | undefined; + /** + * resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. + * + * Since: cosmos-sdk 0.50 + */ + resolveDenom: boolean; +} + +/** + * 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 | undefined; +} + +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} + +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponse { + /** balance is the balance of the coin. */ + balance: Coin | undefined; +} + +/** + * 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 provides the parameters of the bank module. */ + params: Params | undefined; +} + +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} + +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata: Metadata | undefined; +} + +/** + * 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 | undefined; +} + +/** + * DenomOwner defines structure representing an account that owns or holds a + * particular denominated token. It contains the account address and account + * balance of the denominated token. + * + * Since: cosmos-sdk 0.46 + */ +export interface DenomOwner { + /** address defines the address that owns a particular denomination. */ + address: string; + /** balance is the balance of the denominated coin for an account. */ + balance: Coin | undefined; +} + +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryRequest { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequest { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination: PageRequest | undefined; +} + +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponse { + sendEnabled: SendEnabled[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination: PageResponse | undefined; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { address: "", denom: "" }; +} + +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + 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, resolveDenom: false }; +} + +export const QueryAllBalancesRequest: MessageFns = { + encode(message: QueryAllBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.resolveDenom !== false) { + writer.uint32(24).bool(message.resolveDenom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.resolveDenom = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + resolveDenom: isSet(object.resolveDenom) ? globalThis.Boolean(object.resolveDenom) : false, + }; + }, + + toJSON(message: QueryAllBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.resolveDenom !== false) { + obj.resolveDenom = message.resolveDenom; + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesRequest { + return QueryAllBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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; + message.resolveDenom = object.resolveDenom ?? false; + return message; + }, +}; + +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { balances: [], pagination: undefined }; +} + +export const QueryAllBalancesResponse: MessageFns = { + encode(message: QueryAllBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesResponse { + return QueryAllBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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 createBaseQuerySpendableBalanceByDenomRequest(): QuerySpendableBalanceByDenomRequest { + return { address: "", denom: "" }; +} + +export const QuerySpendableBalanceByDenomRequest: MessageFns = { + encode(message: QuerySpendableBalanceByDenomRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QuerySpendableBalanceByDenomRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySpendableBalanceByDenomResponse(): QuerySpendableBalanceByDenomResponse { + return { balance: undefined }; +} + +export const QuerySpendableBalanceByDenomResponse: MessageFns = { + encode(message: QuerySpendableBalanceByDenomResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QuerySpendableBalanceByDenomResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + message.balance = (object.balance !== undefined && object.balance !== null) + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; + +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { pagination: undefined }; +} + +export const QueryTotalSupplyRequest: MessageFns = { + encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryTotalSupplyRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyResponse { + return { + supply: globalThis.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?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySupplyOfRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QuerySupplyOfRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfRequest { + return QuerySupplyOfRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { amount: undefined }; +} + +export const QuerySupplyOfResponse: MessageFns = { + encode(message: QuerySupplyOfResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfResponse { + return { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; + }, + + toJSON(message: QuerySupplyOfResponse): unknown { + const obj: any = {}; + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfResponse { + return QuerySupplyOfResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { pagination: undefined }; +} + +export const QueryDenomsMetadataRequest: MessageFns = { + encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDenomsMetadataRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.metadatas) { + Metadata.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadatas.push(Metadata.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataResponse { + return { + metadatas: globalThis.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?.length) { + obj.metadatas = message.metadatas.map((e) => Metadata.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataResponse: MessageFns = { + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringRequest(): QueryDenomMetadataByQueryStringRequest { + return { denom: "" }; +} + +export const QueryDenomMetadataByQueryStringRequest: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringRequest { + return QueryDenomMetadataByQueryStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringRequest { + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringResponse(): QueryDenomMetadataByQueryStringResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataByQueryStringResponse: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringResponse { + return QueryDenomMetadataByQueryStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringResponse { + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + 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: MessageFns = { + encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomOwner, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomOwner(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomOwner { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DenomOwner): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DenomOwner { + return DenomOwner.fromPartial(base ?? ({} as any)); + }, + 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 { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersResponse: MessageFns = { + encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryRequest(): QueryDenomOwnersByQueryRequest { + return { denom: "", pagination: undefined }; +} + +export const QueryDenomOwnersByQueryRequest: MessageFns = { + encode(message: QueryDenomOwnersByQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryRequest { + return QueryDenomOwnersByQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryRequest { + const message = createBaseQueryDenomOwnersByQueryRequest(); + message.denom = object.denom ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryResponse(): QueryDenomOwnersByQueryResponse { + return { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersByQueryResponse: MessageFns = { + encode(message: QueryDenomOwnersByQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryResponse { + return QueryDenomOwnersByQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryResponse { + const message = createBaseQueryDenomOwnersByQueryResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledRequest(): QuerySendEnabledRequest { + return { denoms: [], pagination: undefined }; +} + +export const QuerySendEnabledRequest: MessageFns = { + encode(message: QuerySendEnabledRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denoms.push(reader.string()); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledRequest { + return { + denoms: globalThis.Array.isArray(object?.denoms) ? object.denoms.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledRequest): unknown { + const obj: any = {}; + if (message.denoms?.length) { + obj.denoms = message.denoms; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledRequest { + return QuerySendEnabledRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map((e) => e) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledResponse(): QuerySendEnabledResponse { + return { sendEnabled: [], pagination: undefined }; +} + +export const QuerySendEnabledResponse: MessageFns = { + encode(message: QuerySendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledResponse { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledResponse): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledResponse { + return QuerySendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + AllBalances(request: QueryAllBalancesRequest): Promise; + /** + * SpendableBalances queries the spendable balance of all coins for a single + * account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + SpendableBalances(request: QuerySpendableBalancesRequest): Promise; + /** + * SpendableBalanceByDenom queries the spendable balance of a single denom for + * a single account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.47 + */ + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise; + /** + * TotalSupply queries the total supply of all coins. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + TotalSupply(request: QueryTotalSupplyRequest): Promise; + /** + * SupplyOf queries the supply of a single coin. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + SupplyOf(request: QuerySupplyOfRequest): Promise; + /** Params queries the parameters of x/bank module. */ + Params(request: QueryParamsRequest): Promise; + /** DenomMetadata queries the client metadata of a given coin denomination. */ + DenomMetadata(request: QueryDenomMetadataRequest): Promise; + /** DenomMetadataByQueryString queries the client metadata of a given coin denomination. */ + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + DenomOwners(request: QueryDenomOwnersRequest): Promise; + /** + * DenomOwnersByQuery queries for all account addresses that own a particular token + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise; + /** + * SendEnabled queries for SendEnabled entries. + * + * This query only returns denominations that have specific SendEnabled settings. + * Any denomination that does not have a specific setting will use the default + * params.default_send_enabled, and will not be returned by this query. + * + * Since: cosmos-sdk 0.47 + */ + SendEnabled(request: QuerySendEnabledRequest): Promise; +} + +export const QueryServiceName = "cosmos.bank.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 || QueryServiceName; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.AllBalances = this.AllBalances.bind(this); + this.SpendableBalances = this.SpendableBalances.bind(this); + this.SpendableBalanceByDenom = this.SpendableBalanceByDenom.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.DenomMetadataByQueryString = this.DenomMetadataByQueryString.bind(this); + this.DenomsMetadata = this.DenomsMetadata.bind(this); + this.DenomOwners = this.DenomOwners.bind(this); + this.DenomOwnersByQuery = this.DenomOwnersByQuery.bind(this); + this.SendEnabled = this.SendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise { + const data = QuerySpendableBalanceByDenomRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SpendableBalanceByDenom", data); + return promise.then((data) => QuerySpendableBalanceByDenomResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): Promise { + const data = QueryDenomMetadataByQueryStringRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomMetadataByQueryString", data); + return promise.then((data) => QueryDenomMetadataByQueryStringResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise { + const data = QueryDenomOwnersByQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomOwnersByQuery", data); + return promise.then((data) => QueryDenomOwnersByQueryResponse.decode(new BinaryReader(data))); + } + + SendEnabled(request: QuerySendEnabledRequest): Promise { + const data = QuerySendEnabledRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendEnabled", data); + return promise.then((data) => QuerySendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 00000000..1f1637f5 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,687 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Input, Output, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSend { + fromAddress: string; + toAddress: 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, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: Input[]; + outputs: Output[]; +} + +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabled { + /** authority is the address that controls the module. */ + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; +} + +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponse { +} + +function createBaseMsgSend(): MsgSend { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +function createBaseMsgMultiSend(): MsgMultiSend { + return { inputs: [], outputs: [] }; +} + +export const MsgMultiSend: MessageFns = { + encode(message: MsgMultiSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.inputs) { + Input.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.outputs) { + Output.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inputs.push(Input.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outputs.push(Output.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgMultiSend { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e: any) => Input.fromJSON(e)) : [], + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e: any) => Output.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgMultiSend): unknown { + const obj: any = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => Input.toJSON(e)); + } + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => Output.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgMultiSend { + return MsgMultiSend.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgMultiSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgMultiSendResponse { + return {}; + }, + + toJSON(_: MsgMultiSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgMultiSendResponse { + return MsgMultiSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSetSendEnabled(): MsgSetSendEnabled { + return { authority: "", sendEnabled: [], useDefaultFor: [] }; +} + +export const MsgSetSendEnabled: MessageFns = { + encode(message: MsgSetSendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.useDefaultFor) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.useDefaultFor.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetSendEnabled { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + useDefaultFor: globalThis.Array.isArray(object?.useDefaultFor) + ? object.useDefaultFor.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgSetSendEnabled): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.useDefaultFor?.length) { + obj.useDefaultFor = message.useDefaultFor; + } + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabled { + return MsgSetSendEnabled.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + message.authority = object.authority ?? ""; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.useDefaultFor = object.useDefaultFor?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgSetSendEnabledResponse(): MsgSetSendEnabledResponse { + return {}; +} + +export const MsgSetSendEnabledResponse: MessageFns = { + encode(_: MsgSetSendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetSendEnabledResponse { + return {}; + }, + + toJSON(_: MsgSetSendEnabledResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/bank module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SetSendEnabled is a governance operation for setting the SendEnabled flag + * on any number of Denoms. Only the entries to add or update should be + * included. Entries that already exist in the store, but that aren't + * included in this message, will be left unchanged. + * + * Since: cosmos-sdk 0.47 + */ + SetSendEnabled(request: MsgSetSendEnabled): Promise; +} + +export const MsgServiceName = "cosmos.bank.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 || MsgServiceName; + this.rpc = rpc; + this.Send = this.Send.bind(this); + this.MultiSend = this.MultiSend.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.SetSendEnabled = this.SetSendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SetSendEnabled(request: MsgSetSendEnabled): Promise { + const data = MsgSetSendEnabled.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetSendEnabled", data); + return promise.then((data) => MsgSetSendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 00000000..6da88804 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1425 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/abci/v1beta1/abci.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Event } from "../../../../tendermint/abci/types"; +import { Block } from "../../../../tendermint/types/block"; + +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: number; + /** The transaction hash. */ + txhash: string; + /** Namespace for the Code */ + codespace: string; + /** Response code. */ + code: number; + /** Result bytes, if any. */ + data: string; + /** + * The output of the application's logger (raw string). May be + * non-deterministic. + */ + rawLog: string; + /** The output of the application's logger (typed). May be non-deterministic. */ + logs: ABCIMessageLog[]; + /** Additional information. May be non-deterministic. */ + info: string; + /** Amount of gas requested for transaction. */ + gasWanted: number; + /** Amount of gas consumed by transaction. */ + gasUsed: number; + /** The request transaction bytes. */ + tx: + | Any + | undefined; + /** + * Time of the previous block. For heights > 1, it's the weighted median of + * the timestamps of the valid votes in the block.LastCommit. For height == 1, + * it's genesis time. + */ + timestamp: string; + /** + * Events defines all the events emitted by processing a transaction. Note, + * these events include those emitted by processing all the messages and those + * emitted from the ante. Whereas Logs contains the events, with + * additional metadata, emitted only by processing the messages. + * + * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + */ + events: Event[]; +} + +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLog { + msgIndex: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEvent[]; +} + +/** + * 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. */ + gasWanted: number; + /** GasUsed is the amount of gas actually consumed. */ + gasUsed: number; +} + +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface Result { + /** + * Data is any data returned from message or handler execution. It MUST be + * length prefixed in order to separate data from multiple message executions. + * Deprecated. This field is still populated, but prefer msg_response instead + * because it also contains the Msg response typeURL. + * + * @deprecated + */ + data: Uint8Array; + /** Log contains the log information from message or handler execution. */ + log: string; + /** + * Events contains a slice of Event objects that were emitted during message + * or handler execution. + */ + events: Event[]; + /** + * msg_responses contains the Msg handler responses type packed in Anys. + * + * Since: cosmos-sdk 0.46 + */ + msgResponses: Any[]; +} + +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponse { + gasInfo: GasInfo | undefined; + result: Result | undefined; +} + +/** + * MsgData defines the data returned in a Result object during message + * execution. + * + * @deprecated + */ +export interface MsgData { + msgType: 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 + */ + msgResponses: Any[]; +} + +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResult { + /** Count of all txs */ + totalCount: number; + /** Count of txs in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count txs per page */ + limit: number; + /** List of txs in current page */ + txs: TxResponse[]; +} + +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResult { + /** Count of all blocks */ + totalCount: number; + /** Count of blocks in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count blocks per page */ + limit: number; + /** List of blocks in current page */ + blocks: Block[]; +} + +function createBaseTxResponse(): TxResponse { + return { + height: 0, + txhash: "", + codespace: "", + code: 0, + data: "", + rawLog: "", + logs: [], + info: "", + gasWanted: 0, + gasUsed: 0, + tx: undefined, + timestamp: "", + events: [], + }; +} + +export const TxResponse: MessageFns = { + encode(message: TxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.rawLog !== "") { + writer.uint32(50).string(message.rawLog); + } + for (const v of message.logs) { + ABCIMessageLog.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.info !== "") { + writer.uint32(66).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(72).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(80).int64(message.gasUsed); + } + if (message.tx !== undefined) { + Any.encode(message.tx, writer.uint32(90).fork()).join(); + } + if (message.timestamp !== "") { + writer.uint32(98).string(message.timestamp); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(106).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txhash = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codespace = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.code = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.data = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.rawLog = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.info = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.tx = Any.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.timestamp = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResponse { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + txhash: isSet(object.txhash) ? globalThis.String(object.txhash) : "", + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + rawLog: isSet(object.rawLog) ? globalThis.String(object.rawLog) : "", + logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => ABCIMessageLog.fromJSON(e)) : [], + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + tx: isSet(object.tx) ? Any.fromJSON(object.tx) : undefined, + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.txhash !== "") { + obj.txhash = message.txhash; + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.rawLog !== "") { + obj.rawLog = message.rawLog; + } + if (message.logs?.length) { + obj.logs = message.logs.map((e) => ABCIMessageLog.toJSON(e)); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + if (message.tx !== undefined) { + obj.tx = Any.toJSON(message.tx); + } + if (message.timestamp !== "") { + obj.timestamp = message.timestamp; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxResponse { + return TxResponse.fromPartial(base ?? ({} as any)); + }, + 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.rawLog = object.rawLog ?? ""; + message.logs = object.logs?.map((e) => ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 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 { msgIndex: 0, log: "", events: [] }; +} + +export const ABCIMessageLog: MessageFns = { + encode(message: ABCIMessageLog, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgIndex !== 0) { + writer.uint32(8).uint32(message.msgIndex); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + StringEvent.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIMessageLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.msgIndex = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(StringEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIMessageLog { + return { + msgIndex: isSet(object.msgIndex) ? globalThis.Number(object.msgIndex) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => StringEvent.fromJSON(e)) : [], + }; + }, + + toJSON(message: ABCIMessageLog): unknown { + const obj: any = {}; + if (message.msgIndex !== 0) { + obj.msgIndex = Math.round(message.msgIndex); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => StringEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ABCIMessageLog { + return ABCIMessageLog.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msgIndex = object.msgIndex ?? 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: MessageFns = { + encode(message: StringEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + Attribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(Attribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StringEvent { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => Attribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: StringEvent): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => Attribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): StringEvent { + return StringEvent.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Attribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Attribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Attribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: Attribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Attribute { + return Attribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseGasInfo(): GasInfo { + return { gasWanted: 0, gasUsed: 0 }; +} + +export const GasInfo: MessageFns = { + encode(message: GasInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasWanted !== 0) { + writer.uint32(8).uint64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(16).uint64(message.gasUsed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.gasWanted = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasUsed = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GasInfo { + return { + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + }; + }, + + toJSON(message: GasInfo): unknown { + const obj: any = {}; + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + return obj; + }, + + create, I>>(base?: I): GasInfo { + return GasInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GasInfo { + const message = createBaseGasInfo(); + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + return message; + }, +}; + +function createBaseResult(): Result { + return { data: new Uint8Array(0), log: "", events: [], msgResponses: [] }; +} + +export const Result: MessageFns = { + encode(message: Result, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Result { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Result { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Result): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Result { + return Result.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Result { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSimulationResponse(): SimulationResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulationResponse: MessageFns = { + encode(message: SimulationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulationResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulationResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulationResponse { + return SimulationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulationResponse { + const message = createBaseSimulationResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseMsgData(): MsgData { + return { msgType: "", data: new Uint8Array(0) }; +} + +export const MsgData: MessageFns = { + encode(message: MsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgType !== "") { + writer.uint32(10).string(message.msgType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgData { + return { + msgType: isSet(object.msgType) ? globalThis.String(object.msgType) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: MsgData): unknown { + const obj: any = {}; + if (message.msgType !== "") { + obj.msgType = message.msgType; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): MsgData { + return MsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgData { + const message = createBaseMsgData(); + message.msgType = object.msgType ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxMsgData(): TxMsgData { + return { data: [], msgResponses: [] }; +} + +export const TxMsgData: MessageFns = { + encode(message: TxMsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.data) { + MsgData.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data.push(MsgData.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxMsgData { + return { + data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => MsgData.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxMsgData): unknown { + const obj: any = {}; + if (message.data?.length) { + obj.data = message.data.map((e) => MsgData.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxMsgData { + return TxMsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map((e) => MsgData.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchTxsResult(): SearchTxsResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, txs: [] }; +} + +export const SearchTxsResult: MessageFns = { + encode(message: SearchTxsResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).uint64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).uint64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).uint64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).uint64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + for (const v of message.txs) { + TxResponse.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchTxsResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.txs.push(TxResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchTxsResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => TxResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchTxsResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => TxResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchTxsResult { + return SearchTxsResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.txs = object.txs?.map((e) => TxResponse.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchBlocksResult(): SearchBlocksResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, blocks: [] }; +} + +export const SearchBlocksResult: MessageFns = { + encode(message: SearchBlocksResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).int64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).int64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).int64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).int64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).int64(message.limit); + } + for (const v of message.blocks) { + Block.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchBlocksResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchBlocksResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.blocks.push(Block.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchBlocksResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e: any) => Block.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchBlocksResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.blocks?.length) { + obj.blocks = message.blocks.map((e) => Block.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchBlocksResult { + return SearchBlocksResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchBlocksResult { + const message = createBaseSearchBlocksResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.blocks = object.blocks?.map((e) => Block.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/node/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/node/v1beta1/query.ts new file mode 100644 index 00000000..ee56c0a8 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/node/v1beta1/query.ts @@ -0,0 +1,476 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/node/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.base.node.v1beta1"; + +/** ConfigRequest defines the request structure for the Config gRPC query. */ +export interface ConfigRequest { +} + +/** ConfigResponse defines the response structure for the Config gRPC query. */ +export interface ConfigResponse { + minimumGasPrice: string; + pruningKeepRecent: string; + pruningInterval: string; + haltHeight: number; +} + +/** StateRequest defines the request structure for the status of a node. */ +export interface StatusRequest { +} + +/** StateResponse defines the response structure for the status of a node. */ +export interface StatusResponse { + /** earliest block height available in the store */ + earliestStoreHeight: number; + /** current block height */ + height: number; + /** block height timestamp */ + timestamp: + | Date + | undefined; + /** app hash of the current block */ + appHash: Uint8Array; + /** validator hash provided by the consensus header */ + validatorHash: Uint8Array; +} + +function createBaseConfigRequest(): ConfigRequest { + return {}; +} + +export const ConfigRequest: MessageFns = { + encode(_: ConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ConfigRequest { + return {}; + }, + + toJSON(_: ConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ConfigRequest { + return ConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ConfigRequest { + const message = createBaseConfigRequest(); + return message; + }, +}; + +function createBaseConfigResponse(): ConfigResponse { + return { minimumGasPrice: "", pruningKeepRecent: "", pruningInterval: "", haltHeight: 0 }; +} + +export const ConfigResponse: MessageFns = { + encode(message: ConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minimumGasPrice !== "") { + writer.uint32(10).string(message.minimumGasPrice); + } + if (message.pruningKeepRecent !== "") { + writer.uint32(18).string(message.pruningKeepRecent); + } + if (message.pruningInterval !== "") { + writer.uint32(26).string(message.pruningInterval); + } + if (message.haltHeight !== 0) { + writer.uint32(32).uint64(message.haltHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minimumGasPrice = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pruningKeepRecent = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pruningInterval = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.haltHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigResponse { + return { + minimumGasPrice: isSet(object.minimumGasPrice) ? globalThis.String(object.minimumGasPrice) : "", + pruningKeepRecent: isSet(object.pruningKeepRecent) ? globalThis.String(object.pruningKeepRecent) : "", + pruningInterval: isSet(object.pruningInterval) ? globalThis.String(object.pruningInterval) : "", + haltHeight: isSet(object.haltHeight) ? globalThis.Number(object.haltHeight) : 0, + }; + }, + + toJSON(message: ConfigResponse): unknown { + const obj: any = {}; + if (message.minimumGasPrice !== "") { + obj.minimumGasPrice = message.minimumGasPrice; + } + if (message.pruningKeepRecent !== "") { + obj.pruningKeepRecent = message.pruningKeepRecent; + } + if (message.pruningInterval !== "") { + obj.pruningInterval = message.pruningInterval; + } + if (message.haltHeight !== 0) { + obj.haltHeight = Math.round(message.haltHeight); + } + return obj; + }, + + create, I>>(base?: I): ConfigResponse { + return ConfigResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigResponse { + const message = createBaseConfigResponse(); + message.minimumGasPrice = object.minimumGasPrice ?? ""; + message.pruningKeepRecent = object.pruningKeepRecent ?? ""; + message.pruningInterval = object.pruningInterval ?? ""; + message.haltHeight = object.haltHeight ?? 0; + return message; + }, +}; + +function createBaseStatusRequest(): StatusRequest { + return {}; +} + +export const StatusRequest: MessageFns = { + encode(_: StatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): StatusRequest { + return {}; + }, + + toJSON(_: StatusRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): StatusRequest { + return StatusRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): StatusRequest { + const message = createBaseStatusRequest(); + return message; + }, +}; + +function createBaseStatusResponse(): StatusResponse { + return { + earliestStoreHeight: 0, + height: 0, + timestamp: undefined, + appHash: new Uint8Array(0), + validatorHash: new Uint8Array(0), + }; +} + +export const StatusResponse: MessageFns = { + encode(message: StatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.earliestStoreHeight !== 0) { + writer.uint32(8).uint64(message.earliestStoreHeight); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(34).bytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + writer.uint32(42).bytes(message.validatorHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.earliestStoreHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StatusResponse { + return { + earliestStoreHeight: isSet(object.earliestStoreHeight) ? globalThis.Number(object.earliestStoreHeight) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + validatorHash: isSet(object.validatorHash) ? bytesFromBase64(object.validatorHash) : new Uint8Array(0), + }; + }, + + toJSON(message: StatusResponse): unknown { + const obj: any = {}; + if (message.earliestStoreHeight !== 0) { + obj.earliestStoreHeight = Math.round(message.earliestStoreHeight); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + obj.validatorHash = base64FromBytes(message.validatorHash); + } + return obj; + }, + + create, I>>(base?: I): StatusResponse { + return StatusResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatusResponse { + const message = createBaseStatusResponse(); + message.earliestStoreHeight = object.earliestStoreHeight ?? 0; + message.height = object.height ?? 0; + message.timestamp = object.timestamp ?? undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + message.validatorHash = object.validatorHash ?? new Uint8Array(0); + return message; + }, +}; + +/** Service defines the gRPC querier service for node related queries. */ +export interface Service { + /** Config queries for the operator configuration. */ + Config(request: ConfigRequest): Promise; + /** Status queries for the node status. */ + Status(request: StatusRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.node.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + this.rpc = rpc; + this.Config = this.Config.bind(this); + this.Status = this.Status.bind(this); + } + Config(request: ConfigRequest): Promise { + const data = ConfigRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Config", data); + return promise.then((data) => ConfigResponse.decode(new BinaryReader(data))); + } + + Status(request: StatusRequest): Promise { + const data = StatusRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Status", data); + return promise.then((data) => StatusResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts new file mode 100644 index 00000000..ebb67be4 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v1beta1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. */ + interfaceNames: string[]; +} + +/** + * ListImplementationsRequest is the request type of the ListImplementations + * RPC. + */ +export interface ListImplementationsRequest { + /** interface_name defines the interface to query the implementations for. */ + interfaceName: string; +} + +/** + * ListImplementationsResponse is the response type of the ListImplementations + * RPC. + */ +export interface ListImplementationsResponse { + implementationMessageNames: string[]; +} + +function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { + return {}; +} + +export const ListAllInterfacesRequest: MessageFns = { + encode(_: ListAllInterfacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListAllInterfacesRequest { + return {}; + }, + + toJSON(_: ListAllInterfacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesRequest { + return ListAllInterfacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListAllInterfacesRequest { + const message = createBaseListAllInterfacesRequest(); + return message; + }, +}; + +function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { + return { interfaceNames: [] }; +} + +export const ListAllInterfacesResponse: MessageFns = { + encode(message: ListAllInterfacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaceNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAllInterfacesResponse { + return { + interfaceNames: globalThis.Array.isArray(object?.interfaceNames) + ? object.interfaceNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListAllInterfacesResponse): unknown { + const obj: any = {}; + if (message.interfaceNames?.length) { + obj.interfaceNames = message.interfaceNames; + } + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesResponse { + return ListAllInterfacesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListAllInterfacesResponse { + const message = createBaseListAllInterfacesResponse(); + message.interfaceNames = object.interfaceNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListImplementationsRequest(): ListImplementationsRequest { + return { interfaceName: "" }; +} + +export const ListImplementationsRequest: MessageFns = { + encode(message: ListImplementationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceName !== "") { + writer.uint32(10).string(message.interfaceName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsRequest { + return { interfaceName: isSet(object.interfaceName) ? globalThis.String(object.interfaceName) : "" }; + }, + + toJSON(message: ListImplementationsRequest): unknown { + const obj: any = {}; + if (message.interfaceName !== "") { + obj.interfaceName = message.interfaceName; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsRequest { + return ListImplementationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsRequest { + const message = createBaseListImplementationsRequest(); + message.interfaceName = object.interfaceName ?? ""; + return message; + }, +}; + +function createBaseListImplementationsResponse(): ListImplementationsResponse { + return { implementationMessageNames: [] }; +} + +export const ListImplementationsResponse: MessageFns = { + encode(message: ListImplementationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.implementationMessageNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.implementationMessageNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsResponse { + return { + implementationMessageNames: globalThis.Array.isArray(object?.implementationMessageNames) + ? object.implementationMessageNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListImplementationsResponse): unknown { + const obj: any = {}; + if (message.implementationMessageNames?.length) { + obj.implementationMessageNames = message.implementationMessageNames; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsResponse { + return ListImplementationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsResponse { + const message = createBaseListImplementationsResponse(); + message.implementationMessageNames = object.implementationMessageNames?.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 const ReflectionServiceServiceName = "cosmos.base.reflection.v1beta1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 00000000..23a7ca89 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,2057 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v2alpha1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 + | undefined; + /** chain provides the chain descriptor */ + chain: + | ChainDescriptor + | undefined; + /** codec provides metadata information regarding codec related types */ + codec: + | CodecDescriptor + | undefined; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration: + | ConfigurationDescriptor + | undefined; + /** query_services provides metadata information regarding the available queriable endpoints */ + queryServices: + | QueryServicesDescriptor + | undefined; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx: TxDescriptor | undefined; +} + +/** 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 */ + signModes: 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 + */ + authnInfoProviderMethodFullname: 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 + */ + interfaceAcceptingMessages: InterfaceAcceptingMessageDescriptor[]; + /** interface_implementers is a list of the descriptors of the interface implementers */ + interfaceImplementers: 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 + */ + typeUrl: 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) + */ + fieldDescriptorNames: string[]; +} + +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptor { + /** bech32_account_address_prefix is the account address prefix */ + bech32AccountAddressPrefix: 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. */ + msgTypeUrl: 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptor { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + queryServices: 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 */ + isModule: 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 + */ + fullQueryPath: string; +} + +function createBaseAppDescriptor(): AppDescriptor { + return { + authn: undefined, + chain: undefined, + codec: undefined, + configuration: undefined, + queryServices: undefined, + tx: undefined, + }; +} + +export const AppDescriptor: MessageFns = { + encode(message: AppDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).join(); + } + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).join(); + } + if (message.configuration !== undefined) { + ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).join(); + } + if (message.queryServices !== undefined) { + QueryServicesDescriptor.encode(message.queryServices, writer.uint32(42).fork()).join(); + } + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.queryServices = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + queryServices: isSet(object.queryServices) ? QueryServicesDescriptor.fromJSON(object.queryServices) : undefined, + tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined, + }; + }, + + toJSON(message: AppDescriptor): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + if (message.configuration !== undefined) { + obj.configuration = ConfigurationDescriptor.toJSON(message.configuration); + } + if (message.queryServices !== undefined) { + obj.queryServices = QueryServicesDescriptor.toJSON(message.queryServices); + } + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): AppDescriptor { + return AppDescriptor.fromPartial(base ?? ({} as any)); + }, + 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.queryServices = (object.queryServices !== undefined && object.queryServices !== null) + ? QueryServicesDescriptor.fromPartial(object.queryServices) + : 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: MessageFns = { + encode(message: TxDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.msgs) { + MsgDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(MsgDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => MsgDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => MsgDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxDescriptor { + return TxDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 { signModes: [] }; +} + +export const AuthnDescriptor: MessageFns = { + encode(message: AuthnDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signModes) { + SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthnDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.signModes.push(SigningModeDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthnDescriptor { + return { + signModes: globalThis.Array.isArray(object?.signModes) + ? object.signModes.map((e: any) => SigningModeDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AuthnDescriptor): unknown { + const obj: any = {}; + if (message.signModes?.length) { + obj.signModes = message.signModes.map((e) => SigningModeDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): AuthnDescriptor { + return AuthnDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.signModes = object.signModes?.map((e) => SigningModeDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningModeDescriptor(): SigningModeDescriptor { + return { name: "", number: 0, authnInfoProviderMethodFullname: "" }; +} + +export const SigningModeDescriptor: MessageFns = { + encode(message: SigningModeDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + writer.uint32(26).string(message.authnInfoProviderMethodFullname); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningModeDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authnInfoProviderMethodFullname = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningModeDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + authnInfoProviderMethodFullname: isSet(object.authnInfoProviderMethodFullname) + ? globalThis.String(object.authnInfoProviderMethodFullname) + : "", + }; + }, + + toJSON(message: SigningModeDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + obj.authnInfoProviderMethodFullname = message.authnInfoProviderMethodFullname; + } + return obj; + }, + + create, I>>(base?: I): SigningModeDescriptor { + return SigningModeDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.authnInfoProviderMethodFullname = object.authnInfoProviderMethodFullname ?? ""; + return message; + }, +}; + +function createBaseChainDescriptor(): ChainDescriptor { + return { id: "" }; +} + +export const ChainDescriptor: MessageFns = { + encode(message: ChainDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChainDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChainDescriptor { + return { id: isSet(object.id) ? globalThis.String(object.id) : "" }; + }, + + toJSON(message: ChainDescriptor): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): ChainDescriptor { + return ChainDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ChainDescriptor { + const message = createBaseChainDescriptor(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseCodecDescriptor(): CodecDescriptor { + return { interfaces: [] }; +} + +export const CodecDescriptor: MessageFns = { + encode(message: CodecDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaces) { + InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CodecDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CodecDescriptor { + return { + interfaces: globalThis.Array.isArray(object?.interfaces) + ? object.interfaces.map((e: any) => InterfaceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: CodecDescriptor): unknown { + const obj: any = {}; + if (message.interfaces?.length) { + obj.interfaces = message.interfaces.map((e) => InterfaceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CodecDescriptor { + return CodecDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map((e) => InterfaceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { fullname: "", interfaceAcceptingMessages: [], interfaceImplementers: [] }; +} + +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.interfaceAcceptingMessages) { + InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.interfaceImplementers) { + InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.interfaceAcceptingMessages.push(InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.interfaceImplementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + interfaceAcceptingMessages: globalThis.Array.isArray(object?.interfaceAcceptingMessages) + ? object.interfaceAcceptingMessages.map((e: any) => InterfaceAcceptingMessageDescriptor.fromJSON(e)) + : [], + interfaceImplementers: globalThis.Array.isArray(object?.interfaceImplementers) + ? object.interfaceImplementers.map((e: any) => InterfaceImplementerDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.interfaceAcceptingMessages?.length) { + obj.interfaceAcceptingMessages = message.interfaceAcceptingMessages.map((e) => + InterfaceAcceptingMessageDescriptor.toJSON(e) + ); + } + if (message.interfaceImplementers?.length) { + obj.interfaceImplementers = message.interfaceImplementers.map((e) => InterfaceImplementerDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): InterfaceDescriptor { + return InterfaceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.fullname = object.fullname ?? ""; + message.interfaceAcceptingMessages = + object.interfaceAcceptingMessages?.map((e) => InterfaceAcceptingMessageDescriptor.fromPartial(e)) || []; + message.interfaceImplementers = + object.interfaceImplementers?.map((e) => InterfaceImplementerDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { + return { fullname: "", typeUrl: "" }; +} + +export const InterfaceImplementerDescriptor: MessageFns = { + encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.typeUrl !== "") { + writer.uint32(18).string(message.typeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceImplementerDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.typeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceImplementerDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", + }; + }, + + toJSON(message: InterfaceImplementerDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.typeUrl !== "") { + obj.typeUrl = message.typeUrl; + } + return obj; + }, + + create, I>>(base?: I): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + message.fullname = object.fullname ?? ""; + message.typeUrl = object.typeUrl ?? ""; + return message; + }, +}; + +function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { + return { fullname: "", fieldDescriptorNames: [] }; +} + +export const InterfaceAcceptingMessageDescriptor: MessageFns = { + encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.fieldDescriptorNames) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fieldDescriptorNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceAcceptingMessageDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + fieldDescriptorNames: globalThis.Array.isArray(object?.fieldDescriptorNames) + ? object.fieldDescriptorNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: InterfaceAcceptingMessageDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.fieldDescriptorNames?.length) { + obj.fieldDescriptorNames = message.fieldDescriptorNames; + } + return obj; + }, + + create, I>>( + base?: I, + ): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + message.fullname = object.fullname ?? ""; + message.fieldDescriptorNames = object.fieldDescriptorNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseConfigurationDescriptor(): ConfigurationDescriptor { + return { bech32AccountAddressPrefix: "" }; +} + +export const ConfigurationDescriptor: MessageFns = { + encode(message: ConfigurationDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32AccountAddressPrefix !== "") { + writer.uint32(10).string(message.bech32AccountAddressPrefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigurationDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32AccountAddressPrefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigurationDescriptor { + return { + bech32AccountAddressPrefix: isSet(object.bech32AccountAddressPrefix) + ? globalThis.String(object.bech32AccountAddressPrefix) + : "", + }; + }, + + toJSON(message: ConfigurationDescriptor): unknown { + const obj: any = {}; + if (message.bech32AccountAddressPrefix !== "") { + obj.bech32AccountAddressPrefix = message.bech32AccountAddressPrefix; + } + return obj; + }, + + create, I>>(base?: I): ConfigurationDescriptor { + return ConfigurationDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + message.bech32AccountAddressPrefix = object.bech32AccountAddressPrefix ?? ""; + return message; + }, +}; + +function createBaseMsgDescriptor(): MsgDescriptor { + return { msgTypeUrl: "" }; +} + +export const MsgDescriptor: MessageFns = { + encode(message: MsgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(10).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDescriptor { + return { msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "" }; + }, + + toJSON(message: MsgDescriptor): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgDescriptor { + return MsgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDescriptor { + const message = createBaseMsgDescriptor(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { + return {}; +} + +export const GetAuthnDescriptorRequest: MessageFns = { + encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetAuthnDescriptorRequest { + return {}; + }, + + toJSON(_: GetAuthnDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, +}; + +function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { + return { authn: undefined }; +} + +export const GetAuthnDescriptorResponse: MessageFns = { + encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetAuthnDescriptorResponse { + return { authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined }; + }, + + toJSON(message: GetAuthnDescriptorResponse): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetChainDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetChainDescriptorRequest { + return {}; + }, + + toJSON(_: GetChainDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorRequest { + return GetChainDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, +}; + +function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { + return { chain: undefined }; +} + +export const GetChainDescriptorResponse: MessageFns = { + encode(message: GetChainDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetChainDescriptorResponse { + return { chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined }; + }, + + toJSON(message: GetChainDescriptorResponse): unknown { + const obj: any = {}; + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorResponse { + return GetChainDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetCodecDescriptorRequest { + return {}; + }, + + toJSON(_: GetCodecDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, +}; + +function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { + return { codec: undefined }; +} + +export const GetCodecDescriptorResponse: MessageFns = { + encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCodecDescriptorResponse { + return { codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined }; + }, + + toJSON(message: GetCodecDescriptorResponse): unknown { + const obj: any = {}; + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetConfigurationDescriptorRequest { + return {}; + }, + + toJSON(_: GetConfigurationDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, +}; + +function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { + return { config: undefined }; +} + +export const GetConfigurationDescriptorResponse: MessageFns = { + encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetConfigurationDescriptorResponse { + return { config: isSet(object.config) ? ConfigurationDescriptor.fromJSON(object.config) : undefined }; + }, + + toJSON(message: GetConfigurationDescriptorResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = ConfigurationDescriptor.toJSON(message.config); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetQueryServicesDescriptorRequest { + return {}; + }, + + toJSON(_: GetQueryServicesDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, +}; + +function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { + return { queries: undefined }; +} + +export const GetQueryServicesDescriptorResponse: MessageFns = { + encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.queries !== undefined) { + QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetQueryServicesDescriptorResponse { + return { queries: isSet(object.queries) ? QueryServicesDescriptor.fromJSON(object.queries) : undefined }; + }, + + toJSON(message: GetQueryServicesDescriptorResponse): unknown { + const obj: any = {}; + if (message.queries !== undefined) { + obj.queries = QueryServicesDescriptor.toJSON(message.queries); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetTxDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetTxDescriptorRequest { + return {}; + }, + + toJSON(_: GetTxDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorRequest { + return GetTxDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, +}; + +function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { + return { tx: undefined }; +} + +export const GetTxDescriptorResponse: MessageFns = { + encode(message: GetTxDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxDescriptorResponse { + return { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: GetTxDescriptorResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorResponse { + return GetTxDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { queryServices: [] }; +} + +export const QueryServicesDescriptor: MessageFns = { + encode(message: QueryServicesDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.queryServices) { + QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServicesDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queryServices.push(QueryServiceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServicesDescriptor { + return { + queryServices: globalThis.Array.isArray(object?.queryServices) + ? object.queryServices.map((e: any) => QueryServiceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServicesDescriptor): unknown { + const obj: any = {}; + if (message.queryServices?.length) { + obj.queryServices = message.queryServices.map((e) => QueryServiceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServicesDescriptor { + return QueryServicesDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.queryServices = object.queryServices?.map((e) => QueryServiceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { + return { fullname: "", isModule: false, methods: [] }; +} + +export const QueryServiceDescriptor: MessageFns = { + encode(message: QueryServiceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.isModule !== false) { + writer.uint32(16).bool(message.isModule); + } + for (const v of message.methods) { + QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServiceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isModule = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServiceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + isModule: isSet(object.isModule) ? globalThis.Boolean(object.isModule) : false, + methods: globalThis.Array.isArray(object?.methods) + ? object.methods.map((e: any) => QueryMethodDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServiceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.isModule !== false) { + obj.isModule = message.isModule; + } + if (message.methods?.length) { + obj.methods = message.methods.map((e) => QueryMethodDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServiceDescriptor { + return QueryServiceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + message.fullname = object.fullname ?? ""; + message.isModule = object.isModule ?? false; + message.methods = object.methods?.map((e) => QueryMethodDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { + return { name: "", fullQueryPath: "" }; +} + +export const QueryMethodDescriptor: MessageFns = { + encode(message: QueryMethodDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.fullQueryPath !== "") { + writer.uint32(18).string(message.fullQueryPath); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryMethodDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullQueryPath = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryMethodDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + fullQueryPath: isSet(object.fullQueryPath) ? globalThis.String(object.fullQueryPath) : "", + }; + }, + + toJSON(message: QueryMethodDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.fullQueryPath !== "") { + obj.fullQueryPath = message.fullQueryPath; + } + return obj; + }, + + create, I>>(base?: I): QueryMethodDescriptor { + return QueryMethodDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + message.name = object.name ?? ""; + message.fullQueryPath = object.fullQueryPath ?? ""; + 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 const ReflectionServiceServiceName = "cosmos.base.reflection.v2alpha1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts new file mode 100644 index 00000000..f58dfb17 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts @@ -0,0 +1,1974 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { DefaultNodeInfo } from "../../../../tendermint/p2p/types"; +import { Block } from "../../../../tendermint/types/block"; +import { BlockID } from "../../../../tendermint/types/types"; +import { PageRequest, PageResponse } from "../../query/v1beta1/pagination"; +import { Block as Block1 } from "./types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightRequest { + height: number; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetRequest { + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** Validator is the type for the validator-set. */ +export interface Validator { + address: string; + pubKey: Any | undefined; + votingPower: number; + proposerPriority: number; +} + +/** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightRequest { + height: number; +} + +/** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightResponse { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + defaultNodeInfo: DefaultNodeInfo | undefined; + applicationVersion: VersionInfo | undefined; +} + +/** VersionInfo is the type for the GetNodeInfoResponse message. */ +export interface VersionInfo { + name: string; + appName: string; + version: string; + gitCommit: string; + buildTags: string; + goVersion: string; + buildDeps: Module[]; + /** Since: cosmos-sdk 0.43 */ + cosmosSdkVersion: string; +} + +/** Module is the type for VersionInfo */ +export interface Module { + /** module path */ + path: string; + /** module version */ + version: string; + /** checksum */ + sum: string; +} + +/** ABCIQueryRequest defines the request structure for the ABCIQuery gRPC query. */ +export interface ABCIQueryRequest { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +/** + * ABCIQueryResponse defines the response structure for the ABCIQuery gRPC query. + * + * Note: This type is a duplicate of the ResponseQuery proto type defined in + * Tendermint. + */ +export interface ABCIQueryResponse { + code: number; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +/** + * ProofOp defines an operation used for calculating Merkle root. The data could + * be arbitrary format, providing necessary data for example neighbouring node + * hash. + * + * Note: This type is a duplicate of the ProofOp proto type defined in Tendermint. + */ +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} + +/** + * ProofOps is Merkle proof defined by the list of ProofOps. + * + * Note: This type is a duplicate of the ProofOps proto type defined in Tendermint. + */ +export interface ProofOps { + ops: ProofOp[]; +} + +function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequest { + return { height: 0, pagination: undefined }; +} + +export const GetValidatorSetByHeightRequest: MessageFns = { + encode(message: GetValidatorSetByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightRequest { + return GetValidatorSetByHeightRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetValidatorSetByHeightResponse: MessageFns = { + encode(message: GetValidatorSetByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightResponse { + return GetValidatorSetByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetValidatorSetByHeightResponse { + const message = createBaseGetValidatorSetByHeightResponse(); + message.blockHeight = object.blockHeight ?? 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: MessageFns = { + encode(message: GetLatestValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: GetLatestValidatorSetRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetRequest { + return GetLatestValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetLatestValidatorSetResponse: MessageFns = { + encode(message: GetLatestValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetResponse { + return GetLatestValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetLatestValidatorSetResponse { + const message = createBaseGetLatestValidatorSetResponse(); + message.blockHeight = object.blockHeight ?? 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: "", pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { + return { height: 0 }; +} + +export const GetBlockByHeightRequest: MessageFns = { + encode(message: GetBlockByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: GetBlockByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightRequest { + return GetBlockByHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightRequest { + const message = createBaseGetBlockByHeightRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetBlockByHeightResponse: MessageFns = { + encode(message: GetBlockByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetBlockByHeightResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightResponse { + return GetBlockByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightResponse { + const message = createBaseGetBlockByHeightResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { + return {}; +} + +export const GetLatestBlockRequest: MessageFns = { + encode(_: GetLatestBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetLatestBlockRequest { + return {}; + }, + + toJSON(_: GetLatestBlockRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetLatestBlockRequest { + return GetLatestBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetLatestBlockRequest { + const message = createBaseGetLatestBlockRequest(); + return message; + }, +}; + +function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetLatestBlockResponse: MessageFns = { + encode(message: GetLatestBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestBlockResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetLatestBlockResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetLatestBlockResponse { + return GetLatestBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetLatestBlockResponse { + const message = createBaseGetLatestBlockResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetSyncingRequest(): GetSyncingRequest { + return {}; +} + +export const GetSyncingRequest: MessageFns = { + encode(_: GetSyncingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetSyncingRequest { + return {}; + }, + + toJSON(_: GetSyncingRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetSyncingRequest { + return GetSyncingRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetSyncingRequest { + const message = createBaseGetSyncingRequest(); + return message; + }, +}; + +function createBaseGetSyncingResponse(): GetSyncingResponse { + return { syncing: false }; +} + +export const GetSyncingResponse: MessageFns = { + encode(message: GetSyncingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.syncing !== false) { + writer.uint32(8).bool(message.syncing); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.syncing = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetSyncingResponse { + return { syncing: isSet(object.syncing) ? globalThis.Boolean(object.syncing) : false }; + }, + + toJSON(message: GetSyncingResponse): unknown { + const obj: any = {}; + if (message.syncing !== false) { + obj.syncing = message.syncing; + } + return obj; + }, + + create, I>>(base?: I): GetSyncingResponse { + return GetSyncingResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetSyncingResponse { + const message = createBaseGetSyncingResponse(); + message.syncing = object.syncing ?? false; + return message; + }, +}; + +function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { + return {}; +} + +export const GetNodeInfoRequest: MessageFns = { + encode(_: GetNodeInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetNodeInfoRequest { + return {}; + }, + + toJSON(_: GetNodeInfoRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetNodeInfoRequest { + return GetNodeInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetNodeInfoRequest { + const message = createBaseGetNodeInfoRequest(); + return message; + }, +}; + +function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { + return { defaultNodeInfo: undefined, applicationVersion: undefined }; +} + +export const GetNodeInfoResponse: MessageFns = { + encode(message: GetNodeInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.defaultNodeInfo !== undefined) { + DefaultNodeInfo.encode(message.defaultNodeInfo, writer.uint32(10).fork()).join(); + } + if (message.applicationVersion !== undefined) { + VersionInfo.encode(message.applicationVersion, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.defaultNodeInfo = DefaultNodeInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.applicationVersion = VersionInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetNodeInfoResponse { + return { + defaultNodeInfo: isSet(object.defaultNodeInfo) ? DefaultNodeInfo.fromJSON(object.defaultNodeInfo) : undefined, + applicationVersion: isSet(object.applicationVersion) + ? VersionInfo.fromJSON(object.applicationVersion) + : undefined, + }; + }, + + toJSON(message: GetNodeInfoResponse): unknown { + const obj: any = {}; + if (message.defaultNodeInfo !== undefined) { + obj.defaultNodeInfo = DefaultNodeInfo.toJSON(message.defaultNodeInfo); + } + if (message.applicationVersion !== undefined) { + obj.applicationVersion = VersionInfo.toJSON(message.applicationVersion); + } + return obj; + }, + + create, I>>(base?: I): GetNodeInfoResponse { + return GetNodeInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetNodeInfoResponse { + const message = createBaseGetNodeInfoResponse(); + message.defaultNodeInfo = (object.defaultNodeInfo !== undefined && object.defaultNodeInfo !== null) + ? DefaultNodeInfo.fromPartial(object.defaultNodeInfo) + : undefined; + message.applicationVersion = (object.applicationVersion !== undefined && object.applicationVersion !== null) + ? VersionInfo.fromPartial(object.applicationVersion) + : undefined; + return message; + }, +}; + +function createBaseVersionInfo(): VersionInfo { + return { + name: "", + appName: "", + version: "", + gitCommit: "", + buildTags: "", + goVersion: "", + buildDeps: [], + cosmosSdkVersion: "", + }; +} + +export const VersionInfo: MessageFns = { + encode(message: VersionInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.appName !== "") { + writer.uint32(18).string(message.appName); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.gitCommit !== "") { + writer.uint32(34).string(message.gitCommit); + } + if (message.buildTags !== "") { + writer.uint32(42).string(message.buildTags); + } + if (message.goVersion !== "") { + writer.uint32(50).string(message.goVersion); + } + for (const v of message.buildDeps) { + Module.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.cosmosSdkVersion !== "") { + writer.uint32(66).string(message.cosmosSdkVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.version = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gitCommit = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.buildTags = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.goVersion = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.buildDeps.push(Module.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.cosmosSdkVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + gitCommit: isSet(object.gitCommit) ? globalThis.String(object.gitCommit) : "", + buildTags: isSet(object.buildTags) ? globalThis.String(object.buildTags) : "", + goVersion: isSet(object.goVersion) ? globalThis.String(object.goVersion) : "", + buildDeps: globalThis.Array.isArray(object?.buildDeps) + ? object.buildDeps.map((e: any) => Module.fromJSON(e)) + : [], + cosmosSdkVersion: isSet(object.cosmosSdkVersion) ? globalThis.String(object.cosmosSdkVersion) : "", + }; + }, + + toJSON(message: VersionInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.gitCommit !== "") { + obj.gitCommit = message.gitCommit; + } + if (message.buildTags !== "") { + obj.buildTags = message.buildTags; + } + if (message.goVersion !== "") { + obj.goVersion = message.goVersion; + } + if (message.buildDeps?.length) { + obj.buildDeps = message.buildDeps.map((e) => Module.toJSON(e)); + } + if (message.cosmosSdkVersion !== "") { + obj.cosmosSdkVersion = message.cosmosSdkVersion; + } + return obj; + }, + + create, I>>(base?: I): VersionInfo { + return VersionInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionInfo { + const message = createBaseVersionInfo(); + message.name = object.name ?? ""; + message.appName = object.appName ?? ""; + message.version = object.version ?? ""; + message.gitCommit = object.gitCommit ?? ""; + message.buildTags = object.buildTags ?? ""; + message.goVersion = object.goVersion ?? ""; + message.buildDeps = object.buildDeps?.map((e) => Module.fromPartial(e)) || []; + message.cosmosSdkVersion = object.cosmosSdkVersion ?? ""; + return message; + }, +}; + +function createBaseModule(): Module { + return { path: "", version: "", sum: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sum = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + path: isSet(object.path) ? globalThis.String(object.path) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + sum: isSet(object.sum) ? globalThis.String(object.sum) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.sum !== "") { + obj.sum = message.sum; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.path = object.path ?? ""; + message.version = object.version ?? ""; + message.sum = object.sum ?? ""; + return message; + }, +}; + +function createBaseABCIQueryRequest(): ABCIQueryRequest { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const ABCIQueryRequest: MessageFns = { + encode(message: ABCIQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryRequest { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: ABCIQueryRequest): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryRequest { + return ABCIQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryRequest { + const message = createBaseABCIQueryRequest(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseABCIQueryResponse(): ABCIQueryResponse { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ABCIQueryResponse: MessageFns = { + encode(message: ABCIQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryResponse { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ABCIQueryResponse): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryResponse { + return ABCIQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryResponse { + const message = createBaseABCIQueryResponse(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? 0; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseProofOp(): ProofOp { + return { type: "", key: new Uint8Array(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + 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; + /** + * ABCIQuery defines a query handler that supports ABCI queries directly to the + * application, bypassing Tendermint completely. The ABCI query must contain + * a valid and supported path, including app, custom, p2p, and store. + * + * Since: cosmos-sdk 0.46 + */ + ABCIQuery(request: ABCIQueryRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.tendermint.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.ABCIQuery = this.ABCIQuery.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ABCIQuery(request: ABCIQueryRequest): Promise { + const data = ABCIQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ABCIQuery", data); + return promise.then((data) => ABCIQueryResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts new file mode 100644 index 00000000..2d229c81 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts @@ -0,0 +1,530 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { EvidenceList } from "../../../../tendermint/types/evidence"; +import { BlockID, Commit, Data } from "../../../../tendermint/types/types"; +import { Consensus } from "../../../../tendermint/version/types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** + * Block is tendermint type Block, with the Header proposer address + * field converted to bech32 string. + */ +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +/** Header defines the structure of a Tendermint block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** + * proposer_address is the original block proposer address, formatted as a Bech32 string. + * In Tendermint, this type is `bytes`, but in the SDK, we convert it to a Bech32 string + * for better UX. + */ + proposerAddress: string; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: "", + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + writer.uint32(114).string(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? globalThis.String(object.proposerAddress) : "", + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + obj.proposerAddress = message.proposerAddress; + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/v1beta1/coin.ts index 430ad537..72eff8cb 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -25,12 +31,28 @@ export interface DecCoin { amount: string; } +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ +export interface IntProto { + int: string; +} + +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ +export interface DecProto { + dec: string; +} + function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +62,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +87,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +125,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +136,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +161,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -173,10 +195,125 @@ export const DecCoin = { }, }; +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +export const IntProto: MessageFns = { + encode(message: IntProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IntProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.int = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IntProto { + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + 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 ?? ""; + return message; + }, +}; + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +export const DecProto: MessageFns = { + encode(message: DecProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dec = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecProto { + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + 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 ?? ""; + 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; @@ -187,3 +324,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/module/v1/module.ts new file mode 100644 index 00000000..733fcc4e --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.circuit.module.v1"; + +/** Module is the config object of the circuit module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/query.ts new file mode 100644 index 00000000..7d1037ab --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/query.ts @@ -0,0 +1,470 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GenesisAccountPermissions, Permissions } from "./types"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + address: string; +} + +/** AccountResponse is the response type for the Query/Account RPC method. */ +export interface AccountResponse { + permission: Permissions | undefined; +} + +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ +export interface QueryAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** AccountsResponse is the response type for the Query/Accounts RPC method. */ +export interface AccountsResponse { + accounts: GenesisAccountPermissions[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryDisableListRequest is the request type for the Query/DisabledList RPC method. */ +export interface QueryDisabledListRequest { +} + +/** DisabledListResponse is the response type for the Query/DisabledList RPC method. */ +export interface DisabledListResponse { + disabledList: string[]; +} + +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { address: "" }; +} + +export const QueryAccountRequest: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseAccountResponse(): AccountResponse { + return { permission: undefined }; +} + +export const AccountResponse: MessageFns = { + encode(message: AccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.permission !== undefined) { + Permissions.encode(message.permission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.permission = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccountResponse { + return { permission: isSet(object.permission) ? Permissions.fromJSON(object.permission) : undefined }; + }, + + toJSON(message: AccountResponse): unknown { + const obj: any = {}; + if (message.permission !== undefined) { + obj.permission = Permissions.toJSON(message.permission); + } + return obj; + }, + + create, I>>(base?: I): AccountResponse { + return AccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccountResponse { + const message = createBaseAccountResponse(); + message.permission = (object.permission !== undefined && object.permission !== null) + ? Permissions.fromPartial(object.permission) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseAccountsResponse(): AccountsResponse { + return { accounts: [], pagination: undefined }; +} + +export const AccountsResponse: MessageFns = { + encode(message: AccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e: any) => GenesisAccountPermissions.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: AccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => GenesisAccountPermissions.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): AccountsResponse { + return AccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccountsResponse { + const message = createBaseAccountsResponse(); + message.accounts = object.accounts?.map((e) => GenesisAccountPermissions.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDisabledListRequest(): QueryDisabledListRequest { + return {}; +} + +export const QueryDisabledListRequest: MessageFns = { + encode(_: QueryDisabledListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDisabledListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDisabledListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryDisabledListRequest { + return {}; + }, + + toJSON(_: QueryDisabledListRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryDisabledListRequest { + return QueryDisabledListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryDisabledListRequest { + const message = createBaseQueryDisabledListRequest(); + return message; + }, +}; + +function createBaseDisabledListResponse(): DisabledListResponse { + return { disabledList: [] }; +} + +export const DisabledListResponse: MessageFns = { + encode(message: DisabledListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.disabledList) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DisabledListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDisabledListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.disabledList.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DisabledListResponse { + return { + disabledList: globalThis.Array.isArray(object?.disabledList) + ? object.disabledList.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: DisabledListResponse): unknown { + const obj: any = {}; + if (message.disabledList?.length) { + obj.disabledList = message.disabledList; + } + return obj; + }, + + create, I>>(base?: I): DisabledListResponse { + return DisabledListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DisabledListResponse { + const message = createBaseDisabledListResponse(); + message.disabledList = object.disabledList?.map((e) => e) || []; + return message; + }, +}; + +/** Query defines the circuit gRPC querier service. */ +export interface Query { + /** Account returns account permissions. */ + Account(request: QueryAccountRequest): Promise; + /** Account returns account permissions. */ + Accounts(request: QueryAccountsRequest): Promise; + /** DisabledList returns a list of disabled message urls */ + DisabledList(request: QueryDisabledListRequest): Promise; +} + +export const QueryServiceName = "cosmos.circuit.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 || QueryServiceName; + this.rpc = rpc; + this.Account = this.Account.bind(this); + this.Accounts = this.Accounts.bind(this); + this.DisabledList = this.DisabledList.bind(this); + } + Account(request: QueryAccountRequest): Promise { + const data = QueryAccountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Account", data); + return promise.then((data) => AccountResponse.decode(new BinaryReader(data))); + } + + Accounts(request: QueryAccountsRequest): Promise { + const data = QueryAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Accounts", data); + return promise.then((data) => AccountsResponse.decode(new BinaryReader(data))); + } + + DisabledList(request: QueryDisabledListRequest): Promise { + const data = QueryDisabledListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DisabledList", data); + return promise.then((data) => DisabledListResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/tx.ts new file mode 100644 index 00000000..1cc16218 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/tx.ts @@ -0,0 +1,566 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Permissions } from "./types"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. */ +export interface MsgAuthorizeCircuitBreaker { + /** + * granter is the granter of the circuit breaker permissions and must have + * LEVEL_SUPER_ADMIN. + */ + granter: string; + /** grantee is the account authorized with the provided permissions. */ + grantee: string; + /** + * permissions are the circuit breaker permissions that the grantee receives. + * These will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can + * be specified to revoke all permissions. + */ + permissions: Permissions | undefined; +} + +/** MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. */ +export interface MsgAuthorizeCircuitBreakerResponse { + success: boolean; +} + +/** MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. */ +export interface MsgTripCircuitBreaker { + /** authority is the account authorized to trip the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of type URLs to immediately stop processing. + * IF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY. + * This value is validated against the authority's permissions and if the + * authority does not have permissions to trip the specified msg type URLs + * (or all URLs), the operation will fail. + */ + msgTypeUrls: string[]; +} + +/** MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. */ +export interface MsgTripCircuitBreakerResponse { + success: boolean; +} + +/** MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. */ +export interface MsgResetCircuitBreaker { + /** authority is the account authorized to trip or reset the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of Msg type URLs to resume processing. If + * it is left empty all Msg processing for type URLs that the account is + * authorized to trip will resume. + */ + msgTypeUrls: string[]; +} + +/** MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. */ +export interface MsgResetCircuitBreakerResponse { + success: boolean; +} + +function createBaseMsgAuthorizeCircuitBreaker(): MsgAuthorizeCircuitBreaker { + return { granter: "", grantee: "", permissions: undefined }; +} + +export const MsgAuthorizeCircuitBreaker: MessageFns = { + encode(message: MsgAuthorizeCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAuthorizeCircuitBreaker { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, + }; + }, + + toJSON(message: MsgAuthorizeCircuitBreaker): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.permissions !== undefined) { + obj.permissions = Permissions.toJSON(message.permissions); + } + return obj; + }, + + create, I>>(base?: I): MsgAuthorizeCircuitBreaker { + return MsgAuthorizeCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgAuthorizeCircuitBreaker { + const message = createBaseMsgAuthorizeCircuitBreaker(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.permissions = (object.permissions !== undefined && object.permissions !== null) + ? Permissions.fromPartial(object.permissions) + : undefined; + return message; + }, +}; + +function createBaseMsgAuthorizeCircuitBreakerResponse(): MsgAuthorizeCircuitBreakerResponse { + return { success: false }; +} + +export const MsgAuthorizeCircuitBreakerResponse: MessageFns = { + encode(message: MsgAuthorizeCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAuthorizeCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgAuthorizeCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgAuthorizeCircuitBreakerResponse { + return MsgAuthorizeCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgAuthorizeCircuitBreakerResponse { + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +function createBaseMsgTripCircuitBreaker(): MsgTripCircuitBreaker { + return { authority: "", msgTypeUrls: [] }; +} + +export const MsgTripCircuitBreaker: MessageFns = { + encode(message: MsgTripCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgTripCircuitBreaker { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgTripCircuitBreaker): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): MsgTripCircuitBreaker { + return MsgTripCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgTripCircuitBreaker { + const message = createBaseMsgTripCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgTripCircuitBreakerResponse(): MsgTripCircuitBreakerResponse { + return { success: false }; +} + +export const MsgTripCircuitBreakerResponse: MessageFns = { + encode(message: MsgTripCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgTripCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgTripCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>(base?: I): MsgTripCircuitBreakerResponse { + return MsgTripCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgTripCircuitBreakerResponse { + const message = createBaseMsgTripCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +function createBaseMsgResetCircuitBreaker(): MsgResetCircuitBreaker { + return { authority: "", msgTypeUrls: [] }; +} + +export const MsgResetCircuitBreaker: MessageFns = { + encode(message: MsgResetCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgResetCircuitBreaker { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgResetCircuitBreaker): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): MsgResetCircuitBreaker { + return MsgResetCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgResetCircuitBreaker { + const message = createBaseMsgResetCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgResetCircuitBreakerResponse(): MsgResetCircuitBreakerResponse { + return { success: false }; +} + +export const MsgResetCircuitBreakerResponse: MessageFns = { + encode(message: MsgResetCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgResetCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgResetCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>(base?: I): MsgResetCircuitBreakerResponse { + return MsgResetCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgResetCircuitBreakerResponse { + const message = createBaseMsgResetCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +/** Msg defines the circuit Msg service. */ +export interface Msg { + /** + * AuthorizeCircuitBreaker allows a super-admin to grant (or revoke) another + * account's circuit breaker permissions. + */ + AuthorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise; + /** TripCircuitBreaker pauses processing of Msg's in the state machine. */ + TripCircuitBreaker(request: MsgTripCircuitBreaker): Promise; + /** + * ResetCircuitBreaker resumes processing of Msg's in the state machine that + * have been been paused using TripCircuitBreaker. + */ + ResetCircuitBreaker(request: MsgResetCircuitBreaker): Promise; +} + +export const MsgServiceName = "cosmos.circuit.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 || MsgServiceName; + this.rpc = rpc; + this.AuthorizeCircuitBreaker = this.AuthorizeCircuitBreaker.bind(this); + this.TripCircuitBreaker = this.TripCircuitBreaker.bind(this); + this.ResetCircuitBreaker = this.ResetCircuitBreaker.bind(this); + } + AuthorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise { + const data = MsgAuthorizeCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizeCircuitBreaker", data); + return promise.then((data) => MsgAuthorizeCircuitBreakerResponse.decode(new BinaryReader(data))); + } + + TripCircuitBreaker(request: MsgTripCircuitBreaker): Promise { + const data = MsgTripCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "TripCircuitBreaker", data); + return promise.then((data) => MsgTripCircuitBreakerResponse.decode(new BinaryReader(data))); + } + + ResetCircuitBreaker(request: MsgResetCircuitBreaker): Promise { + const data = MsgResetCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "ResetCircuitBreaker", data); + return promise.then((data) => MsgResetCircuitBreakerResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/types.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/types.ts new file mode 100644 index 00000000..6810f76c --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/circuit/v1/types.ts @@ -0,0 +1,356 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** + * Permissions are the permissions that an account has to trip + * or reset the circuit breaker. + */ +export interface Permissions { + /** level is the level of permissions granted to this account. */ + level: Permissions_Level; + /** + * limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type + * URLs that the account can trip. It is an error to use limit_type_urls with + * a level other than LEVEL_SOME_MSGS. + */ + limitTypeUrls: string[]; +} + +/** Level is the permission level. */ +export enum Permissions_Level { + /** + * LEVEL_NONE_UNSPECIFIED - LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit + * breaker permissions. + */ + LEVEL_NONE_UNSPECIFIED = 0, + /** + * LEVEL_SOME_MSGS - LEVEL_SOME_MSGS indicates that the account will have permission to + * trip or reset the circuit breaker for some Msg type URLs. If this level + * is chosen, a non-empty list of Msg type URLs must be provided in + * limit_type_urls. + */ + LEVEL_SOME_MSGS = 1, + /** + * LEVEL_ALL_MSGS - LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit + * breaker for Msg's of all type URLs. + */ + LEVEL_ALL_MSGS = 2, + /** + * LEVEL_SUPER_ADMIN - LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker + * actions and can grant permissions to other accounts. + */ + LEVEL_SUPER_ADMIN = 3, + UNRECOGNIZED = -1, +} + +export function permissions_LevelFromJSON(object: any): Permissions_Level { + switch (object) { + case 0: + case "LEVEL_NONE_UNSPECIFIED": + return Permissions_Level.LEVEL_NONE_UNSPECIFIED; + case 1: + case "LEVEL_SOME_MSGS": + return Permissions_Level.LEVEL_SOME_MSGS; + case 2: + case "LEVEL_ALL_MSGS": + return Permissions_Level.LEVEL_ALL_MSGS; + case 3: + case "LEVEL_SUPER_ADMIN": + return Permissions_Level.LEVEL_SUPER_ADMIN; + case -1: + case "UNRECOGNIZED": + default: + return Permissions_Level.UNRECOGNIZED; + } +} + +export function permissions_LevelToJSON(object: Permissions_Level): string { + switch (object) { + case Permissions_Level.LEVEL_NONE_UNSPECIFIED: + return "LEVEL_NONE_UNSPECIFIED"; + case Permissions_Level.LEVEL_SOME_MSGS: + return "LEVEL_SOME_MSGS"; + case Permissions_Level.LEVEL_ALL_MSGS: + return "LEVEL_ALL_MSGS"; + case Permissions_Level.LEVEL_SUPER_ADMIN: + return "LEVEL_SUPER_ADMIN"; + case Permissions_Level.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** GenesisAccountPermissions is the account permissions for the circuit breaker in genesis */ +export interface GenesisAccountPermissions { + address: string; + permissions: Permissions | undefined; +} + +/** GenesisState is the state that must be provided at genesis. */ +export interface GenesisState { + accountPermissions: GenesisAccountPermissions[]; + disabledTypeUrls: string[]; +} + +function createBasePermissions(): Permissions { + return { level: 0, limitTypeUrls: [] }; +} + +export const Permissions: MessageFns = { + encode(message: Permissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.level !== 0) { + writer.uint32(8).int32(message.level); + } + for (const v of message.limitTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Permissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermissions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.level = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.limitTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Permissions { + return { + level: isSet(object.level) ? permissions_LevelFromJSON(object.level) : 0, + limitTypeUrls: globalThis.Array.isArray(object?.limitTypeUrls) + ? object.limitTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Permissions): unknown { + const obj: any = {}; + if (message.level !== 0) { + obj.level = permissions_LevelToJSON(message.level); + } + if (message.limitTypeUrls?.length) { + obj.limitTypeUrls = message.limitTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): Permissions { + return Permissions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Permissions { + const message = createBasePermissions(); + message.level = object.level ?? 0; + message.limitTypeUrls = object.limitTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGenesisAccountPermissions(): GenesisAccountPermissions { + return { address: "", permissions: undefined }; +} + +export const GenesisAccountPermissions: MessageFns = { + encode(message: GenesisAccountPermissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisAccountPermissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisAccountPermissions(); + 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 !== 18) { + break; + } + + message.permissions = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisAccountPermissions { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, + }; + }, + + toJSON(message: GenesisAccountPermissions): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.permissions !== undefined) { + obj.permissions = Permissions.toJSON(message.permissions); + } + return obj; + }, + + create, I>>(base?: I): GenesisAccountPermissions { + return GenesisAccountPermissions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisAccountPermissions { + const message = createBaseGenesisAccountPermissions(); + message.address = object.address ?? ""; + message.permissions = (object.permissions !== undefined && object.permissions !== null) + ? Permissions.fromPartial(object.permissions) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { accountPermissions: [], disabledTypeUrls: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accountPermissions) { + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.disabledTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.accountPermissions.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.disabledTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + accountPermissions: globalThis.Array.isArray(object?.accountPermissions) + ? object.accountPermissions.map((e: any) => GenesisAccountPermissions.fromJSON(e)) + : [], + disabledTypeUrls: globalThis.Array.isArray(object?.disabledTypeUrls) + ? object.disabledTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.accountPermissions?.length) { + obj.accountPermissions = message.accountPermissions.map((e) => GenesisAccountPermissions.toJSON(e)); + } + if (message.disabledTypeUrls?.length) { + obj.disabledTypeUrls = message.disabledTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.accountPermissions = object.accountPermissions?.map((e) => GenesisAccountPermissions.fromPartial(e)) || []; + message.disabledTypeUrls = object.disabledTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/module/v1/module.ts new file mode 100644 index 00000000..97a0d394 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.consensus.module.v1"; + +/** Module is the config object of the consensus module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/v1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/v1/query.ts new file mode 100644 index 00000000..3fe04bb9 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/v1/query.ts @@ -0,0 +1,180 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ConsensusParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponse { + /** + * params are the tendermint consensus params stored in the consensus module. + * Please note that `params.version` is not populated in this response, it is + * tracked separately in the x/upgrade module. + */ + params: ConsensusParams | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + ConsensusParams.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = ConsensusParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? ConsensusParams.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = ConsensusParams.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) + ? ConsensusParams.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/consensus module. */ + Params(request: QueryParamsRequest): Promise; +} + +export const QueryServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/v1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/v1/tx.ts new file mode 100644 index 00000000..c95b67fe --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/consensus/v1/tx.ts @@ -0,0 +1,266 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ABCIParams, BlockParams, EvidenceParams, ValidatorParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/consensus parameters to update. + * VersionsParams is not included in this Msg because it is tracked + * separarately in x/upgrade. + * + * NOTE: All parameters must be supplied. + */ + block: BlockParams | undefined; + evidence: EvidenceParams | undefined; + validator: + | ValidatorParams + | undefined; + /** Since: cosmos-sdk 0.50 */ + abci: ABCIParams | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", block: undefined, evidence: undefined, validator: undefined, abci: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + 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 ?? ""; + 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.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the consensus Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/consensus module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/module/v1/module.ts new file mode 100644 index 00000000..3ae9a625 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/module/v1/module.ts @@ -0,0 +1,117 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crisis.module.v1"; + +/** Module is the config object of the crisis module. */ +export interface Module { + /** fee_collector_name is the name of the FeeCollector ModuleAccount. */ + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts new file mode 100644 index 00000000..4ebe6590 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts @@ -0,0 +1,104 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + */ + constantFee: Coin | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { constantFee: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 26) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/v1beta1/tx.ts new file mode 100644 index 00000000..90d17bf8 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crisis/v1beta1/tx.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.crisis.v1beta1"; + +/** MsgVerifyInvariant represents a message to verify a particular invariance. */ +export interface MsgVerifyInvariant { + /** sender is the account address of private key to send coins to fee collector account. */ + sender: string; + /** name of the invariant module. */ + invariantModuleName: string; + /** invariant_route is the msg's invariant route. */ + invariantRoute: string; +} + +/** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ +export interface MsgVerifyInvariantResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** constant_fee defines the x/crisis parameter. */ + constantFee: Coin | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { + return { sender: "", invariantModuleName: "", invariantRoute: "" }; +} + +export const MsgVerifyInvariant: MessageFns = { + encode(message: MsgVerifyInvariant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.invariantModuleName !== "") { + writer.uint32(18).string(message.invariantModuleName); + } + if (message.invariantRoute !== "") { + writer.uint32(26).string(message.invariantRoute); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.invariantModuleName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.invariantRoute = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVerifyInvariant { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + invariantModuleName: isSet(object.invariantModuleName) ? globalThis.String(object.invariantModuleName) : "", + invariantRoute: isSet(object.invariantRoute) ? globalThis.String(object.invariantRoute) : "", + }; + }, + + toJSON(message: MsgVerifyInvariant): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.invariantModuleName !== "") { + obj.invariantModuleName = message.invariantModuleName; + } + if (message.invariantRoute !== "") { + obj.invariantRoute = message.invariantRoute; + } + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariant { + return MsgVerifyInvariant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVerifyInvariant { + const message = createBaseMsgVerifyInvariant(); + message.sender = object.sender ?? ""; + message.invariantModuleName = object.invariantModuleName ?? ""; + message.invariantRoute = object.invariantRoute ?? ""; + return message; + }, +}; + +function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { + return {}; +} + +export const MsgVerifyInvariantResponse: MessageFns = { + encode(_: MsgVerifyInvariantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVerifyInvariantResponse { + return {}; + }, + + toJSON(_: MsgVerifyInvariantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariantResponse { + return MsgVerifyInvariantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVerifyInvariantResponse { + const message = createBaseMsgVerifyInvariantResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", constantFee: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + 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 ?? ""; + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** VerifyInvariant defines a method to verify a particular invariant. */ + VerifyInvariant(request: MsgVerifyInvariant): Promise; + /** + * UpdateParams defines a governance operation for updating the x/crisis module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.crisis.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 || MsgServiceName; + this.rpc = rpc; + this.VerifyInvariant = this.VerifyInvariant.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/ed25519/keys.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 00000000..59fab7e6 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,193 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/ed25519/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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; +} + +/** + * 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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/hd/v1/hd.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/hd/v1/hd.ts new file mode 100644 index 00000000..55be1b9c --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/hd/v1/hd.ts @@ -0,0 +1,173 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/hd/v1/hd.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crypto.hd.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + coinType: 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 */ + addressIndex: number; +} + +function createBaseBIP44Params(): BIP44Params { + return { purpose: 0, coinType: 0, account: 0, change: false, addressIndex: 0 }; +} + +export const BIP44Params: MessageFns = { + encode(message: BIP44Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.purpose !== 0) { + writer.uint32(8).uint32(message.purpose); + } + if (message.coinType !== 0) { + writer.uint32(16).uint32(message.coinType); + } + if (message.account !== 0) { + writer.uint32(24).uint32(message.account); + } + if (message.change !== false) { + writer.uint32(32).bool(message.change); + } + if (message.addressIndex !== 0) { + writer.uint32(40).uint32(message.addressIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BIP44Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.purpose = reader.uint32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.coinType = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.account = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.change = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.addressIndex = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BIP44Params { + return { + purpose: isSet(object.purpose) ? globalThis.Number(object.purpose) : 0, + coinType: isSet(object.coinType) ? globalThis.Number(object.coinType) : 0, + account: isSet(object.account) ? globalThis.Number(object.account) : 0, + change: isSet(object.change) ? globalThis.Boolean(object.change) : false, + addressIndex: isSet(object.addressIndex) ? globalThis.Number(object.addressIndex) : 0, + }; + }, + + toJSON(message: BIP44Params): unknown { + const obj: any = {}; + if (message.purpose !== 0) { + obj.purpose = Math.round(message.purpose); + } + if (message.coinType !== 0) { + obj.coinType = Math.round(message.coinType); + } + if (message.account !== 0) { + obj.account = Math.round(message.account); + } + if (message.change !== false) { + obj.change = message.change; + } + if (message.addressIndex !== 0) { + obj.addressIndex = Math.round(message.addressIndex); + } + return obj; + }, + + create, I>>(base?: I): BIP44Params { + return BIP44Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BIP44Params { + const message = createBaseBIP44Params(); + message.purpose = object.purpose ?? 0; + message.coinType = object.coinType ?? 0; + message.account = object.account ?? 0; + message.change = object.change ?? false; + message.addressIndex = object.addressIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/keyring/v1/record.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/keyring/v1/record.ts new file mode 100644 index 00000000..d6e83b43 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/keyring/v1/record.ts @@ -0,0 +1,432 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/keyring/v1/record.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { BIP44Params } from "../../hd/v1/hd"; + +export const protobufPackage = "cosmos.crypto.keyring.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + pubKey: + | Any + | undefined; + /** local stores the private key locally. */ + local?: + | Record_Local + | undefined; + /** ledger stores the information about a Ledger key. */ + ledger?: + | Record_Ledger + | undefined; + /** Multi does not store any other information. */ + multi?: + | Record_Multi + | undefined; + /** Offline does not store any other information. */ + offline?: Record_Offline | undefined; +} + +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_Local { + privKey: Any | undefined; +} + +/** Ledger item */ +export interface Record_Ledger { + path: BIP44Params | undefined; +} + +/** Multi item */ +export interface Record_Multi { +} + +/** Offline item */ +export interface Record_Offline { +} + +function createBaseRecord(): Record { + return { name: "", pubKey: undefined, local: undefined, ledger: undefined, multi: undefined, offline: undefined }; +} + +export const Record: MessageFns = { + encode(message: Record, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.local !== undefined) { + Record_Local.encode(message.local, writer.uint32(26).fork()).join(); + } + if (message.ledger !== undefined) { + Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).join(); + } + if (message.multi !== undefined) { + Record_Multi.encode(message.multi, writer.uint32(42).fork()).join(); + } + if (message.offline !== undefined) { + Record_Offline.encode(message.offline, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.local = Record_Local.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.ledger = Record_Ledger.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.multi = Record_Multi.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.offline = Record_Offline.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : 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 = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.local !== undefined) { + obj.local = Record_Local.toJSON(message.local); + } + if (message.ledger !== undefined) { + obj.ledger = Record_Ledger.toJSON(message.ledger); + } + if (message.multi !== undefined) { + obj.multi = Record_Multi.toJSON(message.multi); + } + if (message.offline !== undefined) { + obj.offline = Record_Offline.toJSON(message.offline); + } + return obj; + }, + + create, I>>(base?: I): Record { + return Record.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record { + const message = createBaseRecord(); + message.name = object.name ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : 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 { privKey: undefined }; +} + +export const Record_Local: MessageFns = { + encode(message: Record_Local, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.privKey !== undefined) { + Any.encode(message.privKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Local { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.privKey = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record_Local { + return { privKey: isSet(object.privKey) ? Any.fromJSON(object.privKey) : undefined }; + }, + + toJSON(message: Record_Local): unknown { + const obj: any = {}; + if (message.privKey !== undefined) { + obj.privKey = Any.toJSON(message.privKey); + } + return obj; + }, + + create, I>>(base?: I): Record_Local { + return Record_Local.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record_Local { + const message = createBaseRecord_Local(); + message.privKey = (object.privKey !== undefined && object.privKey !== null) + ? Any.fromPartial(object.privKey) + : undefined; + return message; + }, +}; + +function createBaseRecord_Ledger(): Record_Ledger { + return { path: undefined }; +} + +export const Record_Ledger: MessageFns = { + encode(message: Record_Ledger, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined) { + BIP44Params.encode(message.path, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Ledger { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = BIP44Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.path !== undefined) { + obj.path = BIP44Params.toJSON(message.path); + } + return obj; + }, + + create, I>>(base?: I): Record_Ledger { + return Record_Ledger.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: Record_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Multi { + return {}; + }, + + toJSON(_: Record_Multi): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Multi { + return Record_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, +}; + +function createBaseRecord_Offline(): Record_Offline { + return {}; +} + +export const Record_Offline: MessageFns = { + encode(_: Record_Offline, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Offline { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Offline { + return {}; + }, + + toJSON(_: Record_Offline): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Offline { + return Record_Offline.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/multisig/keys.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/multisig/keys.ts new file mode 100644 index 00000000..3aacbfda --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + publicKeys: Any[]; +} + +function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { + return { threshold: 0, publicKeys: [] }; +} + +export const LegacyAminoPubKey: MessageFns = { + encode(message: LegacyAminoPubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.publicKeys) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LegacyAminoPubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.threshold = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKeys.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyAminoPubKey { + return { + threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0, + publicKeys: globalThis.Array.isArray(object?.publicKeys) + ? object.publicKeys.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LegacyAminoPubKey): unknown { + const obj: any = {}; + if (message.threshold !== 0) { + obj.threshold = Math.round(message.threshold); + } + if (message.publicKeys?.length) { + obj.publicKeys = message.publicKeys.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LegacyAminoPubKey { + return LegacyAminoPubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.publicKeys = object.publicKeys?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 00000000..4f9b99a2 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/v1beta1/multisig.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 { + extraBitsStored: number; + elems: Uint8Array; +} + +function createBaseMultiSignature(): MultiSignature { + return { signatures: [] }; +} + +export const MultiSignature: MessageFns = { + encode(message: MultiSignature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiSignature { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: MultiSignature): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MultiSignature { + return MultiSignature.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCompactBitArray(): CompactBitArray { + return { extraBitsStored: 0, elems: new Uint8Array(0) }; +} + +export const CompactBitArray: MessageFns = { + encode(message: CompactBitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompactBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.extraBitsStored = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.elems = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompactBitArray { + return { + extraBitsStored: isSet(object.extraBitsStored) ? globalThis.Number(object.extraBitsStored) : 0, + elems: isSet(object.elems) ? bytesFromBase64(object.elems) : new Uint8Array(0), + }; + }, + + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + if (message.extraBitsStored !== 0) { + obj.extraBitsStored = Math.round(message.extraBitsStored); + } + if (message.elems.length !== 0) { + obj.elems = base64FromBytes(message.elems); + } + return obj; + }, + + create, I>>(base?: I): CompactBitArray { + return CompactBitArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extraBitsStored = object.extraBitsStored ?? 0; + message.elems = object.elems ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/secp256k1/keys.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 00000000..7f79f331 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256k1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/secp256r1/keys.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 00000000..54922e63 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,191 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256r1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { secret: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.secret = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { secret: isSet(object.secret) ? bytesFromBase64(object.secret) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.secret.length !== 0) { + obj.secret = base64FromBytes(message.secret); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/module/v1/module.ts new file mode 100644 index 00000000..23f8378a --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.distribution.module.v1"; + +/** Module is the config object of the distribution module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..f23cc1d6 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1149 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/distribution.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled !== false) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? globalThis.String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? globalThis.String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? globalThis.String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? globalThis.Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled !== false) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards: MessageFns = { + encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: globalThis.Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? globalThis.Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 0; + return message; + }, +}; + +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { rewards: [], period: 0 }; +} + +export const ValidatorCurrentRewards: MessageFns = { + encode(message: ValidatorCurrentRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommission { + return { + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorAccumulatedCommission): unknown { + const obj: any = {}; + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent: MessageFns = { + encode(message: ValidatorSlashEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? globalThis.Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? globalThis.String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents: MessageFns = { + encode(message: ValidatorSlashEvents, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSlashEvents) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvents(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool: MessageFns = { + encode(message: FeePool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.communityPool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeePool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: globalThis.Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { title: "", description: "", recipient: "", amount: [] }; +} + +export const CommunityPoolSpendProposal: MessageFns = { + encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommunityPoolSpendProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo: MessageFns = { + encode(message: DelegatorStartingInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (message.height !== 0) { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? globalThis.Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? globalThis.String(object.stake) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward: MessageFns = { + encode(message: DelegationDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + reward: globalThis.Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + message.reward = object.reward?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { title: "", description: "", recipient: "", amount: "", deposit: "" }; +} + +export const CommunityPoolSpendProposalWithDeposit: MessageFns = { + encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposalWithDeposit { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + deposit: isSet(object.deposit) ? globalThis.String(object.deposit) : "", + }; + }, + + toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..16d378f9 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1000 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo: MessageFns = { + encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord: MessageFns = { + encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord: MessageFns = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.accumulated !== undefined) { + ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommissionRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord: MessageFns = { + encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + if (message.rewards !== undefined) { + ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord: MessageFns = { + encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.rewards !== undefined) { + ValidatorCurrentRewards.encode(message.rewards, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord: MessageFns = { + encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord: MessageFns = { + encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).join(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.validatorSlashEvents) { + ValidatorSlashEventRecord.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: globalThis.Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? globalThis.String(object.previousProposer) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: globalThis.Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: globalThis.Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: globalThis.Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: globalThis.Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..9d32e8cb --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1674 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest: MessageFns = { + encode(message: QueryValidatorDistributionInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse: MessageFns = { + encode(message: QueryValidatorDistributionInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + selfBondRewards: globalThis.Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { + return { rewards: undefined }; +} + +export const QueryValidatorOutstandingRewardsResponse: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rewards !== undefined) { + ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest: MessageFns = { + encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { + return { commission: undefined }; +} + +export const QueryValidatorCommissionResponse: MessageFns = { + encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commission !== undefined) { + ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest: MessageFns = { + encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? globalThis.Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? globalThis.Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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: MessageFns = { + encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.slashes) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesResponse { + return { + slashes: globalThis.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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest: MessageFns = { + encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { + return { rewards: [] }; +} + +export const QueryDelegationRewardsResponse: MessageFns = { + encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest: MessageFns = { + encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { + return { rewards: [], total: [] }; +} + +export const QueryDelegationTotalRewardsResponse: MessageFns = { + encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.total) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) + ? object.rewards.map((e: any) => DelegationDelegatorReward.fromJSON(e)) + : [], + total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationTotalRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [] }; +} + +export const QueryDelegatorValidatorsResponse: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} + +export const QueryCommunityPoolRequest: MessageFns = { + encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, +}; + +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { pool: [] }; +} + +export const QueryCommunityPoolResponse: MessageFns = { + encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommunityPoolResponse { + return { pool: globalThis.Array.isArray(object?.pool) ? object.pool.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryCommunityPoolResponse): unknown { + const obj: any = {}; + if (message.pool?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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 BinaryReader(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..bf362224 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1161 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress: MessageFns = { + encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} + +export const MsgSetWithdrawAddressResponse: MessageFns = { + encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward: MessageFns = { + encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return { amount: [] }; +} + +export const MsgWithdrawDelegatorRewardResponse: MessageFns = { + encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorRewardResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawDelegatorRewardResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission: MessageFns = { + encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return { amount: [] }; +} + +export const MsgWithdrawValidatorCommissionResponse: MessageFns = { + encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommissionResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MsgFundCommunityPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgFundCommunityPool { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: MsgFundCommunityPool): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend: MessageFns = { + encode(message: MsgCommunityPoolSpend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse: MessageFns = { + encode(_: MsgCommunityPoolSpendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool: MessageFns = { + encode(message: MsgDepositValidatorRewardsPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse: MessageFns = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(new BinaryReader(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/module/v1/module.ts new file mode 100644 index 00000000..f92e0da7 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.evidence.module.v1"; + +/** Module is the config object of the evidence module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts new file mode 100644 index 00000000..16d4bb94 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/evidence.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the equivocation height. */ + height: number; + /** time is the equivocation time. */ + time: + | Date + | undefined; + /** power is the equivocation validator power. */ + power: number; + /** consensus_address is the equivocation validator consensus address. */ + consensusAddress: string; +} + +function createBaseEquivocation(): Equivocation { + return { height: 0, time: undefined, power: 0, consensusAddress: "" }; +} + +export const Equivocation: MessageFns = { + encode(message: Equivocation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(24).int64(message.power); + } + if (message.consensusAddress !== "") { + writer.uint32(34).string(message.consensusAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Equivocation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensusAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Equivocation { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + consensusAddress: isSet(object.consensusAddress) ? globalThis.String(object.consensusAddress) : "", + }; + }, + + toJSON(message: Equivocation): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + if (message.consensusAddress !== "") { + obj.consensusAddress = message.consensusAddress; + } + return obj; + }, + + create, I>>(base?: I): Equivocation { + return Equivocation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Equivocation { + const message = createBaseEquivocation(); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.power = object.power ?? 0; + message.consensusAddress = object.consensusAddress ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts new file mode 100644 index 00000000..5d6dc17a --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts @@ -0,0 +1,97 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.evidence.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/query.ts new file mode 100644 index 00000000..41408c8a --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/query.ts @@ -0,0 +1,408 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + * Deprecated: Use hash, a HEX encoded string, instead. + * + * @deprecated + */ + evidenceHash: Uint8Array; + /** + * hash defines the evidence hash of the requested evidence. + * + * Since: cosmos-sdk 0.47 + */ + hash: string; +} + +/** QueryEvidenceResponse is the response type for the Query/Evidence RPC method. */ +export interface QueryEvidenceResponse { + /** evidence returns the requested evidence. */ + evidence: Any | undefined; +} + +/** + * QueryEvidenceRequest is the request type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { + return { evidenceHash: new Uint8Array(0), hash: "" }; +} + +export const QueryEvidenceRequest: MessageFns = { + encode(message: QueryEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidenceHash.length !== 0) { + writer.uint32(10).bytes(message.evidenceHash); + } + if (message.hash !== "") { + writer.uint32(18).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceRequest { + return { + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + hash: isSet(object.hash) ? globalThis.String(object.hash) : "", + }; + }, + + toJSON(message: QueryEvidenceRequest): unknown { + const obj: any = {}; + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceRequest { + return QueryEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEvidenceRequest { + const message = createBaseQueryEvidenceRequest(); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { + return { evidence: undefined }; +} + +export const QueryEvidenceResponse: MessageFns = { + encode(message: QueryEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceResponse { + return { evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined }; + }, + + toJSON(message: QueryEvidenceResponse): unknown { + const obj: any = {}; + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceResponse { + return QueryEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllEvidenceRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceRequest { + return QueryAllEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidence.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceResponse { + return { + evidence: globalThis.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?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceResponse { + return QueryAllEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.evidence.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/tx.ts new file mode 100644 index 00000000..04c14d2d --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/evidence/v1beta1/tx.ts @@ -0,0 +1,240 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the signer account address of evidence. */ + submitter: string; + /** evidence defines the evidence of misbehavior. */ + evidence: Any | undefined; +} + +/** 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: MessageFns = { + encode(message: MsgSubmitEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.submitter !== "") { + writer.uint32(10).string(message.submitter); + } + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.submitter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidence { + return { + submitter: isSet(object.submitter) ? globalThis.String(object.submitter) : "", + evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined, + }; + }, + + toJSON(message: MsgSubmitEvidence): unknown { + const obj: any = {}; + if (message.submitter !== "") { + obj.submitter = message.submitter; + } + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidence { + return MsgSubmitEvidence.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const MsgSubmitEvidenceResponse: MessageFns = { + encode(message: MsgSubmitEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidenceResponse { + return { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0) }; + }, + + toJSON(message: MsgSubmitEvidenceResponse): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidenceResponse { + return MsgSubmitEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEvidenceResponse { + const message = createBaseMsgSubmitEvidenceResponse(); + message.hash = object.hash ?? new Uint8Array(0); + 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 const MsgServiceName = "cosmos.evidence.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 || MsgServiceName; + 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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/module/v1/module.ts new file mode 100644 index 00000000..386f9d26 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.feegrant.module.v1"; + +/** Module is the config object of the feegrant module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts index 143a35de..9c002d76 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/feegrant.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Any } from "../../../google/protobuf/any"; import { Duration } from "../../../google/protobuf/duration"; import { Timestamp } from "../../../google/protobuf/timestamp"; @@ -79,19 +85,19 @@ function createBaseBasicAllowance(): BasicAllowance { return { spendLimit: [], expiration: undefined }; } -export const BasicAllowance = { - encode(message: BasicAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const BasicAllowance: MessageFns = { + encode(message: BasicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.spendLimit) { - Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + Coin.encode(v!, writer.uint32(10).fork()).join(); } if (message.expiration !== undefined) { - Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): BasicAllowance { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): BasicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBasicAllowance(); while (reader.pos < end) { @@ -115,14 +121,16 @@ export const BasicAllowance = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): BasicAllowance { return { - spendLimit: Array.isArray(object?.spendLimit) ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) : [], + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, }; }, @@ -153,28 +161,28 @@ function createBasePeriodicAllowance(): PeriodicAllowance { return { basic: undefined, period: undefined, periodSpendLimit: [], periodCanSpend: [], periodReset: undefined }; } -export const PeriodicAllowance = { - encode(message: PeriodicAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PeriodicAllowance: MessageFns = { + encode(message: PeriodicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.basic !== undefined) { - BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim(); + BasicAllowance.encode(message.basic, writer.uint32(10).fork()).join(); } if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(18).fork()).ldelim(); + Duration.encode(message.period, writer.uint32(18).fork()).join(); } for (const v of message.periodSpendLimit) { - Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + Coin.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.periodCanSpend) { - Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + Coin.encode(v!, writer.uint32(34).fork()).join(); } if (message.periodReset !== undefined) { - Timestamp.encode(toTimestamp(message.periodReset), writer.uint32(42).fork()).ldelim(); + Timestamp.encode(toTimestamp(message.periodReset), writer.uint32(42).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PeriodicAllowance { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePeriodicAllowance(); while (reader.pos < end) { @@ -219,7 +227,7 @@ export const PeriodicAllowance = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -228,10 +236,10 @@ export const PeriodicAllowance = { return { basic: isSet(object.basic) ? BasicAllowance.fromJSON(object.basic) : undefined, period: isSet(object.period) ? Duration.fromJSON(object.period) : undefined, - periodSpendLimit: Array.isArray(object?.periodSpendLimit) + periodSpendLimit: globalThis.Array.isArray(object?.periodSpendLimit) ? object.periodSpendLimit.map((e: any) => Coin.fromJSON(e)) : [], - periodCanSpend: Array.isArray(object?.periodCanSpend) + periodCanSpend: globalThis.Array.isArray(object?.periodCanSpend) ? object.periodCanSpend.map((e: any) => Coin.fromJSON(e)) : [], periodReset: isSet(object.periodReset) ? fromJsonTimestamp(object.periodReset) : undefined, @@ -280,10 +288,10 @@ function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { return { allowance: undefined, allowedMessages: [] }; } -export const AllowedMsgAllowance = { - encode(message: AllowedMsgAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const AllowedMsgAllowance: MessageFns = { + encode(message: AllowedMsgAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.allowance !== undefined) { - Any.encode(message.allowance, writer.uint32(10).fork()).ldelim(); + Any.encode(message.allowance, writer.uint32(10).fork()).join(); } for (const v of message.allowedMessages) { writer.uint32(18).string(v!); @@ -291,8 +299,8 @@ export const AllowedMsgAllowance = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): AllowedMsgAllowance { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): AllowedMsgAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAllowedMsgAllowance(); while (reader.pos < end) { @@ -316,7 +324,7 @@ export const AllowedMsgAllowance = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -324,7 +332,9 @@ export const AllowedMsgAllowance = { fromJSON(object: any): AllowedMsgAllowance { return { allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, - allowedMessages: Array.isArray(object?.allowedMessages) ? object.allowedMessages.map((e: any) => String(e)) : [], + allowedMessages: globalThis.Array.isArray(object?.allowedMessages) + ? object.allowedMessages.map((e: any) => globalThis.String(e)) + : [], }; }, @@ -356,8 +366,8 @@ function createBaseGrant(): Grant { return { granter: "", grantee: "", allowance: undefined }; } -export const Grant = { - encode(message: Grant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Grant: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } @@ -365,13 +375,13 @@ export const Grant = { writer.uint32(18).string(message.grantee); } if (message.allowance !== undefined) { - Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); + Any.encode(message.allowance, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Grant { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGrant(); while (reader.pos < end) { @@ -402,15 +412,15 @@ export const Grant = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Grant { return { - granter: isSet(object.granter) ? String(object.granter) : "", - grantee: isSet(object.grantee) ? String(object.grantee) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, }; }, @@ -446,7 +456,8 @@ export const Grant = { type Builtin = 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; @@ -455,7 +466,7 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; function toTimestamp(date: Date): Timestamp { - const seconds = date.getTime() / 1_000; + const seconds = Math.trunc(date.getTime() / 1_000); const nanos = (date.getTime() % 1_000) * 1_000_000; return { seconds, nanos }; } @@ -463,14 +474,14 @@ function toTimestamp(date: Date): Timestamp { function fromTimestamp(t: Timestamp): Date { let millis = (t.seconds || 0) * 1_000; millis += (t.nanos || 0) / 1_000_000; - return new Date(millis); + 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)); } @@ -479,3 +490,12 @@ function fromJsonTimestamp(o: any): Date { function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts index 85f4bb7f..14bfd526 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/genesis.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Grant } from "./feegrant"; export const protobufPackage = "cosmos.feegrant.v1beta1"; @@ -15,16 +21,16 @@ function createBaseGenesisState(): GenesisState { return { allowances: [] }; } -export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.allowances) { - Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + Grant.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisState(); while (reader.pos < end) { @@ -41,14 +47,16 @@ export const GenesisState = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GenesisState { return { - allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + allowances: globalThis.Array.isArray(object?.allowances) + ? object.allowances.map((e: any) => Grant.fromJSON(e)) + : [], }; }, @@ -73,10 +81,20 @@ 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; type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/query.ts index d69fbf7b..3f0c781d 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/query.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/query.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/query.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; import { Grant } from "./feegrant"; @@ -63,8 +69,8 @@ function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { return { granter: "", grantee: "" }; } -export const QueryAllowanceRequest = { - encode(message: QueryAllowanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllowanceRequest: MessageFns = { + encode(message: QueryAllowanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } @@ -74,8 +80,8 @@ export const QueryAllowanceRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowanceRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllowanceRequest(); while (reader.pos < end) { @@ -99,15 +105,15 @@ export const QueryAllowanceRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAllowanceRequest { return { - granter: isSet(object.granter) ? String(object.granter) : "", - grantee: isSet(object.grantee) ? String(object.grantee) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", }; }, @@ -137,16 +143,16 @@ function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { return { allowance: undefined }; } -export const QueryAllowanceResponse = { - encode(message: QueryAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllowanceResponse: MessageFns = { + encode(message: QueryAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.allowance !== undefined) { - Grant.encode(message.allowance, writer.uint32(10).fork()).ldelim(); + Grant.encode(message.allowance, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowanceResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllowanceResponse(); while (reader.pos < end) { @@ -163,7 +169,7 @@ export const QueryAllowanceResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -196,19 +202,19 @@ function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { return { grantee: "", pagination: undefined }; } -export const QueryAllowancesRequest = { - encode(message: QueryAllowancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllowancesRequest: MessageFns = { + encode(message: QueryAllowancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); } if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllowancesRequest(); while (reader.pos < end) { @@ -232,14 +238,14 @@ export const QueryAllowancesRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAllowancesRequest { return { - grantee: isSet(object.grantee) ? String(object.grantee) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, }; }, @@ -272,19 +278,19 @@ function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { return { allowances: [], pagination: undefined }; } -export const QueryAllowancesResponse = { - encode(message: QueryAllowancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllowancesResponse: MessageFns = { + encode(message: QueryAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.allowances) { - Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + Grant.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllowancesResponse(); while (reader.pos < end) { @@ -308,14 +314,16 @@ export const QueryAllowancesResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAllowancesResponse { return { - allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + allowances: globalThis.Array.isArray(object?.allowances) + ? object.allowances.map((e: any) => Grant.fromJSON(e)) + : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, @@ -348,19 +356,19 @@ function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRe return { granter: "", pagination: undefined }; } -export const QueryAllowancesByGranterRequest = { - encode(message: QueryAllowancesByGranterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllowancesByGranterRequest: MessageFns = { + encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllowancesByGranterRequest(); while (reader.pos < end) { @@ -384,14 +392,14 @@ export const QueryAllowancesByGranterRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAllowancesByGranterRequest { return { - granter: isSet(object.granter) ? String(object.granter) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, }; }, @@ -426,19 +434,19 @@ function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterR return { allowances: [], pagination: undefined }; } -export const QueryAllowancesByGranterResponse = { - encode(message: QueryAllowancesByGranterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllowancesByGranterResponse: MessageFns = { + encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.allowances) { - Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + Grant.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllowancesByGranterResponse(); while (reader.pos < end) { @@ -462,14 +470,16 @@ export const QueryAllowancesByGranterResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAllowancesByGranterResponse { return { - allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + allowances: globalThis.Array.isArray(object?.allowances) + ? object.allowances.map((e: any) => Grant.fromJSON(e)) + : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, @@ -530,19 +540,19 @@ export class QueryClientImpl implements Query { 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(_m0.Reader.create(data))); + return promise.then((data) => QueryAllowanceResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryAllowancesResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryAllowancesByGranterResponse.decode(new BinaryReader(data))); } } @@ -553,7 +563,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; @@ -564,3 +575,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts index 9fa8087b..052862c2 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/tx.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Any } from "../../../google/protobuf/any"; export const protobufPackage = "cosmos.feegrant.v1beta1"; @@ -57,8 +63,8 @@ function createBaseMsgGrantAllowance(): MsgGrantAllowance { return { granter: "", grantee: "", allowance: undefined }; } -export const MsgGrantAllowance = { - encode(message: MsgGrantAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgGrantAllowance: MessageFns = { + encode(message: MsgGrantAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } @@ -66,13 +72,13 @@ export const MsgGrantAllowance = { writer.uint32(18).string(message.grantee); } if (message.allowance !== undefined) { - Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); + Any.encode(message.allowance, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantAllowance { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgGrantAllowance(); while (reader.pos < end) { @@ -103,15 +109,15 @@ export const MsgGrantAllowance = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgGrantAllowance { return { - granter: isSet(object.granter) ? String(object.granter) : "", - grantee: isSet(object.grantee) ? String(object.grantee) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, }; }, @@ -148,13 +154,13 @@ function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { return {}; } -export const MsgGrantAllowanceResponse = { - encode(_: MsgGrantAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgGrantAllowanceResponse: MessageFns = { + encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantAllowanceResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgGrantAllowanceResponse(); while (reader.pos < end) { @@ -164,7 +170,7 @@ export const MsgGrantAllowanceResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -191,8 +197,8 @@ function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { return { granter: "", grantee: "" }; } -export const MsgRevokeAllowance = { - encode(message: MsgRevokeAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgRevokeAllowance: MessageFns = { + encode(message: MsgRevokeAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } @@ -202,8 +208,8 @@ export const MsgRevokeAllowance = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeAllowance { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRevokeAllowance(); while (reader.pos < end) { @@ -227,15 +233,15 @@ export const MsgRevokeAllowance = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgRevokeAllowance { return { - granter: isSet(object.granter) ? String(object.granter) : "", - grantee: isSet(object.grantee) ? String(object.grantee) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", }; }, @@ -265,13 +271,13 @@ function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { return {}; } -export const MsgRevokeAllowanceResponse = { - encode(_: MsgRevokeAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgRevokeAllowanceResponse: MessageFns = { + encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRevokeAllowanceResponse(); while (reader.pos < end) { @@ -281,7 +287,7 @@ export const MsgRevokeAllowanceResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -308,16 +314,16 @@ function createBaseMsgPruneAllowances(): MsgPruneAllowances { return { pruner: "" }; } -export const MsgPruneAllowances = { - encode(message: MsgPruneAllowances, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgPruneAllowances: MessageFns = { + encode(message: MsgPruneAllowances, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pruner !== "") { writer.uint32(10).string(message.pruner); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgPruneAllowances { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgPruneAllowances(); while (reader.pos < end) { @@ -334,13 +340,13 @@ export const MsgPruneAllowances = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgPruneAllowances { - return { pruner: isSet(object.pruner) ? String(object.pruner) : "" }; + return { pruner: isSet(object.pruner) ? globalThis.String(object.pruner) : "" }; }, toJSON(message: MsgPruneAllowances): unknown { @@ -365,13 +371,13 @@ function createBaseMsgPruneAllowancesResponse(): MsgPruneAllowancesResponse { return {}; } -export const MsgPruneAllowancesResponse = { - encode(_: MsgPruneAllowancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgPruneAllowancesResponse: MessageFns = { + encode(_: MsgPruneAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgPruneAllowancesResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgPruneAllowancesResponse(); while (reader.pos < end) { @@ -381,7 +387,7 @@ export const MsgPruneAllowancesResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -438,19 +444,19 @@ export class MsgClientImpl implements Msg { 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(_m0.Reader.create(data))); + return promise.then((data) => MsgGrantAllowanceResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => MsgRevokeAllowanceResponse.decode(new BinaryReader(data))); } PruneAllowances(request: MsgPruneAllowances): Promise { const data = MsgPruneAllowances.encode(request).finish(); const promise = this.rpc.request(this.service, "PruneAllowances", data); - return promise.then((data) => MsgPruneAllowancesResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgPruneAllowancesResponse.decode(new BinaryReader(data))); } } @@ -461,7 +467,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; @@ -472,3 +479,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/genutil/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/genutil/module/v1/module.ts new file mode 100644 index 00000000..a7da77b1 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/genutil/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.module.v1"; + +/** Module is the config object for the genutil module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts new file mode 100644 index 00000000..11bd3193 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.v1beta1"; + +/** GenesisState defines the raw genesis transaction in JSON. */ +export interface GenesisState { + /** gen_txs defines the genesis transactions. */ + genTxs: Uint8Array[]; +} + +function createBaseGenesisState(): GenesisState { + return { genTxs: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.genTxs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.genTxs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + genTxs: globalThis.Array.isArray(object?.genTxs) ? object.genTxs.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.genTxs?.length) { + obj.genTxs = message.genTxs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.genTxs = object.genTxs?.map((e) => e) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/module/v1/module.ts new file mode 100644 index 00000000..d95ae5ed --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/module/v1/module.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.gov.module.v1"; + +/** Module is the config object of the gov module. */ +export interface Module { + /** + * max_metadata_len defines the maximum proposal metadata length. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { maxMetadataLen: 0, authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMetadataLen !== 0) { + writer.uint32(8).uint64(message.maxMetadataLen); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxMetadataLen = object.maxMetadataLen ?? 0; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/genesis.ts new file mode 100644 index 00000000..d6adbe5f --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/genesis.ts @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Deposit, DepositParams, Params, 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. */ + startingProposalId: number; + /** 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[]; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: + | Params + | undefined; + /** + * The constitution allows builders to lay a foundation and define purpose. + * This is an immutable string set in genesis. + * There are no amendments, to go outside of scope, just fork. + * constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. + * + * Since: cosmos-sdk 0.50 + */ + constitution: string; + portId: string; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + params: undefined, + constitution: "", + portId: "", + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(66).fork()).join(); + } + if (message.constitution !== "") { + writer.uint32(74).string(message.constitution); + } + if (message.portId !== "") { + writer.uint32(82).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.constitution = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.constitution = object.constitution ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/gov.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/gov.ts new file mode 100644 index 00000000..8b77a89a --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/gov.ts @@ -0,0 +1,2031 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines an encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + /** + * PROPOSAL_STATUS_TALLY_PERIOD - PROPOSAL_STATUS_TALLY_PERIOD defines a proposal status during the tally + * period. + */ + PROPOSAL_STATUS_TALLY_PERIOD = 6, + 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 6: + case "PROPOSAL_STATUS_TALLY_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_TALLY_PERIOD; + 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.PROPOSAL_STATUS_TALLY_PERIOD: + return "PROPOSAL_STATUS_TALLY_PERIOD"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** id defines the unique id of the proposal. */ + id: number; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: Any[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; + /** + * expedited defines if the proposal is expedited + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; + /** + * failed_reason defines the reason why the proposal failed + * + * Since: cosmos-sdk 0.50 + */ + failedReason: string; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** decryption key is used to decrypt the encrypted votes during the tally phase */ + decryptionKey: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes_count is the number of yes votes on a proposal. */ + yesCount: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstainCount: string; + /** no_count is the number of no votes on a proposal. */ + noCount: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + noWithVetoCount: string; + /** encrypted_count is the number of encrypted votes on a proposal. */ + encryptedCount: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOption[]; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + */ + metadata: string; + encryptedVoteData: string; +} + +/** + * DepositParams defines the params for deposits on governance proposals. + * + * @deprecated + */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** + * VotingParams defines the params for voting on governance proposals. + * + * @deprecated + */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** + * TallyParams defines the params for tallying votes on governance proposals. + * + * @deprecated + */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; +} + +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface Params { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: + | Duration + | undefined; + /** Duration of the voting period. */ + votingPeriod: + | Duration + | undefined; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + minInitialDepositRatio: string; + /** + * The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelRatio: string; + /** + * The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + * If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelDest: string; + /** + * Duration of the voting period of an expedited proposal. + * + * Since: cosmos-sdk 0.50 + */ + expeditedVotingPeriod: + | Duration + | undefined; + /** + * Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. + * + * Since: cosmos-sdk 0.50 + */ + expeditedThreshold: string; + /** Minimum expedited deposit for a proposal to enter voting period. */ + expeditedMinDeposit: Coin[]; + /** burn deposits if a proposal does not meet quorum */ + burnVoteQuorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burnProposalDepositPrevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burnVoteVeto: boolean; + /** + * The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + * Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + * required. + * + * Since: cosmos-sdk 0.50 + */ + minDepositRatio: string; + /** Duration of the voting period. */ + maxTallyPeriod: Duration | undefined; + trustedCounterParties: TrustedCounterParty[]; + channelId: string; + isSourceChain: boolean; +} + +export interface DecryptedVoteOption { + /** option defines the vote option. */ + option: VoteOption; + randomNo: number; +} + +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + messages: [], + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + metadata: "", + title: "", + summary: "", + proposer: "", + expedited: false, + failedReason: "", + hasEncryptedVotes: false, + identity: "", + pubkey: "", + decryptionKey: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(90).string(message.title); + } + if (message.summary !== "") { + writer.uint32(98).string(message.summary); + } + if (message.proposer !== "") { + writer.uint32(106).string(message.proposer); + } + if (message.expedited !== false) { + writer.uint32(112).bool(message.expedited); + } + if (message.failedReason !== "") { + writer.uint32(122).string(message.failedReason); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(128).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(138).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(146).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(154).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.metadata = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.title = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.summary = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.proposer = reader.string(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.expedited = reader.bool(); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.failedReason = reader.string(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.identity = reader.string(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.pubkey = reader.string(); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(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, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + failedReason: isSet(object.failedReason) ? globalThis.String(object.failedReason) : "", + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(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.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + if (message.failedReason !== "") { + obj.failedReason = message.failedReason; + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + 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; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.proposer = object.proposer ?? ""; + message.expedited = object.expedited ?? false; + message.failedReason = object.failedReason ?? ""; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "", encryptedCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + if (message.encryptedCount !== "") { + writer.uint32(42).string(message.encryptedCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + encryptedCount: isSet(object.encryptedCount) ? globalThis.String(object.encryptedCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + if (message.encryptedCount !== "") { + obj.encryptedCount = message.encryptedCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + message.encryptedCount = object.encryptedCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", options: [], metadata: "", encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(42).string(message.metadata); + } + if (message.encryptedVoteData !== "") { + writer.uint32(50).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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) : "", + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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; + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: "", threshold: "", vetoThreshold: "" }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(26).string(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + 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 ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + minDeposit: [], + maxDepositPeriod: undefined, + votingPeriod: undefined, + quorum: "", + threshold: "", + vetoThreshold: "", + minInitialDepositRatio: "", + proposalCancelRatio: "", + proposalCancelDest: "", + expeditedVotingPeriod: undefined, + expeditedThreshold: "", + expeditedMinDeposit: [], + burnVoteQuorum: false, + burnProposalDepositPrevote: false, + burnVoteVeto: false, + minDepositRatio: "", + maxTallyPeriod: undefined, + trustedCounterParties: [], + channelId: "", + isSourceChain: false, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(26).fork()).join(); + } + if (message.quorum !== "") { + writer.uint32(34).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(42).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(50).string(message.vetoThreshold); + } + if (message.minInitialDepositRatio !== "") { + writer.uint32(58).string(message.minInitialDepositRatio); + } + if (message.proposalCancelRatio !== "") { + writer.uint32(66).string(message.proposalCancelRatio); + } + if (message.proposalCancelDest !== "") { + writer.uint32(74).string(message.proposalCancelDest); + } + if (message.expeditedVotingPeriod !== undefined) { + Duration.encode(message.expeditedVotingPeriod, writer.uint32(82).fork()).join(); + } + if (message.expeditedThreshold !== "") { + writer.uint32(90).string(message.expeditedThreshold); + } + for (const v of message.expeditedMinDeposit) { + Coin.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.burnVoteQuorum !== false) { + writer.uint32(104).bool(message.burnVoteQuorum); + } + if (message.burnProposalDepositPrevote !== false) { + writer.uint32(112).bool(message.burnProposalDepositPrevote); + } + if (message.burnVoteVeto !== false) { + writer.uint32(120).bool(message.burnVoteVeto); + } + if (message.minDepositRatio !== "") { + writer.uint32(130).string(message.minDepositRatio); + } + if (message.maxTallyPeriod !== undefined) { + Duration.encode(message.maxTallyPeriod, writer.uint32(138).fork()).join(); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(146).fork()).join(); + } + if (message.channelId !== "") { + writer.uint32(154).string(message.channelId); + } + if (message.isSourceChain !== false) { + writer.uint32(160).bool(message.isSourceChain); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.quorum = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.threshold = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.minInitialDepositRatio = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposalCancelRatio = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.proposalCancelDest = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.expeditedVotingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.expeditedThreshold = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.expeditedMinDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.burnVoteQuorum = reader.bool(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.burnProposalDepositPrevote = reader.bool(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.burnVoteVeto = reader.bool(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.minDepositRatio = reader.string(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.maxTallyPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.channelId = reader.string(); + continue; + case 20: + if (tag !== 160) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + minInitialDepositRatio: isSet(object.minInitialDepositRatio) + ? globalThis.String(object.minInitialDepositRatio) + : "", + proposalCancelRatio: isSet(object.proposalCancelRatio) ? globalThis.String(object.proposalCancelRatio) : "", + proposalCancelDest: isSet(object.proposalCancelDest) ? globalThis.String(object.proposalCancelDest) : "", + expeditedVotingPeriod: isSet(object.expeditedVotingPeriod) + ? Duration.fromJSON(object.expeditedVotingPeriod) + : undefined, + expeditedThreshold: isSet(object.expeditedThreshold) ? globalThis.String(object.expeditedThreshold) : "", + expeditedMinDeposit: globalThis.Array.isArray(object?.expeditedMinDeposit) + ? object.expeditedMinDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + burnVoteQuorum: isSet(object.burnVoteQuorum) ? globalThis.Boolean(object.burnVoteQuorum) : false, + burnProposalDepositPrevote: isSet(object.burnProposalDepositPrevote) + ? globalThis.Boolean(object.burnProposalDepositPrevote) + : false, + burnVoteVeto: isSet(object.burnVoteVeto) ? globalThis.Boolean(object.burnVoteVeto) : false, + minDepositRatio: isSet(object.minDepositRatio) ? globalThis.String(object.minDepositRatio) : "", + maxTallyPeriod: isSet(object.maxTallyPeriod) ? Duration.fromJSON(object.maxTallyPeriod) : undefined, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + if (message.minInitialDepositRatio !== "") { + obj.minInitialDepositRatio = message.minInitialDepositRatio; + } + if (message.proposalCancelRatio !== "") { + obj.proposalCancelRatio = message.proposalCancelRatio; + } + if (message.proposalCancelDest !== "") { + obj.proposalCancelDest = message.proposalCancelDest; + } + if (message.expeditedVotingPeriod !== undefined) { + obj.expeditedVotingPeriod = Duration.toJSON(message.expeditedVotingPeriod); + } + if (message.expeditedThreshold !== "") { + obj.expeditedThreshold = message.expeditedThreshold; + } + if (message.expeditedMinDeposit?.length) { + obj.expeditedMinDeposit = message.expeditedMinDeposit.map((e) => Coin.toJSON(e)); + } + if (message.burnVoteQuorum !== false) { + obj.burnVoteQuorum = message.burnVoteQuorum; + } + if (message.burnProposalDepositPrevote !== false) { + obj.burnProposalDepositPrevote = message.burnProposalDepositPrevote; + } + if (message.burnVoteVeto !== false) { + obj.burnVoteVeto = message.burnVoteVeto; + } + if (message.minDepositRatio !== "") { + obj.minDepositRatio = message.minDepositRatio; + } + if (message.maxTallyPeriod !== undefined) { + obj.maxTallyPeriod = Duration.toJSON(message.maxTallyPeriod); + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + message.minInitialDepositRatio = object.minInitialDepositRatio ?? ""; + message.proposalCancelRatio = object.proposalCancelRatio ?? ""; + message.proposalCancelDest = object.proposalCancelDest ?? ""; + message.expeditedVotingPeriod = + (object.expeditedVotingPeriod !== undefined && object.expeditedVotingPeriod !== null) + ? Duration.fromPartial(object.expeditedVotingPeriod) + : undefined; + message.expeditedThreshold = object.expeditedThreshold ?? ""; + message.expeditedMinDeposit = object.expeditedMinDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.burnVoteQuorum = object.burnVoteQuorum ?? false; + message.burnProposalDepositPrevote = object.burnProposalDepositPrevote ?? false; + message.burnVoteVeto = object.burnVoteVeto ?? false; + message.minDepositRatio = object.minDepositRatio ?? ""; + message.maxTallyPeriod = (object.maxTallyPeriod !== undefined && object.maxTallyPeriod !== null) + ? Duration.fromPartial(object.maxTallyPeriod) + : undefined; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.channelId = object.channelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + return message; + }, +}; + +function createBaseDecryptedVoteOption(): DecryptedVoteOption { + return { option: 0, randomNo: 0 }; +} + +export const DecryptedVoteOption: MessageFns = { + encode(message: DecryptedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.randomNo !== 0) { + writer.uint32(16).int64(message.randomNo); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.randomNo = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + randomNo: isSet(object.randomNo) ? globalThis.Number(object.randomNo) : 0, + }; + }, + + toJSON(message: DecryptedVoteOption): unknown { + const obj: any = {}; + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.randomNo !== 0) { + obj.randomNo = Math.round(message.randomNo); + } + return obj; + }, + + create, I>>(base?: I): DecryptedVoteOption { + return DecryptedVoteOption.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptedVoteOption { + const message = createBaseDecryptedVoteOption(); + message.option = object.option ?? 0; + message.randomNo = object.randomNo ?? 0; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/query.ts new file mode 100644 index 00000000..54a6bef2 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/query.ts @@ -0,0 +1,1575 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + Deposit, + DepositParams, + Params, + Proposal, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyParams, + TallyResult, + Vote, + VotingParams, +} from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryConstitutionRequest is the request type for the Query/Constitution RPC method */ +export interface QueryConstitutionRequest { +} + +/** QueryConstitutionResponse is the response type for the Query/Constitution RPC method */ +export interface QueryConstitutionResponse { + constitution: string; +} + +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + /** proposal is the requested governance proposal. */ + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: Params | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryConstitutionRequest(): QueryConstitutionRequest { + return {}; +} + +export const QueryConstitutionRequest: MessageFns = { + encode(_: QueryConstitutionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConstitutionRequest { + return {}; + }, + + toJSON(_: QueryConstitutionRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConstitutionRequest { + return QueryConstitutionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConstitutionRequest { + const message = createBaseQueryConstitutionRequest(); + return message; + }, +}; + +function createBaseQueryConstitutionResponse(): QueryConstitutionResponse { + return { constitution: "" }; +} + +export const QueryConstitutionResponse: MessageFns = { + encode(message: QueryConstitutionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constitution !== "") { + writer.uint32(10).string(message.constitution); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.constitution = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConstitutionResponse { + return { constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "" }; + }, + + toJSON(message: QueryConstitutionResponse): unknown { + const obj: any = {}; + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + return obj; + }, + + create, I>>(base?: I): QueryConstitutionResponse { + return QueryConstitutionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryConstitutionResponse { + const message = createBaseQueryConstitutionResponse(); + message.constitution = object.constitution ?? ""; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined, params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + 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.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Constitution queries the chain's constitution. */ + Constitution(request: QueryConstitutionRequest): Promise; + /** 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 on 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 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 || QueryServiceName; + this.rpc = rpc; + this.Constitution = this.Constitution.bind(this); + 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); + } + Constitution(request: QueryConstitutionRequest): Promise { + const data = QueryConstitutionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Constitution", data); + return promise.then((data) => QueryConstitutionResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/tx.ts new file mode 100644 index 00000000..9f8156b7 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1/tx.ts @@ -0,0 +1,1531 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params, VoteOption, voteOptionFromJSON, voteOptionToJSON, WeightedVoteOption } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages: Any[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * expedited defines if the proposal is expedited or not + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContent { + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** authority must be the gov module address. */ + authority: string; +} + +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse { +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata: string; +} + +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse { +} + +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCancelProposal is the Msg/CancelProposal request type. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** canceled_time is the time when proposal is canceled. */ + canceledTime: + | Date + | undefined; + /** canceled_height defines the block height at which the proposal is canceled. */ + canceledHeight: number; +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { messages: [], initialDeposit: [], proposer: "", metadata: "", title: "", summary: "", expedited: false }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.summary !== "") { + writer.uint32(50).string(message.summary); + } + if (message.expedited !== false) { + writer.uint32(56).bool(message.expedited); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.title = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.summary = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expedited = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + 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)) || []; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.expedited = object.expedited ?? false; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { content: undefined, authority: "" }; +} + +export const MsgExecLegacyContent: MessageFns = { + encode(message: MsgExecLegacyContent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecLegacyContent { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: MsgExecLegacyContent): unknown { + const obj: any = {}; + 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) + ? Any.fromPartial(object.content) + : undefined; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} + +export const MsgExecLegacyContentResponse: MessageFns = { + encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgExecLegacyContentResponse { + return {}; + }, + + toJSON(_: MsgExecLegacyContentResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "" }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "", metadata: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [], metadata: "" }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCancelProposal(): MsgCancelProposal { + return { proposalId: 0, proposer: "" }; +} + +export const MsgCancelProposal: MessageFns = { + encode(message: MsgCancelProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.proposer !== "") { + writer.uint32(18).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgCancelProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposal { + return MsgCancelProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposal { + const message = createBaseMsgCancelProposal(); + message.proposalId = object.proposalId ?? 0; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgCancelProposalResponse(): MsgCancelProposalResponse { + return { proposalId: 0, canceledTime: undefined, canceledHeight: 0 }; +} + +export const MsgCancelProposalResponse: MessageFns = { + encode(message: MsgCancelProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.canceledTime !== undefined) { + Timestamp.encode(toTimestamp(message.canceledTime), writer.uint32(18).fork()).join(); + } + if (message.canceledHeight !== 0) { + writer.uint32(24).uint64(message.canceledHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.canceledTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.canceledHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposalResponse { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + canceledTime: isSet(object.canceledTime) ? fromJsonTimestamp(object.canceledTime) : undefined, + canceledHeight: isSet(object.canceledHeight) ? globalThis.Number(object.canceledHeight) : 0, + }; + }, + + toJSON(message: MsgCancelProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.canceledTime !== undefined) { + obj.canceledTime = message.canceledTime.toISOString(); + } + if (message.canceledHeight !== 0) { + obj.canceledHeight = Math.round(message.canceledHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposalResponse { + return MsgCancelProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposalResponse { + const message = createBaseMsgCancelProposalResponse(); + message.proposalId = object.proposalId ?? 0; + message.canceledTime = object.canceledTime ?? undefined; + message.canceledHeight = object.canceledHeight ?? 0; + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given the messages. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + */ + ExecLegacyContent(request: MsgExecLegacyContent): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): Promise; + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; + /** + * UpdateParams defines a governance operation for updating the x/gov module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CancelProposal defines a method to cancel governance proposal + * + * Since: cosmos-sdk 0.50 + */ + CancelProposal(request: MsgCancelProposal): 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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.ExecLegacyContent = this.ExecLegacyContent.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.CancelProposal = this.CancelProposal.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelProposal(request: MsgCancelProposal): Promise { + const data = MsgCancelProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelProposal", data); + return promise.then((data) => MsgCancelProposalResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 00000000..f70b4ccf --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,234 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + startingProposalId: number; + /** 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[]; + /** deposit_params defines all the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** voting_params defines all the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** tally_params defines all the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/gov.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 00000000..b58fe54c --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1356 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines a encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** aggregated keyshare is used to decrypt the encrypted votes during the tally phase */ + aggrKeyshare: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + noWithVeto: string; + /** encrypted is the number of encrypted votes on a proposal. */ + encrypted: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + * + * @deprecated + */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOption[]; + encryptedVoteData: string; +} + +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: Uint8Array; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: Uint8Array; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: Uint8Array; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseTextProposal(): TextProposal { + return { title: "", description: "" }; +} + +export const TextProposal: MessageFns = { + encode(message: TextProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TextProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: TextProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): TextProposal { + return TextProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + proposalId: 0, + content: undefined, + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + hasEncryptedVotes: false, + identity: "", + pubkey: "", + aggrKeyshare: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(80).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(90).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(98).string(message.pubkey); + } + if (message.aggrKeyshare !== "") { + writer.uint32(106).string(message.aggrKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.identity = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.pubkey = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.aggrKeyshare = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + aggrKeyshare: isSet(object.aggrKeyshare) ? globalThis.String(object.aggrKeyshare) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.aggrKeyshare !== "") { + obj.aggrKeyshare = message.aggrKeyshare; + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.proposalId = object.proposalId ?? 0; + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.aggrKeyshare = object.aggrKeyshare ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes: "", abstain: "", no: "", noWithVeto: "", encrypted: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yes !== "") { + writer.uint32(10).string(message.yes); + } + if (message.abstain !== "") { + writer.uint32(18).string(message.abstain); + } + if (message.no !== "") { + writer.uint32(26).string(message.no); + } + if (message.noWithVeto !== "") { + writer.uint32(34).string(message.noWithVeto); + } + if (message.encrypted !== "") { + writer.uint32(42).string(message.encrypted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yes = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstain = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.no = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVeto = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encrypted = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes: isSet(object.yes) ? globalThis.String(object.yes) : "", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "", + no: isSet(object.no) ? globalThis.String(object.no) : "", + noWithVeto: isSet(object.noWithVeto) ? globalThis.String(object.noWithVeto) : "", + encrypted: isSet(object.encrypted) ? globalThis.String(object.encrypted) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yes !== "") { + obj.yes = message.yes; + } + if (message.abstain !== "") { + obj.abstain = message.abstain; + } + if (message.no !== "") { + obj.no = message.no; + } + if (message.noWithVeto !== "") { + obj.noWithVeto = message.noWithVeto; + } + if (message.encrypted !== "") { + obj.encrypted = message.encrypted; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.noWithVeto = object.noWithVeto ?? ""; + message.encrypted = object.encrypted ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, options: [], encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.encryptedVoteData !== "") { + writer.uint32(42).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: new Uint8Array(0), threshold: new Uint8Array(0), vetoThreshold: new Uint8Array(0) }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + writer.uint32(26).bytes(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? bytesFromBase64(object.quorum) : new Uint8Array(0), + threshold: isSet(object.threshold) ? bytesFromBase64(object.threshold) : new Uint8Array(0), + vetoThreshold: isSet(object.vetoThreshold) ? bytesFromBase64(object.vetoThreshold) : new Uint8Array(0), + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum.length !== 0) { + obj.quorum = base64FromBytes(message.quorum); + } + if (message.threshold.length !== 0) { + obj.threshold = base64FromBytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + obj.vetoThreshold = base64FromBytes(message.vetoThreshold); + } + 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 ?? new Uint8Array(0); + message.threshold = object.threshold ?? new Uint8Array(0); + message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/query.ts new file mode 100644 index 00000000..1e13f7d3 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1413 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** deposit_params defines the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** tally_params defines the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? 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 on proposalID, depositor address. */ + 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 const QueryServiceName = "cosmos.gov.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 00000000..85994854 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,880 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the proposal's content. */ + content: + | Any + | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + 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 defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { content: undefined, initialDeposit: [], proposer: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [] }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgVoteWeighted { + return MsgVoteWeighted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): 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 const MsgServiceName = "cosmos.gov.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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/module/v1/module.ts new file mode 100644 index 00000000..fbcfb65d --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/module/v1/module.ts @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../../../google/protobuf/duration"; + +export const protobufPackage = "cosmos.group.module.v1"; + +/** Module is the config object of the group module. */ +export interface Module { + /** + * max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + * to execute the proposal. + */ + maxExecutionPeriod: + | Duration + | undefined; + /** + * max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; +} + +function createBaseModule(): Module { + return { maxExecutionPeriod: undefined, maxMetadataLen: 0 }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxExecutionPeriod !== undefined) { + Duration.encode(message.maxExecutionPeriod, writer.uint32(10).fork()).join(); + } + if (message.maxMetadataLen !== 0) { + writer.uint32(16).uint64(message.maxMetadataLen); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxExecutionPeriod: isSet(object.maxExecutionPeriod) ? Duration.fromJSON(object.maxExecutionPeriod) : undefined, + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxExecutionPeriod !== undefined) { + obj.maxExecutionPeriod = Duration.toJSON(message.maxExecutionPeriod); + } + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxExecutionPeriod = (object.maxExecutionPeriod !== undefined && object.maxExecutionPeriod !== null) + ? Duration.fromPartial(object.maxExecutionPeriod) + : undefined; + message.maxMetadataLen = object.maxMetadataLen ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/events.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/events.ts new file mode 100644 index 00000000..6a221d4e --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/events.ts @@ -0,0 +1,780 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/events.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyResult, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** 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. */ + proposalId: number; +} + +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposal { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVote { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExec { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** result is the proposal execution result. */ + result: ProposalExecutorResult; + /** logs contains error logs in case the execution result is FAILURE. */ + logs: string; +} + +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroup { + /** group_id is the unique ID of the group. */ + groupId: number; + /** address is the account address of the group member. */ + address: string; +} + +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPruned { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). */ + status: ProposalStatus; + /** tally_result is the proposal tally result (when applicable). */ + tallyResult: TallyResult | undefined; +} + +function createBaseEventCreateGroup(): EventCreateGroup { + return { groupId: 0 }; +} + +export const EventCreateGroup: MessageFns = { + encode(message: EventCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventCreateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroup { + return EventCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroup { + const message = createBaseEventCreateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventUpdateGroup(): EventUpdateGroup { + return { groupId: 0 }; +} + +export const EventUpdateGroup: MessageFns = { + encode(message: EventUpdateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventUpdateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroup { + return EventUpdateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { + return { address: "" }; +} + +export const EventCreateGroupPolicy: MessageFns = { + encode(message: EventCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroupPolicy { + return EventCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { + return { address: "" }; +} + +export const EventUpdateGroupPolicy: MessageFns = { + encode(message: EventUpdateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventUpdateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroupPolicy { + return EventUpdateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventSubmitProposal(): EventSubmitProposal { + return { proposalId: 0 }; +} + +export const EventSubmitProposal: MessageFns = { + encode(message: EventSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSubmitProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventSubmitProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventSubmitProposal { + return EventSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventWithdrawProposal(): EventWithdrawProposal { + return { proposalId: 0 }; +} + +export const EventWithdrawProposal: MessageFns = { + encode(message: EventWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventWithdrawProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventWithdrawProposal { + return EventWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventVote(): EventVote { + return { proposalId: 0 }; +} + +export const EventVote: MessageFns = { + encode(message: EventVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventVote { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventVote { + return EventVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventVote { + const message = createBaseEventVote(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventExec(): EventExec { + return { proposalId: 0, result: 0, logs: "" }; +} + +export const EventExec: MessageFns = { + encode(message: EventExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + if (message.logs !== "") { + writer.uint32(26).string(message.logs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.logs = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0, + logs: isSet(object.logs) ? globalThis.String(object.logs) : "", + }; + }, + + toJSON(message: EventExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + if (message.logs !== "") { + obj.logs = message.logs; + } + return obj; + }, + + create, I>>(base?: I): EventExec { + return EventExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventExec { + const message = createBaseEventExec(); + message.proposalId = object.proposalId ?? 0; + message.result = object.result ?? 0; + message.logs = object.logs ?? ""; + return message; + }, +}; + +function createBaseEventLeaveGroup(): EventLeaveGroup { + return { groupId: 0, address: "" }; +} + +export const EventLeaveGroup: MessageFns = { + encode(message: EventLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventLeaveGroup { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: EventLeaveGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventLeaveGroup { + return EventLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + message.groupId = object.groupId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventProposalPruned(): EventProposalPruned { + return { proposalId: 0, status: 0, tallyResult: undefined }; +} + +export const EventProposalPruned: MessageFns = { + encode(message: EventProposalPruned, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.tallyResult !== undefined) { + TallyResult.encode(message.tallyResult, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventProposalPruned { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventProposalPruned(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.status = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventProposalPruned { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + tallyResult: isSet(object.tallyResult) ? TallyResult.fromJSON(object.tallyResult) : undefined, + }; + }, + + toJSON(message: EventProposalPruned): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.tallyResult !== undefined) { + obj.tallyResult = TallyResult.toJSON(message.tallyResult); + } + return obj; + }, + + create, I>>(base?: I): EventProposalPruned { + return EventProposalPruned.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventProposalPruned { + const message = createBaseEventProposalPruned(); + message.proposalId = object.proposalId ?? 0; + message.status = object.status ?? 0; + message.tallyResult = (object.tallyResult !== undefined && object.tallyResult !== null) + ? TallyResult.fromPartial(object.tallyResult) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/genesis.ts new file mode 100644 index 00000000..b2d21dd4 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/genesis.ts @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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. + */ + groupSeq: number; + /** groups is the list of groups info. */ + groups: GroupInfo[]; + /** group_members is the list of groups members. */ + groupMembers: GroupMember[]; + /** + * group_policy_seq is the group policy table orm.Sequence, + * it is used to generate the next group policy account address. + */ + groupPolicySeq: number; + /** group_policies is the list of group policies info. */ + groupPolicies: GroupPolicyInfo[]; + /** + * proposal_seq is the proposal table orm.Sequence, + * it is used to get the next proposal ID. + */ + proposalSeq: number; + /** proposals is the list of proposals. */ + proposals: Proposal[]; + /** votes is the list of votes. */ + votes: Vote[]; +} + +function createBaseGenesisState(): GenesisState { + return { + groupSeq: 0, + groups: [], + groupMembers: [], + groupPolicySeq: 0, + groupPolicies: [], + proposalSeq: 0, + proposals: [], + votes: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupSeq !== 0) { + writer.uint32(8).uint64(message.groupSeq); + } + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.groupMembers) { + GroupMember.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.groupPolicySeq !== 0) { + writer.uint32(32).uint64(message.groupPolicySeq); + } + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.proposalSeq !== 0) { + writer.uint32(48).uint64(message.proposalSeq); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.groupSeq = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMembers.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.groupPolicySeq = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.proposalSeq = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + groupSeq: isSet(object.groupSeq) ? globalThis.Number(object.groupSeq) : 0, + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + groupMembers: globalThis.Array.isArray(object?.groupMembers) + ? object.groupMembers.map((e: any) => GroupMember.fromJSON(e)) + : [], + groupPolicySeq: isSet(object.groupPolicySeq) ? globalThis.Number(object.groupPolicySeq) : 0, + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + proposalSeq: isSet(object.proposalSeq) ? globalThis.Number(object.proposalSeq) : 0, + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.groupSeq !== 0) { + obj.groupSeq = Math.round(message.groupSeq); + } + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.groupMembers?.length) { + obj.groupMembers = message.groupMembers.map((e) => GroupMember.toJSON(e)); + } + if (message.groupPolicySeq !== 0) { + obj.groupPolicySeq = Math.round(message.groupPolicySeq); + } + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.proposalSeq !== 0) { + obj.proposalSeq = Math.round(message.proposalSeq); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.groupSeq = object.groupSeq ?? 0; + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.groupMembers = object.groupMembers?.map((e) => GroupMember.fromPartial(e)) || []; + message.groupPolicySeq = object.groupPolicySeq ?? 0; + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.proposalSeq = object.proposalSeq ?? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/query.ts new file mode 100644 index 00000000..d64f831a --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/query.ts @@ -0,0 +1,2395 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, TallyResult, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequest { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponse { + /** info is the GroupInfo of the group. */ + info: GroupInfo | undefined; +} + +/** 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 of the group policy. */ + info: GroupPolicyInfo | undefined; +} + +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequest { + /** group_id is the unique ID of the group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequest { + /** group_id is the unique ID of the group policy's group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponse { + /** group_policies are the group policies info associated with the provided group. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponse { + /** group_policies are the group policies info with provided admin. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponse { + /** proposal is the proposal info. */ + proposal: Proposal | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequest { + /** proposal_id is the unique id of a proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +/** + * QueryGroupsRequest is the Query/Groups request type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryGroupsResponse is the Query/Groups response type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsResponse { + /** `groups` is all the groups present in state. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { + return { groupId: 0 }; +} + +export const QueryGroupInfoRequest: MessageFns = { + encode(message: QueryGroupInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoRequest { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: QueryGroupInfoRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoRequest { + return QueryGroupInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { + return { info: undefined }; +} + +export const QueryGroupInfoResponse: MessageFns = { + encode(message: QueryGroupInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoResponse { + return { info: isSet(object.info) ? GroupInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoResponse { + return QueryGroupInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupPolicyInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryGroupPolicyInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoRequest { + return QueryGroupPolicyInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { + return { info: undefined }; +} + +export const QueryGroupPolicyInfoResponse: MessageFns = { + encode(message: QueryGroupPolicyInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupPolicyInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoResponse { + return { info: isSet(object.info) ? GroupPolicyInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupPolicyInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupPolicyInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoResponse { + return QueryGroupPolicyInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupMembersRequest: MessageFns = { + encode(message: QueryGroupMembersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupMembersRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersRequest { + return QueryGroupMembersRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + message.groupId = object.groupId ?? 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: MessageFns = { + encode(message: QueryGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.members) { + GroupMember.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.members.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersResponse { + return { + members: globalThis.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?.length) { + obj.members = message.members.map((e) => GroupMember.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersResponse { + return QueryGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminRequest { + return QueryGroupsByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminResponse { + return QueryGroupsByAdminResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupRequest: MessageFns = { + encode(message: QueryGroupPoliciesByGroupRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupRequest { + return QueryGroupPoliciesByGroupRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + message.groupId = object.groupId ?? 0; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { + return { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupResponse: MessageFns = { + encode(message: QueryGroupPoliciesByGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupResponse { + return QueryGroupPoliciesByGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.groupPolicies = object.groupPolicies?.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: MessageFns = { + encode(message: QueryGroupPoliciesByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminRequest { + return QueryGroupPoliciesByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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 { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByAdminResponse: MessageFns = { + encode(message: QueryGroupPoliciesByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminResponse { + return QueryGroupPoliciesByAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { + return { address: "", pagination: undefined }; +} + +export const QueryProposalsByGroupPolicyRequest: MessageFns = { + encode(message: QueryProposalsByGroupPolicyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsByGroupPolicyRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyRequest { + return QueryProposalsByGroupPolicyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryProposalsByGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyResponse { + return { + 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: QueryProposalsByGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyResponse { + return QueryProposalsByGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, voter: "" }; +} + +export const QueryVoteByProposalVoterRequest: MessageFns = { + encode(message: QueryVoteByProposalVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteByProposalVoterRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + return obj; + }, + + create, I>>(base?: I): QueryVoteByProposalVoterRequest { + return QueryVoteByProposalVoterRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { + return { vote: undefined }; +} + +export const QueryVoteByProposalVoterResponse: MessageFns = { + encode(message: QueryVoteByProposalVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteByProposalVoterResponse): unknown { + const obj: any = {}; + if (message.vote !== undefined) { + obj.vote = Vote.toJSON(message.vote); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVoteByProposalVoterResponse { + return QueryVoteByProposalVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesByProposalRequest: MessageFns = { + encode(message: QueryVotesByProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalRequest { + return QueryVotesByProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesByProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalResponse { + return { + 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: QueryVotesByProposalResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalResponse { + return QueryVotesByProposalResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voter !== "") { + writer.uint32(10).string(message.voter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.voter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterRequest { + return { + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByVoterRequest): unknown { + const obj: any = {}; + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterRequest { + return QueryVotesByVoterRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterResponse { + return { + 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: QueryVotesByVoterResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterResponse { + return QueryVotesByVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByMemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberRequest { + return QueryGroupsByMemberRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberResponse { + return QueryGroupsByMemberResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsRequest(): QueryGroupsRequest { + return { pagination: undefined }; +} + +export const QueryGroupsRequest: MessageFns = { + encode(message: QueryGroupsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGroupsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsRequest { + return QueryGroupsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsRequest { + const message = createBaseQueryGroupsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsResponse(): QueryGroupsResponse { + return { groups: [], pagination: undefined }; +} + +export const QueryGroupsResponse: MessageFns = { + encode(message: QueryGroupsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsResponse { + return { + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsResponse): unknown { + const obj: any = {}; + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsResponse { + return QueryGroupsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsResponse { + const message = createBaseQueryGroupsResponse(); + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : 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 by group id. */ + 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; + /** GroupPoliciesByAdmin 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 id. */ + 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 returns the tally result of a proposal. If the proposal is + * still in voting period, then this query computes the current tally state, + * which might not be final. On the other hand, if the proposal is final, + * then it simply returns the `final_tally_result` state stored in the + * proposal itself. + */ + TallyResult(request: QueryTallyResultRequest): Promise; + /** + * Groups queries all groups in state. + * + * Since: cosmos-sdk 0.47.1 + */ + Groups(request: QueryGroupsRequest): Promise; +} + +export const QueryServiceName = "cosmos.group.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 || QueryServiceName; + 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); + this.Groups = this.Groups.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + Groups(request: QueryGroupsRequest): Promise { + const data = QueryGroupsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Groups", data); + return promise.then((data) => QueryGroupsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/tx.ts new file mode 100644 index 00000000..006eb292 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/tx.ts @@ -0,0 +1,2576 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { + MemberRequest, + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + VoteOption, + voteOptionFromJSON, + voteOptionToJSON, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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: MemberRequest[]; + /** 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. */ + groupId: number; +} + +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembers { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + memberUpdates: MemberRequest[]; +} + +/** 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. */ + groupId: number; + /** new_admin is the group new admin account address. */ + newAdmin: 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. */ + groupId: number; + /** 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. */ + groupId: number; + /** metadata is any arbitrary metadata attached to the group policy. */ + metadata: string; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of the group policy. */ + groupPolicyAddress: string; + /** new_admin is the new group policy admin. */ + newAdmin: string; +} + +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponse { +} + +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicy { + /** admin is the account address of the group and group policy admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequest[]; + /** group_metadata is any arbitrary metadata attached to the group. */ + groupMetadata: string; + /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ + groupPolicyMetadata: string; + /** + * group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + * and group policy admin. + */ + groupPolicyAsAdmin: boolean; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponse { + /** group_id is the unique ID of the newly created group with policy. */ + groupId: number; + /** group_policy_address is the account address of the newly created group policy. */ + groupPolicyAddress: string; +} + +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** decision_policy is the updated group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** metadata is the group policy metadata to be updated. */ + metadata: string; +} + +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponse { +} + +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposal { + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * proposers are the account addresses of the proposers. + * Proposers signatures will be counted as yes votes. + */ + proposers: string[]; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * exec defines the mode of execution of the proposal, + * whether it should be executed immediately on creation or not. + * If so, proposers signatures are considered as Yes votes. + */ + exec: Exec; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal is the unique ID of the proposal. */ + proposalId: number; +} + +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposal { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** 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. */ + proposalId: number; + /** voter is the voter account address. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} + +/** 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. */ + proposalId: number; + /** executor is the account address used to execute the proposal. */ + executor: string; +} + +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponse { + /** result is the final result of the proposal execution. */ + result: ProposalExecutorResult; +} + +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroup { + /** address is the account address of the group member. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponse { +} + +function createBaseMsgCreateGroup(): MsgCreateGroup { + return { admin: "", members: [], metadata: "" }; +} + +export const MsgCreateGroup: MessageFns = { + encode(message: MsgCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroup { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgCreateGroup): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroup { + return MsgCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { + return { groupId: 0 }; +} + +export const MsgCreateGroupResponse: MessageFns = { + encode(message: MsgCreateGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupResponse { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: MsgCreateGroupResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupResponse { + return MsgCreateGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { + return { admin: "", groupId: 0, memberUpdates: [] }; +} + +export const MsgUpdateGroupMembers: MessageFns = { + encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + for (const v of message.memberUpdates) { + MemberRequest.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.memberUpdates.push(MemberRequest.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMembers { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + memberUpdates: globalThis.Array.isArray(object?.memberUpdates) + ? object.memberUpdates.map((e: any) => MemberRequest.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgUpdateGroupMembers): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.memberUpdates?.length) { + obj.memberUpdates = message.memberUpdates.map((e) => MemberRequest.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.memberUpdates = object.memberUpdates?.map((e) => MemberRequest.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { + return {}; +} + +export const MsgUpdateGroupMembersResponse: MessageFns = { + encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMembersResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMembersResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { + return { admin: "", groupId: 0, newAdmin: "" }; +} + +export const MsgUpdateGroupAdmin: MessageFns = { + encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { + return {}; +} + +export const MsgUpdateGroupAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { + return { admin: "", groupId: 0, metadata: "" }; +} + +export const MsgUpdateGroupMetadata: MessageFns = { + encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { + return {}; +} + +export const MsgUpdateGroupMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { + return { admin: "", groupId: 0, metadata: "", decisionPolicy: undefined }; +} + +export const MsgCreateGroupPolicy: MessageFns = { + encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { + return { address: "" }; +} + +export const MsgCreateGroupPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicyResponse { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: MsgCreateGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { + return { admin: "", groupPolicyAddress: "", newAdmin: "" }; +} + +export const MsgUpdateGroupPolicyAdmin: MessageFns = { + encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { + return {}; +} + +export const MsgUpdateGroupPolicyAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { + return { + admin: "", + members: [], + groupMetadata: "", + groupPolicyMetadata: "", + groupPolicyAsAdmin: false, + decisionPolicy: undefined, + }; +} + +export const MsgCreateGroupWithPolicy: MessageFns = { + encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.groupMetadata !== "") { + writer.uint32(26).string(message.groupMetadata); + } + if (message.groupPolicyMetadata !== "") { + writer.uint32(34).string(message.groupPolicyMetadata); + } + if (message.groupPolicyAsAdmin !== false) { + writer.uint32(40).bool(message.groupPolicyAsAdmin); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMetadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.groupPolicyMetadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.groupPolicyAsAdmin = reader.bool(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + groupMetadata: isSet(object.groupMetadata) ? globalThis.String(object.groupMetadata) : "", + groupPolicyMetadata: isSet(object.groupPolicyMetadata) ? globalThis.String(object.groupPolicyMetadata) : "", + groupPolicyAsAdmin: isSet(object.groupPolicyAsAdmin) ? globalThis.Boolean(object.groupPolicyAsAdmin) : false, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupWithPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.groupMetadata !== "") { + obj.groupMetadata = message.groupMetadata; + } + if (message.groupPolicyMetadata !== "") { + obj.groupPolicyMetadata = message.groupPolicyMetadata; + } + if (message.groupPolicyAsAdmin !== false) { + obj.groupPolicyAsAdmin = message.groupPolicyAsAdmin; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.groupMetadata = object.groupMetadata ?? ""; + message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; + message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { + return { groupId: 0, groupPolicyAddress: "" }; +} + +export const MsgCreateGroupWithPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicyResponse { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + }; + }, + + toJSON(message: MsgCreateGroupWithPolicyResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + message.groupId = object.groupId ?? 0; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { + return { admin: "", groupPolicyAddress: "", decisionPolicy: undefined }; +} + +export const MsgUpdateGroupPolicyDecisionPolicy: MessageFns = { + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyDecisionPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; +} + +export const MsgUpdateGroupPolicyDecisionPolicyResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { + return { admin: "", groupPolicyAddress: "", metadata: "" }; +} + +export const MsgUpdateGroupPolicyMetadata: MessageFns = { + encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { + return {}; +} + +export const MsgUpdateGroupPolicyMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, +}; + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { groupPolicyAddress: "", proposers: [], metadata: "", messages: [], exec: 0, title: "", summary: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupPolicyAddress !== "") { + writer.uint32(10).string(message.groupPolicyAddress); + } + for (const v of message.proposers) { + writer.uint32(18).string(v!); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + if (message.title !== "") { + writer.uint32(50).string(message.title); + } + if (message.summary !== "") { + writer.uint32(58).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.title = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.metadata = object.metadata ?? ""; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.exec = object.exec ?? 0; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { + return { proposalId: 0, address: "" }; +} + +export const MsgWithdrawProposal: MessageFns = { + encode(message: MsgWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: MsgWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposal { + return MsgWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { + return {}; +} + +export const MsgWithdrawProposalResponse: MessageFns = { + encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgWithdrawProposalResponse { + return {}; + }, + + toJSON(_: MsgWithdrawProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "", exec: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { proposalId: 0, executor: "" }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.executor !== "") { + writer.uint32(18).string(message.executor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.executor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + executor: isSet(object.executor) ? globalThis.String(object.executor) : "", + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.executor !== "") { + obj.executor = message.executor; + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.proposalId = object.proposalId ?? 0; + message.executor = object.executor ?? ""; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { result: 0 }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroup(): MsgLeaveGroup { + return { address: "", groupId: 0 }; +} + +export const MsgLeaveGroup: MessageFns = { + encode(message: MsgLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgLeaveGroup { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + }; + }, + + toJSON(message: MsgLeaveGroup): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroup { + return MsgLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { + return {}; +} + +export const MsgLeaveGroupResponse: MessageFns = { + encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgLeaveGroupResponse { + return {}; + }, + + toJSON(_: MsgLeaveGroupResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.fromPartial(base ?? ({} as any)); + }, + 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 withdraws 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 const MsgServiceName = "cosmos.group.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/types.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/types.ts new file mode 100644 index 00000000..3f7a9e54 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/group/v1/types.ts @@ -0,0 +1,1799 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given proposal. */ +export enum VoteOption { + /** + * VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will + * return an error. + */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} + +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} + +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus defines proposal statuses. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when submitted. */ + PROPOSAL_STATUS_SUBMITTED = 1, + /** + * PROPOSAL_STATUS_ACCEPTED - Final status of a proposal when the final tally is done and the outcome + * passes the group policy's decision policy. + */ + PROPOSAL_STATUS_ACCEPTED = 2, + /** + * PROPOSAL_STATUS_REJECTED - Final status of a proposal when the final tally is done and the outcome + * is rejected by the group policy's decision policy. + */ + PROPOSAL_STATUS_REJECTED = 3, + /** + * PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group policy is modified before the + * final tally. + */ + PROPOSAL_STATUS_ABORTED = 4, + /** + * PROPOSAL_STATUS_WITHDRAWN - A proposal can be withdrawn before the voting start time by the owner. + * When this happens the final status is Withdrawn. + */ + PROPOSAL_STATUS_WITHDRAWN = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_SUBMITTED": + return ProposalStatus.PROPOSAL_STATUS_SUBMITTED; + case 2: + case "PROPOSAL_STATUS_ACCEPTED": + return ProposalStatus.PROPOSAL_STATUS_ACCEPTED; + case 3: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 4: + case "PROPOSAL_STATUS_ABORTED": + return ProposalStatus.PROPOSAL_STATUS_ABORTED; + case 5: + case "PROPOSAL_STATUS_WITHDRAWN": + return ProposalStatus.PROPOSAL_STATUS_WITHDRAWN; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_SUBMITTED: + return "PROPOSAL_STATUS_SUBMITTED"; + case ProposalStatus.PROPOSAL_STATUS_ACCEPTED: + return "PROPOSAL_STATUS_ACCEPTED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return "PROPOSAL_STATUS_ABORTED"; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return "PROPOSAL_STATUS_WITHDRAWN"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalExecutorResult defines types of proposal executor results. */ +export enum ProposalExecutorResult { + /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ + PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0, + /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ + PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1, + /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ + PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2, + /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ + PROPOSAL_EXECUTOR_RESULT_FAILURE = 3, + UNRECOGNIZED = -1, +} + +export function proposalExecutorResultFromJSON(object: any): ProposalExecutorResult { + switch (object) { + case 0: + case "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; + case 1: + case "PROPOSAL_EXECUTOR_RESULT_NOT_RUN": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN; + case 2: + case "PROPOSAL_EXECUTOR_RESULT_SUCCESS": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS; + case 3: + case "PROPOSAL_EXECUTOR_RESULT_FAILURE": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE; + case -1: + case "UNRECOGNIZED": + default: + return ProposalExecutorResult.UNRECOGNIZED; + } +} + +export function proposalExecutorResultToJSON(object: ProposalExecutorResult): string { + switch (object) { + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: + return "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN: + return "PROPOSAL_EXECUTOR_RESULT_NOT_RUN"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS: + return "PROPOSAL_EXECUTOR_RESULT_SUCCESS"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE: + return "PROPOSAL_EXECUTOR_RESULT_FAILURE"; + case ProposalExecutorResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface Member { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + addedAt: Date | undefined; +} + +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequest { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; +} + +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicy { + /** + * threshold is the minimum weighted sum of `YES` votes that must be met or + * exceeded for a proposal to succeed. + */ + threshold: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicy { + /** + * percentage is the minimum percentage of the weighted sum of `YES` votes must + * meet for a proposal to succeed. + */ + percentage: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindows { + /** + * voting_period is the duration from submission of a proposal to the end of voting period + * Within this times votes can be submitted with MsgVote. + */ + votingPeriod: + | Duration + | undefined; + /** + * min_execution_period is the minimum duration after the proposal submission + * where members can start sending MsgExec. This means that the window for + * sending a MsgExec transaction is: + * `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + * where max_execution_period is a app-specific config, defined in the keeper. + * If not set, min_execution_period will default to 0. + * + * Please make sure to set a `min_execution_period` that is smaller than + * `voting_period + max_execution_period`, or else the above execution window + * is empty, meaning that all proposals created with this decision policy + * won't be able to be executed. + */ + minExecutionPeriod: Duration | undefined; +} + +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfo { + /** id is the unique ID of the group. */ + id: number; + /** admin is the account address of the group's admin. */ + admin: string; + /** + * metadata is any arbitrary metadata to attached to the group. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 + */ + metadata: string; + /** + * version is used to track changes to a group's membership structure that + * would break existing proposals. Whenever any members weight is changed, + * or any member is added or removed this version is incremented and will + * cause proposals based on older versions of this group to fail + */ + version: number; + /** total_weight is the sum of the group members' weights. */ + totalWeight: string; + /** created_at is a timestamp specifying when a group was created. */ + createdAt: Date | undefined; +} + +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMember { + /** group_id is the unique ID of the group. */ + groupId: number; + /** member is the member data. */ + member: Member | undefined; +} + +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfo { + /** address is the account address of group policy. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** admin is the account address of the group admin. */ + admin: string; + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ + metadata: string; + /** + * version is used to track changes to a group's GroupPolicyInfo structure that + * would create a different result on a running proposal. + */ + version: number; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: + | Any + | undefined; + /** created_at is a timestamp specifying when a group policy was created. */ + createdAt: Date | undefined; +} + +/** + * 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: number; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ + metadata: string; + /** proposers are the account addresses of the proposers. */ + proposers: string[]; + /** submit_time is a timestamp specifying when a proposal was submitted. */ + submitTime: + | Date + | undefined; + /** + * group_version tracks the version of the group at proposal submission. + * This field is here for informational purposes only. + */ + groupVersion: number; + /** + * group_policy_version tracks the version of the group policy at proposal submission. + * When a decision policy is changed, existing proposals from previous policy + * versions will become invalid with the `ABORTED` status. + * This field is here for informational purposes only. + */ + groupPolicyVersion: number; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option. It is empty at submission, and only + * populated after tallying, at voting period end or at proposal execution, + * whichever happens first. + */ + finalTallyResult: + | TallyResult + | undefined; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successful MsgExec is called before (to execute a proposal whose + * tally is successful before the voting period ends), tallying will be done + * at this point, and the `final_tally_result`and `status` fields will be + * accordingly updated. + */ + votingPeriodEnd: + | Date + | undefined; + /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ + executorResult: ProposalExecutorResult; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResult { + /** yes_count is the weighted sum of yes votes. */ + yesCount: string; + /** abstain_count is the weighted sum of abstainers. */ + abstainCount: string; + /** no_count is the weighted sum of no votes. */ + noCount: string; + /** no_with_veto_count is the weighted sum of veto. */ + noWithVetoCount: string; +} + +/** Vote represents a vote for a proposal.string metadata */ +export interface Vote { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** voter is the account address of the voter. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 + */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submitTime: Date | undefined; +} + +function createBaseMember(): Member { + return { address: "", weight: "", metadata: "", addedAt: undefined }; +} + +export const Member: MessageFns = { + encode(message: Member, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.addedAt !== undefined) { + Timestamp.encode(toTimestamp(message.addedAt), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Member { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.addedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Member { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + addedAt: isSet(object.addedAt) ? fromJsonTimestamp(object.addedAt) : undefined, + }; + }, + + toJSON(message: Member): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.addedAt !== undefined) { + obj.addedAt = message.addedAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Member { + return Member.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Member { + const message = createBaseMember(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + message.addedAt = object.addedAt ?? undefined; + return message; + }, +}; + +function createBaseMemberRequest(): MemberRequest { + return { address: "", weight: "", metadata: "" }; +} + +export const MemberRequest: MessageFns = { + encode(message: MemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MemberRequest { + return MemberRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MemberRequest { + const message = createBaseMemberRequest(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { + return { threshold: "", windows: undefined }; +} + +export const ThresholdDecisionPolicy: MessageFns = { + encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== "") { + writer.uint32(10).string(message.threshold); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseThresholdDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.threshold = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ThresholdDecisionPolicy { + return { + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: ThresholdDecisionPolicy): unknown { + const obj: any = {}; + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: PercentageDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.percentage !== "") { + writer.uint32(10).string(message.percentage); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePercentageDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.percentage = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PercentageDecisionPolicy { + return { + percentage: isSet(object.percentage) ? globalThis.String(object.percentage) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: PercentageDecisionPolicy): unknown { + const obj: any = {}; + if (message.percentage !== "") { + obj.percentage = message.percentage; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): PercentageDecisionPolicy { + return PercentageDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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 { votingPeriod: undefined, minExecutionPeriod: undefined }; +} + +export const DecisionPolicyWindows: MessageFns = { + encode(message: DecisionPolicyWindows, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + if (message.minExecutionPeriod !== undefined) { + Duration.encode(message.minExecutionPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecisionPolicyWindows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecisionPolicyWindows { + return { + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + minExecutionPeriod: isSet(object.minExecutionPeriod) ? Duration.fromJSON(object.minExecutionPeriod) : undefined, + }; + }, + + toJSON(message: DecisionPolicyWindows): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.minExecutionPeriod !== undefined) { + obj.minExecutionPeriod = Duration.toJSON(message.minExecutionPeriod); + } + return obj; + }, + + create, I>>(base?: I): DecisionPolicyWindows { + return DecisionPolicyWindows.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.minExecutionPeriod = (object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null) + ? Duration.fromPartial(object.minExecutionPeriod) + : undefined; + return message; + }, +}; + +function createBaseGroupInfo(): GroupInfo { + return { id: 0, admin: "", metadata: "", version: 0, totalWeight: "", createdAt: undefined }; +} + +export const GroupInfo: MessageFns = { + encode(message: GroupInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.totalWeight !== "") { + writer.uint32(42).string(message.totalWeight); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.admin = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.totalWeight = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupInfo { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + totalWeight: isSet(object.totalWeight) ? globalThis.String(object.totalWeight) : "", + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupInfo): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.totalWeight !== "") { + obj.totalWeight = message.totalWeight; + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupInfo { + return GroupInfo.fromPartial(base ?? ({} as any)); + }, + 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.totalWeight = object.totalWeight ?? ""; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseGroupMember(): GroupMember { + return { groupId: 0, member: undefined }; +} + +export const GroupMember: MessageFns = { + encode(message: GroupMember, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.member !== undefined) { + Member.encode(message.member, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.member = Member.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupMember { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + member: isSet(object.member) ? Member.fromJSON(object.member) : undefined, + }; + }, + + toJSON(message: GroupMember): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.member !== undefined) { + obj.member = Member.toJSON(message.member); + } + return obj; + }, + + create, I>>(base?: I): GroupMember { + return GroupMember.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupMember { + const message = createBaseGroupMember(); + message.groupId = object.groupId ?? 0; + message.member = (object.member !== undefined && object.member !== null) + ? Member.fromPartial(object.member) + : undefined; + return message; + }, +}; + +function createBaseGroupPolicyInfo(): GroupPolicyInfo { + return { + address: "", + groupId: 0, + admin: "", + metadata: "", + version: 0, + decisionPolicy: undefined, + createdAt: undefined, + }; +} + +export const GroupPolicyInfo: MessageFns = { + encode(message: GroupPolicyInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.version !== 0) { + writer.uint32(40).uint64(message.version); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupPolicyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.admin = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupPolicyInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupPolicyInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupPolicyInfo { + return GroupPolicyInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version ?? 0; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + groupPolicyAddress: "", + metadata: "", + proposers: [], + submitTime: undefined, + groupVersion: 0, + groupPolicyVersion: 0, + status: 0, + finalTallyResult: undefined, + votingPeriodEnd: undefined, + executorResult: 0, + messages: [], + title: "", + summary: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.proposers) { + writer.uint32(34).string(v!); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.groupVersion !== 0) { + writer.uint32(48).uint64(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + writer.uint32(56).uint64(message.groupPolicyVersion); + } + if (message.status !== 0) { + writer.uint32(64).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(74).fork()).join(); + } + if (message.votingPeriodEnd !== undefined) { + Timestamp.encode(toTimestamp(message.votingPeriodEnd), writer.uint32(82).fork()).join(); + } + if (message.executorResult !== 0) { + writer.uint32(88).int32(message.executorResult); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.title !== "") { + writer.uint32(106).string(message.title); + } + if (message.summary !== "") { + writer.uint32(114).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.groupVersion = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.groupPolicyVersion = longToNumber(reader.uint64()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.status = reader.int32() as any; + continue; + case 9: + if (tag !== 74) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.votingPeriodEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.executorResult = reader.int32() as any; + continue; + case 12: + if (tag !== 98) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.title = reader.string(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + groupVersion: isSet(object.groupVersion) ? globalThis.Number(object.groupVersion) : 0, + groupPolicyVersion: isSet(object.groupPolicyVersion) ? globalThis.Number(object.groupPolicyVersion) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + votingPeriodEnd: isSet(object.votingPeriodEnd) ? fromJsonTimestamp(object.votingPeriodEnd) : undefined, + executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : 0, + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.groupVersion !== 0) { + obj.groupVersion = Math.round(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + obj.groupPolicyVersion = Math.round(message.groupPolicyVersion); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.votingPeriodEnd !== undefined) { + obj.votingPeriodEnd = message.votingPeriodEnd.toISOString(); + } + if (message.executorResult !== 0) { + obj.executorResult = proposalExecutorResultToJSON(message.executorResult); + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + 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; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.submitTime = object.submitTime ?? undefined; + message.groupVersion = object.groupVersion ?? 0; + message.groupPolicyVersion = object.groupPolicyVersion ?? 0; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; + message.executorResult = object.executorResult ?? 0; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, metadata: "", submitTime: undefined }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.submitTime = object.submitTime ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/module/v1/module.ts new file mode 100644 index 00000000..233c0dd3 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.module.v1"; + +/** Module is the config object of the mint module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 00000000..d5580d2d --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,124 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** params defines all the parameters of the module. */ + params: Params | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { minter: undefined, params: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.minter = Minter.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.minter !== undefined) { + obj.minter = Minter.toJSON(message.minter); + } + 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.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/mint.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 00000000..c9b14ff0 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,285 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/mint.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** Minter represents the minting state. */ +export interface Minter { + /** current annual inflation rate */ + inflation: string; + /** current annual expected provisions */ + annualProvisions: string; +} + +/** Params defines the parameters for the x/mint module. */ +export interface Params { + /** type of coin to mint */ + mintDenom: string; + /** maximum annual change in inflation rate */ + inflationRateChange: string; + /** maximum inflation rate */ + inflationMax: string; + /** minimum inflation rate */ + inflationMin: string; + /** goal of percent bonded atoms */ + goalBonded: string; + /** expected blocks per year */ + blocksPerYear: number; +} + +function createBaseMinter(): Minter { + return { inflation: "", annualProvisions: "" }; +} + +export const Minter: MessageFns = { + encode(message: Minter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation !== "") { + writer.uint32(10).string(message.inflation); + } + if (message.annualProvisions !== "") { + writer.uint32(18).string(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Minter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.annualProvisions = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Minter { + return { + inflation: isSet(object.inflation) ? globalThis.String(object.inflation) : "", + annualProvisions: isSet(object.annualProvisions) ? globalThis.String(object.annualProvisions) : "", + }; + }, + + toJSON(message: Minter): unknown { + const obj: any = {}; + if (message.inflation !== "") { + obj.inflation = message.inflation; + } + if (message.annualProvisions !== "") { + obj.annualProvisions = message.annualProvisions; + } + return obj; + }, + + create, I>>(base?: I): Minter { + return Minter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Minter { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annualProvisions = object.annualProvisions ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + mintDenom: "", + inflationRateChange: "", + inflationMax: "", + inflationMin: "", + goalBonded: "", + blocksPerYear: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mintDenom !== "") { + writer.uint32(10).string(message.mintDenom); + } + if (message.inflationRateChange !== "") { + writer.uint32(18).string(message.inflationRateChange); + } + if (message.inflationMax !== "") { + writer.uint32(26).string(message.inflationMax); + } + if (message.inflationMin !== "") { + writer.uint32(34).string(message.inflationMin); + } + if (message.goalBonded !== "") { + writer.uint32(42).string(message.goalBonded); + } + if (message.blocksPerYear !== 0) { + writer.uint32(48).uint64(message.blocksPerYear); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.mintDenom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.inflationRateChange = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.inflationMax = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.inflationMin = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.goalBonded = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.blocksPerYear = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + mintDenom: isSet(object.mintDenom) ? globalThis.String(object.mintDenom) : "", + inflationRateChange: isSet(object.inflationRateChange) ? globalThis.String(object.inflationRateChange) : "", + inflationMax: isSet(object.inflationMax) ? globalThis.String(object.inflationMax) : "", + inflationMin: isSet(object.inflationMin) ? globalThis.String(object.inflationMin) : "", + goalBonded: isSet(object.goalBonded) ? globalThis.String(object.goalBonded) : "", + blocksPerYear: isSet(object.blocksPerYear) ? globalThis.Number(object.blocksPerYear) : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.mintDenom !== "") { + obj.mintDenom = message.mintDenom; + } + if (message.inflationRateChange !== "") { + obj.inflationRateChange = message.inflationRateChange; + } + if (message.inflationMax !== "") { + obj.inflationMax = message.inflationMax; + } + if (message.inflationMin !== "") { + obj.inflationMin = message.inflationMin; + } + if (message.goalBonded !== "") { + obj.goalBonded = message.goalBonded; + } + if (message.blocksPerYear !== 0) { + obj.blocksPerYear = Math.round(message.blocksPerYear); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.mintDenom = object.mintDenom ?? ""; + message.inflationRateChange = object.inflationRateChange ?? ""; + message.inflationMax = object.inflationMax ?? ""; + message.inflationMin = object.inflationMin ?? ""; + message.goalBonded = object.goalBonded ?? ""; + message.blocksPerYear = object.blocksPerYear ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/query.ts new file mode 100644 index 00000000..c90cf9db --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,450 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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. */ + annualProvisions: Uint8Array; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryInflationRequest(): QueryInflationRequest { + return {}; +} + +export const QueryInflationRequest: MessageFns = { + encode(_: QueryInflationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryInflationRequest { + return {}; + }, + + toJSON(_: QueryInflationRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryInflationRequest { + return QueryInflationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, +}; + +function createBaseQueryInflationResponse(): QueryInflationResponse { + return { inflation: new Uint8Array(0) }; +} + +export const QueryInflationResponse: MessageFns = { + encode(message: QueryInflationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryInflationResponse { + return { inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array(0) }; + }, + + toJSON(message: QueryInflationResponse): unknown { + const obj: any = {}; + if (message.inflation.length !== 0) { + obj.inflation = base64FromBytes(message.inflation); + } + return obj; + }, + + create, I>>(base?: I): QueryInflationResponse { + return QueryInflationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { + return {}; +} + +export const QueryAnnualProvisionsRequest: MessageFns = { + encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAnnualProvisionsRequest { + return {}; + }, + + toJSON(_: QueryAnnualProvisionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { + return { annualProvisions: new Uint8Array(0) }; +} + +export const QueryAnnualProvisionsResponse: MessageFns = { + encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.annualProvisions.length !== 0) { + writer.uint32(10).bytes(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.annualProvisions = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAnnualProvisionsResponse { + return { + annualProvisions: isSet(object.annualProvisions) ? bytesFromBase64(object.annualProvisions) : new Uint8Array(0), + }; + }, + + toJSON(message: QueryAnnualProvisionsResponse): unknown { + const obj: any = {}; + if (message.annualProvisions.length !== 0) { + obj.annualProvisions = base64FromBytes(message.annualProvisions); + } + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annualProvisions = object.annualProvisions ?? new Uint8Array(0); + 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 const QueryServiceName = "cosmos.mint.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/tx.ts new file mode 100644 index 00000000..c3d6285e --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/mint/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./mint"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/mint parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/mint Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/mint module + * parameters. The authority is defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.mint.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/msg/textual/v1/textual.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/msg/textual/v1/textual.ts new file mode 100644 index 00000000..cb8b705c --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/msg/textual/v1/textual.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/textual/v1/textual.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.textual.v1"; diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/module/v1/module.ts new file mode 100644 index 00000000..6a444831 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.nft.module.v1"; + +/** Module is the config object of the nft module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/event.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/event.ts new file mode 100644 index 00000000..81e4fb5e --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/event.ts @@ -0,0 +1,349 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** EventSend is emitted on Msg/Send */ +export interface EventSend { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} + +/** EventMint is emitted on Mint */ +export interface EventMint { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} + +/** EventBurn is emitted on Burn */ +export interface EventBurn { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} + +function createBaseEventSend(): EventSend { + return { classId: "", id: "", sender: "", receiver: "" }; +} + +export const EventSend: MessageFns = { + encode(message: EventSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + 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: BinaryReader | Uint8Array, length?: number): EventSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.receiver = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSend { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", + }; + }, + + toJSON(message: EventSend): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + + create, I>>(base?: I): EventSend { + return EventSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSend { + const message = createBaseEventSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseEventMint(): EventMint { + return { classId: "", id: "", owner: "" }; +} + +export const EventMint: MessageFns = { + encode(message: EventMint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventMint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventMint { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: EventMint): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): EventMint { + return EventMint.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventMint { + const message = createBaseEventMint(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseEventBurn(): EventBurn { + return { classId: "", id: "", owner: "" }; +} + +export const EventBurn: MessageFns = { + encode(message: EventBurn, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventBurn { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventBurn { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: EventBurn): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): EventBurn { + return EventBurn.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventBurn { + const message = createBaseEventBurn(); + message.classId = object.classId ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/genesis.ts new file mode 100644 index 00000000..e310a55d --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/genesis.ts @@ -0,0 +1,200 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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[]; + /** entry defines all nft owned by a person. */ + 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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + Entry.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.classes.push(Class.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(Entry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + classes: globalThis.Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => Entry.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.classes?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => Entry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Entry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Entry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.owner = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Entry { + return { + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + nfts: globalThis.Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + }; + }, + + toJSON(message: Entry): unknown { + const obj: any = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Entry { + return Entry.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/nft.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/nft.ts new file mode 100644 index 00000000..bbfc88c2 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/nft.ts @@ -0,0 +1,336 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/nft.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 */ + uriHash: string; + /** data is the app specific metadata of the NFT class. Optional */ + data: Any | undefined; +} + +/** NFT defines the NFT. */ +export interface NFT { + /** class_id associated with the NFT, similar to the contract address of ERC721 */ + classId: 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 */ + uriHash: string; + /** data is an app specific data of the NFT. Optional */ + data: Any | undefined; +} + +function createBaseClass(): Class { + return { id: "", name: "", symbol: "", description: "", uri: "", uriHash: "", data: undefined }; +} + +export const Class: MessageFns = { + encode(message: Class, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.uriHash !== "") { + writer.uint32(50).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Class { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.symbol = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.description = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.uri = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.uriHash = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Class { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: Class): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): Class { + return Class.fromPartial(base ?? ({} as any)); + }, + 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.uriHash = object.uriHash ?? ""; + message.data = (object.data !== undefined && object.data !== null) ? Any.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseNFT(): NFT { + return { classId: "", id: "", uri: "", uriHash: "", data: undefined }; +} + +export const NFT: MessageFns = { + encode(message: NFT, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.uri !== "") { + writer.uint32(26).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(34).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NFT { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.uri = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.uriHash = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NFT { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: NFT): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): NFT { + return NFT.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NFT { + const message = createBaseNFT(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/query.ts new file mode 100644 index 00000000..869693cd --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/query.ts @@ -0,0 +1,1152 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; +} + +/** QueryBalanceResponse is the response type for the Query/Balance RPC method */ +export interface QueryBalanceResponse { + /** amount is the number of all NFTs of a given class owned by the owner */ + amount: number; +} + +/** QueryOwnerRequest is the request type for the Query/Owner RPC method */ +export interface QueryOwnerRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} + +/** QueryOwnerResponse is the response type for the Query/Owner RPC method */ +export interface QueryOwnerResponse { + /** owner is the owner address of the nft */ + owner: string; +} + +/** QuerySupplyRequest is the request type for the Query/Supply RPC method */ +export interface QuerySupplyRequest { + /** class_id associated with the nft */ + classId: string; +} + +/** QuerySupplyResponse is the response type for the Query/Supply RPC method */ +export interface QuerySupplyResponse { + /** amount is the number of all NFTs from the given class */ + amount: number; +} + +/** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ +export interface QueryNFTsRequest { + /** class_id associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ +export interface QueryNFTsResponse { + /** NFT defines the NFT */ + nfts: NFT[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryNFTRequest is the request type for the Query/NFT RPC method */ +export interface QueryNFTRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} + +/** QueryNFTResponse is the response type for the Query/NFT RPC method */ +export interface QueryNFTResponse { + /** owner is the owner address of the nft */ + nft: NFT | undefined; +} + +/** QueryClassRequest is the request type for the Query/Class RPC method */ +export interface QueryClassRequest { + /** class_id associated with the nft */ + classId: string; +} + +/** QueryClassResponse is the response type for the Query/Class RPC method */ +export interface QueryClassResponse { + /** class defines the class of the nft type. */ + class: Class | undefined; +} + +/** QueryClassesRequest is the request type for the Query/Classes RPC method */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryClassesResponse is the response type for the Query/Classes RPC method */ +export interface QueryClassesResponse { + /** class defines the class of the nft type. */ + classes: Class[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { classId: "", owner: "" }; +} + +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.classId = object.classId ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { amount: 0 }; +} + +export const QueryBalanceResponse: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.amount = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; + +function createBaseQueryOwnerRequest(): QueryOwnerRequest { + return { classId: "", id: "" }; +} + +export const QueryOwnerRequest: MessageFns = { + encode(message: QueryOwnerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryOwnerRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: QueryOwnerRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): QueryOwnerRequest { + return QueryOwnerRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryOwnerRequest { + const message = createBaseQueryOwnerRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryOwnerResponse(): QueryOwnerResponse { + return { owner: "" }; +} + +export const QueryOwnerResponse: MessageFns = { + encode(message: QueryOwnerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryOwnerResponse { + return { owner: isSet(object.owner) ? globalThis.String(object.owner) : "" }; + }, + + toJSON(message: QueryOwnerResponse): unknown { + const obj: any = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): QueryOwnerResponse { + return QueryOwnerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryOwnerResponse { + const message = createBaseQueryOwnerResponse(); + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyRequest(): QuerySupplyRequest { + return { classId: "" }; +} + +export const QuerySupplyRequest: MessageFns = { + encode(message: QuerySupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyRequest { + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; + }, + + toJSON(message: QuerySupplyRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyRequest { + return QuerySupplyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyRequest { + const message = createBaseQuerySupplyRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyResponse(): QuerySupplyResponse { + return { amount: 0 }; +} + +export const QuerySupplyResponse: MessageFns = { + encode(message: QuerySupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.amount = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyResponse { + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; + }, + + toJSON(message: QuerySupplyResponse): unknown { + const obj: any = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyResponse { + return QuerySupplyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyResponse { + const message = createBaseQuerySupplyResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; + +function createBaseQueryNFTsRequest(): QueryNFTsRequest { + return { classId: "", owner: "", pagination: undefined }; +} + +export const QueryNFTsRequest: MessageFns = { + encode(message: QueryNFTsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.owner = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTsRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryNFTsRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTsRequest { + return QueryNFTsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryNFTsRequest { + const message = createBaseQueryNFTsRequest(); + message.classId = object.classId ?? ""; + 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: MessageFns = { + encode(message: QueryNFTsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTsResponse { + return { + nfts: globalThis.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?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTsResponse { + return QueryNFTsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { classId: "", id: "" }; +} + +export const QueryNFTRequest: MessageFns = { + encode(message: QueryNFTRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: QueryNFTRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): QueryNFTRequest { + return QueryNFTRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryNFTRequest { + const message = createBaseQueryNFTRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryNFTResponse(): QueryNFTResponse { + return { nft: undefined }; +} + +export const QueryNFTResponse: MessageFns = { + encode(message: QueryNFTResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nft !== undefined) { + NFT.encode(message.nft, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.nft = NFT.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTResponse { + return { nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined }; + }, + + toJSON(message: QueryNFTResponse): unknown { + const obj: any = {}; + if (message.nft !== undefined) { + obj.nft = NFT.toJSON(message.nft); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTResponse { + return QueryNFTResponse.fromPartial(base ?? ({} as any)); + }, + 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 { classId: "" }; +} + +export const QueryClassRequest: MessageFns = { + encode(message: QueryClassRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassRequest { + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; + }, + + toJSON(message: QueryClassRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + + create, I>>(base?: I): QueryClassRequest { + return QueryClassRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryClassRequest { + const message = createBaseQueryClassRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; + +function createBaseQueryClassResponse(): QueryClassResponse { + return { class: undefined }; +} + +export const QueryClassResponse: MessageFns = { + encode(message: QueryClassResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.class !== undefined) { + Class.encode(message.class, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.class = Class.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassResponse { + return { class: isSet(object.class) ? Class.fromJSON(object.class) : undefined }; + }, + + toJSON(message: QueryClassResponse): unknown { + const obj: any = {}; + if (message.class !== undefined) { + obj.class = Class.toJSON(message.class); + } + return obj; + }, + + create, I>>(base?: I): QueryClassResponse { + return QueryClassResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryClassesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryClassesRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryClassesRequest { + return QueryClassesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryClassesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classes.push(Class.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassesResponse { + return { + classes: globalThis.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?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryClassesResponse { + return QueryClassesResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.nft.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/tx.ts new file mode 100644 index 00000000..63ad423f --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/nft/v1beta1/tx.ts @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 */ + classId: 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 { classId: "", id: "", sender: "", receiver: "" }; +} + +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + 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: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.receiver = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + 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 const MsgServiceName = "cosmos.nft.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 || MsgServiceName; + 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts new file mode 100644 index 00000000..053430b5 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts @@ -0,0 +1,82 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/module/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.module.v1alpha1"; + +/** + * Module defines the ORM module which adds providers to the app container for + * ORM ModuleDB's and in the future will automatically register query + * services for modules that use the ORM. + */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts new file mode 100644 index 00000000..da9a277e --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts @@ -0,0 +1,911 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/query/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Duration } from "../../../../google/protobuf/duration"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { PageRequest, PageResponse } from "../../../base/query/v1beta1/pagination"; + +export const protobufPackage = "cosmos.orm.query.v1alpha1"; + +/** GetRequest is the Query/Get request type. */ +export interface GetRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. If it is non-empty, it must + * refer to an unique index. + */ + index: string; + /** + * values are the values of the fields corresponding to the requested index. + * There must be as many values provided as there are fields in the index and + * these values must correspond to the index field types. + */ + values: IndexValue[]; +} + +/** GetResponse is the Query/Get response type. */ +export interface GetResponse { + /** + * result is the result of the get query. If no value is found, the gRPC + * status code NOT_FOUND will be returned. + */ + result: Any | undefined; +} + +/** ListRequest is the Query/List request type. */ +export interface ListRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. + */ + index: string; + /** prefix defines a prefix query. */ + prefix?: + | ListRequest_Prefix + | undefined; + /** range defines a range query. */ + range?: + | ListRequest_Range + | undefined; + /** pagination is the pagination request. */ + pagination: PageRequest | undefined; +} + +/** Prefix specifies the arguments to a prefix query. */ +export interface ListRequest_Prefix { + /** + * values specifies the index values for the prefix query. + * It is valid to special a partial prefix with fewer values than + * the number of fields in the index. + */ + values: IndexValue[]; +} + +/** Range specifies the arguments to a range query. */ +export interface ListRequest_Range { + /** + * start specifies the starting index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + start: IndexValue[]; + /** + * end specifies the inclusive ending index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + end: IndexValue[]; +} + +/** ListResponse is the Query/List response type. */ +export interface ListResponse { + /** results are the results of the query. */ + results: Any[]; + /** pagination is the pagination response. */ + pagination: PageResponse | undefined; +} + +/** IndexValue represents the value of a field in an ORM index expression. */ +export interface IndexValue { + /** + * uint specifies a value for an uint32, fixed32, uint64, or fixed64 + * index field. + */ + uint?: + | number + | undefined; + /** + * int64 specifies a value for an int32, sfixed32, int64, or sfixed64 + * index field. + */ + int?: + | number + | undefined; + /** str specifies a value for a string index field. */ + str?: + | string + | undefined; + /** bytes specifies a value for a bytes index field. */ + bytes?: + | Uint8Array + | undefined; + /** enum specifies a value for an enum index field. */ + enum?: + | string + | undefined; + /** bool specifies a value for a bool index field. */ + bool?: + | boolean + | undefined; + /** timestamp specifies a value for a timestamp index field. */ + timestamp?: + | Date + | undefined; + /** duration specifies a value for a duration index field. */ + duration?: Duration | undefined; +} + +function createBaseGetRequest(): GetRequest { + return { messageName: "", index: "", values: [] }; +} + +export const GetRequest: MessageFns = { + encode(message: GetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: GetRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GetRequest { + return GetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetRequest { + const message = createBaseGetRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetResponse(): GetResponse { + return { result: undefined }; +} + +export const GetResponse: MessageFns = { + encode(message: GetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== undefined) { + Any.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.result = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetResponse { + return { result: isSet(object.result) ? Any.fromJSON(object.result) : undefined }; + }, + + toJSON(message: GetResponse): unknown { + const obj: any = {}; + if (message.result !== undefined) { + obj.result = Any.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): GetResponse { + return GetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetResponse { + const message = createBaseGetResponse(); + message.result = (object.result !== undefined && object.result !== null) + ? Any.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseListRequest(): ListRequest { + return { messageName: "", index: "", prefix: undefined, range: undefined, pagination: undefined }; +} + +export const ListRequest: MessageFns = { + encode(message: ListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + if (message.prefix !== undefined) { + ListRequest_Prefix.encode(message.prefix, writer.uint32(26).fork()).join(); + } + if (message.range !== undefined) { + ListRequest_Range.encode(message.range, writer.uint32(34).fork()).join(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.prefix = ListRequest_Prefix.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.range = ListRequest_Range.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + prefix: isSet(object.prefix) ? ListRequest_Prefix.fromJSON(object.prefix) : undefined, + range: isSet(object.range) ? ListRequest_Range.fromJSON(object.range) : undefined, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.prefix !== undefined) { + obj.prefix = ListRequest_Prefix.toJSON(message.prefix); + } + if (message.range !== undefined) { + obj.range = ListRequest_Range.toJSON(message.range); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListRequest { + return ListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest { + const message = createBaseListRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.prefix = (object.prefix !== undefined && object.prefix !== null) + ? ListRequest_Prefix.fromPartial(object.prefix) + : undefined; + message.range = (object.range !== undefined && object.range !== null) + ? ListRequest_Range.fromPartial(object.range) + : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseListRequest_Prefix(): ListRequest_Prefix { + return { values: [] }; +} + +export const ListRequest_Prefix: MessageFns = { + encode(message: ListRequest_Prefix, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Prefix { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Prefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Prefix { + return { + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Prefix): unknown { + const obj: any = {}; + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Prefix { + return ListRequest_Prefix.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Prefix { + const message = createBaseListRequest_Prefix(); + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListRequest_Range(): ListRequest_Range { + return { start: [], end: [] }; +} + +export const ListRequest_Range: MessageFns = { + encode(message: ListRequest_Range, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.start) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.end) { + IndexValue.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Range { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Range(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.start.push(IndexValue.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.end.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Range { + return { + start: globalThis.Array.isArray(object?.start) ? object.start.map((e: any) => IndexValue.fromJSON(e)) : [], + end: globalThis.Array.isArray(object?.end) ? object.end.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Range): unknown { + const obj: any = {}; + if (message.start?.length) { + obj.start = message.start.map((e) => IndexValue.toJSON(e)); + } + if (message.end?.length) { + obj.end = message.end.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Range { + return ListRequest_Range.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Range { + const message = createBaseListRequest_Range(); + message.start = object.start?.map((e) => IndexValue.fromPartial(e)) || []; + message.end = object.end?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListResponse(): ListResponse { + return { results: [], pagination: undefined }; +} + +export const ListResponse: MessageFns = { + encode(message: ListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListResponse { + return ListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListResponse { + const message = createBaseListResponse(); + message.results = object.results?.map((e) => Any.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseIndexValue(): IndexValue { + return { + uint: undefined, + int: undefined, + str: undefined, + bytes: undefined, + enum: undefined, + bool: undefined, + timestamp: undefined, + duration: undefined, + }; +} + +export const IndexValue: MessageFns = { + encode(message: IndexValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uint !== undefined) { + writer.uint32(8).uint64(message.uint); + } + if (message.int !== undefined) { + writer.uint32(16).int64(message.int); + } + if (message.str !== undefined) { + writer.uint32(26).string(message.str); + } + if (message.bytes !== undefined) { + writer.uint32(34).bytes(message.bytes); + } + if (message.enum !== undefined) { + writer.uint32(42).string(message.enum); + } + if (message.bool !== undefined) { + writer.uint32(48).bool(message.bool); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(58).fork()).join(); + } + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.uint = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.int = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.str = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.enum = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.bool = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.duration = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexValue { + return { + uint: isSet(object.uint) ? globalThis.Number(object.uint) : undefined, + int: isSet(object.int) ? globalThis.Number(object.int) : undefined, + str: isSet(object.str) ? globalThis.String(object.str) : undefined, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : undefined, + enum: isSet(object.enum) ? globalThis.String(object.enum) : undefined, + bool: isSet(object.bool) ? globalThis.Boolean(object.bool) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + }; + }, + + toJSON(message: IndexValue): unknown { + const obj: any = {}; + if (message.uint !== undefined) { + obj.uint = Math.round(message.uint); + } + if (message.int !== undefined) { + obj.int = Math.round(message.int); + } + if (message.str !== undefined) { + obj.str = message.str; + } + if (message.bytes !== undefined) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.enum !== undefined) { + obj.enum = message.enum; + } + if (message.bool !== undefined) { + obj.bool = message.bool; + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.duration !== undefined) { + obj.duration = Duration.toJSON(message.duration); + } + return obj; + }, + + create, I>>(base?: I): IndexValue { + return IndexValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexValue { + const message = createBaseIndexValue(); + message.uint = object.uint ?? undefined; + message.int = object.int ?? undefined; + message.str = object.str ?? undefined; + message.bytes = object.bytes ?? undefined; + message.enum = object.enum ?? undefined; + message.bool = object.bool ?? undefined; + message.timestamp = object.timestamp ?? undefined; + message.duration = (object.duration !== undefined && object.duration !== null) + ? Duration.fromPartial(object.duration) + : undefined; + return message; + }, +}; + +/** Query is a generic gRPC service for querying ORM data. */ +export interface Query { + /** Get queries an ORM table against an unique index. */ + Get(request: GetRequest): Promise; + /** List queries an ORM table against an index. */ + List(request: ListRequest): Promise; +} + +export const QueryServiceName = "cosmos.orm.query.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Get = this.Get.bind(this); + this.List = this.List.bind(this); + } + Get(request: GetRequest): Promise { + const data = GetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Get", data); + return promise.then((data) => GetResponse.decode(new BinaryReader(data))); + } + + List(request: ListRequest): Promise { + const data = ListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "List", data); + return promise.then((data) => ListResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/v1/orm.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/v1/orm.ts new file mode 100644 index 00000000..e13476dc --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/v1/orm.ts @@ -0,0 +1,444 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1/orm.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1"; + +/** TableDescriptor describes an ORM table. */ +export interface TableDescriptor { + /** primary_key defines the primary key for the table. */ + primaryKey: + | PrimaryKeyDescriptor + | undefined; + /** 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 is encoded such that values with only seconds occupy 6 bytes, + * values including nanos occupy 9 bytes, and nil values occupy 1 byte. When iterating, nil + * values will always be ordered last. Seconds and nanos values must conform to the officially + * specified ranges of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z and 0 to 999,999,999 respectively. + * - google.protobuf.Duration is 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. + */ + autoIncrement: 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 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 { primaryKey: undefined, index: [], id: 0 }; +} + +export const TableDescriptor: MessageFns = { + encode(message: TableDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.primaryKey !== undefined) { + PrimaryKeyDescriptor.encode(message.primaryKey, writer.uint32(10).fork()).join(); + } + for (const v of message.index) { + SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.id !== 0) { + writer.uint32(24).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TableDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.primaryKey = PrimaryKeyDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index.push(SecondaryIndexDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TableDescriptor { + return { + primaryKey: isSet(object.primaryKey) ? PrimaryKeyDescriptor.fromJSON(object.primaryKey) : undefined, + index: globalThis.Array.isArray(object?.index) + ? object.index.map((e: any) => SecondaryIndexDescriptor.fromJSON(e)) + : [], + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + }; + }, + + toJSON(message: TableDescriptor): unknown { + const obj: any = {}; + if (message.primaryKey !== undefined) { + obj.primaryKey = PrimaryKeyDescriptor.toJSON(message.primaryKey); + } + if (message.index?.length) { + obj.index = message.index.map((e) => SecondaryIndexDescriptor.toJSON(e)); + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): TableDescriptor { + return TableDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TableDescriptor { + const message = createBaseTableDescriptor(); + message.primaryKey = (object.primaryKey !== undefined && object.primaryKey !== null) + ? PrimaryKeyDescriptor.fromPartial(object.primaryKey) + : undefined; + message.index = object.index?.map((e) => SecondaryIndexDescriptor.fromPartial(e)) || []; + message.id = object.id ?? 0; + return message; + }, +}; + +function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { + return { fields: "", autoIncrement: false }; +} + +export const PrimaryKeyDescriptor: MessageFns = { + encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.autoIncrement !== false) { + writer.uint32(16).bool(message.autoIncrement); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrimaryKeyDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.autoIncrement = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrimaryKeyDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + autoIncrement: isSet(object.autoIncrement) ? globalThis.Boolean(object.autoIncrement) : false, + }; + }, + + toJSON(message: PrimaryKeyDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.autoIncrement !== false) { + obj.autoIncrement = message.autoIncrement; + } + return obj; + }, + + create, I>>(base?: I): PrimaryKeyDescriptor { + return PrimaryKeyDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrimaryKeyDescriptor { + const message = createBasePrimaryKeyDescriptor(); + message.fields = object.fields ?? ""; + message.autoIncrement = object.autoIncrement ?? false; + return message; + }, +}; + +function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { + return { fields: "", id: 0, unique: false }; +} + +export const SecondaryIndexDescriptor: MessageFns = { + encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.id !== 0) { + writer.uint32(16).uint32(message.id); + } + if (message.unique !== false) { + writer.uint32(24).bool(message.unique); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecondaryIndexDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.id = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.unique = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecondaryIndexDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + unique: isSet(object.unique) ? globalThis.Boolean(object.unique) : false, + }; + }, + + toJSON(message: SecondaryIndexDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.unique !== false) { + obj.unique = message.unique; + } + return obj; + }, + + create, I>>(base?: I): SecondaryIndexDescriptor { + return SecondaryIndexDescriptor.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: SingletonDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SingletonDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SingletonDescriptor { + return { id: isSet(object.id) ? globalThis.Number(object.id) : 0 }; + }, + + toJSON(message: SingletonDescriptor): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): SingletonDescriptor { + return SingletonDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/v1alpha1/schema.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/v1alpha1/schema.ts new file mode 100644 index 00000000..e326c1bc --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/orm/v1alpha1/schema.ts @@ -0,0 +1,316 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1alpha1/schema.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1alpha1"; + +/** StorageType */ +export enum StorageType { + /** + * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent storage where all + * data is stored in the regular Merkle-tree backed KV-store. + */ + 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, + 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 -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.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptor { + schemaFile: 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. + */ + protoFileName: 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. + */ + storageType: StorageType; +} + +function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { + return { schemaFile: [], prefix: new Uint8Array(0) }; +} + +export const ModuleSchemaDescriptor: MessageFns = { + encode(message: ModuleSchemaDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.schemaFile) { + ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.schemaFile.push(ModuleSchemaDescriptor_FileEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.prefix = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor { + return { + schemaFile: globalThis.Array.isArray(object?.schemaFile) + ? object.schemaFile.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)) + : [], + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0), + }; + }, + + toJSON(message: ModuleSchemaDescriptor): unknown { + const obj: any = {}; + if (message.schemaFile?.length) { + obj.schemaFile = message.schemaFile.map((e) => ModuleSchemaDescriptor_FileEntry.toJSON(e)); + } + if (message.prefix.length !== 0) { + obj.prefix = base64FromBytes(message.prefix); + } + return obj; + }, + + create, I>>(base?: I): ModuleSchemaDescriptor { + return ModuleSchemaDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schemaFile = object.schemaFile?.map((e) => ModuleSchemaDescriptor_FileEntry.fromPartial(e)) || []; + message.prefix = object.prefix ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { + return { id: 0, protoFileName: "", storageType: 0 }; +} + +export const ModuleSchemaDescriptor_FileEntry: MessageFns = { + encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.protoFileName !== "") { + writer.uint32(18).string(message.protoFileName); + } + if (message.storageType !== 0) { + writer.uint32(24).int32(message.storageType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor_FileEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.protoFileName = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.storageType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor_FileEntry { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + protoFileName: isSet(object.protoFileName) ? globalThis.String(object.protoFileName) : "", + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : 0, + }; + }, + + toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.protoFileName !== "") { + obj.protoFileName = message.protoFileName; + } + if (message.storageType !== 0) { + obj.storageType = storageTypeToJSON(message.storageType); + } + return obj; + }, + + create, I>>( + base?: I, + ): ModuleSchemaDescriptor_FileEntry { + return ModuleSchemaDescriptor_FileEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + message.id = object.id ?? 0; + message.protoFileName = object.protoFileName ?? ""; + message.storageType = object.storageType ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/module/v1/module.ts new file mode 100644 index 00000000..731379ce --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.params.module.v1"; + +/** Module is the config object of the params module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/v1beta1/params.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/v1beta1/params.ts new file mode 100644 index 00000000..24070188 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/v1beta1/params.ts @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: MessageFns = { + encode(message: ParameterChangeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParameterChangeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changes.push(ParamChange.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParameterChangeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + changes: globalThis.Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [], + }; + }, + + toJSON(message: ParameterChangeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.changes?.length) { + obj.changes = message.changes.map((e) => ParamChange.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ParameterChangeProposal { + return ParameterChangeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ParamChange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ParamChange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParamChange { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: ParamChange): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ParamChange { + return ParamChange.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/v1beta1/query.ts new file mode 100644 index 00000000..d45f57cd --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/params/v1beta1/query.ts @@ -0,0 +1,433 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesRequest { +} + +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesResponse { + subspaces: Subspace[]; +} + +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface Subspace { + subspace: string; + keys: string[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { subspace: "", key: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.param !== undefined) { + ParamChange.encode(message.param, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.param = ParamChange.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.param !== undefined) { + obj.param = ParamChange.toJSON(message.param); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QuerySubspacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QuerySubspacesRequest { + return {}; + }, + + toJSON(_: QuerySubspacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QuerySubspacesRequest { + return QuerySubspacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, +}; + +function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { + return { subspaces: [] }; +} + +export const QuerySubspacesResponse: MessageFns = { + encode(message: QuerySubspacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.subspaces) { + Subspace.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspaces.push(Subspace.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySubspacesResponse { + return { + subspaces: globalThis.Array.isArray(object?.subspaces) + ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QuerySubspacesResponse): unknown { + const obj: any = {}; + if (message.subspaces?.length) { + obj.subspaces = message.subspaces.map((e) => Subspace.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QuerySubspacesResponse { + return QuerySubspacesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Subspace, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + for (const v of message.keys) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Subspace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keys.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Subspace { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: Subspace): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.keys?.length) { + obj.keys = message.keys; + } + return obj; + }, + + create, I>>(base?: I): Subspace { + return Subspace.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + Subspaces(request: QuerySubspacesRequest): Promise; +} + +export const QueryServiceName = "cosmos.params.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/query/v1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/query/v1/query.ts new file mode 100644 index 00000000..bcdfc76d --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/query/v1/query.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/query/v1/query.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.query.v1"; diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/reflection/v1/reflection.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/reflection/v1/reflection.ts new file mode 100644 index 00000000..0962d0d1 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/reflection/v1/reflection.ts @@ -0,0 +1,178 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/reflection/v1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { FileDescriptorProto } from "../../../google/protobuf/descriptor"; + +export const protobufPackage = "cosmos.reflection.v1"; + +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequest { +} + +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponse { + /** files is the file descriptors. */ + files: FileDescriptorProto[]; +} + +function createBaseFileDescriptorsRequest(): FileDescriptorsRequest { + return {}; +} + +export const FileDescriptorsRequest: MessageFns = { + encode(_: FileDescriptorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): FileDescriptorsRequest { + return {}; + }, + + toJSON(_: FileDescriptorsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): FileDescriptorsRequest { + return FileDescriptorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): FileDescriptorsRequest { + const message = createBaseFileDescriptorsRequest(); + return message; + }, +}; + +function createBaseFileDescriptorsResponse(): FileDescriptorsResponse { + return { files: [] }; +} + +export const FileDescriptorsResponse: MessageFns = { + encode(message: FileDescriptorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.files) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.files.push(FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileDescriptorsResponse { + return { + files: globalThis.Array.isArray(object?.files) + ? object.files.map((e: any) => FileDescriptorProto.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileDescriptorsResponse): unknown { + const obj: any = {}; + if (message.files?.length) { + obj.files = message.files.map((e) => FileDescriptorProto.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FileDescriptorsResponse { + return FileDescriptorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileDescriptorsResponse { + const message = createBaseFileDescriptorsResponse(); + message.files = object.files?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +/** + * Package cosmos.reflection.v1 provides support for inspecting protobuf + * file descriptors. + */ +export interface ReflectionService { + /** + * FileDescriptors queries all the file descriptors in the app in order + * to enable easier generation of dynamic clients. + */ + FileDescriptors(request: FileDescriptorsRequest): Promise; +} + +export const ReflectionServiceServiceName = "cosmos.reflection.v1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + this.rpc = rpc; + this.FileDescriptors = this.FileDescriptors.bind(this); + } + FileDescriptors(request: FileDescriptorsRequest): Promise { + const data = FileDescriptorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FileDescriptors", data); + return promise.then((data) => FileDescriptorsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/module/v1/module.ts new file mode 100644 index 00000000..bf27cfd0 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.slashing.module.v1"; + +/** Module is the config object of the slashing module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts new file mode 100644 index 00000000..958b6870 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signingInfos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missedBlocks: 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. */ + validatorSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * 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. */ + missedBlocks: MissedBlock[]; +} + +/** MissedBlock contains height and missed status as boolean. */ +export interface MissedBlock { + /** index is the height at which the block was missed. */ + index: number; + /** missed is the missed status. */ + missed: boolean; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, signingInfos: [], missedBlocks: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.signingInfos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.missedBlocks) { + ValidatorMissedBlocks.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signingInfos.push(SigningInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.missedBlocks.push(ValidatorMissedBlocks.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signingInfos: globalThis.Array.isArray(object?.signingInfos) + ? object.signingInfos.map((e: any) => SigningInfo.fromJSON(e)) + : [], + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.signingInfos?.length) { + obj.signingInfos = message.signingInfos.map((e) => SigningInfo.toJSON(e)); + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => ValidatorMissedBlocks.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) + ? Params.fromPartial(object.params) + : undefined; + message.signingInfos = object.signingInfos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missedBlocks = object.missedBlocks?.map((e) => ValidatorMissedBlocks.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningInfo(): SigningInfo { + return { address: "", validatorSigningInfo: undefined }; +} + +export const SigningInfo: MessageFns = { + encode(message: SigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.validatorSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.validatorSigningInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + validatorSigningInfo: isSet(object.validatorSigningInfo) + ? ValidatorSigningInfo.fromJSON(object.validatorSigningInfo) + : undefined, + }; + }, + + toJSON(message: SigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.validatorSigningInfo !== undefined) { + obj.validatorSigningInfo = ValidatorSigningInfo.toJSON(message.validatorSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): SigningInfo { + return SigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningInfo { + const message = createBaseSigningInfo(); + message.address = object.address ?? ""; + message.validatorSigningInfo = (object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.validatorSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { + return { address: "", missedBlocks: [] }; +} + +export const ValidatorMissedBlocks: MessageFns = { + encode(message: ValidatorMissedBlocks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.missedBlocks) { + MissedBlock.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorMissedBlocks { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.missedBlocks.push(MissedBlock.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlocks { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => MissedBlock.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorMissedBlocks): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => MissedBlock.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorMissedBlocks { + return ValidatorMissedBlocks.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorMissedBlocks { + const message = createBaseValidatorMissedBlocks(); + message.address = object.address ?? ""; + message.missedBlocks = object.missedBlocks?.map((e) => MissedBlock.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMissedBlock(): MissedBlock { + return { index: 0, missed: false }; +} + +export const MissedBlock: MessageFns = { + encode(message: MissedBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).int64(message.index); + } + if (message.missed !== false) { + writer.uint32(16).bool(message.missed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MissedBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.missed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MissedBlock { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + missed: isSet(object.missed) ? globalThis.Boolean(object.missed) : false, + }; + }, + + toJSON(message: MissedBlock): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.missed !== false) { + obj.missed = message.missed; + } + return obj; + }, + + create, I>>(base?: I): MissedBlock { + return MissedBlock.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 00000000..bc78c27e --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,481 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoRequest { + /** cons_address is the address to query signing info of */ + consAddress: 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 */ + valSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosRequest { + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { + return { consAddress: "" }; +} + +export const QuerySigningInfoRequest: MessageFns = { + encode(message: QuerySigningInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consAddress !== "") { + writer.uint32(10).string(message.consAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.consAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoRequest { + return { consAddress: isSet(object.consAddress) ? globalThis.String(object.consAddress) : "" }; + }, + + toJSON(message: QuerySigningInfoRequest): unknown { + const obj: any = {}; + if (message.consAddress !== "") { + obj.consAddress = message.consAddress; + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoRequest { + return QuerySigningInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoRequest { + const message = createBaseQuerySigningInfoRequest(); + message.consAddress = object.consAddress ?? ""; + return message; + }, +}; + +function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { + return { valSigningInfo: undefined }; +} + +export const QuerySigningInfoResponse: MessageFns = { + encode(message: QuerySigningInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.valSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.valSigningInfo, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.valSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoResponse { + return { + valSigningInfo: isSet(object.valSigningInfo) ? ValidatorSigningInfo.fromJSON(object.valSigningInfo) : undefined, + }; + }, + + toJSON(message: QuerySigningInfoResponse): unknown { + const obj: any = {}; + if (message.valSigningInfo !== undefined) { + obj.valSigningInfo = ValidatorSigningInfo.toJSON(message.valSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoResponse { + return QuerySigningInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoResponse { + const message = createBaseQuerySigningInfoResponse(); + message.valSigningInfo = (object.valSigningInfo !== undefined && object.valSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.valSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { + return { pagination: undefined }; +} + +export const QuerySigningInfosRequest: MessageFns = { + encode(message: QuerySigningInfosRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QuerySigningInfosRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosRequest { + return QuerySigningInfosRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySigningInfosResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.info) { + ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info.push(ValidatorSigningInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosResponse { + return { + info: globalThis.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?.length) { + obj.info = message.info.map((e) => ValidatorSigningInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosResponse { + return QuerySigningInfosResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.slashing.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts new file mode 100644 index 00000000..06f87d05 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts @@ -0,0 +1,411 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/slashing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 un-jailed */ + startHeight: number; + /** + * Index which is incremented every time a validator is bonded in a block and + * _may_ have signed a pre-commit or not. This in conjunction with the + * signed_blocks_window param determines the index in the missed block bitmap. + */ + indexOffset: number; + /** Timestamp until which the validator is jailed due to liveness downtime. */ + jailedUntil: + | Date + | undefined; + /** + * 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 misbehavior. + */ + tombstoned: boolean; + /** + * A counter of missed (unsigned) blocks. It is used to avoid unnecessary + * reads in the missed block bitmap. + */ + missedBlocksCounter: number; +} + +/** Params represents the parameters used for by the slashing module. */ +export interface Params { + signedBlocksWindow: number; + minSignedPerWindow: Uint8Array; + downtimeJailDuration: Duration | undefined; + slashFractionDoubleSign: Uint8Array; + slashFractionDowntime: Uint8Array; +} + +function createBaseValidatorSigningInfo(): ValidatorSigningInfo { + return { + address: "", + startHeight: 0, + indexOffset: 0, + jailedUntil: undefined, + tombstoned: false, + missedBlocksCounter: 0, + }; +} + +export const ValidatorSigningInfo: MessageFns = { + encode(message: ValidatorSigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.startHeight !== 0) { + writer.uint32(16).int64(message.startHeight); + } + if (message.indexOffset !== 0) { + writer.uint32(24).int64(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + Timestamp.encode(toTimestamp(message.jailedUntil), writer.uint32(34).fork()).join(); + } + if (message.tombstoned !== false) { + writer.uint32(40).bool(message.tombstoned); + } + if (message.missedBlocksCounter !== 0) { + writer.uint32(48).int64(message.missedBlocksCounter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.indexOffset = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.jailedUntil = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.tombstoned = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.missedBlocksCounter = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + startHeight: isSet(object.startHeight) ? globalThis.Number(object.startHeight) : 0, + indexOffset: isSet(object.indexOffset) ? globalThis.Number(object.indexOffset) : 0, + jailedUntil: isSet(object.jailedUntil) ? fromJsonTimestamp(object.jailedUntil) : undefined, + tombstoned: isSet(object.tombstoned) ? globalThis.Boolean(object.tombstoned) : false, + missedBlocksCounter: isSet(object.missedBlocksCounter) ? globalThis.Number(object.missedBlocksCounter) : 0, + }; + }, + + toJSON(message: ValidatorSigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.startHeight !== 0) { + obj.startHeight = Math.round(message.startHeight); + } + if (message.indexOffset !== 0) { + obj.indexOffset = Math.round(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + obj.jailedUntil = message.jailedUntil.toISOString(); + } + if (message.tombstoned !== false) { + obj.tombstoned = message.tombstoned; + } + if (message.missedBlocksCounter !== 0) { + obj.missedBlocksCounter = Math.round(message.missedBlocksCounter); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSigningInfo { + return ValidatorSigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSigningInfo { + const message = createBaseValidatorSigningInfo(); + message.address = object.address ?? ""; + message.startHeight = object.startHeight ?? 0; + message.indexOffset = object.indexOffset ?? 0; + message.jailedUntil = object.jailedUntil ?? undefined; + message.tombstoned = object.tombstoned ?? false; + message.missedBlocksCounter = object.missedBlocksCounter ?? 0; + return message; + }, +}; + +function createBaseParams(): Params { + return { + signedBlocksWindow: 0, + minSignedPerWindow: new Uint8Array(0), + downtimeJailDuration: undefined, + slashFractionDoubleSign: new Uint8Array(0), + slashFractionDowntime: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedBlocksWindow !== 0) { + writer.uint32(8).int64(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + writer.uint32(18).bytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + Duration.encode(message.downtimeJailDuration, writer.uint32(26).fork()).join(); + } + if (message.slashFractionDoubleSign.length !== 0) { + writer.uint32(34).bytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + writer.uint32(42).bytes(message.slashFractionDowntime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.signedBlocksWindow = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minSignedPerWindow = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.downtimeJailDuration = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.slashFractionDoubleSign = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionDowntime = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + signedBlocksWindow: isSet(object.signedBlocksWindow) ? globalThis.Number(object.signedBlocksWindow) : 0, + minSignedPerWindow: isSet(object.minSignedPerWindow) + ? bytesFromBase64(object.minSignedPerWindow) + : new Uint8Array(0), + downtimeJailDuration: isSet(object.downtimeJailDuration) + ? Duration.fromJSON(object.downtimeJailDuration) + : undefined, + slashFractionDoubleSign: isSet(object.slashFractionDoubleSign) + ? bytesFromBase64(object.slashFractionDoubleSign) + : new Uint8Array(0), + slashFractionDowntime: isSet(object.slashFractionDowntime) + ? bytesFromBase64(object.slashFractionDowntime) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.signedBlocksWindow !== 0) { + obj.signedBlocksWindow = Math.round(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + obj.minSignedPerWindow = base64FromBytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + obj.downtimeJailDuration = Duration.toJSON(message.downtimeJailDuration); + } + if (message.slashFractionDoubleSign.length !== 0) { + obj.slashFractionDoubleSign = base64FromBytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + obj.slashFractionDowntime = base64FromBytes(message.slashFractionDowntime); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.signedBlocksWindow = object.signedBlocksWindow ?? 0; + message.minSignedPerWindow = object.minSignedPerWindow ?? new Uint8Array(0); + message.downtimeJailDuration = (object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null) + ? Duration.fromPartial(object.downtimeJailDuration) + : undefined; + message.slashFractionDoubleSign = object.slashFractionDoubleSign ?? new Uint8Array(0); + message.slashFractionDowntime = object.slashFractionDowntime ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/tx.ts new file mode 100644 index 00000000..54377079 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/slashing/v1beta1/tx.ts @@ -0,0 +1,333 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./slashing"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** MsgUnjail defines the Msg/Unjail request type */ +export interface MsgUnjail { + validatorAddr: string; +} + +/** MsgUnjailResponse defines the Msg/Unjail response type */ +export interface MsgUnjailResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/slashing parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUnjail(): MsgUnjail { + return { validatorAddr: "" }; +} + +export const MsgUnjail: MessageFns = { + encode(message: MsgUnjail, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjail { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnjail { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: MsgUnjail): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): MsgUnjail { + return MsgUnjail.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnjail { + const message = createBaseMsgUnjail(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseMsgUnjailResponse(): MsgUnjailResponse { + return {}; +} + +export const MsgUnjailResponse: MessageFns = { + encode(_: MsgUnjailResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjailResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjailResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnjailResponse { + return {}; + }, + + toJSON(_: MsgUnjailResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnjailResponse { + return MsgUnjailResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnjailResponse { + const message = createBaseMsgUnjailResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/slashing module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.slashing.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 || MsgServiceName; + this.rpc = rpc; + this.Unjail = this.Unjail.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/module/v1/module.ts new file mode 100644 index 00000000..7f8fe4b9 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/module/v1/module.ts @@ -0,0 +1,157 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.staking.module.v1"; + +/** Module is the config object of the staking module. */ +export interface Module { + /** + * hooks_order specifies the order of staking hooks and should be a list + * of module names which provide a staking hooks instance. If no order is + * provided, then hooks will be applied in alphabetical order of module names. + */ + hooksOrder: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** bech32_prefix_validator is the bech32 validator prefix for the app. */ + bech32PrefixValidator: string; + /** bech32_prefix_consensus is the bech32 consensus node prefix for the app. */ + bech32PrefixConsensus: string; +} + +function createBaseModule(): Module { + return { hooksOrder: [], authority: "", bech32PrefixValidator: "", bech32PrefixConsensus: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.hooksOrder) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + if (message.bech32PrefixValidator !== "") { + writer.uint32(26).string(message.bech32PrefixValidator); + } + if (message.bech32PrefixConsensus !== "") { + writer.uint32(34).string(message.bech32PrefixConsensus); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.hooksOrder.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bech32PrefixValidator = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bech32PrefixConsensus = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + hooksOrder: globalThis.Array.isArray(object?.hooksOrder) + ? object.hooksOrder.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + bech32PrefixValidator: isSet(object.bech32PrefixValidator) ? globalThis.String(object.bech32PrefixValidator) : "", + bech32PrefixConsensus: isSet(object.bech32PrefixConsensus) ? globalThis.String(object.bech32PrefixConsensus) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.hooksOrder?.length) { + obj.hooksOrder = message.hooksOrder; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.bech32PrefixValidator !== "") { + obj.bech32PrefixValidator = message.bech32PrefixValidator; + } + if (message.bech32PrefixConsensus !== "") { + obj.bech32PrefixConsensus = message.bech32PrefixConsensus; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.hooksOrder = object.hooksOrder?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.bech32PrefixValidator = object.bech32PrefixValidator ?? ""; + message.bech32PrefixConsensus = object.bech32PrefixConsensus ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/authz.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 00000000..b989d692 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,301 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION - AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION defines an authorization type for Msg/MsgCancelUnbondingDelegation */ + AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION = 4, + 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 4: + case "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION": + return AuthorizationType.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION; + 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.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION: + return "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION"; + 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. + */ + maxTokens: + | Coin + | undefined; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allowList?: + | StakeAuthorization_Validators + | undefined; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + denyList?: + | StakeAuthorization_Validators + | undefined; + /** authorization_type defines one of AuthorizationType. */ + authorizationType: AuthorizationType; +} + +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_Validators { + address: string[]; +} + +function createBaseStakeAuthorization(): StakeAuthorization { + return { maxTokens: undefined, allowList: undefined, denyList: undefined, authorizationType: 0 }; +} + +export const StakeAuthorization: MessageFns = { + encode(message: StakeAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTokens !== undefined) { + Coin.encode(message.maxTokens, writer.uint32(10).fork()).join(); + } + if (message.allowList !== undefined) { + StakeAuthorization_Validators.encode(message.allowList, writer.uint32(18).fork()).join(); + } + if (message.denyList !== undefined) { + StakeAuthorization_Validators.encode(message.denyList, writer.uint32(26).fork()).join(); + } + if (message.authorizationType !== 0) { + writer.uint32(32).int32(message.authorizationType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxTokens = Coin.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.denyList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.authorizationType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization { + return { + maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, + allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, + denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, + authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : 0, + }; + }, + + toJSON(message: StakeAuthorization): unknown { + const obj: any = {}; + if (message.maxTokens !== undefined) { + obj.maxTokens = Coin.toJSON(message.maxTokens); + } + if (message.allowList !== undefined) { + obj.allowList = StakeAuthorization_Validators.toJSON(message.allowList); + } + if (message.denyList !== undefined) { + obj.denyList = StakeAuthorization_Validators.toJSON(message.denyList); + } + if (message.authorizationType !== 0) { + obj.authorizationType = authorizationTypeToJSON(message.authorizationType); + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization { + return StakeAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeAuthorization { + const message = createBaseStakeAuthorization(); + message.maxTokens = (object.maxTokens !== undefined && object.maxTokens !== null) + ? Coin.fromPartial(object.maxTokens) + : undefined; + message.allowList = (object.allowList !== undefined && object.allowList !== null) + ? StakeAuthorization_Validators.fromPartial(object.allowList) + : undefined; + message.denyList = (object.denyList !== undefined && object.denyList !== null) + ? StakeAuthorization_Validators.fromPartial(object.denyList) + : undefined; + message.authorizationType = object.authorizationType ?? 0; + return message; + }, +}; + +function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { + return { address: [] }; +} + +export const StakeAuthorization_Validators: MessageFns = { + encode(message: StakeAuthorization_Validators, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.address) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization_Validators { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization_Validators { + return { + address: globalThis.Array.isArray(object?.address) ? object.address.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: StakeAuthorization_Validators): unknown { + const obj: any = {}; + if (message.address?.length) { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization_Validators { + return StakeAuthorization_Validators.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/genesis.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 00000000..8c967ba2 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,367 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of related to deposit. */ + params: + | Params + | undefined; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + lastTotalPower: Uint8Array; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + lastValidatorPowers: LastValidatorPower[]; + /** validators 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. */ + unbondingDelegations: UnbondingDelegation[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: Redelegation[]; + /** exported defines a bool to identify whether the chain dealing with exported or initialized genesis. */ + 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: number; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + lastTotalPower: new Uint8Array(0), + lastValidatorPowers: [], + validators: [], + delegations: [], + unbondingDelegations: [], + redelegations: [], + exported: false, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.lastTotalPower.length !== 0) { + writer.uint32(18).bytes(message.lastTotalPower); + } + for (const v of message.lastValidatorPowers) { + LastValidatorPower.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.delegations) { + Delegation.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.unbondingDelegations) { + UnbondingDelegation.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.redelegations) { + Redelegation.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.exported !== false) { + writer.uint32(64).bool(message.exported); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lastTotalPower = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.lastValidatorPowers.push(LastValidatorPower.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delegations.push(Delegation.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.unbondingDelegations.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.redelegations.push(Redelegation.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.exported = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + lastTotalPower: isSet(object.lastTotalPower) ? bytesFromBase64(object.lastTotalPower) : new Uint8Array(0), + lastValidatorPowers: globalThis.Array.isArray(object?.lastValidatorPowers) + ? object.lastValidatorPowers.map((e: any) => LastValidatorPower.fromJSON(e)) + : [], + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + delegations: globalThis.Array.isArray(object?.delegations) + ? object.delegations.map((e: any) => Delegation.fromJSON(e)) + : [], + unbondingDelegations: globalThis.Array.isArray(object?.unbondingDelegations) + ? object.unbondingDelegations.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + redelegations: globalThis.Array.isArray(object?.redelegations) + ? object.redelegations.map((e: any) => Redelegation.fromJSON(e)) + : [], + exported: isSet(object.exported) ? globalThis.Boolean(object.exported) : false, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.lastTotalPower.length !== 0) { + obj.lastTotalPower = base64FromBytes(message.lastTotalPower); + } + if (message.lastValidatorPowers?.length) { + obj.lastValidatorPowers = message.lastValidatorPowers.map((e) => LastValidatorPower.toJSON(e)); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.delegations?.length) { + obj.delegations = message.delegations.map((e) => Delegation.toJSON(e)); + } + if (message.unbondingDelegations?.length) { + obj.unbondingDelegations = message.unbondingDelegations.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.redelegations?.length) { + obj.redelegations = message.redelegations.map((e) => Redelegation.toJSON(e)); + } + if (message.exported !== false) { + obj.exported = message.exported; + } + 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) + ? Params.fromPartial(object.params) + : undefined; + message.lastTotalPower = object.lastTotalPower ?? new Uint8Array(0); + message.lastValidatorPowers = object.lastValidatorPowers?.map((e) => LastValidatorPower.fromPartial(e)) || []; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.delegations = object.delegations?.map((e) => Delegation.fromPartial(e)) || []; + message.unbondingDelegations = object.unbondingDelegations?.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: MessageFns = { + encode(message: LastValidatorPower, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LastValidatorPower { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LastValidatorPower { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: LastValidatorPower): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): LastValidatorPower { + return LastValidatorPower.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LastValidatorPower { + const message = createBaseLastValidatorPower(); + message.address = object.address ?? ""; + message.power = object.power ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/query.ts new file mode 100644 index 00000000..ef8f2dc7 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,2495 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponse { + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegationResponse: DelegationResponse | undefined; +} + +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond: UnbondingDelegation | undefined; +} + +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** src_validator_addr defines the validator address to redelegate from. */ + srcValidatorAddr: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dstValidatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponse { + redelegationResponses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: number; +} + +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist: HistoricalInfo | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { status: "", pagination: undefined }; +} + +export const QueryValidatorsRequest: MessageFns = { + encode(message: QueryValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.status = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsRequest { + return { + status: isSet(object.status) ? globalThis.String(object.status) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsRequest): unknown { + const obj: any = {}; + if (message.status !== "") { + obj.status = message.status; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsRequest { + return QueryValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsResponse { + return QueryValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "" }; +} + +export const QueryValidatorRequest: MessageFns = { + encode(message: QueryValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorRequest { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: QueryValidatorRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorRequest { + return QueryValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { validator: undefined }; +} + +export const QueryValidatorResponse: MessageFns = { + encode(message: QueryValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorResponse { + return QueryValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorDelegationsRequest: MessageFns = { + encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryValidatorDelegationsResponse: MessageFns = { + encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegationRequest: MessageFns = { + encode(message: QueryDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRequest { + return QueryDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { delegationResponse: undefined }; +} + +export const QueryDelegationResponse: MessageFns = { + encode(message: QueryDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegationResponse !== undefined) { + DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponse = DelegationResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationResponse { + return { + delegationResponse: isSet(object.delegationResponse) + ? DelegationResponse.fromJSON(object.delegationResponse) + : undefined, + }; + }, + + toJSON(message: QueryDelegationResponse): unknown { + const obj: any = {}; + if (message.delegationResponse !== undefined) { + obj.delegationResponse = DelegationResponse.toJSON(message.delegationResponse); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationResponse { + return QueryDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegationResponse = (object.delegationResponse !== undefined && object.delegationResponse !== null) + ? DelegationResponse.fromPartial(object.delegationResponse) + : undefined; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryUnbondingDelegationRequest: MessageFns = { + encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryUnbondingDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { unbond: undefined }; +} + +export const QueryUnbondingDelegationResponse: MessageFns = { + encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbond = UnbondingDelegation.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationResponse { + return { unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined }; + }, + + toJSON(message: QueryUnbondingDelegationResponse): unknown { + const obj: any = {}; + if (message.unbond !== undefined) { + obj.unbond = UnbondingDelegation.toJSON(message.unbond); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryDelegatorDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { delegatorAddr: "", srcValidatorAddr: "", dstValidatorAddr: "", pagination: undefined }; +} + +export const QueryRedelegationsRequest: MessageFns = { + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.srcValidatorAddr !== "") { + writer.uint32(18).string(message.srcValidatorAddr); + } + if (message.dstValidatorAddr !== "") { + writer.uint32(26).string(message.dstValidatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.srcValidatorAddr = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.dstValidatorAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + srcValidatorAddr: isSet(object.srcValidatorAddr) ? globalThis.String(object.srcValidatorAddr) : "", + dstValidatorAddr: isSet(object.dstValidatorAddr) ? globalThis.String(object.dstValidatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.srcValidatorAddr !== "") { + obj.srcValidatorAddr = message.srcValidatorAddr; + } + if (message.dstValidatorAddr !== "") { + obj.dstValidatorAddr = message.dstValidatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsRequest { + return QueryRedelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.srcValidatorAddr = object.srcValidatorAddr ?? ""; + message.dstValidatorAddr = object.dstValidatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { redelegationResponses: [], pagination: undefined }; +} + +export const QueryRedelegationsResponse: MessageFns = { + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.redelegationResponses) { + RedelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationResponses.push(RedelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsResponse { + return { + redelegationResponses: globalThis.Array.isArray(object?.redelegationResponses) + ? object.redelegationResponses.map((e: any) => RedelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsResponse): unknown { + const obj: any = {}; + if (message.redelegationResponses?.length) { + obj.redelegationResponses = message.redelegationResponses.map((e) => RedelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsResponse { + return QueryRedelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegationResponses?.map((e) => RedelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + 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: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegatorValidatorRequest: MessageFns = { + encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegatorValidatorRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { validator: undefined }; +} + +export const QueryDelegatorValidatorResponse: MessageFns = { + encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryDelegatorValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryHistoricalInfoRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { hist: undefined }; +} + +export const QueryHistoricalInfoResponse: MessageFns = { + encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hist = HistoricalInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoResponse { + return { hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined }; + }, + + toJSON(message: QueryHistoricalInfoResponse): unknown { + const obj: any = {}; + if (message.hist !== undefined) { + obj.hist = HistoricalInfo.toJSON(message.hist); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPoolRequest { + return {}; + }, + + toJSON(_: QueryPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPoolRequest { + return QueryPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, +}; + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +export const QueryPoolResponse: MessageFns = { + encode(message: QueryPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pool = Pool.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + if (message.pool !== undefined) { + obj.pool = Pool.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) ? Pool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Validators(request: QueryValidatorsRequest): Promise; + /** Validator queries validator info for given validator address. */ + Validator(request: QueryValidatorRequest): Promise; + /** + * ValidatorDelegations queries delegate info for given validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + ValidatorDelegations(request: QueryValidatorDelegationsRequest): Promise; + /** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; + /** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorUnbondingDelegations( + request: QueryDelegatorUnbondingDelegationsRequest, + ): Promise; + /** + * Redelegations queries redelegations of given address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Redelegations(request: QueryRedelegationsRequest): Promise; + /** + * DelegatorValidators queries all validators info for given delegator + * address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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 const QueryServiceName = "cosmos.staking.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/staking.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 00000000..7ea20d02 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,2506 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/staking.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { ValidatorUpdate } from "../../../tendermint/abci/types"; +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"; + } +} + +/** Infraction indicates the infraction a validator commited. */ +export enum Infraction { + /** INFRACTION_UNSPECIFIED - UNSPECIFIED defines an empty infraction. */ + INFRACTION_UNSPECIFIED = 0, + /** INFRACTION_DOUBLE_SIGN - DOUBLE_SIGN defines a validator that double-signs a block. */ + INFRACTION_DOUBLE_SIGN = 1, + /** INFRACTION_DOWNTIME - DOWNTIME defines a validator that missed signing too many blocks. */ + INFRACTION_DOWNTIME = 2, + UNRECOGNIZED = -1, +} + +export function infractionFromJSON(object: any): Infraction { + switch (object) { + case 0: + case "INFRACTION_UNSPECIFIED": + return Infraction.INFRACTION_UNSPECIFIED; + case 1: + case "INFRACTION_DOUBLE_SIGN": + return Infraction.INFRACTION_DOUBLE_SIGN; + case 2: + case "INFRACTION_DOWNTIME": + return Infraction.INFRACTION_DOWNTIME; + case -1: + case "UNRECOGNIZED": + default: + return Infraction.UNRECOGNIZED; + } +} + +export function infractionToJSON(object: Infraction): string { + switch (object) { + case Infraction.INFRACTION_UNSPECIFIED: + return "INFRACTION_UNSPECIFIED"; + case Infraction.INFRACTION_DOUBLE_SIGN: + return "INFRACTION_DOUBLE_SIGN"; + case Infraction.INFRACTION_DOWNTIME: + return "INFRACTION_DOWNTIME"; + case Infraction.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfo { + header: Header | undefined; + 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. */ + maxRate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + maxChangeRate: 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. */ + commissionRates: + | CommissionRates + | undefined; + /** update_time is the last time the commission rate was changed. */ + updateTime: Date | undefined; +} + +/** Description defines a validator description. */ +export interface Description { + /** moniker defines a human-readable name for the validator. */ + moniker: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity: string; + /** website defines an optional website link. */ + website: string; + /** security_contact defines an optional email for security contact. */ + securityContact: string; + /** details define other optional details. */ + details: string; +} + +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface Validator { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operatorAddress: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensusPubkey: + | Any + | undefined; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegatorShares: string; + /** description defines the description terms for the validator. */ + description: + | Description + | undefined; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbondingHeight: number; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbondingTime: + | Date + | undefined; + /** commission defines the commission parameters. */ + commission: + | Commission + | undefined; + /** + * min_self_delegation is the validator's self declared minimum self delegation. + * + * Since: cosmos-sdk 0.46 + */ + minSelfDelegation: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbondingIds: number[]; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: 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 encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** shares define the delegation shares received. */ + shares: string; +} + +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegation { + /** delegator_address is the encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} + +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; + /** completion_time is the unix time for unbonding completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initialBalance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creationHeight: number; + /** completion_time defines the unix time for redelegation completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the initial balance when redelegation started. */ + initialBalance: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + sharesDst: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface Redelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegatorAddress: string; + /** validator_src_address is the validator redelegation source operator address. */ + validatorSrcAddress: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validatorDstAddress: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntry[]; +} + +/** Params defines the parameters for the x/staking module. */ +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbondingTime: + | Duration + | undefined; + /** max_validators is the maximum number of validators. */ + maxValidators: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + maxEntries: number; + /** historical_entries is the number of historical entries to persist. */ + historicalEntries: number; + /** bond_denom defines the bondable coin denomination. */ + bondDenom: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + minCommissionRate: string; +} + +/** + * 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 | undefined; + balance: Coin | undefined; +} + +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponse { + redelegationEntry: RedelegationEntry | undefined; + 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 | undefined; + entries: RedelegationEntryResponse[]; +} + +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface Pool { + notBondedTokens: string; + bondedTokens: string; +} + +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdates { + updates: ValidatorUpdate[]; +} + +function createBaseHistoricalInfo(): HistoricalInfo { + return { header: undefined, valset: [] }; +} + +export const HistoricalInfo: MessageFns = { + encode(message: HistoricalInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + for (const v of message.valset) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoricalInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.valset.push(Validator.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HistoricalInfo { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + valset: globalThis.Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [], + }; + }, + + toJSON(message: HistoricalInfo): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.valset?.length) { + obj.valset = message.valset.map((e) => Validator.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HistoricalInfo { + return HistoricalInfo.fromPartial(base ?? ({} as any)); + }, + 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: "", maxRate: "", maxChangeRate: "" }; +} + +export const CommissionRates: MessageFns = { + encode(message: CommissionRates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.maxRate !== "") { + writer.uint32(18).string(message.maxRate); + } + if (message.maxChangeRate !== "") { + writer.uint32(26).string(message.maxChangeRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rate = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxRate = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.maxChangeRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommissionRates { + return { + rate: isSet(object.rate) ? globalThis.String(object.rate) : "", + maxRate: isSet(object.maxRate) ? globalThis.String(object.maxRate) : "", + maxChangeRate: isSet(object.maxChangeRate) ? globalThis.String(object.maxChangeRate) : "", + }; + }, + + toJSON(message: CommissionRates): unknown { + const obj: any = {}; + if (message.rate !== "") { + obj.rate = message.rate; + } + if (message.maxRate !== "") { + obj.maxRate = message.maxRate; + } + if (message.maxChangeRate !== "") { + obj.maxChangeRate = message.maxChangeRate; + } + return obj; + }, + + create, I>>(base?: I): CommissionRates { + return CommissionRates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.maxRate = object.maxRate ?? ""; + message.maxChangeRate = object.maxChangeRate ?? ""; + return message; + }, +}; + +function createBaseCommission(): Commission { + return { commissionRates: undefined, updateTime: undefined }; +} + +export const Commission: MessageFns = { + encode(message: Commission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commissionRates !== undefined) { + CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).join(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commissionRates = CommissionRates.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commission { + return { + commissionRates: isSet(object.commissionRates) ? CommissionRates.fromJSON(object.commissionRates) : undefined, + updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, + }; + }, + + toJSON(message: Commission): unknown { + const obj: any = {}; + if (message.commissionRates !== undefined) { + obj.commissionRates = CommissionRates.toJSON(message.commissionRates); + } + if (message.updateTime !== undefined) { + obj.updateTime = message.updateTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Commission { + return Commission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commission { + const message = createBaseCommission(); + message.commissionRates = (object.commissionRates !== undefined && object.commissionRates !== null) + ? CommissionRates.fromPartial(object.commissionRates) + : undefined; + message.updateTime = object.updateTime ?? undefined; + return message; + }, +}; + +function createBaseDescription(): Description { + return { moniker: "", identity: "", website: "", securityContact: "", details: "" }; +} + +export const Description: MessageFns = { + encode(message: Description, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.securityContact !== "") { + writer.uint32(34).string(message.securityContact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Description { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moniker = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.website = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.securityContact = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.details = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Description { + return { + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + securityContact: isSet(object.securityContact) ? globalThis.String(object.securityContact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", + }; + }, + + toJSON(message: Description): unknown { + const obj: any = {}; + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.securityContact !== "") { + obj.securityContact = message.securityContact; + } + if (message.details !== "") { + obj.details = message.details; + } + return obj; + }, + + create, I>>(base?: I): Description { + return Description.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.securityContact = object.securityContact ?? ""; + message.details = object.details ?? ""; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { + operatorAddress: "", + consensusPubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegatorShares: "", + description: undefined, + unbondingHeight: 0, + unbondingTime: undefined, + commission: undefined, + minSelfDelegation: "", + unbondingOnHoldRefCount: 0, + unbondingIds: [], + }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + if (message.consensusPubkey !== undefined) { + Any.encode(message.consensusPubkey, writer.uint32(18).fork()).join(); + } + if (message.jailed !== false) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegatorShares !== "") { + writer.uint32(50).string(message.delegatorShares); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).join(); + } + if (message.unbondingHeight !== 0) { + writer.uint32(64).int64(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + Timestamp.encode(toTimestamp(message.unbondingTime), writer.uint32(74).fork()).join(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(90).string(message.minSelfDelegation); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(96).int64(message.unbondingOnHoldRefCount); + } + writer.uint32(106).fork(); + for (const v of message.unbondingIds) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.consensusPubkey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.jailed = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.status = reader.int32() as any; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.tokens = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.delegatorShares = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.unbondingHeight = longToNumber(reader.int64()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.unbondingTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.commission = Commission.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + case 13: + if (tag === 104) { + message.unbondingIds.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 106) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.unbondingIds.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, + jailed: isSet(object.jailed) ? globalThis.Boolean(object.jailed) : false, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + tokens: isSet(object.tokens) ? globalThis.String(object.tokens) : "", + delegatorShares: isSet(object.delegatorShares) ? globalThis.String(object.delegatorShares) : "", + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + unbondingHeight: isSet(object.unbondingHeight) ? globalThis.Number(object.unbondingHeight) : 0, + unbondingTime: isSet(object.unbondingTime) ? fromJsonTimestamp(object.unbondingTime) : undefined, + commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + unbondingIds: globalThis.Array.isArray(object?.unbondingIds) + ? object.unbondingIds.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.consensusPubkey !== undefined) { + obj.consensusPubkey = Any.toJSON(message.consensusPubkey); + } + if (message.jailed !== false) { + obj.jailed = message.jailed; + } + if (message.status !== 0) { + obj.status = bondStatusToJSON(message.status); + } + if (message.tokens !== "") { + obj.tokens = message.tokens; + } + if (message.delegatorShares !== "") { + obj.delegatorShares = message.delegatorShares; + } + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.unbondingHeight !== 0) { + obj.unbondingHeight = Math.round(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + obj.unbondingTime = message.unbondingTime.toISOString(); + } + if (message.commission !== undefined) { + obj.commission = Commission.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + if (message.unbondingIds?.length) { + obj.unbondingIds = message.unbondingIds.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.operatorAddress = object.operatorAddress ?? ""; + message.consensusPubkey = (object.consensusPubkey !== undefined && object.consensusPubkey !== null) + ? Any.fromPartial(object.consensusPubkey) + : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegatorShares = object.delegatorShares ?? ""; + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.unbondingHeight = object.unbondingHeight ?? 0; + message.unbondingTime = object.unbondingTime ?? undefined; + message.commission = (object.commission !== undefined && object.commission !== null) + ? Commission.fromPartial(object.commission) + : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + message.unbondingIds = object.unbondingIds?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValAddresses(): ValAddresses { + return { addresses: [] }; +} + +export const ValAddresses: MessageFns = { + encode(message: ValAddresses, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addresses.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValAddresses { + return { + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValAddresses): unknown { + const obj: any = {}; + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + return obj; + }, + + create, I>>(base?: I): ValAddresses { + return ValAddresses.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDVPair(): DVPair { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const DVPair: MessageFns = { + encode(message: DVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPair { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: DVPair): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): DVPair { + return DVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPair { + const message = createBaseDVPair(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseDVPairs(): DVPairs { + return { pairs: [] }; +} + +export const DVPairs: MessageFns = { + encode(message: DVPairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pairs.push(DVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] }; + }, + + toJSON(message: DVPairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => DVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVPairs { + return DVPairs.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map((e) => DVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDVVTriplet(): DVVTriplet { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" }; +} + +export const DVVTriplet: MessageFns = { + encode(message: DVVTriplet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplet { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + }; + }, + + toJSON(message: DVVTriplet): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + return obj; + }, + + create, I>>(base?: I): DVVTriplet { + return DVVTriplet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + return message; + }, +}; + +function createBaseDVVTriplets(): DVVTriplets { + return { triplets: [] }; +} + +export const DVVTriplets: MessageFns = { + encode(message: DVVTriplets, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.triplets.push(DVVTriplet.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplets { + return { + triplets: globalThis.Array.isArray(object?.triplets) + ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DVVTriplets): unknown { + const obj: any = {}; + if (message.triplets?.length) { + obj.triplets = message.triplets.map((e) => DVVTriplet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVVTriplets { + return DVVTriplets.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map((e) => DVVTriplet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDelegation(): Delegation { + return { delegatorAddress: "", validatorAddress: "", shares: "" }; +} + +export const Delegation: MessageFns = { + encode(message: Delegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Delegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.shares = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Delegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + shares: isSet(object.shares) ? globalThis.String(object.shares) : "", + }; + }, + + toJSON(message: Delegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.shares !== "") { + obj.shares = message.shares; + } + return obj; + }, + + create, I>>(base?: I): Delegation { + return Delegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Delegation { + const message = createBaseDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.shares = object.shares ?? ""; + return message; + }, +}; + +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", entries: [] }; +} + +export const UnbondingDelegation: MessageFns = { + encode(message: UnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: UnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => UnbondingDelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegation { + return UnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + balance: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const UnbondingDelegationEntry: MessageFns = { + encode(message: UnbondingDelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: UnbondingDelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.balance !== "") { + obj.balance = message.balance; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegationEntry { + return UnbondingDelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.balance = object.balance ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegationEntry(): RedelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + sharesDst: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const RedelegationEntry: MessageFns = { + encode(message: RedelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.sharesDst !== "") { + writer.uint32(34).string(message.sharesDst); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sharesDst = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + sharesDst: isSet(object.sharesDst) ? globalThis.String(object.sharesDst) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.sharesDst !== "") { + obj.sharesDst = message.sharesDst; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntry { + return RedelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.sharesDst = object.sharesDst ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegation(): Redelegation { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", entries: [] }; +} + +export const Redelegation: MessageFns = { + encode(message: Redelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Redelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Redelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Redelegation { + return Redelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Redelegation { + const message = createBaseRedelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.entries = object.entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + unbondingTime: undefined, + maxValidators: 0, + maxEntries: 0, + historicalEntries: 0, + bondDenom: "", + minCommissionRate: "", + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbondingTime !== undefined) { + Duration.encode(message.unbondingTime, writer.uint32(10).fork()).join(); + } + if (message.maxValidators !== 0) { + writer.uint32(16).uint32(message.maxValidators); + } + if (message.maxEntries !== 0) { + writer.uint32(24).uint32(message.maxEntries); + } + if (message.historicalEntries !== 0) { + writer.uint32(32).uint32(message.historicalEntries); + } + if (message.bondDenom !== "") { + writer.uint32(42).string(message.bondDenom); + } + if (message.minCommissionRate !== "") { + writer.uint32(50).string(message.minCommissionRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingTime = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxValidators = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxEntries = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.historicalEntries = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bondDenom = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.minCommissionRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbondingTime: isSet(object.unbondingTime) ? Duration.fromJSON(object.unbondingTime) : undefined, + maxValidators: isSet(object.maxValidators) ? globalThis.Number(object.maxValidators) : 0, + maxEntries: isSet(object.maxEntries) ? globalThis.Number(object.maxEntries) : 0, + historicalEntries: isSet(object.historicalEntries) ? globalThis.Number(object.historicalEntries) : 0, + bondDenom: isSet(object.bondDenom) ? globalThis.String(object.bondDenom) : "", + minCommissionRate: isSet(object.minCommissionRate) ? globalThis.String(object.minCommissionRate) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.unbondingTime !== undefined) { + obj.unbondingTime = Duration.toJSON(message.unbondingTime); + } + if (message.maxValidators !== 0) { + obj.maxValidators = Math.round(message.maxValidators); + } + if (message.maxEntries !== 0) { + obj.maxEntries = Math.round(message.maxEntries); + } + if (message.historicalEntries !== 0) { + obj.historicalEntries = Math.round(message.historicalEntries); + } + if (message.bondDenom !== "") { + obj.bondDenom = message.bondDenom; + } + if (message.minCommissionRate !== "") { + obj.minCommissionRate = message.minCommissionRate; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbondingTime = (object.unbondingTime !== undefined && object.unbondingTime !== null) + ? Duration.fromPartial(object.unbondingTime) + : undefined; + message.maxValidators = object.maxValidators ?? 0; + message.maxEntries = object.maxEntries ?? 0; + message.historicalEntries = object.historicalEntries ?? 0; + message.bondDenom = object.bondDenom ?? ""; + message.minCommissionRate = object.minCommissionRate ?? ""; + return message; + }, +}; + +function createBaseDelegationResponse(): DelegationResponse { + return { delegation: undefined, balance: undefined }; +} + +export const DelegationResponse: MessageFns = { + encode(message: DelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegation !== undefined) { + Delegation.encode(message.delegation, writer.uint32(10).fork()).join(); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegation = Delegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.delegation !== undefined) { + obj.delegation = Delegation.toJSON(message.delegation); + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DelegationResponse { + return DelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { redelegationEntry: undefined, balance: "" }; +} + +export const RedelegationEntryResponse: MessageFns = { + encode(message: RedelegationEntryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegationEntry !== undefined) { + RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).join(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationEntry = RedelegationEntry.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntryResponse { + return { + redelegationEntry: isSet(object.redelegationEntry) + ? RedelegationEntry.fromJSON(object.redelegationEntry) + : undefined, + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + }; + }, + + toJSON(message: RedelegationEntryResponse): unknown { + const obj: any = {}; + if (message.redelegationEntry !== undefined) { + obj.redelegationEntry = RedelegationEntry.toJSON(message.redelegationEntry); + } + if (message.balance !== "") { + obj.balance = message.balance; + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntryResponse { + return RedelegationEntryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegationEntry = (object.redelegationEntry !== undefined && object.redelegationEntry !== null) + ? RedelegationEntry.fromPartial(object.redelegationEntry) + : undefined; + message.balance = object.balance ?? ""; + return message; + }, +}; + +function createBaseRedelegationResponse(): RedelegationResponse { + return { redelegation: undefined, entries: [] }; +} + +export const RedelegationResponse: MessageFns = { + encode(message: RedelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegation !== undefined) { + Redelegation.encode(message.redelegation, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + RedelegationEntryResponse.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegation = Redelegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(RedelegationEntryResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationResponse { + return { + redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RedelegationResponse): unknown { + const obj: any = {}; + if (message.redelegation !== undefined) { + obj.redelegation = Redelegation.toJSON(message.redelegation); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntryResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RedelegationResponse { + return RedelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { notBondedTokens: "", bondedTokens: "" }; +} + +export const Pool: MessageFns = { + encode(message: Pool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.notBondedTokens !== "") { + writer.uint32(10).string(message.notBondedTokens); + } + if (message.bondedTokens !== "") { + writer.uint32(18).string(message.bondedTokens); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.notBondedTokens = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bondedTokens = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pool { + return { + notBondedTokens: isSet(object.notBondedTokens) ? globalThis.String(object.notBondedTokens) : "", + bondedTokens: isSet(object.bondedTokens) ? globalThis.String(object.bondedTokens) : "", + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + if (message.notBondedTokens !== "") { + obj.notBondedTokens = message.notBondedTokens; + } + if (message.bondedTokens !== "") { + obj.bondedTokens = message.bondedTokens; + } + return obj; + }, + + create, I>>(base?: I): Pool { + return Pool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.notBondedTokens = object.notBondedTokens ?? ""; + message.bondedTokens = object.bondedTokens ?? ""; + return message; + }, +}; + +function createBaseValidatorUpdates(): ValidatorUpdates { + return { updates: [] }; +} + +export const ValidatorUpdates: MessageFns = { + encode(message: ValidatorUpdates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdates { + return { + updates: globalThis.Array.isArray(object?.updates) + ? object.updates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorUpdates): unknown { + const obj: any = {}; + if (message.updates?.length) { + obj.updates = message.updates.map((e) => ValidatorUpdate.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdates { + return ValidatorUpdates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 00000000..06be4ca4 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,1403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { CommissionRates, Description, Params } from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidator { + description: Description | undefined; + commission: CommissionRates | undefined; + minSelfDelegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + * + * @deprecated + */ + delegatorAddress: string; + validatorAddress: string; + pubkey: Any | undefined; + value: Coin | undefined; +} + +/** 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 | undefined; + validatorAddress: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commissionRate: string; + minSelfDelegation: string; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; + amount: Coin | undefined; +} + +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponse { + completionTime: Date | undefined; +} + +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponse { + completionTime: + | Date + | undefined; + /** + * amount returns the amount of undelegated coins + * + * Since: cosmos-sdk 0.50 + */ + amount: Coin | undefined; +} + +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegation { + delegatorAddress: string; + validatorAddress: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: + | Coin + | undefined; + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; +} + +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: undefined, + commission: undefined, + minSelfDelegation: "", + delegatorAddress: "", + validatorAddress: "", + pubkey: undefined, + value: undefined, + }; +} + +export const MsgCreateValidator: MessageFns = { + encode(message: MsgCreateValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.commission !== undefined) { + CommissionRates.encode(message.commission, writer.uint32(18).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(26).string(message.minSelfDelegation); + } + if (message.delegatorAddress !== "") { + writer.uint32(34).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(42).string(message.validatorAddress); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(50).fork()).join(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commission = CommissionRates.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.pubkey = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + 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 = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.commission !== undefined) { + obj.commission = CommissionRates.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.pubkey !== undefined) { + obj.pubkey = Any.toJSON(message.pubkey); + } + if (message.value !== undefined) { + obj.value = Coin.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateValidator { + return MsgCreateValidator.fromPartial(base ?? ({} as any)); + }, + 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.minSelfDelegation = object.minSelfDelegation ?? ""; + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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: MessageFns = { + encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateValidatorResponse { + return {}; + }, + + toJSON(_: MsgCreateValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, +}; + +function createBaseMsgEditValidator(): MsgEditValidator { + return { description: undefined, validatorAddress: "", commissionRate: "", minSelfDelegation: "" }; +} + +export const MsgEditValidator: MessageFns = { + encode(message: MsgEditValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.commissionRate !== "") { + writer.uint32(26).string(message.commissionRate); + } + if (message.minSelfDelegation !== "") { + writer.uint32(34).string(message.minSelfDelegation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commissionRate = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + commissionRate: isSet(object.commissionRate) ? globalThis.String(object.commissionRate) : "", + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + }; + }, + + toJSON(message: MsgEditValidator): unknown { + const obj: any = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.commissionRate !== "") { + obj.commissionRate = message.commissionRate; + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + return obj; + }, + + create, I>>(base?: I): MsgEditValidator { + return MsgEditValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.validatorAddress = object.validatorAddress ?? ""; + message.commissionRate = object.commissionRate ?? ""; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, +}; + +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} + +export const MsgEditValidatorResponse: MessageFns = { + encode(_: MsgEditValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgEditValidatorResponse { + return {}; + }, + + toJSON(_: MsgEditValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgEditValidatorResponse { + return MsgEditValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, +}; + +function createBaseMsgDelegate(): MsgDelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgDelegate: MessageFns = { + encode(message: MsgDelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgDelegate { + return MsgDelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +export const MsgDelegateResponse: MessageFns = { + encode(_: MsgDelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDelegateResponse { + return MsgDelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", amount: undefined }; +} + +export const MsgBeginRedelegate: MessageFns = { + encode(message: MsgBeginRedelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgBeginRedelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegate { + return MsgBeginRedelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { completionTime: undefined }; +} + +export const MsgBeginRedelegateResponse: MessageFns = { + encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegateResponse { + return { completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined }; + }, + + toJSON(message: MsgBeginRedelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + return message; + }, +}; + +function createBaseMsgUndelegate(): MsgUndelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgUndelegate: MessageFns = { + encode(message: MsgUndelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegate { + return MsgUndelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { completionTime: undefined, amount: undefined }; +} + +export const MsgUndelegateResponse: MessageFns = { + encode(message: MsgUndelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegateResponse { + return { + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegateResponse { + return MsgUndelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegation(): MsgCancelUnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", amount: undefined, creationHeight: 0 }; +} + +export const MsgCancelUnbondingDelegation: MessageFns = { + encode(message: MsgCancelUnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + if (message.creationHeight !== 0) { + writer.uint32(32).int64(message.creationHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelUnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + }; + }, + + toJSON(message: MsgCancelUnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelUnbondingDelegation { + return MsgCancelUnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelUnbondingDelegation { + const message = createBaseMsgCancelUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + message.creationHeight = object.creationHeight ?? 0; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegationResponse(): MsgCancelUnbondingDelegationResponse { + return {}; +} + +export const MsgCancelUnbondingDelegationResponse: MessageFns = { + encode(_: MsgCancelUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelUnbondingDelegationResponse { + return {}; + }, + + toJSON(_: MsgCancelUnbondingDelegationResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCancelUnbondingDelegationResponse { + return MsgCancelUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCancelUnbondingDelegationResponse { + const message = createBaseMsgCancelUnbondingDelegationResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + * and delegate back to previous validator. + * + * Since: cosmos-sdk 0.46 + */ + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise; + /** + * UpdateParams defines an operation for updating the x/staking module + * parameters. + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.staking.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 || MsgServiceName; + 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); + this.CancelUnbondingDelegation = this.CancelUnbondingDelegation.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise { + const data = MsgCancelUnbondingDelegation.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelUnbondingDelegation", data); + return promise.then((data) => MsgCancelUnbondingDelegationResponse.decode(new BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts new file mode 100644 index 00000000..15cd0546 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts @@ -0,0 +1,202 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/internal/kv/v1beta1/kv.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.internal.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: MessageFns = { + encode(message: Pairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + Pair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pairs.push(Pair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => Pair.fromJSON(e)) : [] }; + }, + + toJSON(message: Pairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => Pair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Pairs { + return Pairs.fromPartial(base ?? ({} as any)); + }, + 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(0), value: new Uint8Array(0) }; +} + +export const Pair: MessageFns = { + encode(message: Pair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pair { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Pair): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Pair { + return Pair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pair { + const message = createBasePair(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts new file mode 100644 index 00000000..6763ba8c --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts @@ -0,0 +1,728 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/snapshots/v1/snapshot.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.snapshots.v1"; + +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface Snapshot { + height: number; + format: number; + chunks: number; + hash: Uint8Array; + metadata: Metadata | undefined; +} + +/** Metadata contains SDK-specific snapshot metadata. */ +export interface Metadata { + /** SHA-256 chunk hashes */ + chunkHashes: Uint8Array[]; +} + +/** + * SnapshotItem is an item contained in a rootmulti.Store snapshot. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotItem { + store?: SnapshotStoreItem | undefined; + iavl?: SnapshotIAVLItem | undefined; + extension?: SnapshotExtensionMeta | undefined; + extensionPayload?: SnapshotExtensionPayload | undefined; +} + +/** + * SnapshotStoreItem contains metadata about a snapshotted store. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotStoreItem { + name: string; +} + +/** + * SnapshotIAVLItem is an exported IAVL node. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotIAVLItem { + key: Uint8Array; + value: Uint8Array; + /** version is block height */ + version: number; + /** height is depth of the tree. */ + height: number; +} + +/** + * SnapshotExtensionMeta contains metadata about an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionMeta { + name: string; + format: number; +} + +/** + * SnapshotExtensionPayload contains payloads of an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionPayload { + payload: Uint8Array; +} + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: undefined }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { chunkHashes: [] }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.chunkHashes) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunkHashes.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + chunkHashes: globalThis.Array.isArray(object?.chunkHashes) + ? object.chunkHashes.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.chunkHashes?.length) { + obj.chunkHashes = message.chunkHashes.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.chunkHashes = object.chunkHashes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSnapshotItem(): SnapshotItem { + return { store: undefined, iavl: undefined, extension: undefined, extensionPayload: undefined }; +} + +export const SnapshotItem: MessageFns = { + encode(message: SnapshotItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.store !== undefined) { + SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).join(); + } + if (message.iavl !== undefined) { + SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).join(); + } + if (message.extension !== undefined) { + SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).join(); + } + if (message.extensionPayload !== undefined) { + SnapshotExtensionPayload.encode(message.extensionPayload, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.store = SnapshotStoreItem.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionPayload = SnapshotExtensionPayload.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + extensionPayload: isSet(object.extensionPayload) + ? SnapshotExtensionPayload.fromJSON(object.extensionPayload) + : undefined, + }; + }, + + toJSON(message: SnapshotItem): unknown { + const obj: any = {}; + if (message.store !== undefined) { + obj.store = SnapshotStoreItem.toJSON(message.store); + } + if (message.iavl !== undefined) { + obj.iavl = SnapshotIAVLItem.toJSON(message.iavl); + } + if (message.extension !== undefined) { + obj.extension = SnapshotExtensionMeta.toJSON(message.extension); + } + if (message.extensionPayload !== undefined) { + obj.extensionPayload = SnapshotExtensionPayload.toJSON(message.extensionPayload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotItem { + return SnapshotItem.fromPartial(base ?? ({} as any)); + }, + 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.extensionPayload = (object.extensionPayload !== undefined && object.extensionPayload !== null) + ? SnapshotExtensionPayload.fromPartial(object.extensionPayload) + : undefined; + return message; + }, +}; + +function createBaseSnapshotStoreItem(): SnapshotStoreItem { + return { name: "" }; +} + +export const SnapshotStoreItem: MessageFns = { + encode(message: SnapshotStoreItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotStoreItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotStoreItem { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: SnapshotStoreItem): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): SnapshotStoreItem { + return SnapshotStoreItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { + return { key: new Uint8Array(0), value: new Uint8Array(0), version: 0, height: 0 }; +} + +export const SnapshotIAVLItem: MessageFns = { + encode(message: SnapshotIAVLItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.version !== 0) { + writer.uint32(24).int64(message.version); + } + if (message.height !== 0) { + writer.uint32(32).int32(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotIAVLItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.height = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotIAVLItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: SnapshotIAVLItem): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): SnapshotIAVLItem { + return SnapshotIAVLItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.version = object.version ?? 0; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { + return { name: "", format: 0 }; +} + +export const SnapshotExtensionMeta: MessageFns = { + encode(message: SnapshotExtensionMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionMeta { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + }; + }, + + toJSON(message: SnapshotExtensionMeta): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionMeta { + return SnapshotExtensionMeta.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SnapshotExtensionPayload: MessageFns = { + encode(message: SnapshotExtensionPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.payload = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionPayload { + return { payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(0) }; + }, + + toJSON(message: SnapshotExtensionPayload): unknown { + const obj: any = {}; + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionPayload { + return SnapshotExtensionPayload.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + message.payload = object.payload ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/streaming/abci/grpc.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/streaming/abci/grpc.ts new file mode 100644 index 00000000..4e0a2d5d --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/streaming/abci/grpc.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/streaming/abci/grpc.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../../tendermint/abci/types"; +import { StoreKVPair } from "../../v1beta1/listening"; + +export const protobufPackage = "cosmos.store.streaming.abci"; + +/** ListenEndBlockRequest is the request type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockRequest { + req: RequestFinalizeBlock | undefined; + res: ResponseFinalizeBlock | undefined; +} + +/** ListenEndBlockResponse is the response type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockResponse { +} + +/** ListenCommitRequest is the request type for the ListenCommit RPC method */ +export interface ListenCommitRequest { + /** explicitly pass in block height as ResponseCommit does not contain this info */ + blockHeight: number; + res: ResponseCommit | undefined; + changeSet: StoreKVPair[]; +} + +/** ListenCommitResponse is the response type for the ListenCommit RPC method */ +export interface ListenCommitResponse { +} + +function createBaseListenFinalizeBlockRequest(): ListenFinalizeBlockRequest { + return { req: undefined, res: undefined }; +} + +export const ListenFinalizeBlockRequest: MessageFns = { + encode(message: ListenFinalizeBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.req !== undefined) { + RequestFinalizeBlock.encode(message.req, writer.uint32(10).fork()).join(); + } + if (message.res !== undefined) { + ResponseFinalizeBlock.encode(message.res, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.req = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenFinalizeBlockRequest { + return { + req: isSet(object.req) ? RequestFinalizeBlock.fromJSON(object.req) : undefined, + res: isSet(object.res) ? ResponseFinalizeBlock.fromJSON(object.res) : undefined, + }; + }, + + toJSON(message: ListenFinalizeBlockRequest): unknown { + const obj: any = {}; + if (message.req !== undefined) { + obj.req = RequestFinalizeBlock.toJSON(message.req); + } + if (message.res !== undefined) { + obj.res = ResponseFinalizeBlock.toJSON(message.res); + } + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockRequest { + return ListenFinalizeBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenFinalizeBlockRequest { + const message = createBaseListenFinalizeBlockRequest(); + message.req = (object.req !== undefined && object.req !== null) + ? RequestFinalizeBlock.fromPartial(object.req) + : undefined; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseFinalizeBlock.fromPartial(object.res) + : undefined; + return message; + }, +}; + +function createBaseListenFinalizeBlockResponse(): ListenFinalizeBlockResponse { + return {}; +} + +export const ListenFinalizeBlockResponse: MessageFns = { + encode(_: ListenFinalizeBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenFinalizeBlockResponse { + return {}; + }, + + toJSON(_: ListenFinalizeBlockResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockResponse { + return ListenFinalizeBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenFinalizeBlockResponse { + const message = createBaseListenFinalizeBlockResponse(); + return message; + }, +}; + +function createBaseListenCommitRequest(): ListenCommitRequest { + return { blockHeight: 0, res: undefined, changeSet: [] }; +} + +export const ListenCommitRequest: MessageFns = { + encode(message: ListenCommitRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + if (message.res !== undefined) { + ResponseCommit.encode(message.res, writer.uint32(18).fork()).join(); + } + for (const v of message.changeSet) { + StoreKVPair.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changeSet.push(StoreKVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenCommitRequest { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + res: isSet(object.res) ? ResponseCommit.fromJSON(object.res) : undefined, + changeSet: globalThis.Array.isArray(object?.changeSet) + ? object.changeSet.map((e: any) => StoreKVPair.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListenCommitRequest): unknown { + const obj: any = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.res !== undefined) { + obj.res = ResponseCommit.toJSON(message.res); + } + if (message.changeSet?.length) { + obj.changeSet = message.changeSet.map((e) => StoreKVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListenCommitRequest { + return ListenCommitRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenCommitRequest { + const message = createBaseListenCommitRequest(); + message.blockHeight = object.blockHeight ?? 0; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseCommit.fromPartial(object.res) + : undefined; + message.changeSet = object.changeSet?.map((e) => StoreKVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListenCommitResponse(): ListenCommitResponse { + return {}; +} + +export const ListenCommitResponse: MessageFns = { + encode(_: ListenCommitResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenCommitResponse { + return {}; + }, + + toJSON(_: ListenCommitResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenCommitResponse { + return ListenCommitResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenCommitResponse { + const message = createBaseListenCommitResponse(); + return message; + }, +}; + +/** ABCIListenerService is the service for the BaseApp ABCIListener interface */ +export interface ABCIListenerService { + /** ListenFinalizeBlock is the corresponding endpoint for ABCIListener.ListenEndBlock */ + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise; + /** ListenCommit is the corresponding endpoint for ABCIListener.ListenCommit */ + ListenCommit(request: ListenCommitRequest): Promise; +} + +export const ABCIListenerServiceServiceName = "cosmos.store.streaming.abci.ABCIListenerService"; +export class ABCIListenerServiceClientImpl implements ABCIListenerService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIListenerServiceServiceName; + this.rpc = rpc; + this.ListenFinalizeBlock = this.ListenFinalizeBlock.bind(this); + this.ListenCommit = this.ListenCommit.bind(this); + } + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise { + const data = ListenFinalizeBlockRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenFinalizeBlock", data); + return promise.then((data) => ListenFinalizeBlockResponse.decode(new BinaryReader(data))); + } + + ListenCommit(request: ListenCommitRequest): Promise { + const data = ListenCommitRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenCommit", data); + return promise.then((data) => ListenCommitResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/v1beta1/commit_info.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/v1beta1/commit_info.ts new file mode 100644 index 00000000..17c74706 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/v1beta1/commit_info.ts @@ -0,0 +1,363 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/commit_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.store.v1beta1"; + +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfo { + version: number; + storeInfos: StoreInfo[]; + timestamp: Date | undefined; +} + +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfo { + name: string; + commitId: CommitID | undefined; +} + +/** + * CommitID defines the commitment information when a specific store is + * committed. + */ +export interface CommitID { + version: number; + hash: Uint8Array; +} + +function createBaseCommitInfo(): CommitInfo { + return { version: 0, storeInfos: [], timestamp: undefined }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== 0) { + writer.uint32(8).int64(message.version); + } + for (const v of message.storeInfos) { + StoreInfo.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.storeInfos.push(StoreInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + storeInfos: globalThis.Array.isArray(object?.storeInfos) + ? object.storeInfos.map((e: any) => StoreInfo.fromJSON(e)) + : [], + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.storeInfos?.length) { + obj.storeInfos = message.storeInfos.map((e) => StoreInfo.toJSON(e)); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.version = object.version ?? 0; + message.storeInfos = object.storeInfos?.map((e) => StoreInfo.fromPartial(e)) || []; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseStoreInfo(): StoreInfo { + return { name: "", commitId: undefined }; +} + +export const StoreInfo: MessageFns = { + encode(message: StoreInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.commitId !== undefined) { + CommitID.encode(message.commitId, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commitId = CommitID.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + commitId: isSet(object.commitId) ? CommitID.fromJSON(object.commitId) : undefined, + }; + }, + + toJSON(message: StoreInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.commitId !== undefined) { + obj.commitId = CommitID.toJSON(message.commitId); + } + return obj; + }, + + create, I>>(base?: I): StoreInfo { + return StoreInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreInfo { + const message = createBaseStoreInfo(); + message.name = object.name ?? ""; + message.commitId = (object.commitId !== undefined && object.commitId !== null) + ? CommitID.fromPartial(object.commitId) + : undefined; + return message; + }, +}; + +function createBaseCommitID(): CommitID { + return { version: 0, hash: new Uint8Array(0) }; +} + +export const CommitID: MessageFns = { + encode(message: CommitID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): CommitID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitID { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitID): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): CommitID { + return CommitID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitID { + const message = createBaseCommitID(); + message.version = object.version ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/v1beta1/listening.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/v1beta1/listening.ts new file mode 100644 index 00000000..73eb4288 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/store/v1beta1/listening.ts @@ -0,0 +1,294 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/listening.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../tendermint/abci/types"; + +export const protobufPackage = "cosmos.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 */ + storeKey: string; + /** true indicates a delete operation, false indicates a set operation */ + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} + +/** + * BlockMetadata contains all the abci event data of a block + * the file streamer dump them into files together with the state changes. + */ +export interface BlockMetadata { + responseCommit: ResponseCommit | undefined; + requestFinalizeBlock: + | RequestFinalizeBlock + | undefined; + /** TODO: should we renumber this? */ + responseFinalizeBlock: ResponseFinalizeBlock | undefined; +} + +function createBaseStoreKVPair(): StoreKVPair { + return { storeKey: "", delete: false, key: new Uint8Array(0), value: new Uint8Array(0) }; +} + +export const StoreKVPair: MessageFns = { + encode(message: StoreKVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.storeKey !== "") { + writer.uint32(10).string(message.storeKey); + } + if (message.delete !== false) { + 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: BinaryReader | Uint8Array, length?: number): StoreKVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.storeKey = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.delete = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.key = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKVPair { + return { + storeKey: isSet(object.storeKey) ? globalThis.String(object.storeKey) : "", + delete: isSet(object.delete) ? globalThis.Boolean(object.delete) : false, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: StoreKVPair): unknown { + const obj: any = {}; + if (message.storeKey !== "") { + obj.storeKey = message.storeKey; + } + if (message.delete !== false) { + obj.delete = message.delete; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): StoreKVPair { + return StoreKVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKVPair { + const message = createBaseStoreKVPair(); + message.storeKey = object.storeKey ?? ""; + message.delete = object.delete ?? false; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseBlockMetadata(): BlockMetadata { + return { responseCommit: undefined, requestFinalizeBlock: undefined, responseFinalizeBlock: undefined }; +} + +export const BlockMetadata: MessageFns = { + encode(message: BlockMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.responseCommit !== undefined) { + ResponseCommit.encode(message.responseCommit, writer.uint32(50).fork()).join(); + } + if (message.requestFinalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.requestFinalizeBlock, writer.uint32(58).fork()).join(); + } + if (message.responseFinalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.responseFinalizeBlock, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + if (tag !== 50) { + break; + } + + message.responseCommit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestFinalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.responseFinalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMetadata { + return { + responseCommit: isSet(object.responseCommit) ? ResponseCommit.fromJSON(object.responseCommit) : undefined, + requestFinalizeBlock: isSet(object.requestFinalizeBlock) + ? RequestFinalizeBlock.fromJSON(object.requestFinalizeBlock) + : undefined, + responseFinalizeBlock: isSet(object.responseFinalizeBlock) + ? ResponseFinalizeBlock.fromJSON(object.responseFinalizeBlock) + : undefined, + }; + }, + + toJSON(message: BlockMetadata): unknown { + const obj: any = {}; + if (message.responseCommit !== undefined) { + obj.responseCommit = ResponseCommit.toJSON(message.responseCommit); + } + if (message.requestFinalizeBlock !== undefined) { + obj.requestFinalizeBlock = RequestFinalizeBlock.toJSON(message.requestFinalizeBlock); + } + if (message.responseFinalizeBlock !== undefined) { + obj.responseFinalizeBlock = ResponseFinalizeBlock.toJSON(message.responseFinalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): BlockMetadata { + return BlockMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMetadata { + const message = createBaseBlockMetadata(); + message.responseCommit = (object.responseCommit !== undefined && object.responseCommit !== null) + ? ResponseCommit.fromPartial(object.responseCommit) + : undefined; + message.requestFinalizeBlock = (object.requestFinalizeBlock !== undefined && object.requestFinalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.requestFinalizeBlock) + : undefined; + message.responseFinalizeBlock = + (object.responseFinalizeBlock !== undefined && object.responseFinalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.responseFinalizeBlock) + : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/config/v1/config.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/config/v1/config.ts new file mode 100644 index 00000000..aa780391 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/config/v1/config.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/config/v1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.tx.config.v1"; + +/** Config is the config object of the x/auth/tx package. */ +export interface Config { + /** + * skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipAnteHandler: boolean; + /** + * skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipPostHandler: boolean; +} + +function createBaseConfig(): Config { + return { skipAnteHandler: false, skipPostHandler: false }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.skipAnteHandler !== false) { + writer.uint32(8).bool(message.skipAnteHandler); + } + if (message.skipPostHandler !== false) { + writer.uint32(16).bool(message.skipPostHandler); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.skipAnteHandler = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.skipPostHandler = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + skipAnteHandler: isSet(object.skipAnteHandler) ? globalThis.Boolean(object.skipAnteHandler) : false, + skipPostHandler: isSet(object.skipPostHandler) ? globalThis.Boolean(object.skipPostHandler) : false, + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.skipAnteHandler !== false) { + obj.skipAnteHandler = message.skipAnteHandler; + } + if (message.skipPostHandler !== false) { + obj.skipPostHandler = message.skipPostHandler; + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.skipAnteHandler = object.skipAnteHandler ?? false; + message.skipPostHandler = object.skipPostHandler ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 00000000..35f6e628 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,620 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/signing/v1beta1/signing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + * + * Since: cosmos-sdk 0.50 + */ + SIGN_MODE_TEXTUAL = 2, + /** + * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses + * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not + * require signers signing over other signers' `signer_info`. + * + * Since: cosmos-sdk 0.46 + */ + SIGN_MODE_DIRECT_AUX = 3, + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future. + */ + SIGN_MODE_LEGACY_AMINO_JSON = 127, + /** + * SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + * SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + * + * Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + * but is not implemented on the SDK by default. To enable EIP-191, you need + * to pass a custom `TxConfig` that has an implementation of + * `SignModeHandler` for EIP-191. The SDK may decide to fully support + * EIP-191 in the future. + * + * Since: cosmos-sdk 0.45.2 + */ + SIGN_MODE_EIP_191 = 191, + UNRECOGNIZED = -1, +} + +export function signModeFromJSON(object: any): SignMode { + switch (object) { + case 0: + case "SIGN_MODE_UNSPECIFIED": + return SignMode.SIGN_MODE_UNSPECIFIED; + case 1: + case "SIGN_MODE_DIRECT": + return SignMode.SIGN_MODE_DIRECT; + case 2: + case "SIGN_MODE_TEXTUAL": + return SignMode.SIGN_MODE_TEXTUAL; + case 3: + case "SIGN_MODE_DIRECT_AUX": + return SignMode.SIGN_MODE_DIRECT_AUX; + case 127: + case "SIGN_MODE_LEGACY_AMINO_JSON": + return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + case 191: + case "SIGN_MODE_EIP_191": + return SignMode.SIGN_MODE_EIP_191; + case -1: + case "UNRECOGNIZED": + default: + return SignMode.UNRECOGNIZED; + } +} + +export function signModeToJSON(object: SignMode): string { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return "SIGN_MODE_UNSPECIFIED"; + case SignMode.SIGN_MODE_DIRECT: + return "SIGN_MODE_DIRECT"; + case SignMode.SIGN_MODE_TEXTUAL: + return "SIGN_MODE_TEXTUAL"; + case SignMode.SIGN_MODE_DIRECT_AUX: + return "SIGN_MODE_DIRECT_AUX"; + case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: + return "SIGN_MODE_LEGACY_AMINO_JSON"; + case SignMode.SIGN_MODE_EIP_191: + return "SIGN_MODE_EIP_191"; + case SignMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} + +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + publicKey: Any | undefined; + data: + | SignatureDescriptor_Data + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_Data[]; +} + +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { signatures: [] }; +} + +export const SignatureDescriptors: MessageFns = { + encode(message: SignatureDescriptors, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptors(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptors { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptors): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptors { + return SignatureDescriptors.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map((e) => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { publicKey: undefined, data: undefined, sequence: 0 }; +} + +export const SignatureDescriptor: MessageFns = { + encode(message: SignatureDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + data: isSet(object.data) ? SignatureDescriptor_Data.fromJSON(object.data) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.data !== undefined) { + obj.data = SignatureDescriptor_Data.toJSON(message.data); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor { + return SignatureDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.data = (object.data !== undefined && object.data !== null) + ? SignatureDescriptor_Data.fromPartial(object.data) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { + return { single: undefined, multi: undefined }; +} + +export const SignatureDescriptor_Data: MessageFns = { + encode(message: SignatureDescriptor_Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = SignatureDescriptor_Data_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = SignatureDescriptor_Data_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data { + return SignatureDescriptor_Data.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SignatureDescriptor_Data_Single: MessageFns = { + encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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(0), + }; + }, + + toJSON(message: SignatureDescriptor_Data_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { + return { bitarray: undefined, signatures: [] }; +} + +export const SignatureDescriptor_Data_Multi: MessageFns = { + encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.signatures) { + SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor_Data_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptor_Data_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor_Data.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/v1beta1/service.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/v1beta1/service.ts new file mode 100644 index 00000000..411f1dc2 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,1855 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 - DEPRECATED: use BROADCAST_MODE_SYNC instead, + * BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + * + * @deprecated + */ + 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. + * Deprecated post v0.47.x: use query instead, which should contain a valid + * events query. + * + * @deprecated + */ + events: string[]; + /** + * pagination defines a pagination for the request. + * Deprecated post v0.46.x: use page and limit instead. + * + * @deprecated + */ + pagination: PageRequest | undefined; + orderBy: OrderBy; + /** + * page is the page number to query, starts at 1. If not provided, will + * default to first page. + */ + page: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * query defines the transaction event query that is proxied to Tendermint's + * TxSearch RPC method. The query must be valid. + * + * Since cosmos-sdk 0.50 + */ + query: string; +} + +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponse { + /** txs is the list of queried transactions. */ + txs: Tx[]; + /** tx_responses is the list of queried TxResponses. */ + txResponses: TxResponse[]; + /** + * pagination defines a pagination for the response. + * Deprecated post v0.46.x: use total instead. + * + * @deprecated + */ + pagination: + | PageResponse + | undefined; + /** total is total number of results available */ + total: number; +} + +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; + mode: BroadcastMode; +} + +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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 + | undefined; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + txBytes: 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. */ + gasInfo: + | GasInfo + | undefined; + /** result is the result of the simulation. */ + result: Result | undefined; +} + +/** + * 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 + | undefined; + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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: number; + /** pagination defines a pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponse { + /** txs are the transactions in the block. */ + txs: Tx[]; + blockId: BlockID | undefined; + block: + | Block + | undefined; + /** pagination defines a pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; +} + +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponse { + /** tx is the decoded transaction. */ + tx: Tx | undefined; +} + +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequest { + /** tx is the transaction to encode. */ + tx: Tx | undefined; +} + +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponse { + /** tx_bytes is the encoded transaction bytes. */ + txBytes: Uint8Array; +} + +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequest { + aminoJson: string; +} + +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponse { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequest { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponse { + aminoJson: string; +} + +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { events: [], pagination: undefined, orderBy: 0, page: 0, limit: 0, query: "" }; +} + +export const GetTxsEventRequest: MessageFns = { + encode(message: GetTxsEventRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.orderBy !== 0) { + writer.uint32(24).int32(message.orderBy); + } + if (message.page !== 0) { + writer.uint32(32).uint64(message.page); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + if (message.query !== "") { + writer.uint32(50).string(message.query); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.orderBy = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.page = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventRequest { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0, + page: isSet(object.page) ? globalThis.Number(object.page) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + query: isSet(object.query) ? globalThis.String(object.query) : "", + }; + }, + + toJSON(message: GetTxsEventRequest): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.orderBy !== 0) { + obj.orderBy = orderByToJSON(message.orderBy); + } + if (message.page !== 0) { + obj.page = Math.round(message.page); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.query !== "") { + obj.query = message.query; + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventRequest { + return GetTxsEventRequest.fromPartial(base ?? ({} as any)); + }, + 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.orderBy = object.orderBy ?? 0; + message.page = object.page ?? 0; + message.limit = object.limit ?? 0; + message.query = object.query ?? ""; + return message; + }, +}; + +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { txs: [], txResponses: [], pagination: undefined, total: 0 }; +} + +export const GetTxsEventResponse: MessageFns = { + encode(message: GetTxsEventResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResponses) { + TxResponse.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + if (message.total !== 0) { + writer.uint32(32).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponses.push(TxResponse.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + txResponses: globalThis.Array.isArray(object?.txResponses) + ? object.txResponses.map((e: any) => TxResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: GetTxsEventResponse): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.txResponses?.length) { + obj.txResponses = message.txResponses.map((e) => TxResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventResponse { + return GetTxsEventResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.txResponses = object.txResponses?.map((e) => TxResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.total = object.total ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { txBytes: new Uint8Array(0), mode: 0 }; +} + +export const BroadcastTxRequest: MessageFns = { + encode(message: BroadcastTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxRequest { + return { + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0, + }; + }, + + toJSON(message: BroadcastTxRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + if (message.mode !== 0) { + obj.mode = broadcastModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxRequest { + return BroadcastTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + message.mode = object.mode ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { txResponse: undefined }; +} + +export const BroadcastTxResponse: MessageFns = { + encode(message: BroadcastTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxResponse { + return { txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined }; + }, + + toJSON(message: BroadcastTxResponse): unknown { + const obj: any = {}; + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxResponse { + return BroadcastTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseSimulateRequest(): SimulateRequest { + return { tx: undefined, txBytes: new Uint8Array(0) }; +} + +export const SimulateRequest: MessageFns = { + encode(message: SimulateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txBytes.length !== 0) { + writer.uint32(18).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateRequest { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + }; + }, + + toJSON(message: SimulateRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): SimulateRequest { + return SimulateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSimulateResponse(): SimulateResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulateResponse: MessageFns = { + encode(message: SimulateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulateResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulateResponse { + return SimulateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateResponse { + const message = createBaseSimulateResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseGetTxRequest(): GetTxRequest { + return { hash: "" }; +} + +export const GetTxRequest: MessageFns = { + encode(message: GetTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxRequest { + return { hash: isSet(object.hash) ? globalThis.String(object.hash) : "" }; + }, + + toJSON(message: GetTxRequest): unknown { + const obj: any = {}; + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): GetTxRequest { + return GetTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseGetTxResponse(): GetTxResponse { + return { tx: undefined, txResponse: undefined }; +} + +export const GetTxResponse: MessageFns = { + encode(message: GetTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxResponse { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined, + }; + }, + + toJSON(message: GetTxResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): GetTxResponse { + return GetTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { height: 0, pagination: undefined }; +} + +export const GetBlockWithTxsRequest: MessageFns = { + encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.fromPartial(base ?? ({} as any)); + }, + 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: [], blockId: undefined, block: undefined, pagination: undefined }; +} + +export const GetBlockWithTxsResponse: MessageFns = { + encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(18).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(26).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : 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?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseTxDecodeRequest(): TxDecodeRequest { + return { txBytes: new Uint8Array(0) }; +} + +export const TxDecodeRequest: MessageFns = { + encode(message: TxDecodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeRequest { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeRequest { + return TxDecodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeResponse(): TxDecodeResponse { + return { tx: undefined }; +} + +export const TxDecodeResponse: MessageFns = { + encode(message: TxDecodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeResponse { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxDecodeResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeResponse { + return TxDecodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeRequest(): TxEncodeRequest { + return { tx: undefined }; +} + +export const TxEncodeRequest: MessageFns = { + encode(message: TxEncodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeRequest { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxEncodeRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeRequest { + return TxEncodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeResponse(): TxEncodeResponse { + return { txBytes: new Uint8Array(0) }; +} + +export const TxEncodeResponse: MessageFns = { + encode(message: TxEncodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeResponse { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeResponse): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeResponse { + return TxEncodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxEncodeAminoRequest(): TxEncodeAminoRequest { + return { aminoJson: "" }; +} + +export const TxEncodeAminoRequest: MessageFns = { + encode(message: TxEncodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoRequest { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxEncodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoRequest { + return TxEncodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, +}; + +function createBaseTxEncodeAminoResponse(): TxEncodeAminoResponse { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxEncodeAminoResponse: MessageFns = { + encode(message: TxEncodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoResponse { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoResponse { + return TxEncodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoRequest(): TxDecodeAminoRequest { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxDecodeAminoRequest: MessageFns = { + encode(message: TxDecodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoRequest { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoRequest { + return TxDecodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoResponse(): TxDecodeAminoResponse { + return { aminoJson: "" }; +} + +export const TxDecodeAminoResponse: MessageFns = { + encode(message: TxDecodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoResponse { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxDecodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoResponse { + return TxDecodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + message.aminoJson = object.aminoJson ?? ""; + 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; + /** + * TxDecode decodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxDecode(request: TxDecodeRequest): Promise; + /** + * TxEncode encodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxEncode(request: TxEncodeRequest): Promise; + /** + * TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. + * + * Since: cosmos-sdk 0.47 + */ + TxEncodeAmino(request: TxEncodeAminoRequest): Promise; + /** + * TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. + * + * Since: cosmos-sdk 0.47 + */ + TxDecodeAmino(request: TxDecodeAminoRequest): Promise; +} + +export const ServiceServiceName = "cosmos.tx.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.TxDecode = this.TxDecode.bind(this); + this.TxEncode = this.TxEncode.bind(this); + this.TxEncodeAmino = this.TxEncodeAmino.bind(this); + this.TxDecodeAmino = this.TxDecodeAmino.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + TxDecode(request: TxDecodeRequest): Promise { + const data = TxDecodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecode", data); + return promise.then((data) => TxDecodeResponse.decode(new BinaryReader(data))); + } + + TxEncode(request: TxEncodeRequest): Promise { + const data = TxEncodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncode", data); + return promise.then((data) => TxEncodeResponse.decode(new BinaryReader(data))); + } + + TxEncodeAmino(request: TxEncodeAminoRequest): Promise { + const data = TxEncodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncodeAmino", data); + return promise.then((data) => TxEncodeAminoResponse.decode(new BinaryReader(data))); + } + + TxDecodeAmino(request: TxDecodeAminoRequest): Promise { + const data = TxDecodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecodeAmino", data); + return promise.then((data) => TxDecodeAminoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 00000000..f2c427d1 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,1615 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + authInfo: + | AuthInfo + | undefined; + /** + * 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. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + authInfoBytes: Uint8Array; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} + +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDoc { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + authInfoBytes: Uint8Array; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chainId: string; + /** account_number is the account number of the account in state */ + accountNumber: number; +} + +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAux { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** public_key is the public key of the signing account. */ + publicKey: + | Any + | undefined; + /** + * chain_id is the identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker. + */ + chainId: string; + /** account_number is the account number of the account in state. */ + accountNumber: number; + /** sequence is the sequence number of the signing account. */ + sequence: number; + /** + * tips have been depreacted and should not be used + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBody { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages: Any[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeoutHeight: number; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extensionOptions: Any[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + nonCriticalExtensionOptions: Any[]; +} + +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfo { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signerInfos: SignerInfo[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee: + | Fee + | undefined; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + * + * Since: cosmos-sdk 0.46 + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfo { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + publicKey: + | Any + | undefined; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + modeInfo: + | ModeInfo + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + modeInfos: 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 + */ + gasLimit: number; + /** + * 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 + * + * @deprecated + */ +export interface Tip { + /** amount is the amount of the tip */ + amount: Coin[]; + /** tipper is the address of the account paying for the tip */ + tipper: string; +} + +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerData { + /** + * address is the bech32-encoded address of the auxiliary signer. If using + * AuxSignerData across different chains, the bech32 prefix of the target + * chain (where the final transaction is broadcasted) should be used. + */ + address: string; + /** + * sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + * signs. Note: we use the same sign doc even if we're signing with + * LEGACY_AMINO_JSON. + */ + signDoc: + | SignDocDirectAux + | undefined; + /** 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, authInfo: undefined, signatures: [] }; +} + +export const Tx: MessageFns = { + encode(message: Tx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).join(); + } + if (message.authInfo !== undefined) { + AuthInfo.encode(message.authInfo, writer.uint32(18).fork()).join(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.body = TxBody.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfo = AuthInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tx { + return { + body: isSet(object.body) ? TxBody.fromJSON(object.body) : undefined, + authInfo: isSet(object.authInfo) ? AuthInfo.fromJSON(object.authInfo) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Tx): unknown { + const obj: any = {}; + if (message.body !== undefined) { + obj.body = TxBody.toJSON(message.body); + } + if (message.authInfo !== undefined) { + obj.authInfo = AuthInfo.toJSON(message.authInfo); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Tx { + return Tx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Tx { + const message = createBaseTx(); + message.body = (object.body !== undefined && object.body !== null) ? TxBody.fromPartial(object.body) : undefined; + message.authInfo = (object.authInfo !== undefined && object.authInfo !== null) + ? AuthInfo.fromPartial(object.authInfo) + : undefined; + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTxRaw(): TxRaw { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), signatures: [] }; +} + +export const TxRaw: MessageFns = { + encode(message: TxRaw, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRaw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxRaw { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: TxRaw): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): TxRaw { + return TxRaw.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxRaw { + const message = createBaseTxRaw(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSignDoc(): SignDoc { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), chainId: "", accountNumber: 0 }; +} + +export const SignDoc: MessageFns = { + encode(message: SignDoc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDoc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDoc { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + }; + }, + + toJSON(message: SignDoc): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + return obj; + }, + + create, I>>(base?: I): SignDoc { + return SignDoc.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDoc { + const message = createBaseSignDoc(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 0; + return message; + }, +}; + +function createBaseSignDocDirectAux(): SignDocDirectAux { + return { + bodyBytes: new Uint8Array(0), + publicKey: undefined, + chainId: "", + accountNumber: 0, + sequence: 0, + tip: undefined, + }; +} + +export const SignDocDirectAux: MessageFns = { + encode(message: SignDocDirectAux, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(18).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(40).uint64(message.sequence); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDocDirectAux(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDocDirectAux { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined, + }; + }, + + toJSON(message: SignDocDirectAux): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): SignDocDirectAux { + return SignDocDirectAux.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 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: "", timeoutHeight: 0, extensionOptions: [], nonCriticalExtensionOptions: [] }; +} + +export const TxBody: MessageFns = { + encode(message: TxBody, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (message.timeoutHeight !== 0) { + writer.uint32(24).uint64(message.timeoutHeight); + } + for (const v of message.extensionOptions) { + Any.encode(v!, writer.uint32(8186).fork()).join(); + } + for (const v of message.nonCriticalExtensionOptions) { + Any.encode(v!, writer.uint32(16378).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.memo = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.timeoutHeight = longToNumber(reader.uint64()); + continue; + case 1023: + if (tag !== 8186) { + break; + } + + message.extensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + case 2047: + if (tag !== 16378) { + break; + } + + message.nonCriticalExtensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxBody { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + memo: isSet(object.memo) ? globalThis.String(object.memo) : "", + timeoutHeight: isSet(object.timeoutHeight) ? globalThis.Number(object.timeoutHeight) : 0, + extensionOptions: globalThis.Array.isArray(object?.extensionOptions) + ? object.extensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + nonCriticalExtensionOptions: globalThis.Array.isArray(object?.nonCriticalExtensionOptions) + ? object.nonCriticalExtensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.memo !== "") { + obj.memo = message.memo; + } + if (message.timeoutHeight !== 0) { + obj.timeoutHeight = Math.round(message.timeoutHeight); + } + if (message.extensionOptions?.length) { + obj.extensionOptions = message.extensionOptions.map((e) => Any.toJSON(e)); + } + if (message.nonCriticalExtensionOptions?.length) { + obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxBody { + return TxBody.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeoutHeight = object.timeoutHeight ?? 0; + message.extensionOptions = object.extensionOptions?.map((e) => Any.fromPartial(e)) || []; + message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAuthInfo(): AuthInfo { + return { signerInfos: [], fee: undefined, tip: undefined }; +} + +export const AuthInfo: MessageFns = { + encode(message: AuthInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signerInfos) { + SignerInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fee !== undefined) { + Fee.encode(message.fee, writer.uint32(18).fork()).join(); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signerInfos.push(SignerInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fee = Fee.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthInfo { + return { + signerInfos: globalThis.Array.isArray(object?.signerInfos) + ? object.signerInfos.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.signerInfos?.length) { + obj.signerInfos = message.signerInfos.map((e) => SignerInfo.toJSON(e)); + } + if (message.fee !== undefined) { + obj.fee = Fee.toJSON(message.fee); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): AuthInfo { + return AuthInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signerInfos?.map((e) => SignerInfo.fromPartial(e)) || []; + message.fee = (object.fee !== undefined && object.fee !== null) ? Fee.fromPartial(object.fee) : undefined; + message.tip = (object.tip !== undefined && object.tip !== null) ? Tip.fromPartial(object.tip) : undefined; + return message; + }, +}; + +function createBaseSignerInfo(): SignerInfo { + return { publicKey: undefined, modeInfo: undefined, sequence: 0 }; +} + +export const SignerInfo: MessageFns = { + encode(message: SignerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.modeInfo !== undefined) { + ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfo = ModeInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignerInfo { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + modeInfo: isSet(object.modeInfo) ? ModeInfo.fromJSON(object.modeInfo) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.modeInfo !== undefined) { + obj.modeInfo = ModeInfo.toJSON(message.modeInfo); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignerInfo { + return SignerInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignerInfo { + const message = createBaseSignerInfo(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.modeInfo = (object.modeInfo !== undefined && object.modeInfo !== null) + ? ModeInfo.fromPartial(object.modeInfo) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModeInfo(): ModeInfo { + return { single: undefined, multi: undefined }; +} + +export const ModeInfo: MessageFns = { + encode(message: ModeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + ModeInfo_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = ModeInfo_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = ModeInfo_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = ModeInfo_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = ModeInfo_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo { + return ModeInfo.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ModeInfo_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Single { + return { mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; + }, + + toJSON(message: ModeInfo_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Single { + return ModeInfo_Single.fromPartial(base ?? ({} as any)); + }, + 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, modeInfos: [] }; +} + +export const ModeInfo_Multi: MessageFns = { + encode(message: ModeInfo_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.modeInfos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfos.push(ModeInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + modeInfos: globalThis.Array.isArray(object?.modeInfos) + ? object.modeInfos.map((e: any) => ModeInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModeInfo_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.modeInfos?.length) { + obj.modeInfos = message.modeInfos.map((e) => ModeInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Multi { + return ModeInfo_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + message.bitarray = (object.bitarray !== undefined && object.bitarray !== null) + ? CompactBitArray.fromPartial(object.bitarray) + : undefined; + message.modeInfos = object.modeInfos?.map((e) => ModeInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFee(): Fee { + return { amount: [], gasLimit: 0, payer: "", granter: "" }; +} + +export const Fee: MessageFns = { + encode(message: Fee, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.gasLimit !== 0) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.payer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.granter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Fee { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + gasLimit: isSet(object.gasLimit) ? globalThis.Number(object.gasLimit) : 0, + payer: isSet(object.payer) ? globalThis.String(object.payer) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + }; + }, + + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.gasLimit !== 0) { + obj.gasLimit = Math.round(message.gasLimit); + } + if (message.payer !== "") { + obj.payer = message.payer; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + return obj; + }, + + create, I>>(base?: I): Fee { + return Fee.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.gasLimit = object.gasLimit ?? 0; + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, +}; + +function createBaseTip(): Tip { + return { amount: [], tipper: "" }; +} + +export const Tip: MessageFns = { + encode(message: Tip, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.tipper !== "") { + writer.uint32(18).string(message.tipper); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tip { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTip(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tipper = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tip { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + tipper: isSet(object.tipper) ? globalThis.String(object.tipper) : "", + }; + }, + + toJSON(message: Tip): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.tipper !== "") { + obj.tipper = message.tipper; + } + return obj; + }, + + create, I>>(base?: I): Tip { + return Tip.fromPartial(base ?? ({} as any)); + }, + 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: "", signDoc: undefined, mode: 0, sig: new Uint8Array(0) }; +} + +export const AuxSignerData: MessageFns = { + encode(message: AuxSignerData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.signDoc !== undefined) { + SignDocDirectAux.encode(message.signDoc, writer.uint32(18).fork()).join(); + } + if (message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + if (message.sig.length !== 0) { + writer.uint32(34).bytes(message.sig); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuxSignerData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signDoc = SignDocDirectAux.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sig = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuxSignerData { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array(0), + }; + }, + + toJSON(message: AuxSignerData): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.signDoc !== undefined) { + obj.signDoc = SignDocDirectAux.toJSON(message.signDoc); + } + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.sig.length !== 0) { + obj.sig = base64FromBytes(message.sig); + } + return obj; + }, + + create, I>>(base?: I): AuxSignerData { + return AuxSignerData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuxSignerData { + const message = createBaseAuxSignerData(); + message.address = object.address ?? ""; + message.signDoc = (object.signDoc !== undefined && object.signDoc !== null) + ? SignDocDirectAux.fromPartial(object.signDoc) + : undefined; + message.mode = object.mode ?? 0; + message.sig = object.sig ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/module/v1/module.ts new file mode 100644 index 00000000..2bec3886 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.upgrade.module.v1"; + +/** Module is the config object of the upgrade module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/query.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 00000000..39cddba7 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,811 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * 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: number; +} + +/** + * 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 + */ + lastHeight: number; +} + +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + * + * @deprecated + */ +export interface QueryUpgradedConsensusStateResponse { + /** Since: cosmos-sdk 0.43 */ + upgradedConsensusState: 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 + */ + moduleName: 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. */ + moduleVersions: 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: MessageFns = { + encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCurrentPlanRequest { + return {}; + }, + + toJSON(_: QueryCurrentPlanRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, +}; + +function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { + return { plan: undefined }; +} + +export const QueryCurrentPlanResponse: MessageFns = { + encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCurrentPlanResponse { + return { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; + }, + + toJSON(message: QueryCurrentPlanResponse): unknown { + const obj: any = {}; + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryAppliedPlanRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { + return { height: 0 }; +} + +export const QueryAppliedPlanResponse: MessageFns = { + encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryAppliedPlanResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return { lastHeight: 0 }; +} + +export const QueryUpgradedConsensusStateRequest: MessageFns = { + encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.lastHeight !== 0) { + writer.uint32(8).int64(message.lastHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.lastHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateRequest { + return { lastHeight: isSet(object.lastHeight) ? globalThis.Number(object.lastHeight) : 0 }; + }, + + toJSON(message: QueryUpgradedConsensusStateRequest): unknown { + const obj: any = {}; + if (message.lastHeight !== 0) { + obj.lastHeight = Math.round(message.lastHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + message.lastHeight = object.lastHeight ?? 0; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { upgradedConsensusState: new Uint8Array(0) }; +} + +export const QueryUpgradedConsensusStateResponse: MessageFns = { + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.upgradedConsensusState.length !== 0) { + writer.uint32(18).bytes(message.upgradedConsensusState); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.upgradedConsensusState = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: isSet(object.upgradedConsensusState) + ? bytesFromBase64(object.upgradedConsensusState) + : new Uint8Array(0), + }; + }, + + toJSON(message: QueryUpgradedConsensusStateResponse): unknown { + const obj: any = {}; + if (message.upgradedConsensusState.length !== 0) { + obj.upgradedConsensusState = base64FromBytes(message.upgradedConsensusState); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgradedConsensusState = object.upgradedConsensusState ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { + return { moduleName: "" }; +} + +export const QueryModuleVersionsRequest: MessageFns = { + encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsRequest { + return { moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "" }; + }, + + toJSON(message: QueryModuleVersionsRequest): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + message.moduleName = object.moduleName ?? ""; + return message; + }, +}; + +function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { + return { moduleVersions: [] }; +} + +export const QueryModuleVersionsResponse: MessageFns = { + encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.moduleVersions) { + ModuleVersion.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.moduleVersions.push(ModuleVersion.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsResponse { + return { + moduleVersions: globalThis.Array.isArray(object?.moduleVersions) + ? object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryModuleVersionsResponse): unknown { + const obj: any = {}; + if (message.moduleVersions?.length) { + obj.moduleVersions = message.moduleVersions.map((e) => ModuleVersion.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.moduleVersions = object.moduleVersions?.map((e) => ModuleVersion.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { + return {}; +} + +export const QueryAuthorityRequest: MessageFns = { + encode(_: QueryAuthorityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAuthorityRequest { + return {}; + }, + + toJSON(_: QueryAuthorityRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAuthorityRequest { + return QueryAuthorityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAuthorityRequest { + const message = createBaseQueryAuthorityRequest(); + return message; + }, +}; + +function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { + return { address: "" }; +} + +export const QueryAuthorityResponse: MessageFns = { + encode(message: QueryAuthorityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorityResponse { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAuthorityResponse): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorityResponse { + return QueryAuthorityResponse.fromPartial(base ?? ({} as any)); + }, + 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 + * + * Since: cosmos-sdk 0.46 + */ + Authority(request: QueryAuthorityRequest): Promise; +} + +export const QueryServiceName = "cosmos.upgrade.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts new file mode 100644 index 00000000..48e7cf58 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts @@ -0,0 +1,337 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Plan } from "./upgrade"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgrade { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** plan is the upgrade plan. */ + plan: Plan | undefined; +} + +/** + * 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 that controls the module (defaults to x/gov unless overwritten). */ + 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: MessageFns = { + encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSoftwareUpgrade { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: MsgSoftwareUpgrade): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgSoftwareUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSoftwareUpgradeResponse { + return {}; + }, + + toJSON(_: MsgSoftwareUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSoftwareUpgradeResponse { + const message = createBaseMsgSoftwareUpgradeResponse(); + return message; + }, +}; + +function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { + return { authority: "" }; +} + +export const MsgCancelUpgrade: MessageFns = { + encode(message: MsgCancelUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelUpgrade { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: MsgCancelUpgrade): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): MsgCancelUpgrade { + return MsgCancelUpgrade.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelUpgrade { + const message = createBaseMsgCancelUpgrade(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { + return {}; +} + +export const MsgCancelUpgradeResponse: MessageFns = { + encode(_: MsgCancelUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelUpgradeResponse { + return {}; + }, + + toJSON(_: MsgCancelUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.fromPartial(base ?? ({} as any)); + }, + 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 + * approved software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + CancelUpgrade(request: MsgCancelUpgrade): Promise; +} + +export const MsgServiceName = "cosmos.upgrade.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 00000000..30096c1f --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,513 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/upgrade.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** The height at which the upgrade must be performed. */ + height: number; + /** + * Any application specific upgrade info to be included on-chain + * such as a git commit that validators could automatically upgrade to + */ + info: string; + /** + * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + * moved to the IBC module in the sub module 02-client. + * If this field is not empty, an error will be thrown. + * + * @deprecated + */ + upgradedClientState: Any | undefined; +} + +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + * + * @deprecated + */ +export interface SoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; + /** plan of the proposal */ + plan: Plan | undefined; +} + +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + * + * @deprecated + */ +export interface CancelSoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; +} + +/** + * 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: number; +} + +function createBasePlan(): Plan { + return { name: "", time: undefined, height: 0, info: "", upgradedClientState: undefined }; +} + +export const Plan: MessageFns = { + encode(message: Plan, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Plan { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.upgradedClientState = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Plan { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + info: isSet(object.info) ? globalThis.String(object.info) : "", + upgradedClientState: isSet(object.upgradedClientState) ? Any.fromJSON(object.upgradedClientState) : undefined, + }; + }, + + toJSON(message: Plan): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.upgradedClientState !== undefined) { + obj.upgradedClientState = Any.toJSON(message.upgradedClientState); + } + return obj; + }, + + create, I>>(base?: I): Plan { + return Plan.fromPartial(base ?? ({} as any)); + }, + 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.upgradedClientState = (object.upgradedClientState !== undefined && object.upgradedClientState !== null) + ? Any.fromPartial(object.upgradedClientState) + : undefined; + return message; + }, +}; + +function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { + return { title: "", description: "", plan: undefined }; +} + +export const SoftwareUpgradeProposal: MessageFns = { + encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: SoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CancelSoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: CancelSoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ModuleVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.version !== 0) { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleVersion { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: ModuleVersion): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): ModuleVersion { + return ModuleVersion.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/module/v1/module.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/module/v1/module.ts new file mode 100644 index 00000000..99609e8c --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.vesting.module.v1"; + +/** Module is the config object of the vesting module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/v1beta1/tx.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 00000000..034b0314 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,628 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + fromAddress: string; + toAddress: string; + amount: Coin[]; + /** end of vesting as unix time (in seconds). */ + endTime: number; + delayed: boolean; +} + +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponse { +} + +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; +} + +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponse { +} + +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccount { + fromAddress: string; + toAddress: string; + /** start of vesting as unix time (in seconds). */ + startTime: number; + vestingPeriods: Period[]; +} + +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponse { +} + +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { fromAddress: "", toAddress: "", amount: [], endTime: 0, delayed: false }; +} + +export const MsgCreateVestingAccount: MessageFns = { + encode(message: MsgCreateVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(32).int64(message.endTime); + } + if (message.delayed !== false) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.delayed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + delayed: isSet(object.delayed) ? globalThis.Boolean(object.delayed) : false, + }; + }, + + toJSON(message: MsgCreateVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + if (message.delayed !== false) { + obj.delayed = message.delayed; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccount { + return MsgCreateVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + message.delayed = object.delayed ?? false; + return message; + }, +}; + +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} + +export const MsgCreateVestingAccountResponse: MessageFns = { + encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreateVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgCreatePermanentLockedAccount: MessageFns = { + encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePermanentLockedAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCreatePermanentLockedAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { + return {}; +} + +export const MsgCreatePermanentLockedAccountResponse: MessageFns = { + encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePermanentLockedAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { + return { fromAddress: "", toAddress: "", startTime: 0, vestingPeriods: [] }; +} + +export const MsgCreatePeriodicVestingAccount: MessageFns = { + encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + if (message.startTime !== 0) { + writer.uint32(24).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePeriodicVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreatePeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { + return {}; +} + +export const MsgCreatePeriodicVestingAccountResponse: MessageFns = { + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePeriodicVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + CreatePermanentLockedAccount( + request: MsgCreatePermanentLockedAccount, + ): Promise; + /** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * + * Since: cosmos-sdk 0.46 + */ + CreatePeriodicVestingAccount( + request: MsgCreatePeriodicVestingAccount, + ): Promise; +} + +export const MsgServiceName = "cosmos.vesting.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 00000000..0fe13459 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,610 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/vesting.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + baseAccount: BaseAccount | undefined; + originalVesting: Coin[]; + delegatedFree: Coin[]; + delegatedVesting: Coin[]; + /** Vesting end time, as unix timestamp (in seconds). */ + endTime: number; +} + +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccount { + baseVestingAccount: + | BaseVestingAccount + | undefined; + /** Vesting start time, as unix timestamp (in seconds). */ + startTime: number; +} + +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; +} + +/** Period defines a length of time and amount of coins that will vest. */ +export interface Period { + /** Period duration in seconds. */ + length: number; + amount: Coin[]; +} + +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; + startTime: number; + vestingPeriods: 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 { + baseVestingAccount: BaseVestingAccount | undefined; +} + +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { baseAccount: undefined, originalVesting: [], delegatedFree: [], delegatedVesting: [], endTime: 0 }; +} + +export const BaseVestingAccount: MessageFns = { + encode(message: BaseVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + for (const v of message.originalVesting) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatedFree) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.delegatedVesting) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(40).int64(message.endTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.originalVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatedFree.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatedVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseVestingAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + originalVesting: globalThis.Array.isArray(object?.originalVesting) + ? object.originalVesting.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedFree: globalThis.Array.isArray(object?.delegatedFree) + ? object.delegatedFree.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedVesting: globalThis.Array.isArray(object?.delegatedVesting) + ? object.delegatedVesting.map((e: any) => Coin.fromJSON(e)) + : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + }; + }, + + toJSON(message: BaseVestingAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.originalVesting?.length) { + obj.originalVesting = message.originalVesting.map((e) => Coin.toJSON(e)); + } + if (message.delegatedFree?.length) { + obj.delegatedFree = message.delegatedFree.map((e) => Coin.toJSON(e)); + } + if (message.delegatedVesting?.length) { + obj.delegatedVesting = message.delegatedVesting.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + return obj; + }, + + create, I>>(base?: I): BaseVestingAccount { + return BaseVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.originalVesting = object.originalVesting?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedFree = object.delegatedFree?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedVesting = object.delegatedVesting?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + return message; + }, +}; + +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { baseVestingAccount: undefined, startTime: 0 }; +} + +export const ContinuousVestingAccount: MessageFns = { + encode(message: ContinuousVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContinuousVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + }; + }, + + toJSON(message: ContinuousVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + return obj; + }, + + create, I>>(base?: I): ContinuousVestingAccount { + return ContinuousVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + return message; + }, +}; + +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { baseVestingAccount: undefined }; +} + +export const DelayedVestingAccount: MessageFns = { + encode(message: DelayedVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelayedVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: DelayedVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): DelayedVestingAccount { + return DelayedVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +function createBasePeriod(): Period { + return { length: 0, amount: [] }; +} + +export const Period: MessageFns = { + encode(message: Period, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.length !== 0) { + writer.uint32(8).int64(message.length); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Period { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.length = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Period { + return { + length: isSet(object.length) ? globalThis.Number(object.length) : 0, + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Period): unknown { + const obj: any = {}; + if (message.length !== 0) { + obj.length = Math.round(message.length); + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Period { + return Period.fromPartial(base ?? ({} as any)); + }, + 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 { baseVestingAccount: undefined, startTime: 0, vestingPeriods: [] }; +} + +export const PeriodicVestingAccount: MessageFns = { + encode(message: PeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeriodicVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PeriodicVestingAccount { + return PeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { baseVestingAccount: undefined }; +} + +export const PermanentLockedAccount: MessageFns = { + encode(message: PermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PermanentLockedAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: PermanentLockedAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): PermanentLockedAccount { + return PermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.feegrant.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.feegrant.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.feegrant.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.feegrant.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.feegrant.v1beta1/types/google/api/http.ts b/ts-client/cosmos.feegrant.v1beta1/types/google/api/http.ts index 9010600b..d3390802 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,94 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} + * This enables an HTTP REST to gRPC mapping as below: * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: - * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` - * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` - * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. - * - * For HTTP method kinds which allow a request body, the `body` field + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +134,10 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +147,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +159,14 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +188,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC + * HTTP | gRPC * -----|----- * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` - * - * # Rules for HTTP mapping - * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: - * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. - * - * The syntax of the path template is as follows: + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +224,115 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +346,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +383,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +419,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +438,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +470,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +491,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +500,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +586,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +668,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +679,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +704,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +741,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; @@ -673,3 +753,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/any.ts b/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/any.ts index f4abfdf9..24b86540 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/any.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/any.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/any.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -28,6 +34,10 @@ 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. * @@ -111,7 +121,8 @@ export interface Any { * * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. * * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. @@ -125,8 +136,8 @@ function createBaseAny(): Any { return { typeUrl: "", value: new Uint8Array(0) }; } -export const Any = { - encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Any: MessageFns = { + encode(message: Any, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.typeUrl !== "") { writer.uint32(10).string(message.typeUrl); } @@ -136,8 +147,8 @@ export const Any = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Any { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAny(); while (reader.pos < end) { @@ -161,14 +172,14 @@ export const Any = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Any { return { - typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), }; }, @@ -195,30 +206,11 @@ export const Any = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -228,21 +220,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -253,3 +246,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..b7d4af33 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,106 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +112,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +133,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +142,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +178,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +193,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,33 +312,40 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** @@ -163,7 +371,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +398,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +529,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +544,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +561,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +573,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +607,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +657,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +667,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,13 +678,17 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** * 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 @@ -469,8 +697,10 @@ export interface FileOptions { * However, an extension field still accepts non-UTF-8 byte sequences. * This option has no effect on when used with the lite runtime. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +708,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +723,83 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: boolean | undefined; + phpGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,21 +871,31 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** + * 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. + * * Whether the message is an automatically generated map entry type for the * maps field. * @@ -647,12 +913,31 @@ export interface MessageOptions { * 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. + */ + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. * - * 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. + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated */ - mapEntry: boolean; + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -661,18 +946,26 @@ 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release -- sorry, we'll try to include + * other types in a future version! */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +979,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -715,17 +1010,46 @@ export interface FieldOptions { * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. + * + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1057,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1144,150 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1297,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1337,39 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1381,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1453,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,51 +1474,341 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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. +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + NONE = 1, + VERIFY = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 1: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: Edition | undefined; + features?: FeatureSet | undefined; +} + +/** + * 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. @@ -1010,8 +1822,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition occurs. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1879,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1900,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1925,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2020,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2063,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2082,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2226,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) + : [], + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2309,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2339,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2359,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2394,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2475,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2571,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2617,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2664,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2700,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2737,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2771,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2821,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,6 +2839,134 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; + return message; + }, +}; + +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; +} + +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; return message; }, }; @@ -1915,46 +2987,46 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { }; } -export const FieldDescriptorProto = { - encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(24).int32(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { writer.uint32(32).int32(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { writer.uint32(40).int32(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { writer.uint32(50).string(message.typeName); } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { writer.uint32(18).string(message.extendee); } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { writer.uint32(58).string(message.defaultValue); } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { writer.uint32(72).int32(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3113,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3198,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3234,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3274,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3294,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3340,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3402,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3438,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3480,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3526,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3571,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3617,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3671,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3747,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2736,7 +3817,7 @@ function createBaseFileOptions(): FileOptions { pyGenericServices: false, phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3825,84 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { writer.uint32(336).bool(message.phpGenericServices); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2963,6 +4048,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4066,37 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + phpGenericServices: isSet(object.phpGenericServices) ? globalThis.Boolean(object.phpGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4104,69 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { obj.phpGenericServices = message.phpGenericServices; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3094,7 +4190,7 @@ export const FileOptions = { message.pyGenericServices = object.pyGenericServices ?? false; message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4198,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4212,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4281,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4306,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4333,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4368,81 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4476,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4497,51 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4553,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4561,22 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4584,42 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,32 +4635,124 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; +} + +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptions_EditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: FieldOptions_EditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; + return message; + }, +}; + function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; + return { features: undefined, uninterpretedOption: [] }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3417,14 +4764,15 @@ export const OneofOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3432,6 +4780,9 @@ export const OneofOptions = { toJSON(message: OneofOptions): unknown { const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3443,31 +4794,48 @@ export const OneofOptions = { }, fromPartial, I>>(object: I): OneofOptions { const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { writer.uint32(16).bool(message.allowAlias); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumOptions(); while (reader.pos < end) { @@ -3487,6 +4855,20 @@ export const EnumOptions = { message.deprecated = reader.bool(); continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3498,16 +4880,20 @@ export const EnumOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumOptions { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3515,12 +4901,20 @@ export const EnumOptions = { toJSON(message: EnumOptions): unknown { const obj: any = {}; - if (message.allowAlias === true) { + if (message.allowAlias !== undefined && message.allowAlias !== false) { obj.allowAlias = message.allowAlias; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3534,28 +4928,38 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { deprecated: false, features: undefined, debugRedact: false, uninterpretedOption: [] }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +4972,20 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +4997,17 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5015,15 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5036,47 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5095,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5112,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5129,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5139,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5180,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5198,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5218,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5240,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5260,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5312,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5346,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5370,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5411,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5447,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5464,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5481,337 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, features: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +5828,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +5863,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +5887,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +5953,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +5978,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6008,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6034,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6066,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6136,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6167,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6191,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6210,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6233,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/duration.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/timestamp.ts b/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/timestamp.ts index 560af8a4..c7ff7f50 100644 --- a/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/timestamp.ts +++ b/ts-client/cosmos.feegrant.v1beta1/types/google/protobuf/timestamp.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/timestamp.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -92,7 +97,7 @@ export const protobufPackage = "google.protobuf"; * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use * the Joda Time's [`ISODateTimeFormat.dateTime()`]( - * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() * ) to obtain a formatter capable of generating timestamps in this format. */ export interface Timestamp { @@ -115,8 +120,8 @@ function createBaseTimestamp(): Timestamp { return { seconds: 0, nanos: 0 }; } -export const Timestamp = { - encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Timestamp: MessageFns = { + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -126,8 +131,8 @@ export const Timestamp = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTimestamp(); while (reader.pos < end) { @@ -138,7 +143,7 @@ export const Timestamp = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -151,15 +156,15 @@ export const Timestamp = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Timestamp { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -185,29 +190,11 @@ export const Timestamp = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -215,18 +202,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/route-name.eta b/ts-client/cosmos.feegrant.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/abci/types.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/abci/types.ts new file mode 100644 index 00000000..c4e0902e --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/abci/types.ts @@ -0,0 +1,5925 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/abci/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { ConsensusParams } from "../types/params"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON } from "../types/validator"; + +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 MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1, +} + +export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} + +export function misbehaviorTypeToJSON(object: MisbehaviorType): string { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Request { + echo?: RequestEcho | undefined; + flush?: RequestFlush | undefined; + info?: RequestInfo | undefined; + initChain?: RequestInitChain | undefined; + query?: RequestQuery | undefined; + checkTx?: RequestCheckTx | undefined; + commit?: RequestCommit | undefined; + listSnapshots?: RequestListSnapshots | undefined; + offerSnapshot?: RequestOfferSnapshot | undefined; + loadSnapshotChunk?: RequestLoadSnapshotChunk | undefined; + applySnapshotChunk?: RequestApplySnapshotChunk | undefined; + prepareProposal?: RequestPrepareProposal | undefined; + processProposal?: RequestProcessProposal | undefined; + extendVote?: RequestExtendVote | undefined; + verifyVoteExtension?: RequestVerifyVoteExtension | undefined; + finalizeBlock?: RequestFinalizeBlock | undefined; +} + +export interface RequestEcho { + message: string; +} + +export interface RequestFlush { +} + +export interface RequestInfo { + version: string; + blockVersion: number; + p2pVersion: number; + abciVersion: string; +} + +export interface RequestInitChain { + time: Date | undefined; + chainId: string; + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appStateBytes: Uint8Array; + initialHeight: number; +} + +export interface RequestQuery { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} + +export interface RequestCommit { +} + +/** lists available snapshots */ +export interface RequestListSnapshots { +} + +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot: + | Snapshot + | undefined; + /** light client-verified app hash for snapshot height */ + appHash: Uint8Array; +} + +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: number; + format: number; + chunk: number; +} + +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} + +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: number; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit: ExtendedCommitInfo | undefined; + misbehavior: Misbehavior[]; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} + +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Extends a vote with application-injected data */ +export interface RequestExtendVote { + /** the hash of the block that this vote may be referring to */ + hash: Uint8Array; + /** the height of the extended vote */ + height: number; + /** info of the block that this vote may be referring to */ + time: Date | undefined; + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Verify the vote extension */ +export interface RequestVerifyVoteExtension { + /** the hash of the block that this received vote corresponds to */ + hash: Uint8Array; + /** the validator that signed the vote extension */ + validatorAddress: Uint8Array; + height: number; + voteExtension: Uint8Array; +} + +export interface RequestFinalizeBlock { + txs: Uint8Array[]; + decidedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the decided block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +export interface Response { + exception?: ResponseException | undefined; + echo?: ResponseEcho | undefined; + flush?: ResponseFlush | undefined; + info?: ResponseInfo | undefined; + initChain?: ResponseInitChain | undefined; + query?: ResponseQuery | undefined; + checkTx?: ResponseCheckTx | undefined; + commit?: ResponseCommit | undefined; + listSnapshots?: ResponseListSnapshots | undefined; + offerSnapshot?: ResponseOfferSnapshot | undefined; + loadSnapshotChunk?: ResponseLoadSnapshotChunk | undefined; + applySnapshotChunk?: ResponseApplySnapshotChunk | undefined; + prepareProposal?: ResponsePrepareProposal | undefined; + processProposal?: ResponseProcessProposal | undefined; + extendVote?: ResponseExtendVote | undefined; + verifyVoteExtension?: ResponseVerifyVoteExtension | undefined; + finalizeBlock?: ResponseFinalizeBlock | undefined; +} + +/** nondeterministic */ +export interface ResponseException { + error: string; +} + +export interface ResponseEcho { + message: string; +} + +export interface ResponseFlush { +} + +export interface ResponseInfo { + data: string; + version: string; + appVersion: number; + lastBlockHeight: number; + lastBlockAppHash: Uint8Array; +} + +export interface ResponseInitChain { + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appHash: Uint8Array; +} + +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + events: Event[]; + codespace: string; +} + +export interface ResponseCommit { + retainHeight: number; +} + +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 */ + refetchChunks: number[]; + /** Chunk senders to reject and ban */ + rejectSenders: 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"; + } +} + +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} + +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} + +export enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} + +export function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseExtendVote { + voteExtension: Uint8Array; +} + +export interface ResponseVerifyVoteExtension { + status: ResponseVerifyVoteExtension_VerifyStatus; +} + +export enum ResponseVerifyVoteExtension_VerifyStatus { + UNKNOWN = 0, + ACCEPT = 1, + /** + * REJECT - Rejecting the vote extension will reject the entire precommit by the sender. + * Incorrectly implementing this thus has liveness implications as it may affect + * CometBFT's ability to receive 2/3+ valid votes to finalize the block. + * Honest nodes should never be rejected. + */ + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseVerifyVoteExtension_VerifyStatusFromJSON( + object: any, +): ResponseVerifyVoteExtension_VerifyStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseVerifyVoteExtension_VerifyStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseVerifyVoteExtension_VerifyStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED; + } +} + +export function responseVerifyVoteExtension_VerifyStatusToJSON( + object: ResponseVerifyVoteExtension_VerifyStatus, +): string { + switch (object) { + case ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseVerifyVoteExtension_VerifyStatus.ACCEPT: + return "ACCEPT"; + case ResponseVerifyVoteExtension_VerifyStatus.REJECT: + return "REJECT"; + case ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseFinalizeBlock { + /** set of block events emmitted as part of executing the block */ + events: Event[]; + /** + * the result of executing each transaction including the events + * the particular transction emitted. This should match the order + * of the transactions delivered in the block itself + */ + txResults: ExecTxResult[]; + /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ + validatorUpdates: ValidatorUpdate[]; + /** updates to the consensus params, if any. */ + consensusParamUpdates: + | ConsensusParams + | undefined; + /** + * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + * deterministic. It is up to the application to decide which algorithm to use. + */ + appHash: Uint8Array; +} + +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} + +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} + +/** + * Event allows application developers to attach additional information to + * ResponseFinalizeBlock and ResponseCheckTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} + +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} + +/** + * ExecTxResult contains results of executing one individual transaction. + * + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted + */ +export interface ExecTxResult { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + /** nondeterministic */ + events: Event[]; + codespace: string; +} + +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: number; + index: number; + tx: Uint8Array; + result: ExecTxResult | undefined; +} + +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: number; +} + +export interface ValidatorUpdate { + pubKey: PublicKey | undefined; + power: number; +} + +export interface VoteInfo { + validator: Validator | undefined; + blockIdFlag: BlockIDFlag; +} + +export interface ExtendedVoteInfo { + /** The validator that sent the vote. */ + validator: + | Validator + | undefined; + /** Non-deterministic extension provided by the sending validator's application. */ + voteExtension: Uint8Array; + /** Vote extension signature created by CometBFT */ + extensionSignature: Uint8Array; + /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ + blockIdFlag: BlockIDFlag; +} + +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator: + | Validator + | undefined; + /** The height when the offense occurred */ + height: number; + /** The corresponding time where the offense occurred */ + time: + | Date + | undefined; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + totalVotingPower: number; +} + +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: number; + /** 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, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Request: MessageFns = { + encode(message: Request, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.echo !== undefined) { + RequestEcho.encode(message.echo, writer.uint32(10).fork()).join(); + } + if (message.flush !== undefined) { + RequestFlush.encode(message.flush, writer.uint32(18).fork()).join(); + } + if (message.info !== undefined) { + RequestInfo.encode(message.info, writer.uint32(26).fork()).join(); + } + if (message.initChain !== undefined) { + RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).join(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).join(); + } + if (message.checkTx !== undefined) { + RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).join(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).join(); + } + if (message.listSnapshots !== undefined) { + RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.prepareProposal !== undefined) { + RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).join(); + } + if (message.processProposal !== undefined) { + RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).join(); + } + if (message.extendVote !== undefined) { + RequestExtendVote.encode(message.extendVote, writer.uint32(146).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + RequestVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(154).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.finalizeBlock, writer.uint32(162).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Request { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.echo = RequestEcho.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.flush = RequestFlush.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.info = RequestInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.initChain = RequestInitChain.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = RequestQuery.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.commit = RequestCommit.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.extendVote = RequestExtendVote.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.verifyVoteExtension = RequestVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.finalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? RequestInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? RequestCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? RequestListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? RequestOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? RequestPrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? RequestProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? RequestExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? RequestVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? RequestFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Request): unknown { + const obj: any = {}; + if (message.echo !== undefined) { + obj.echo = RequestEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = RequestFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = RequestInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = RequestInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = RequestQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = RequestCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = RequestCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = RequestListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = RequestOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = RequestPrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = RequestProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = RequestExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = RequestVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = RequestFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Request { + return Request.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? RequestInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? RequestQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? RequestCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? RequestCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? RequestListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? RequestPrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? RequestProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? RequestExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? RequestVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseRequestEcho(): RequestEcho { + return { message: "" }; +} + +export const RequestEcho: MessageFns = { + encode(message: RequestEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: RequestEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): RequestEcho { + return RequestEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseRequestFlush(): RequestFlush { + return {}; +} + +export const RequestFlush: MessageFns = { + encode(_: RequestFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestFlush { + return {}; + }, + + toJSON(_: RequestFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestFlush { + return RequestFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, +}; + +function createBaseRequestInfo(): RequestInfo { + return { version: "", blockVersion: 0, p2pVersion: 0, abciVersion: "" }; +} + +export const RequestInfo: MessageFns = { + encode(message: RequestInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.blockVersion !== 0) { + writer.uint32(16).uint64(message.blockVersion); + } + if (message.p2pVersion !== 0) { + writer.uint32(24).uint64(message.p2pVersion); + } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockVersion = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.p2pVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.abciVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo { + return { + version: isSet(object.version) ? globalThis.String(object.version) : "", + blockVersion: isSet(object.blockVersion) ? globalThis.Number(object.blockVersion) : 0, + p2pVersion: isSet(object.p2pVersion) ? globalThis.Number(object.p2pVersion) : 0, + abciVersion: isSet(object.abciVersion) ? globalThis.String(object.abciVersion) : "", + }; + }, + + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + if (message.version !== "") { + obj.version = message.version; + } + if (message.blockVersion !== 0) { + obj.blockVersion = Math.round(message.blockVersion); + } + if (message.p2pVersion !== 0) { + obj.p2pVersion = Math.round(message.p2pVersion); + } + if (message.abciVersion !== "") { + obj.abciVersion = message.abciVersion; + } + return obj; + }, + + create, I>>(base?: I): RequestInfo { + return RequestInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = object.blockVersion ?? 0; + message.p2pVersion = object.p2pVersion ?? 0; + message.abciVersion = object.abciVersion ?? ""; + return message; + }, +}; + +function createBaseRequestInitChain(): RequestInitChain { + return { + time: undefined, + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(0), + initialHeight: 0, + }; +} + +export const RequestInitChain: MessageFns = { + encode(message: RequestInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appStateBytes = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.initialHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInitChain { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appStateBytes: isSet(object.appStateBytes) ? bytesFromBase64(object.appStateBytes) : new Uint8Array(0), + initialHeight: isSet(object.initialHeight) ? globalThis.Number(object.initialHeight) : 0, + }; + }, + + toJSON(message: RequestInitChain): unknown { + const obj: any = {}; + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appStateBytes.length !== 0) { + obj.appStateBytes = base64FromBytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + obj.initialHeight = Math.round(message.initialHeight); + } + return obj; + }, + + create, I>>(base?: I): RequestInitChain { + return RequestInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(0); + message.initialHeight = object.initialHeight ?? 0; + return message; + }, +}; + +function createBaseRequestQuery(): RequestQuery { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const RequestQuery: MessageFns = { + encode(message: RequestQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestQuery { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: RequestQuery): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): RequestQuery { + return RequestQuery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseRequestCheckTx(): RequestCheckTx { + return { tx: new Uint8Array(0), type: 0 }; +} + +export const RequestCheckTx: MessageFns = { + encode(message: RequestCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestCheckTx { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + + toJSON(message: RequestCheckTx): unknown { + const obj: any = {}; + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.type !== 0) { + obj.type = checkTxTypeToJSON(message.type); + } + return obj; + }, + + create, I>>(base?: I): RequestCheckTx { + return RequestCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(0); + message.type = object.type ?? 0; + return message; + }, +}; + +function createBaseRequestCommit(): RequestCommit { + return {}; +} + +export const RequestCommit: MessageFns = { + encode(_: RequestCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestCommit { + return {}; + }, + + toJSON(_: RequestCommit): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestCommit { + return RequestCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, +}; + +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} + +export const RequestListSnapshots: MessageFns = { + encode(_: RequestListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestListSnapshots { + return {}; + }, + + toJSON(_: RequestListSnapshots): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestListSnapshots { + return RequestListSnapshots.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; + +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { snapshot: undefined, appHash: new Uint8Array(0) }; +} + +export const RequestOfferSnapshot: MessageFns = { + encode(message: RequestOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshot = Snapshot.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestOfferSnapshot { + return { + snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestOfferSnapshot): unknown { + const obj: any = {}; + if (message.snapshot !== undefined) { + obj.snapshot = Snapshot.toJSON(message.snapshot); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): RequestOfferSnapshot { + return RequestOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) + ? Snapshot.fromPartial(object.snapshot) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { height: 0, format: 0, chunk: 0 }; +} + +export const RequestLoadSnapshotChunk: MessageFns = { + encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunk = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestLoadSnapshotChunk { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunk: isSet(object.chunk) ? globalThis.Number(object.chunk) : 0, + }; + }, + + toJSON(message: RequestLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunk !== 0) { + obj.chunk = Math.round(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + 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(0), sender: "" }; +} + +export const RequestApplySnapshotChunk: MessageFns = { + encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chunk = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestApplySnapshotChunk { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0), + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + }; + }, + + toJSON(message: RequestApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + if (message.sender !== "") { + obj.sender = message.sender; + } + return obj; + }, + + create, I>>(base?: I): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(0); + message.sender = object.sender ?? ""; + return message; + }, +}; + +function createBaseRequestPrepareProposal(): RequestPrepareProposal { + return { + maxTxBytes: 0, + txs: [], + localLastCommit: undefined, + misbehavior: [], + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestPrepareProposal: MessageFns = { + encode(message: RequestPrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTxBytes !== 0) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v!); + } + if (message.localLastCommit !== undefined) { + ExtendedCommitInfo.encode(message.localLastCommit, writer.uint32(26).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxTxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.localLastCommit = ExtendedCommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrepareProposal { + return { + maxTxBytes: isSet(object.maxTxBytes) ? globalThis.Number(object.maxTxBytes) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + localLastCommit: isSet(object.localLastCommit) ? ExtendedCommitInfo.fromJSON(object.localLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestPrepareProposal): unknown { + const obj: any = {}; + if (message.maxTxBytes !== 0) { + obj.maxTxBytes = Math.round(message.maxTxBytes); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.localLastCommit !== undefined) { + obj.localLastCommit = ExtendedCommitInfo.toJSON(message.localLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestPrepareProposal { + return RequestPrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = object.maxTxBytes ?? 0; + message.txs = object.txs?.map((e) => e) || []; + message.localLastCommit = (object.localLastCommit !== undefined && object.localLastCommit !== null) + ? ExtendedCommitInfo.fromPartial(object.localLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestProcessProposal(): RequestProcessProposal { + return { + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestProcessProposal: MessageFns = { + encode(message: RequestProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestProcessProposal { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestProcessProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestProcessProposal { + return RequestProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestExtendVote(): RequestExtendVote { + return { + hash: new Uint8Array(0), + height: 0, + time: undefined, + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestExtendVote: MessageFns = { + encode(message: RequestExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(26).fork()).join(); + } + for (const v of message.txs) { + writer.uint32(34).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(42).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestExtendVote { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestExtendVote): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestExtendVote { + return RequestExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestExtendVote { + const message = createBaseRequestExtendVote(); + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestVerifyVoteExtension(): RequestVerifyVoteExtension { + return { hash: new Uint8Array(0), validatorAddress: new Uint8Array(0), height: 0, voteExtension: new Uint8Array(0) }; +} + +export const RequestVerifyVoteExtension: MessageFns = { + encode(message: RequestVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.voteExtension.length !== 0) { + writer.uint32(34).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestVerifyVoteExtension { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + message.hash = object.hash ?? new Uint8Array(0); + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestFinalizeBlock(): RequestFinalizeBlock { + return { + txs: [], + decidedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestFinalizeBlock: MessageFns = { + encode(message: RequestFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.decidedLastCommit !== undefined) { + CommitInfo.encode(message.decidedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decidedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestFinalizeBlock { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + decidedLastCommit: isSet(object.decidedLastCommit) ? CommitInfo.fromJSON(object.decidedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestFinalizeBlock): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.decidedLastCommit !== undefined) { + obj.decidedLastCommit = CommitInfo.toJSON(message.decidedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestFinalizeBlock { + return RequestFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map((e) => e) || []; + message.decidedLastCommit = (object.decidedLastCommit !== undefined && object.decidedLastCommit !== null) + ? CommitInfo.fromPartial(object.decidedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Response: MessageFns = { + encode(message: Response, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).join(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).join(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).join(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + if (message.initChain !== undefined) { + ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).join(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).join(); + } + if (message.checkTx !== undefined) { + ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).join(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).join(); + } + if (message.listSnapshots !== undefined) { + ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).join(); + } + if (message.prepareProposal !== undefined) { + ResponsePrepareProposal.encode(message.prepareProposal, writer.uint32(138).fork()).join(); + } + if (message.processProposal !== undefined) { + ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).join(); + } + if (message.extendVote !== undefined) { + ResponseExtendVote.encode(message.extendVote, writer.uint32(154).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + ResponseVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(162).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.finalizeBlock, writer.uint32(170).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exception = ResponseException.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.echo = ResponseEcho.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.flush = ResponseFlush.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = ResponseInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.initChain = ResponseInitChain.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.query = ResponseQuery.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.commit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.listSnapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.offerSnapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.applySnapshotChunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.prepareProposal = ResponsePrepareProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.processProposal = ResponseProcessProposal.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.extendVote = ResponseExtendVote.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.verifyVoteExtension = ResponseVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.finalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? ResponseInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? ResponseQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? ResponseCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? ResponseCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? ResponseListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? ResponseOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? ResponsePrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? ResponseProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? ResponseExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? ResponseVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? ResponseFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + if (message.exception !== undefined) { + obj.exception = ResponseException.toJSON(message.exception); + } + if (message.echo !== undefined) { + obj.echo = ResponseEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = ResponseFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = ResponseInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = ResponseInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = ResponseQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = ResponseCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = ResponseCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = ResponseListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = ResponseOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = ResponsePrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = ResponseProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = ResponseExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = ResponseVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = ResponseFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Response { + return Response.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? ResponseInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ResponseQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? ResponseCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? ResponseCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? ResponseListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? ResponsePrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? ResponseProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? ResponseExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? ResponseVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseResponseException(): ResponseException { + return { error: "" }; +} + +export const ResponseException: MessageFns = { + encode(message: ResponseException, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.error = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseException { + return { error: isSet(object.error) ? globalThis.String(object.error) : "" }; + }, + + toJSON(message: ResponseException): unknown { + const obj: any = {}; + if (message.error !== "") { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): ResponseException { + return ResponseException.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; + +function createBaseResponseEcho(): ResponseEcho { + return { message: "" }; +} + +export const ResponseEcho: MessageFns = { + encode(message: ResponseEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: ResponseEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ResponseEcho { + return ResponseEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseResponseFlush(): ResponseFlush { + return {}; +} + +export const ResponseFlush: MessageFns = { + encode(_: ResponseFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ResponseFlush { + return {}; + }, + + toJSON(_: ResponseFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ResponseFlush { + return ResponseFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, +}; + +function createBaseResponseInfo(): ResponseInfo { + return { data: "", version: "", appVersion: 0, lastBlockHeight: 0, lastBlockAppHash: new Uint8Array(0) }; +} + +export const ResponseInfo: MessageFns = { + encode(message: ResponseInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.appVersion !== 0) { + writer.uint32(24).uint64(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.appVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.lastBlockHeight = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockAppHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInfo { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + appVersion: isSet(object.appVersion) ? globalThis.Number(object.appVersion) : 0, + lastBlockHeight: isSet(object.lastBlockHeight) ? globalThis.Number(object.lastBlockHeight) : 0, + lastBlockAppHash: isSet(object.lastBlockAppHash) ? bytesFromBase64(object.lastBlockAppHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInfo): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.appVersion !== 0) { + obj.appVersion = Math.round(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + obj.lastBlockHeight = Math.round(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + obj.lastBlockAppHash = base64FromBytes(message.lastBlockAppHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInfo { + return ResponseInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = object.appVersion ?? 0; + message.lastBlockHeight = object.lastBlockHeight ?? 0; + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseInitChain(): ResponseInitChain { + return { consensusParams: undefined, validators: [], appHash: new Uint8Array(0) }; +} + +export const ResponseInitChain: MessageFns = { + encode(message: ResponseInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInitChain { + return { + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInitChain): unknown { + const obj: any = {}; + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInitChain { + return ResponseInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ResponseQuery: MessageFns = { + encode(message: ResponseQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseQuery { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseQuery): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseQuery { + return ResponseQuery.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCheckTx(): ResponseCheckTx { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ResponseCheckTx: MessageFns = { + encode(message: ResponseCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCheckTx { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseCheckTx): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseCheckTx { + return ResponseCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCommit(): ResponseCommit { + return { retainHeight: 0 }; +} + +export const ResponseCommit: MessageFns = { + encode(message: ResponseCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.retainHeight !== 0) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.retainHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCommit { + return { retainHeight: isSet(object.retainHeight) ? globalThis.Number(object.retainHeight) : 0 }; + }, + + toJSON(message: ResponseCommit): unknown { + const obj: any = {}; + if (message.retainHeight !== 0) { + obj.retainHeight = Math.round(message.retainHeight); + } + return obj; + }, + + create, I>>(base?: I): ResponseCommit { + return ResponseCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCommit { + const message = createBaseResponseCommit(); + message.retainHeight = object.retainHeight ?? 0; + return message; + }, +}; + +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { snapshots: [] }; +} + +export const ResponseListSnapshots: MessageFns = { + encode(message: ResponseListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshots.push(Snapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseListSnapshots { + return { + snapshots: globalThis.Array.isArray(object?.snapshots) + ? object.snapshots.map((e: any) => Snapshot.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ResponseListSnapshots): unknown { + const obj: any = {}; + if (message.snapshots?.length) { + obj.snapshots = message.snapshots.map((e) => Snapshot.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponseListSnapshots { + return ResponseListSnapshots.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ResponseOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseOfferSnapshot { + return { result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: ResponseOfferSnapshot): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseOfferSnapshot_ResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { chunk: new Uint8Array(0) }; +} + +export const ResponseLoadSnapshotChunk: MessageFns = { + encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunk = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseLoadSnapshotChunk { + return { chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { result: 0, refetchChunks: [], rejectSenders: [] }; +} + +export const ResponseApplySnapshotChunk: MessageFns = { + encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.join(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + case 2: + if (tag === 16) { + message.refetchChunks.push(reader.uint32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + + continue; + } + + break; + case 3: + if (tag !== 26) { + break; + } + + message.rejectSenders.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseApplySnapshotChunk { + return { + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + refetchChunks: globalThis.Array.isArray(object?.refetchChunks) + ? object.refetchChunks.map((e: any) => globalThis.Number(e)) + : [], + rejectSenders: globalThis.Array.isArray(object?.rejectSenders) + ? object.rejectSenders.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ResponseApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + } + if (message.refetchChunks?.length) { + obj.refetchChunks = message.refetchChunks.map((e) => Math.round(e)); + } + if (message.rejectSenders?.length) { + obj.rejectSenders = message.rejectSenders; + } + return obj; + }, + + create, I>>(base?: I): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map((e) => e) || []; + message.rejectSenders = object.rejectSenders?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponsePrepareProposal(): ResponsePrepareProposal { + return { txs: [] }; +} + +export const ResponsePrepareProposal: MessageFns = { + encode(message: ResponsePrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponsePrepareProposal { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: ResponsePrepareProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponsePrepareProposal { + return ResponsePrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { status: 0 }; +} + +export const ResponseProcessProposal: MessageFns = { + encode(message: ResponseProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseProcessProposal { + return { status: isSet(object.status) ? responseProcessProposal_ProposalStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseProcessProposal): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseProcessProposal_ProposalStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseProcessProposal { + return ResponseProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseExtendVote(): ResponseExtendVote { + return { voteExtension: new Uint8Array(0) }; +} + +export const ResponseExtendVote: MessageFns = { + encode(message: ResponseExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtension.length !== 0) { + writer.uint32(10).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseExtendVote { + return { voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseExtendVote): unknown { + const obj: any = {}; + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): ResponseExtendVote { + return ResponseExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseVerifyVoteExtension(): ResponseVerifyVoteExtension { + return { status: 0 }; +} + +export const ResponseVerifyVoteExtension: MessageFns = { + encode(message: ResponseVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseVerifyVoteExtension { + return { status: isSet(object.status) ? responseVerifyVoteExtension_VerifyStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseVerifyVoteExtension_VerifyStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseFinalizeBlock(): ResponseFinalizeBlock { + return { + events: [], + txResults: [], + validatorUpdates: [], + consensusParamUpdates: undefined, + appHash: new Uint8Array(0), + }; +} + +export const ResponseFinalizeBlock: MessageFns = { + encode(message: ResponseFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResults) { + ExecTxResult.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.validatorUpdates) { + ValidatorUpdate.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.consensusParamUpdates !== undefined) { + ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(34).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(42).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResults.push(ExecTxResult.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseFinalizeBlock { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + txResults: globalThis.Array.isArray(object?.txResults) + ? object.txResults.map((e: any) => ExecTxResult.fromJSON(e)) + : [], + validatorUpdates: globalThis.Array.isArray(object?.validatorUpdates) + ? object.validatorUpdates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + consensusParamUpdates: isSet(object.consensusParamUpdates) + ? ConsensusParams.fromJSON(object.consensusParamUpdates) + : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseFinalizeBlock): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.txResults?.length) { + obj.txResults = message.txResults.map((e) => ExecTxResult.toJSON(e)); + } + if (message.validatorUpdates?.length) { + obj.validatorUpdates = message.validatorUpdates.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.consensusParamUpdates !== undefined) { + obj.consensusParamUpdates = ConsensusParams.toJSON(message.consensusParamUpdates); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseFinalizeBlock { + return ResponseFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.txResults = object.txResults?.map((e) => ExecTxResult.fromPartial(e)) || []; + message.validatorUpdates = object.validatorUpdates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = + (object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null) + ? ConsensusParams.fromPartial(object.consensusParamUpdates) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommitInfo(): CommitInfo { + return { round: 0, votes: [] }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + VoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(VoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => VoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitInfo(): ExtendedCommitInfo { + return { round: 0, votes: [] }; +} + +export const ExtendedCommitInfo: MessageFns = { + encode(message: ExtendedCommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + ExtendedVoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => ExtendedVoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ExtendedCommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => ExtendedVoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitInfo { + return ExtendedCommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEvent(): Event { + return { type: "", attributes: [] }; +} + +export const Event: MessageFns = { + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + EventAttribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(EventAttribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Event { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => EventAttribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => EventAttribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + 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: "", value: "", index: false }; +} + +export const EventAttribute: MessageFns = { + encode(message: EventAttribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index !== false) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.index = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventAttribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + index: isSet(object.index) ? globalThis.Boolean(object.index) : false, + }; + }, + + toJSON(message: EventAttribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.index !== false) { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): EventAttribute { + return EventAttribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, +}; + +function createBaseExecTxResult(): ExecTxResult { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ExecTxResult: MessageFns = { + encode(message: ExecTxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecTxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecTxResult { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ExecTxResult): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ExecTxResult { + return ExecTxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecTxResult { + const message = createBaseExecTxResult(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseTxResult(): TxResult { + return { height: 0, index: 0, tx: new Uint8Array(0), result: undefined }; +} + +export const TxResult: MessageFns = { + encode(message: TxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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) { + ExecTxResult.encode(message.result, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tx = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.result = ExecTxResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + result: isSet(object.result) ? ExecTxResult.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.result !== undefined) { + obj.result = ExecTxResult.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): TxResult { + return TxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.height = object.height ?? 0; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(0); + message.result = (object.result !== undefined && object.result !== null) + ? ExecTxResult.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), power: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseValidatorUpdate(): ValidatorUpdate { + return { pubKey: undefined, power: 0 }; +} + +export const ValidatorUpdate: MessageFns = { + encode(message: ValidatorUpdate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdate { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: ValidatorUpdate): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdate { + return ValidatorUpdate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseVoteInfo(): VoteInfo { + return { validator: undefined, blockIdFlag: 0 }; +} + +export const VoteInfo: MessageFns = { + encode(message: VoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.blockIdFlag !== 0) { + writer.uint32(24).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: VoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): VoteInfo { + return VoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseExtendedVoteInfo(): ExtendedVoteInfo { + return { + validator: undefined, + voteExtension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + blockIdFlag: 0, + }; +} + +export const ExtendedVoteInfo: MessageFns = { + encode(message: ExtendedVoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(34).bytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + writer.uint32(40).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedVoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedVoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: ExtendedVoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): ExtendedVoteInfo { + return ExtendedVoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseMisbehavior(): Misbehavior { + return { type: 0, validator: undefined, height: 0, time: undefined, totalVotingPower: 0 }; +} + +export const Misbehavior: MessageFns = { + encode(message: Misbehavior, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Misbehavior { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Misbehavior { + return { + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: Misbehavior): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = misbehaviorTypeToJSON(message.type); + } + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): Misbehavior { + return Misbehavior.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Misbehavior { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: new Uint8Array(0) }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? bytesFromBase64(object.metadata) : new Uint8Array(0), + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata.length !== 0) { + obj.metadata = base64FromBytes(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = object.metadata ?? new Uint8Array(0); + return message; + }, +}; + +export interface ABCI { + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; + PrepareProposal(request: RequestPrepareProposal): Promise; + ProcessProposal(request: RequestProcessProposal): Promise; + ExtendVote(request: RequestExtendVote): Promise; + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise; + FinalizeBlock(request: RequestFinalizeBlock): Promise; +} + +export const ABCIServiceName = "tendermint.abci.ABCI"; +export class ABCIClientImpl implements ABCI { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIServiceName; + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.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.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + this.PrepareProposal = this.PrepareProposal.bind(this); + this.ProcessProposal = this.ProcessProposal.bind(this); + this.ExtendVote = this.ExtendVote.bind(this); + this.VerifyVoteExtension = this.VerifyVoteExtension.bind(this); + this.FinalizeBlock = this.FinalizeBlock.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + PrepareProposal(request: RequestPrepareProposal): Promise { + const data = RequestPrepareProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrepareProposal", data); + return promise.then((data) => ResponsePrepareProposal.decode(new BinaryReader(data))); + } + + ProcessProposal(request: RequestProcessProposal): Promise { + const data = RequestProcessProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "ProcessProposal", data); + return promise.then((data) => ResponseProcessProposal.decode(new BinaryReader(data))); + } + + ExtendVote(request: RequestExtendVote): Promise { + const data = RequestExtendVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExtendVote", data); + return promise.then((data) => ResponseExtendVote.decode(new BinaryReader(data))); + } + + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise { + const data = RequestVerifyVoteExtension.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifyVoteExtension", data); + return promise.then((data) => ResponseVerifyVoteExtension.decode(new BinaryReader(data))); + } + + FinalizeBlock(request: RequestFinalizeBlock): Promise { + const data = RequestFinalizeBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizeBlock", data); + return promise.then((data) => ResponseFinalizeBlock.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/crypto/keys.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/crypto/keys.ts new file mode 100644 index 00000000..f30b6751 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/crypto/keys.ts @@ -0,0 +1,140 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKey { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; +} + +function createBasePublicKey(): PublicKey { + return { ed25519: undefined, secp256k1: undefined }; +} + +export const PublicKey: MessageFns = { + encode(message: PublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ed25519 = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.secp256k1 = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.ed25519 !== undefined) { + obj.ed25519 = base64FromBytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + obj.secp256k1 = base64FromBytes(message.secp256k1); + } + return obj; + }, + + create, I>>(base?: I): PublicKey { + return PublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/crypto/proof.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/crypto/proof.ts new file mode 100644 index 00000000..2b470701 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/crypto/proof.ts @@ -0,0 +1,520 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/proof.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +export interface Proof { + total: number; + index: number; + leafHash: Uint8Array; + aunts: Uint8Array[]; +} + +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof: Proof | undefined; +} + +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, leafHash: new Uint8Array(0), aunts: [] }; +} + +export const Proof: MessageFns = { + encode(message: Proof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).int64(message.total); + } + if (message.index !== 0) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.leafHash = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aunts.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proof { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + leafHash: isSet(object.leafHash) ? bytesFromBase64(object.leafHash) : new Uint8Array(0), + aunts: globalThis.Array.isArray(object?.aunts) ? object.aunts.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Proof): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.leafHash.length !== 0) { + obj.leafHash = base64FromBytes(message.leafHash); + } + if (message.aunts?.length) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Proof { + return Proof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proof { + const message = createBaseProof(); + message.total = object.total ?? 0; + message.index = object.index ?? 0; + message.leafHash = object.leafHash ?? new Uint8Array(0); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValueOp(): ValueOp { + return { key: new Uint8Array(0), proof: undefined }; +} + +export const ValueOp: MessageFns = { + encode(message: ValueOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValueOp { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: ValueOp): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): ValueOp { + return ValueOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValueOp { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(0); + 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: MessageFns = { + encode(message: DominoOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.input = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.output = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DominoOp { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + input: isSet(object.input) ? globalThis.String(object.input) : "", + output: isSet(object.output) ? globalThis.String(object.output) : "", + }; + }, + + toJSON(message: DominoOp): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.input !== "") { + obj.input = message.input; + } + if (message.output !== "") { + obj.output = message.output; + } + return obj; + }, + + create, I>>(base?: I): DominoOp { + return DominoOp.fromPartial(base ?? ({} as any)); + }, + 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(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/libs/bits/types.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/libs/bits/types.ts new file mode 100644 index 00000000..e8ec9685 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/libs/bits/types.ts @@ -0,0 +1,137 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/libs/bits/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.libs.bits"; + +export interface BitArray { + bits: number; + elems: number[]; +} + +function createBaseBitArray(): BitArray { + return { bits: 0, elems: [] }; +} + +export const BitArray: MessageFns = { + encode(message: BitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bits !== 0) { + writer.uint32(8).int64(message.bits); + } + writer.uint32(18).fork(); + for (const v of message.elems) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.bits = longToNumber(reader.int64()); + continue; + case 2: + if (tag === 16) { + message.elems.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.elems.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BitArray { + return { + bits: isSet(object.bits) ? globalThis.Number(object.bits) : 0, + elems: globalThis.Array.isArray(object?.elems) ? object.elems.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: BitArray): unknown { + const obj: any = {}; + if (message.bits !== 0) { + obj.bits = Math.round(message.bits); + } + if (message.elems?.length) { + obj.elems = message.elems.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): BitArray { + return BitArray.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/p2p/types.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/p2p/types.ts new file mode 100644 index 00000000..4ea8187a --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/p2p/types.ts @@ -0,0 +1,528 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/p2p/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.p2p"; + +export interface NetAddress { + id: string; + ip: string; + port: number; +} + +export interface ProtocolVersion { + p2p: number; + block: number; + app: number; +} + +export interface DefaultNodeInfo { + protocolVersion: ProtocolVersion | undefined; + defaultNodeId: string; + listenAddr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other: DefaultNodeInfoOther | undefined; +} + +export interface DefaultNodeInfoOther { + txIndex: string; + rpcAddress: string; +} + +function createBaseNetAddress(): NetAddress { + return { id: "", ip: "", port: 0 }; +} + +export const NetAddress: MessageFns = { + encode(message: NetAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.ip !== "") { + writer.uint32(18).string(message.ip); + } + if (message.port !== 0) { + writer.uint32(24).uint32(message.port); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.ip = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.port = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NetAddress { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + ip: isSet(object.ip) ? globalThis.String(object.ip) : "", + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + }; + }, + + toJSON(message: NetAddress): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.ip !== "") { + obj.ip = message.ip; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + + create, I>>(base?: I): NetAddress { + return NetAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetAddress { + const message = createBaseNetAddress(); + message.id = object.id ?? ""; + message.ip = object.ip ?? ""; + message.port = object.port ?? 0; + return message; + }, +}; + +function createBaseProtocolVersion(): ProtocolVersion { + return { p2p: 0, block: 0, app: 0 }; +} + +export const ProtocolVersion: MessageFns = { + encode(message: ProtocolVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ProtocolVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.p2p = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProtocolVersion { + return { + p2p: isSet(object.p2p) ? globalThis.Number(object.p2p) : 0, + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: ProtocolVersion): unknown { + const obj: any = {}; + if (message.p2p !== 0) { + obj.p2p = Math.round(message.p2p); + } + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): ProtocolVersion { + return ProtocolVersion.fromPartial(base ?? ({} as any)); + }, + 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 createBaseDefaultNodeInfo(): DefaultNodeInfo { + return { + protocolVersion: undefined, + defaultNodeId: "", + listenAddr: "", + network: "", + version: "", + channels: new Uint8Array(0), + moniker: "", + other: undefined, + }; +} + +export const DefaultNodeInfo: MessageFns = { + encode(message: DefaultNodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocolVersion !== undefined) { + ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).join(); + } + if (message.defaultNodeId !== "") { + writer.uint32(18).string(message.defaultNodeId); + } + if (message.listenAddr !== "") { + writer.uint32(26).string(message.listenAddr); + } + 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) { + DefaultNodeInfoOther.encode(message.other, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protocolVersion = ProtocolVersion.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.defaultNodeId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.listenAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.network = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.version = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.channels = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.moniker = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.other = DefaultNodeInfoOther.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfo { + return { + protocolVersion: isSet(object.protocolVersion) ? ProtocolVersion.fromJSON(object.protocolVersion) : undefined, + defaultNodeId: isSet(object.defaultNodeId) ? globalThis.String(object.defaultNodeId) : "", + listenAddr: isSet(object.listenAddr) ? globalThis.String(object.listenAddr) : "", + network: isSet(object.network) ? globalThis.String(object.network) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + channels: isSet(object.channels) ? bytesFromBase64(object.channels) : new Uint8Array(0), + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + other: isSet(object.other) ? DefaultNodeInfoOther.fromJSON(object.other) : undefined, + }; + }, + + toJSON(message: DefaultNodeInfo): unknown { + const obj: any = {}; + if (message.protocolVersion !== undefined) { + obj.protocolVersion = ProtocolVersion.toJSON(message.protocolVersion); + } + if (message.defaultNodeId !== "") { + obj.defaultNodeId = message.defaultNodeId; + } + if (message.listenAddr !== "") { + obj.listenAddr = message.listenAddr; + } + if (message.network !== "") { + obj.network = message.network; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.channels.length !== 0) { + obj.channels = base64FromBytes(message.channels); + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.other !== undefined) { + obj.other = DefaultNodeInfoOther.toJSON(message.other); + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfo { + return DefaultNodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfo { + const message = createBaseDefaultNodeInfo(); + message.protocolVersion = (object.protocolVersion !== undefined && object.protocolVersion !== null) + ? ProtocolVersion.fromPartial(object.protocolVersion) + : undefined; + message.defaultNodeId = object.defaultNodeId ?? ""; + message.listenAddr = object.listenAddr ?? ""; + message.network = object.network ?? ""; + message.version = object.version ?? ""; + message.channels = object.channels ?? new Uint8Array(0); + message.moniker = object.moniker ?? ""; + message.other = (object.other !== undefined && object.other !== null) + ? DefaultNodeInfoOther.fromPartial(object.other) + : undefined; + return message; + }, +}; + +function createBaseDefaultNodeInfoOther(): DefaultNodeInfoOther { + return { txIndex: "", rpcAddress: "" }; +} + +export const DefaultNodeInfoOther: MessageFns = { + encode(message: DefaultNodeInfoOther, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txIndex !== "") { + writer.uint32(10).string(message.txIndex); + } + if (message.rpcAddress !== "") { + writer.uint32(18).string(message.rpcAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfoOther { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfoOther(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txIndex = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfoOther { + return { + txIndex: isSet(object.txIndex) ? globalThis.String(object.txIndex) : "", + rpcAddress: isSet(object.rpcAddress) ? globalThis.String(object.rpcAddress) : "", + }; + }, + + toJSON(message: DefaultNodeInfoOther): unknown { + const obj: any = {}; + if (message.txIndex !== "") { + obj.txIndex = message.txIndex; + } + if (message.rpcAddress !== "") { + obj.rpcAddress = message.rpcAddress; + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfoOther { + return DefaultNodeInfoOther.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfoOther { + const message = createBaseDefaultNodeInfoOther(); + message.txIndex = object.txIndex ?? ""; + message.rpcAddress = object.rpcAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/block.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/block.ts new file mode 100644 index 00000000..4fbb3c13 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/block.ts @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/block.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { EvidenceList } from "./evidence"; +import { Commit, Data, Header } from "./types"; + +export const protobufPackage = "tendermint.types"; + +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/evidence.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/evidence.ts new file mode 100644 index 00000000..9a2fc48b --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/evidence.ts @@ -0,0 +1,489 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/evidence.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { LightBlock, Vote } from "./types"; +import { Validator } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +export interface Evidence { + duplicateVoteEvidence?: DuplicateVoteEvidence | undefined; + lightClientAttackEvidence?: LightClientAttackEvidence | undefined; +} + +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidence { + voteA: Vote | undefined; + voteB: Vote | undefined; + totalVotingPower: number; + validatorPower: number; + timestamp: Date | undefined; +} + +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidence { + conflictingBlock: LightBlock | undefined; + commonHeight: number; + byzantineValidators: Validator[]; + totalVotingPower: number; + timestamp: Date | undefined; +} + +export interface EvidenceList { + evidence: Evidence[]; +} + +function createBaseEvidence(): Evidence { + return { duplicateVoteEvidence: undefined, lightClientAttackEvidence: undefined }; +} + +export const Evidence: MessageFns = { + encode(message: Evidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.duplicateVoteEvidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).join(); + } + if (message.lightClientAttackEvidence !== undefined) { + LightClientAttackEvidence.encode(message.lightClientAttackEvidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.duplicateVoteEvidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lightClientAttackEvidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + duplicateVoteEvidence: isSet(object.duplicateVoteEvidence) + ? DuplicateVoteEvidence.fromJSON(object.duplicateVoteEvidence) + : undefined, + lightClientAttackEvidence: isSet(object.lightClientAttackEvidence) + ? LightClientAttackEvidence.fromJSON(object.lightClientAttackEvidence) + : undefined, + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + if (message.duplicateVoteEvidence !== undefined) { + obj.duplicateVoteEvidence = DuplicateVoteEvidence.toJSON(message.duplicateVoteEvidence); + } + if (message.lightClientAttackEvidence !== undefined) { + obj.lightClientAttackEvidence = LightClientAttackEvidence.toJSON(message.lightClientAttackEvidence); + } + return obj; + }, + + create, I>>(base?: I): Evidence { + return Evidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.duplicateVoteEvidence = + (object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null) + ? DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) + : undefined; + message.lightClientAttackEvidence = + (object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null) + ? LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) + : undefined; + return message; + }, +}; + +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { voteA: undefined, voteB: undefined, totalVotingPower: 0, validatorPower: 0, timestamp: undefined }; +} + +export const DuplicateVoteEvidence: MessageFns = { + encode(message: DuplicateVoteEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteA !== undefined) { + Vote.encode(message.voteA, writer.uint32(10).fork()).join(); + } + if (message.voteB !== undefined) { + Vote.encode(message.voteB, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + writer.uint32(32).int64(message.validatorPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuplicateVoteEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteA = Vote.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voteB = Vote.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.validatorPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DuplicateVoteEvidence { + return { + voteA: isSet(object.voteA) ? Vote.fromJSON(object.voteA) : undefined, + voteB: isSet(object.voteB) ? Vote.fromJSON(object.voteB) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + validatorPower: isSet(object.validatorPower) ? globalThis.Number(object.validatorPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: DuplicateVoteEvidence): unknown { + const obj: any = {}; + if (message.voteA !== undefined) { + obj.voteA = Vote.toJSON(message.voteA); + } + if (message.voteB !== undefined) { + obj.voteB = Vote.toJSON(message.voteB); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + obj.validatorPower = Math.round(message.validatorPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.voteA = (object.voteA !== undefined && object.voteA !== null) ? Vote.fromPartial(object.voteA) : undefined; + message.voteB = (object.voteB !== undefined && object.voteB !== null) ? Vote.fromPartial(object.voteB) : undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.validatorPower = object.validatorPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflictingBlock: undefined, + commonHeight: 0, + byzantineValidators: [], + totalVotingPower: 0, + timestamp: undefined, + }; +} + +export const LightClientAttackEvidence: MessageFns = { + encode(message: LightClientAttackEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.conflictingBlock !== undefined) { + LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).join(); + } + if (message.commonHeight !== 0) { + writer.uint32(16).int64(message.commonHeight); + } + for (const v of message.byzantineValidators) { + Validator.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(32).int64(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightClientAttackEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.conflictingBlock = LightBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.commonHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.byzantineValidators.push(Validator.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightClientAttackEvidence { + return { + conflictingBlock: isSet(object.conflictingBlock) ? LightBlock.fromJSON(object.conflictingBlock) : undefined, + commonHeight: isSet(object.commonHeight) ? globalThis.Number(object.commonHeight) : 0, + byzantineValidators: globalThis.Array.isArray(object?.byzantineValidators) + ? object.byzantineValidators.map((e: any) => Validator.fromJSON(e)) + : [], + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: LightClientAttackEvidence): unknown { + const obj: any = {}; + if (message.conflictingBlock !== undefined) { + obj.conflictingBlock = LightBlock.toJSON(message.conflictingBlock); + } + if (message.commonHeight !== 0) { + obj.commonHeight = Math.round(message.commonHeight); + } + if (message.byzantineValidators?.length) { + obj.byzantineValidators = message.byzantineValidators.map((e) => Validator.toJSON(e)); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): LightClientAttackEvidence { + return LightClientAttackEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflictingBlock = (object.conflictingBlock !== undefined && object.conflictingBlock !== null) + ? LightBlock.fromPartial(object.conflictingBlock) + : undefined; + message.commonHeight = object.commonHeight ?? 0; + message.byzantineValidators = object.byzantineValidators?.map((e) => Validator.fromPartial(e)) || []; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseEvidenceList(): EvidenceList { + return { evidence: [] }; +} + +export const EvidenceList: MessageFns = { + encode(message: EvidenceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence.push(Evidence.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceList { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Evidence.fromJSON(e)) : [], + }; + }, + + toJSON(message: EvidenceList): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Evidence.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EvidenceList { + return EvidenceList.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/params.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/params.ts new file mode 100644 index 00000000..d4cc2b8a --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/params.ts @@ -0,0 +1,686 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; + evidence: EvidenceParams | undefined; + validator: ValidatorParams | undefined; + version: VersionParams | undefined; + abci: ABCIParams | undefined; +} + +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + maxBytes: number; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + maxGas: number; +} + +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + maxAgeNumBlocks: number; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + maxAgeDuration: + | Duration + | undefined; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + maxBytes: number; +} + +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pubKeyTypes: string[]; +} + +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app: number; +} + +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + blockMaxBytes: number; + blockMaxGas: number; +} + +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParams { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + voteExtensionsEnableHeight: number; +} + +function createBaseConsensusParams(): ConsensusParams { + return { block: undefined, evidence: undefined, validator: undefined, version: undefined, abci: undefined }; +} + +export const ConsensusParams: MessageFns = { + encode(message: ConsensusParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(10).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(26).fork()).join(); + } + if (message.version !== undefined) { + VersionParams.encode(message.version, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.version = VersionParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.version !== undefined) { + obj.version = VersionParams.toJSON(message.version); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + return obj; + }, + + create, I>>(base?: I): ConsensusParams { + return ConsensusParams.fromPartial(base ?? ({} as any)); + }, + 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; + message.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseBlockParams(): BlockParams { + return { maxBytes: 0, maxGas: 0 }; +} + +export const BlockParams: MessageFns = { + encode(message: BlockParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxBytes !== 0) { + writer.uint32(8).int64(message.maxBytes); + } + if (message.maxGas !== 0) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + maxGas: isSet(object.maxGas) ? globalThis.Number(object.maxGas) : 0, + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxGas !== 0) { + obj.maxGas = Math.round(message.maxGas); + } + return obj; + }, + + create, I>>(base?: I): BlockParams { + return BlockParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes ?? 0; + message.maxGas = object.maxGas ?? 0; + return message; + }, +}; + +function createBaseEvidenceParams(): EvidenceParams { + return { maxAgeNumBlocks: 0, maxAgeDuration: undefined, maxBytes: 0 }; +} + +export const EvidenceParams: MessageFns = { + encode(message: EvidenceParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxAgeNumBlocks !== 0) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).join(); + } + if (message.maxBytes !== 0) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxAgeNumBlocks = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxAgeDuration = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceParams { + return { + maxAgeNumBlocks: isSet(object.maxAgeNumBlocks) ? globalThis.Number(object.maxAgeNumBlocks) : 0, + maxAgeDuration: isSet(object.maxAgeDuration) ? Duration.fromJSON(object.maxAgeDuration) : undefined, + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + }; + }, + + toJSON(message: EvidenceParams): unknown { + const obj: any = {}; + if (message.maxAgeNumBlocks !== 0) { + obj.maxAgeNumBlocks = Math.round(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + obj.maxAgeDuration = Duration.toJSON(message.maxAgeDuration); + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + return obj; + }, + + create, I>>(base?: I): EvidenceParams { + return EvidenceParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EvidenceParams { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = object.maxAgeNumBlocks ?? 0; + message.maxAgeDuration = (object.maxAgeDuration !== undefined && object.maxAgeDuration !== null) + ? Duration.fromPartial(object.maxAgeDuration) + : undefined; + message.maxBytes = object.maxBytes ?? 0; + return message; + }, +}; + +function createBaseValidatorParams(): ValidatorParams { + return { pubKeyTypes: [] }; +} + +export const ValidatorParams: MessageFns = { + encode(message: ValidatorParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKeyTypes.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorParams { + return { + pubKeyTypes: globalThis.Array.isArray(object?.pubKeyTypes) + ? object.pubKeyTypes.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValidatorParams): unknown { + const obj: any = {}; + if (message.pubKeyTypes?.length) { + obj.pubKeyTypes = message.pubKeyTypes; + } + return obj; + }, + + create, I>>(base?: I): ValidatorParams { + return ValidatorParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVersionParams(): VersionParams { + return { app: 0 }; +} + +export const VersionParams: MessageFns = { + encode(message: VersionParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.app !== 0) { + writer.uint32(8).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionParams { + return { app: isSet(object.app) ? globalThis.Number(object.app) : 0 }; + }, + + toJSON(message: VersionParams): unknown { + const obj: any = {}; + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): VersionParams { + return VersionParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionParams { + const message = createBaseVersionParams(); + message.app = object.app ?? 0; + return message; + }, +}; + +function createBaseHashedParams(): HashedParams { + return { blockMaxBytes: 0, blockMaxGas: 0 }; +} + +export const HashedParams: MessageFns = { + encode(message: HashedParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockMaxBytes !== 0) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockMaxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockMaxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashedParams { + return { + blockMaxBytes: isSet(object.blockMaxBytes) ? globalThis.Number(object.blockMaxBytes) : 0, + blockMaxGas: isSet(object.blockMaxGas) ? globalThis.Number(object.blockMaxGas) : 0, + }; + }, + + toJSON(message: HashedParams): unknown { + const obj: any = {}; + if (message.blockMaxBytes !== 0) { + obj.blockMaxBytes = Math.round(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + obj.blockMaxGas = Math.round(message.blockMaxGas); + } + return obj; + }, + + create, I>>(base?: I): HashedParams { + return HashedParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HashedParams { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes ?? 0; + message.blockMaxGas = object.blockMaxGas ?? 0; + return message; + }, +}; + +function createBaseABCIParams(): ABCIParams { + return { voteExtensionsEnableHeight: 0 }; +} + +export const ABCIParams: MessageFns = { + encode(message: ABCIParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtensionsEnableHeight !== 0) { + writer.uint32(8).int64(message.voteExtensionsEnableHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.voteExtensionsEnableHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIParams { + return { + voteExtensionsEnableHeight: isSet(object.voteExtensionsEnableHeight) + ? globalThis.Number(object.voteExtensionsEnableHeight) + : 0, + }; + }, + + toJSON(message: ABCIParams): unknown { + const obj: any = {}; + if (message.voteExtensionsEnableHeight !== 0) { + obj.voteExtensionsEnableHeight = Math.round(message.voteExtensionsEnableHeight); + } + return obj; + }, + + create, I>>(base?: I): ABCIParams { + return ABCIParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIParams { + const message = createBaseABCIParams(); + message.voteExtensionsEnableHeight = object.voteExtensionsEnableHeight ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/types.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/types.ts new file mode 100644 index 00000000..85454a42 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/types.ts @@ -0,0 +1,2065 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON, ValidatorSet } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +/** 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 | undefined; +} + +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + partSetHeader: PartSetHeader | undefined; +} + +/** Header defines the structure of a block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** original proposer of the block */ + proposerAddress: Uint8Array; +} + +/** 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 or precommit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: number; + round: number; + /** zero if vote is nil. */ + blockId: BlockID | undefined; + timestamp: Date | undefined; + validatorAddress: Uint8Array; + validatorIndex: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ + signature: Uint8Array; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension: Uint8Array; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. + * Only valid for precommit messages. + */ + extensionSignature: Uint8Array; +} + +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: number; + round: number; + blockId: BlockID | undefined; + signatures: CommitSig[]; +} + +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface ExtendedCommit { + height: number; + round: number; + blockId: BlockID | undefined; + extendedSignatures: ExtendedCommitSig[]; +} + +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; + /** Vote extension data */ + extension: Uint8Array; + /** Vote extension signature */ + extensionSignature: Uint8Array; +} + +export interface Proposal { + type: SignedMsgType; + height: number; + round: number; + polRound: number; + blockId: BlockID | undefined; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface SignedHeader { + header: Header | undefined; + commit: Commit | undefined; +} + +export interface LightBlock { + signedHeader: SignedHeader | undefined; + validatorSet: ValidatorSet | undefined; +} + +export interface BlockMeta { + blockId: BlockID | undefined; + blockSize: number; + header: Header | undefined; + numTxs: number; +} + +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + rootHash: Uint8Array; + data: Uint8Array; + proof: Proof | undefined; +} + +function createBasePartSetHeader(): PartSetHeader { + return { total: 0, hash: new Uint8Array(0) }; +} + +export const PartSetHeader: MessageFns = { + encode(message: PartSetHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PartSetHeader { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: PartSetHeader): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): PartSetHeader { + return PartSetHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePart(): Part { + return { index: 0, bytes: new Uint8Array(0), proof: undefined }; +} + +export const Part: MessageFns = { + encode(message: Part, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Part { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Part { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: Part): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.bytes.length !== 0) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): Part { + return Part.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Part { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function createBaseBlockID(): BlockID { + return { hash: new Uint8Array(0), partSetHeader: undefined }; +} + +export const BlockID: MessageFns = { + encode(message: BlockID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.partSetHeader = PartSetHeader.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockID { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + partSetHeader: isSet(object.partSetHeader) ? PartSetHeader.fromJSON(object.partSetHeader) : undefined, + }; + }, + + toJSON(message: BlockID): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.partSetHeader !== undefined) { + obj.partSetHeader = PartSetHeader.toJSON(message.partSetHeader); + } + return obj; + }, + + create, I>>(base?: I): BlockID { + return BlockID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(0); + message.partSetHeader = (object.partSetHeader !== undefined && object.partSetHeader !== null) + ? PartSetHeader.fromPartial(object.partSetHeader) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseData(): Data { + return { txs: [] }; +} + +export const Data: MessageFns = { + encode(message: Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Data { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: Data): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Data { + return Data.fromPartial(base ?? ({} as any)); + }, + 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, + blockId: undefined, + timestamp: undefined, + validatorAddress: new Uint8Array(0), + validatorIndex: 0, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(74).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(82).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.validatorIndex = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.signature = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.extension = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + validatorIndex: isSet(object.validatorIndex) ? globalThis.Number(object.validatorIndex) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + obj.validatorIndex = Math.round(message.validatorIndex); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommit(): Commit { + return { height: 0, round: 0, blockId: undefined, signatures: [] }; +} + +export const Commit: MessageFns = { + encode(message: Commit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signatures.push(CommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => CommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Commit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => CommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Commit { + return Commit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commit { + const message = createBaseCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.signatures = object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommitSig(): CommitSig { + return { blockIdFlag: 0, validatorAddress: new Uint8Array(0), timestamp: undefined, signature: new Uint8Array(0) }; +} + +export const CommitSig: MessageFns = { + encode(message: CommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): CommitSig { + return CommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitSig { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseExtendedCommit(): ExtendedCommit { + return { height: 0, round: 0, blockId: undefined, extendedSignatures: [] }; +} + +export const ExtendedCommit: MessageFns = { + encode(message: ExtendedCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.extendedSignatures) { + ExtendedCommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extendedSignatures.push(ExtendedCommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + extendedSignatures: globalThis.Array.isArray(object?.extendedSignatures) + ? object.extendedSignatures.map((e: any) => ExtendedCommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ExtendedCommit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.extendedSignatures?.length) { + obj.extendedSignatures = message.extendedSignatures.map((e) => ExtendedCommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommit { + return ExtendedCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommit { + const message = createBaseExtendedCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.extendedSignatures = object.extendedSignatures?.map((e) => ExtendedCommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitSig(): ExtendedCommitSig { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(0), + timestamp: undefined, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const ExtendedCommitSig: MessageFns = { + encode(message: ExtendedCommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(42).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(50).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.extension = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: ExtendedCommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitSig { + return ExtendedCommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + type: 0, + height: 0, + round: 0, + polRound: 0, + blockId: undefined, + timestamp: undefined, + signature: new Uint8Array(0), + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(42).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.polRound = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + polRound: isSet(object.polRound) ? globalThis.Number(object.polRound) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.polRound !== 0) { + obj.polRound = Math.round(message.polRound); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignedHeader(): SignedHeader { + return { header: undefined, commit: undefined }; +} + +export const SignedHeader: MessageFns = { + encode(message: SignedHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.commit !== undefined) { + Commit.encode(message.commit, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.commit !== undefined) { + obj.commit = Commit.toJSON(message.commit); + } + return obj; + }, + + create, I>>(base?: I): SignedHeader { + return SignedHeader.fromPartial(base ?? ({} as any)); + }, + 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 { signedHeader: undefined, validatorSet: undefined }; +} + +export const LightBlock: MessageFns = { + encode(message: LightBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedHeader !== undefined) { + SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).join(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightBlock { + return { + signedHeader: isSet(object.signedHeader) ? SignedHeader.fromJSON(object.signedHeader) : undefined, + validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined, + }; + }, + + toJSON(message: LightBlock): unknown { + const obj: any = {}; + if (message.signedHeader !== undefined) { + obj.signedHeader = SignedHeader.toJSON(message.signedHeader); + } + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): LightBlock { + return LightBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightBlock { + const message = createBaseLightBlock(); + message.signedHeader = (object.signedHeader !== undefined && object.signedHeader !== null) + ? SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseBlockMeta(): BlockMeta { + return { blockId: undefined, blockSize: 0, header: undefined, numTxs: 0 }; +} + +export const BlockMeta: MessageFns = { + encode(message: BlockMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.blockSize !== 0) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).join(); + } + if (message.numTxs !== 0) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockSize = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numTxs = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMeta { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + blockSize: isSet(object.blockSize) ? globalThis.Number(object.blockSize) : 0, + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + numTxs: isSet(object.numTxs) ? globalThis.Number(object.numTxs) : 0, + }; + }, + + toJSON(message: BlockMeta): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.blockSize !== 0) { + obj.blockSize = Math.round(message.blockSize); + } + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.numTxs !== 0) { + obj.numTxs = Math.round(message.numTxs); + } + return obj; + }, + + create, I>>(base?: I): BlockMeta { + return BlockMeta.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMeta { + const message = createBaseBlockMeta(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.blockSize = object.blockSize ?? 0; + message.header = (object.header !== undefined && object.header !== null) + ? Header.fromPartial(object.header) + : undefined; + message.numTxs = object.numTxs ?? 0; + return message; + }, +}; + +function createBaseTxProof(): TxProof { + return { rootHash: new Uint8Array(0), data: new Uint8Array(0), proof: undefined }; +} + +export const TxProof: MessageFns = { + encode(message: TxProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rootHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxProof { + return { + rootHash: isSet(object.rootHash) ? bytesFromBase64(object.rootHash) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: TxProof): unknown { + const obj: any = {}; + if (message.rootHash.length !== 0) { + obj.rootHash = base64FromBytes(message.rootHash); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): TxProof { + return TxProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxProof { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/validator.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/validator.ts new file mode 100644 index 00000000..623b14d8 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/types/validator.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/validator.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PublicKey } from "../crypto/keys"; + +export const protobufPackage = "tendermint.types"; + +/** BlockIdFlag indicates which BlockID the signature is for */ +export enum BlockIDFlag { + /** BLOCK_ID_FLAG_UNKNOWN - indicates an error condition */ + BLOCK_ID_FLAG_UNKNOWN = 0, + /** BLOCK_ID_FLAG_ABSENT - the vote was not received */ + BLOCK_ID_FLAG_ABSENT = 1, + /** BLOCK_ID_FLAG_COMMIT - voted for the block that received the majority */ + BLOCK_ID_FLAG_COMMIT = 2, + /** BLOCK_ID_FLAG_NIL - voted for nil */ + 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"; + } +} + +export interface ValidatorSet { + validators: Validator[]; + proposer: Validator | undefined; + totalVotingPower: number; +} + +export interface Validator { + address: Uint8Array; + pubKey: PublicKey | undefined; + votingPower: number; + proposerPriority: number; +} + +export interface SimpleValidator { + pubKey: PublicKey | undefined; + votingPower: number; +} + +function createBaseValidatorSet(): ValidatorSet { + return { validators: [], proposer: undefined, totalVotingPower: 0 }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.proposer !== undefined) { + Validator.encode(message.proposer, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.proposer !== undefined) { + obj.proposer = Validator.toJSON(message.proposer); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + 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.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseSimpleValidator(): SimpleValidator { + return { pubKey: undefined, votingPower: 0 }; +} + +export const SimpleValidator: MessageFns = { + encode(message: SimpleValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimpleValidator { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + }; + }, + + toJSON(message: SimpleValidator): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + return obj; + }, + + create, I>>(base?: I): SimpleValidator { + return SimpleValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.feegrant.v1beta1/types/tendermint/version/types.ts b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/version/types.ts new file mode 100644 index 00000000..7a4b2fa4 --- /dev/null +++ b/ts-client/cosmos.feegrant.v1beta1/types/tendermint/version/types.ts @@ -0,0 +1,214 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/version/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: number; + 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: number; + app: number; +} + +function createBaseApp(): App { + return { protocol: 0, software: "" }; +} + +export const App: MessageFns = { + encode(message: App, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocol !== 0) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): App { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.protocol = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.software = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): App { + return { + protocol: isSet(object.protocol) ? globalThis.Number(object.protocol) : 0, + software: isSet(object.software) ? globalThis.String(object.software) : "", + }; + }, + + toJSON(message: App): unknown { + const obj: any = {}; + if (message.protocol !== 0) { + obj.protocol = Math.round(message.protocol); + } + if (message.software !== "") { + obj.software = message.software; + } + return obj; + }, + + create, I>>(base?: I): App { + return App.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Consensus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== 0) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== 0) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Consensus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Consensus { + return { + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: Consensus): unknown { + const obj: any = {}; + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): Consensus { + return Consensus.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/module.ts b/ts-client/cosmos.gov.v1/module.ts index 258c1bc7..9a8924df 100755 --- a/ts-client/cosmos.gov.v1/module.ts +++ b/ts-client/cosmos.gov.v1/module.ts @@ -6,387 +6,375 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { QueryConstitutionResponse } from "./types/cosmos/gov/v1/query"; -import { QueryVotesRequest } from "./types/cosmos/gov/v1/query"; -import { QueryVotesResponse } from "./types/cosmos/gov/v1/query"; -import { MsgDepositResponse } from "./types/cosmos/gov/v1/tx"; -import { QueryTallyResultResponse } from "./types/cosmos/gov/v1/query"; -import { MsgUpdateParams } from "./types/cosmos/gov/v1/tx"; -import { QueryConstitutionRequest } from "./types/cosmos/gov/v1/query"; -import { QueryVoteResponse } from "./types/cosmos/gov/v1/query"; -import { QueryParamsRequest } from "./types/cosmos/gov/v1/query"; -import { MsgVoteEncrypted } from "./types/cosmos/gov/v1/tx"; -import { VotingParams } from "./types/cosmos/gov/v1/gov"; -import { QueryProposalsResponse } from "./types/cosmos/gov/v1/query"; -import { QueryTallyResultRequest } from "./types/cosmos/gov/v1/query"; -import { GenesisState } from "./types/cosmos/gov/v1/genesis"; -import { QueryProposalResponse } from "./types/cosmos/gov/v1/query"; -import { QueryDepositRequest } from "./types/cosmos/gov/v1/query"; -import { DecryptedVoteOption } from "./types/cosmos/gov/v1/gov"; -import { TrustedCounterParty } from "./types/cosmos/gov/v1/gov"; -import { QueryVoteRequest } from "./types/cosmos/gov/v1/query"; -import { QueryDepositResponse } from "./types/cosmos/gov/v1/query"; -import { QueryParamsResponse } from "./types/cosmos/gov/v1/query"; -import { QueryDepositsRequest } from "./types/cosmos/gov/v1/query"; -import { MsgExecLegacyContent } from "./types/cosmos/gov/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/cosmos/gov/v1/tx"; -import { TallyResult } from "./types/cosmos/gov/v1/gov"; -import { DepositParams } from "./types/cosmos/gov/v1/gov"; -import { MsgCancelProposalResponse } from "./types/cosmos/gov/v1/tx"; -import { QueryProposalsRequest } from "./types/cosmos/gov/v1/query"; -import { MsgCancelProposal } from "./types/cosmos/gov/v1/tx"; -import { MsgSubmitProposal } from "./types/cosmos/gov/v1/tx"; -import { MsgExecLegacyContentResponse } from "./types/cosmos/gov/v1/tx"; -import { MsgVoteEncryptedResponse } from "./types/cosmos/gov/v1/tx"; -import { MsgVoteWeightedResponse } from "./types/cosmos/gov/v1/tx"; -import { QueryDepositsResponse } from "./types/cosmos/gov/v1/query"; -import { MsgVoteResponse } from "./types/cosmos/gov/v1/tx"; -import { Params } from "./types/cosmos/gov/v1/gov"; -import { Deposit } from "./types/cosmos/gov/v1/gov"; -import { Proposal } from "./types/cosmos/gov/v1/gov"; -import { MsgVote } from "./types/cosmos/gov/v1/tx"; -import { WeightedVoteOption } from "./types/cosmos/gov/v1/gov"; -import { QueryProposalRequest } from "./types/cosmos/gov/v1/query"; -import { MsgSubmitProposalResponse } from "./types/cosmos/gov/v1/tx"; -import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx"; -import { Vote } from "./types/cosmos/gov/v1/gov"; -import { TallyParams } from "./types/cosmos/gov/v1/gov"; -import { MsgDeposit } from "./types/cosmos/gov/v1/tx"; - - -export { QueryConstitutionResponse, QueryVotesRequest, QueryVotesResponse, MsgDepositResponse, QueryTallyResultResponse, MsgUpdateParams, QueryConstitutionRequest, QueryVoteResponse, QueryParamsRequest, MsgVoteEncrypted, VotingParams, QueryProposalsResponse, QueryTallyResultRequest, GenesisState, QueryProposalResponse, QueryDepositRequest, DecryptedVoteOption, TrustedCounterParty, QueryVoteRequest, QueryDepositResponse, QueryParamsResponse, QueryDepositsRequest, MsgExecLegacyContent, MsgUpdateParamsResponse, TallyResult, DepositParams, MsgCancelProposalResponse, QueryProposalsRequest, MsgCancelProposal, MsgSubmitProposal, MsgExecLegacyContentResponse, MsgVoteEncryptedResponse, MsgVoteWeightedResponse, QueryDepositsResponse, MsgVoteResponse, Params, Deposit, Proposal, MsgVote, WeightedVoteOption, QueryProposalRequest, MsgSubmitProposalResponse, MsgVoteWeighted, Vote, TallyParams, MsgDeposit }; +import { QueryConstitutionRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { TrustedCounterParty } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgExecLegacyContent } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { DepositParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { VotingParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { DecryptedVoteOption } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgDeposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryProposalsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { MsgVoteWeighted } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgVoteWeightedResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryDepositRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryDepositsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { MsgVoteEncrypted } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/genesis"; +import { QueryConstitutionResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryTallyResultRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryProposalsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { Deposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { QueryVoteRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { TallyParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryProposalRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { MsgSubmitProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { WeightedVoteOption } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { Vote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgSubmitProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgDepositResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgCancelProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryVotesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { Proposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { QueryVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryDepositResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryDepositsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryTallyResultResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { TallyResult } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgVote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgCancelProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryVotesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { MsgExecLegacyContentResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgVoteEncryptedResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; + + +export { QueryConstitutionRequest, TrustedCounterParty, MsgExecLegacyContent, DepositParams, VotingParams, DecryptedVoteOption, MsgDeposit, MsgUpdateParams, QueryProposalsRequest, MsgVoteWeighted, MsgVoteWeightedResponse, QueryProposalResponse, QueryDepositRequest, QueryDepositsRequest, MsgVoteEncrypted, MsgUpdateParamsResponse, GenesisState, QueryConstitutionResponse, QueryTallyResultRequest, QueryProposalsResponse, Deposit, QueryVoteRequest, TallyParams, MsgVoteResponse, QueryProposalRequest, MsgSubmitProposalResponse, QueryParamsResponse, Params, QueryParamsRequest, WeightedVoteOption, Vote, MsgSubmitProposal, MsgDepositResponse, MsgCancelProposal, QueryVotesResponse, Proposal, QueryVoteResponse, QueryDepositResponse, QueryDepositsResponse, QueryTallyResultResponse, TallyResult, MsgVote, MsgCancelProposalResponse, QueryVotesRequest, MsgExecLegacyContentResponse, MsgVoteEncryptedResponse }; -type sendQueryConstitutionResponseParams = { - value: QueryConstitutionResponse, +type sendQueryConstitutionRequestParams = { + value: QueryConstitutionRequest, fee?: StdFee, memo?: string }; -type sendQueryVotesRequestParams = { - value: QueryVotesRequest, +type sendTrustedCounterPartyParams = { + value: TrustedCounterParty, fee?: StdFee, memo?: string }; -type sendQueryVotesResponseParams = { - value: QueryVotesResponse, +type sendMsgExecLegacyContentParams = { + value: MsgExecLegacyContent, fee?: StdFee, memo?: string }; -type sendMsgDepositResponseParams = { - value: MsgDepositResponse, +type sendDepositParamsParams = { + value: DepositParams, fee?: StdFee, memo?: string }; -type sendQueryTallyResultResponseParams = { - value: QueryTallyResultResponse, +type sendVotingParamsParams = { + value: VotingParams, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendDecryptedVoteOptionParams = { + value: DecryptedVoteOption, fee?: StdFee, memo?: string }; -type sendQueryConstitutionRequestParams = { - value: QueryConstitutionRequest, +type sendMsgDepositParams = { + value: MsgDeposit, fee?: StdFee, memo?: string }; -type sendQueryVoteResponseParams = { - value: QueryVoteResponse, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendQueryProposalsRequestParams = { + value: QueryProposalsRequest, fee?: StdFee, memo?: string }; -type sendMsgVoteEncryptedParams = { - value: MsgVoteEncrypted, +type sendMsgVoteWeightedParams = { + value: MsgVoteWeighted, fee?: StdFee, memo?: string }; -type sendVotingParamsParams = { - value: VotingParams, +type sendMsgVoteWeightedResponseParams = { + value: MsgVoteWeightedResponse, fee?: StdFee, memo?: string }; -type sendQueryProposalsResponseParams = { - value: QueryProposalsResponse, +type sendQueryProposalResponseParams = { + value: QueryProposalResponse, fee?: StdFee, memo?: string }; -type sendQueryTallyResultRequestParams = { - value: QueryTallyResultRequest, +type sendQueryDepositRequestParams = { + value: QueryDepositRequest, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryDepositsRequestParams = { + value: QueryDepositsRequest, fee?: StdFee, memo?: string }; -type sendQueryProposalResponseParams = { - value: QueryProposalResponse, +type sendMsgVoteEncryptedParams = { + value: MsgVoteEncrypted, fee?: StdFee, memo?: string }; -type sendQueryDepositRequestParams = { - value: QueryDepositRequest, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendDecryptedVoteOptionParams = { - value: DecryptedVoteOption, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendTrustedCounterPartyParams = { - value: TrustedCounterParty, +type sendQueryConstitutionResponseParams = { + value: QueryConstitutionResponse, fee?: StdFee, memo?: string }; -type sendQueryVoteRequestParams = { - value: QueryVoteRequest, +type sendQueryTallyResultRequestParams = { + value: QueryTallyResultRequest, fee?: StdFee, memo?: string }; -type sendQueryDepositResponseParams = { - value: QueryDepositResponse, +type sendQueryProposalsResponseParams = { + value: QueryProposalsResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendDepositParams = { + value: Deposit, fee?: StdFee, memo?: string }; -type sendQueryDepositsRequestParams = { - value: QueryDepositsRequest, +type sendQueryVoteRequestParams = { + value: QueryVoteRequest, fee?: StdFee, memo?: string }; -type sendMsgExecLegacyContentParams = { - value: MsgExecLegacyContent, +type sendTallyParamsParams = { + value: TallyParams, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendMsgVoteResponseParams = { + value: MsgVoteResponse, fee?: StdFee, memo?: string }; -type sendTallyResultParams = { - value: TallyResult, +type sendQueryProposalRequestParams = { + value: QueryProposalRequest, fee?: StdFee, memo?: string }; -type sendDepositParamsParams = { - value: DepositParams, +type sendMsgSubmitProposalResponseParams = { + value: MsgSubmitProposalResponse, fee?: StdFee, memo?: string }; -type sendMsgCancelProposalResponseParams = { - value: MsgCancelProposalResponse, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryProposalsRequestParams = { - value: QueryProposalsRequest, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendMsgCancelProposalParams = { - value: MsgCancelProposal, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendMsgSubmitProposalParams = { - value: MsgSubmitProposal, +type sendWeightedVoteOptionParams = { + value: WeightedVoteOption, fee?: StdFee, memo?: string }; -type sendMsgExecLegacyContentResponseParams = { - value: MsgExecLegacyContentResponse, +type sendVoteParams = { + value: Vote, fee?: StdFee, memo?: string }; -type sendMsgVoteEncryptedResponseParams = { - value: MsgVoteEncryptedResponse, +type sendMsgSubmitProposalParams = { + value: MsgSubmitProposal, fee?: StdFee, memo?: string }; -type sendMsgVoteWeightedResponseParams = { - value: MsgVoteWeightedResponse, +type sendMsgDepositResponseParams = { + value: MsgDepositResponse, fee?: StdFee, memo?: string }; -type sendQueryDepositsResponseParams = { - value: QueryDepositsResponse, +type sendMsgCancelProposalParams = { + value: MsgCancelProposal, fee?: StdFee, memo?: string }; -type sendMsgVoteResponseParams = { - value: MsgVoteResponse, +type sendQueryVotesResponseParams = { + value: QueryVotesResponse, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendProposalParams = { + value: Proposal, fee?: StdFee, memo?: string }; -type sendDepositParams = { - value: Deposit, +type sendQueryVoteResponseParams = { + value: QueryVoteResponse, fee?: StdFee, memo?: string }; -type sendProposalParams = { - value: Proposal, +type sendQueryDepositResponseParams = { + value: QueryDepositResponse, fee?: StdFee, memo?: string }; -type sendMsgVoteParams = { - value: MsgVote, +type sendQueryDepositsResponseParams = { + value: QueryDepositsResponse, fee?: StdFee, memo?: string }; -type sendWeightedVoteOptionParams = { - value: WeightedVoteOption, +type sendQueryTallyResultResponseParams = { + value: QueryTallyResultResponse, fee?: StdFee, memo?: string }; -type sendQueryProposalRequestParams = { - value: QueryProposalRequest, +type sendTallyResultParams = { + value: TallyResult, fee?: StdFee, memo?: string }; -type sendMsgSubmitProposalResponseParams = { - value: MsgSubmitProposalResponse, +type sendMsgVoteParams = { + value: MsgVote, fee?: StdFee, memo?: string }; -type sendMsgVoteWeightedParams = { - value: MsgVoteWeighted, +type sendMsgCancelProposalResponseParams = { + value: MsgCancelProposalResponse, fee?: StdFee, memo?: string }; -type sendVoteParams = { - value: Vote, +type sendQueryVotesRequestParams = { + value: QueryVotesRequest, fee?: StdFee, memo?: string }; -type sendTallyParamsParams = { - value: TallyParams, +type sendMsgExecLegacyContentResponseParams = { + value: MsgExecLegacyContentResponse, fee?: StdFee, memo?: string }; -type sendMsgDepositParams = { - value: MsgDeposit, +type sendMsgVoteEncryptedResponseParams = { + value: MsgVoteEncryptedResponse, fee?: StdFee, memo?: string }; -type queryConstitutionResponseParams = { - value: QueryConstitutionResponse, -}; - -type queryVotesRequestParams = { - value: QueryVotesRequest, -}; - -type queryVotesResponseParams = { - value: QueryVotesResponse, -}; - -type msgDepositResponseParams = { - value: MsgDepositResponse, +type queryConstitutionRequestParams = { + value: QueryConstitutionRequest, }; -type queryTallyResultResponseParams = { - value: QueryTallyResultResponse, +type trustedCounterPartyParams = { + value: TrustedCounterParty, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type msgExecLegacyContentParams = { + value: MsgExecLegacyContent, }; -type queryConstitutionRequestParams = { - value: QueryConstitutionRequest, +type depositParamsParams = { + value: DepositParams, }; -type queryVoteResponseParams = { - value: QueryVoteResponse, +type votingParamsParams = { + value: VotingParams, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type decryptedVoteOptionParams = { + value: DecryptedVoteOption, }; -type msgVoteEncryptedParams = { - value: MsgVoteEncrypted, +type msgDepositParams = { + value: MsgDeposit, }; -type votingParamsParams = { - value: VotingParams, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type queryProposalsResponseParams = { - value: QueryProposalsResponse, +type queryProposalsRequestParams = { + value: QueryProposalsRequest, }; -type queryTallyResultRequestParams = { - value: QueryTallyResultRequest, +type msgVoteWeightedParams = { + value: MsgVoteWeighted, }; -type genesisStateParams = { - value: GenesisState, +type msgVoteWeightedResponseParams = { + value: MsgVoteWeightedResponse, }; type queryProposalResponseParams = { @@ -397,124 +385,136 @@ type queryDepositRequestParams = { value: QueryDepositRequest, }; -type decryptedVoteOptionParams = { - value: DecryptedVoteOption, +type queryDepositsRequestParams = { + value: QueryDepositsRequest, }; -type trustedCounterPartyParams = { - value: TrustedCounterParty, +type msgVoteEncryptedParams = { + value: MsgVoteEncrypted, }; -type queryVoteRequestParams = { - value: QueryVoteRequest, +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; -type queryDepositResponseParams = { - value: QueryDepositResponse, +type genesisStateParams = { + value: GenesisState, }; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type queryConstitutionResponseParams = { + value: QueryConstitutionResponse, }; -type queryDepositsRequestParams = { - value: QueryDepositsRequest, +type queryTallyResultRequestParams = { + value: QueryTallyResultRequest, }; -type msgExecLegacyContentParams = { - value: MsgExecLegacyContent, +type queryProposalsResponseParams = { + value: QueryProposalsResponse, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type depositParams = { + value: Deposit, }; -type tallyResultParams = { - value: TallyResult, +type queryVoteRequestParams = { + value: QueryVoteRequest, }; -type depositParamsParams = { - value: DepositParams, +type tallyParamsParams = { + value: TallyParams, }; -type msgCancelProposalResponseParams = { - value: MsgCancelProposalResponse, +type msgVoteResponseParams = { + value: MsgVoteResponse, }; -type queryProposalsRequestParams = { - value: QueryProposalsRequest, +type queryProposalRequestParams = { + value: QueryProposalRequest, }; -type msgCancelProposalParams = { - value: MsgCancelProposal, +type msgSubmitProposalResponseParams = { + value: MsgSubmitProposalResponse, }; -type msgSubmitProposalParams = { - value: MsgSubmitProposal, +type queryParamsResponseParams = { + value: QueryParamsResponse, }; -type msgExecLegacyContentResponseParams = { - value: MsgExecLegacyContentResponse, +type paramsParams = { + value: Params, }; -type msgVoteEncryptedResponseParams = { - value: MsgVoteEncryptedResponse, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; -type msgVoteWeightedResponseParams = { - value: MsgVoteWeightedResponse, +type weightedVoteOptionParams = { + value: WeightedVoteOption, }; -type queryDepositsResponseParams = { - value: QueryDepositsResponse, +type voteParams = { + value: Vote, }; -type msgVoteResponseParams = { - value: MsgVoteResponse, +type msgSubmitProposalParams = { + value: MsgSubmitProposal, }; -type paramsParams = { - value: Params, +type msgDepositResponseParams = { + value: MsgDepositResponse, }; -type depositParams = { - value: Deposit, +type msgCancelProposalParams = { + value: MsgCancelProposal, +}; + +type queryVotesResponseParams = { + value: QueryVotesResponse, }; type proposalParams = { value: Proposal, }; -type msgVoteParams = { - value: MsgVote, +type queryVoteResponseParams = { + value: QueryVoteResponse, }; -type weightedVoteOptionParams = { - value: WeightedVoteOption, +type queryDepositResponseParams = { + value: QueryDepositResponse, }; -type queryProposalRequestParams = { - value: QueryProposalRequest, +type queryDepositsResponseParams = { + value: QueryDepositsResponse, }; -type msgSubmitProposalResponseParams = { - value: MsgSubmitProposalResponse, +type queryTallyResultResponseParams = { + value: QueryTallyResultResponse, }; -type msgVoteWeightedParams = { - value: MsgVoteWeighted, +type tallyResultParams = { + value: TallyResult, }; -type voteParams = { - value: Vote, +type msgVoteParams = { + value: MsgVote, }; -type tallyParamsParams = { - value: TallyParams, +type msgCancelProposalResponseParams = { + value: MsgCancelProposalResponse, }; -type msgDepositParams = { - value: MsgDeposit, +type queryVotesRequestParams = { + value: QueryVotesRequest, +}; + +type msgExecLegacyContentResponseParams = { + value: MsgExecLegacyContentResponse, +}; + +type msgVoteEncryptedResponseParams = { + value: MsgVoteEncryptedResponse, }; @@ -547,1016 +547,1016 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendQueryConstitutionResponse({ value, fee, memo }: sendQueryConstitutionResponseParams): Promise { + async sendQueryConstitutionRequest({ value, fee, memo }: sendQueryConstitutionRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConstitutionResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConstitutionRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConstitutionResponse({ value: QueryConstitutionResponse.fromPartial(value) }) + let msg = this.queryConstitutionRequest({ value: QueryConstitutionRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConstitutionResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConstitutionRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVotesRequest({ value, fee, memo }: sendQueryVotesRequestParams): Promise { + async sendTrustedCounterParty({ value, fee, memo }: sendTrustedCounterPartyParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVotesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTrustedCounterParty: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVotesRequest({ value: QueryVotesRequest.fromPartial(value) }) + let msg = this.trustedCounterParty({ value: TrustedCounterParty.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVotesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTrustedCounterParty: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVotesResponse({ value, fee, memo }: sendQueryVotesResponseParams): Promise { + async sendMsgExecLegacyContent({ value, fee, memo }: sendMsgExecLegacyContentParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVotesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgExecLegacyContent: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVotesResponse({ value: QueryVotesResponse.fromPartial(value) }) + let msg = this.msgExecLegacyContent({ value: MsgExecLegacyContent.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVotesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgExecLegacyContent: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDepositResponse({ value, fee, memo }: sendMsgDepositResponseParams): Promise { + async sendDepositParams({ value, fee, memo }: sendDepositParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDepositResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDepositParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDepositResponse({ value: MsgDepositResponse.fromPartial(value) }) + let msg = this.depositParams({ value: DepositParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDepositResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDepositParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTallyResultResponse({ value, fee, memo }: sendQueryTallyResultResponseParams): Promise { + async sendVotingParams({ value, fee, memo }: sendVotingParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTallyResultResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendVotingParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTallyResultResponse({ value: QueryTallyResultResponse.fromPartial(value) }) + let msg = this.votingParams({ value: VotingParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTallyResultResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendVotingParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendDecryptedVoteOption({ value, fee, memo }: sendDecryptedVoteOptionParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDecryptedVoteOption: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.decryptedVoteOption({ value: DecryptedVoteOption.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDecryptedVoteOption: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConstitutionRequest({ value, fee, memo }: sendQueryConstitutionRequestParams): Promise { + async sendMsgDeposit({ value, fee, memo }: sendMsgDepositParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConstitutionRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDeposit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConstitutionRequest({ value: QueryConstitutionRequest.fromPartial(value) }) + let msg = this.msgDeposit({ value: MsgDeposit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConstitutionRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDeposit: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVoteResponse({ value, fee, memo }: sendQueryVoteResponseParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVoteResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVoteResponse({ value: QueryVoteResponse.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVoteResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendQueryProposalsRequest({ value, fee, memo }: sendQueryProposalsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.queryProposalsRequest({ value: QueryProposalsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteEncrypted({ value, fee, memo }: sendMsgVoteEncryptedParams): Promise { + async sendMsgVoteWeighted({ value, fee, memo }: sendMsgVoteWeightedParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteEncrypted: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteWeighted: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteEncrypted({ value: MsgVoteEncrypted.fromPartial(value) }) + let msg = this.msgVoteWeighted({ value: MsgVoteWeighted.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteEncrypted: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteWeighted: Could not broadcast Tx: '+ e.message) } }, - async sendVotingParams({ value, fee, memo }: sendVotingParamsParams): Promise { + async sendMsgVoteWeightedResponse({ value, fee, memo }: sendMsgVoteWeightedResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendVotingParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteWeightedResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.votingParams({ value: VotingParams.fromPartial(value) }) + let msg = this.msgVoteWeightedResponse({ value: MsgVoteWeightedResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendVotingParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteWeightedResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalsResponse({ value, fee, memo }: sendQueryProposalsResponseParams): Promise { + async sendQueryProposalResponse({ value, fee, memo }: sendQueryProposalResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalsResponse({ value: QueryProposalsResponse.fromPartial(value) }) + let msg = this.queryProposalResponse({ value: QueryProposalResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTallyResultRequest({ value, fee, memo }: sendQueryTallyResultRequestParams): Promise { + async sendQueryDepositRequest({ value, fee, memo }: sendQueryDepositRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTallyResultRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDepositRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTallyResultRequest({ value: QueryTallyResultRequest.fromPartial(value) }) + let msg = this.queryDepositRequest({ value: QueryDepositRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTallyResultRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDepositRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryDepositsRequest({ value, fee, memo }: sendQueryDepositsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDepositsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryDepositsRequest({ value: QueryDepositsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDepositsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalResponse({ value, fee, memo }: sendQueryProposalResponseParams): Promise { + async sendMsgVoteEncrypted({ value, fee, memo }: sendMsgVoteEncryptedParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteEncrypted: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalResponse({ value: QueryProposalResponse.fromPartial(value) }) + let msg = this.msgVoteEncrypted({ value: MsgVoteEncrypted.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteEncrypted: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDepositRequest({ value, fee, memo }: sendQueryDepositRequestParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDepositRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDepositRequest({ value: QueryDepositRequest.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDepositRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendDecryptedVoteOption({ value, fee, memo }: sendDecryptedVoteOptionParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendDecryptedVoteOption: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.decryptedVoteOption({ value: DecryptedVoteOption.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDecryptedVoteOption: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendTrustedCounterParty({ value, fee, memo }: sendTrustedCounterPartyParams): Promise { + async sendQueryConstitutionResponse({ value, fee, memo }: sendQueryConstitutionResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendTrustedCounterParty: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConstitutionResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.trustedCounterParty({ value: TrustedCounterParty.fromPartial(value) }) + let msg = this.queryConstitutionResponse({ value: QueryConstitutionResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTrustedCounterParty: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConstitutionResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVoteRequest({ value, fee, memo }: sendQueryVoteRequestParams): Promise { + async sendQueryTallyResultRequest({ value, fee, memo }: sendQueryTallyResultRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVoteRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTallyResultRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVoteRequest({ value: QueryVoteRequest.fromPartial(value) }) + let msg = this.queryTallyResultRequest({ value: QueryTallyResultRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVoteRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTallyResultRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDepositResponse({ value, fee, memo }: sendQueryDepositResponseParams): Promise { + async sendQueryProposalsResponse({ value, fee, memo }: sendQueryProposalsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDepositResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDepositResponse({ value: QueryDepositResponse.fromPartial(value) }) + let msg = this.queryProposalsResponse({ value: QueryProposalsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDepositResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendDeposit({ value, fee, memo }: sendDepositParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDeposit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.deposit({ value: Deposit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDeposit: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDepositsRequest({ value, fee, memo }: sendQueryDepositsRequestParams): Promise { + async sendQueryVoteRequest({ value, fee, memo }: sendQueryVoteRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDepositsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVoteRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDepositsRequest({ value: QueryDepositsRequest.fromPartial(value) }) + let msg = this.queryVoteRequest({ value: QueryVoteRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDepositsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVoteRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgExecLegacyContent({ value, fee, memo }: sendMsgExecLegacyContentParams): Promise { + async sendTallyParams({ value, fee, memo }: sendTallyParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgExecLegacyContent: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTallyParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgExecLegacyContent({ value: MsgExecLegacyContent.fromPartial(value) }) + let msg = this.tallyParams({ value: TallyParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgExecLegacyContent: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTallyParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendMsgVoteResponse({ value, fee, memo }: sendMsgVoteResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.msgVoteResponse({ value: MsgVoteResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteResponse: Could not broadcast Tx: '+ e.message) } }, - async sendTallyResult({ value, fee, memo }: sendTallyResultParams): Promise { + async sendQueryProposalRequest({ value, fee, memo }: sendQueryProposalRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTallyResult: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.tallyResult({ value: TallyResult.fromPartial(value) }) + let msg = this.queryProposalRequest({ value: QueryProposalRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTallyResult: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalRequest: Could not broadcast Tx: '+ e.message) } }, - async sendDepositParams({ value, fee, memo }: sendDepositParamsParams): Promise { + async sendMsgSubmitProposalResponse({ value, fee, memo }: sendMsgSubmitProposalResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendDepositParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitProposalResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.depositParams({ value: DepositParams.fromPartial(value) }) + let msg = this.msgSubmitProposalResponse({ value: MsgSubmitProposalResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDepositParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitProposalResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCancelProposalResponse({ value, fee, memo }: sendMsgCancelProposalResponseParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCancelProposalResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCancelProposalResponse({ value: MsgCancelProposalResponse.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCancelProposalResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalsRequest({ value, fee, memo }: sendQueryProposalsRequestParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalsRequest({ value: QueryProposalsRequest.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCancelProposal({ value, fee, memo }: sendMsgCancelProposalParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCancelProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCancelProposal({ value: MsgCancelProposal.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCancelProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitProposal({ value, fee, memo }: sendMsgSubmitProposalParams): Promise { + async sendWeightedVoteOption({ value, fee, memo }: sendWeightedVoteOptionParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendWeightedVoteOption: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitProposal({ value: MsgSubmitProposal.fromPartial(value) }) + let msg = this.weightedVoteOption({ value: WeightedVoteOption.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendWeightedVoteOption: Could not broadcast Tx: '+ e.message) } }, - async sendMsgExecLegacyContentResponse({ value, fee, memo }: sendMsgExecLegacyContentResponseParams): Promise { + async sendVote({ value, fee, memo }: sendVoteParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgExecLegacyContentResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendVote: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgExecLegacyContentResponse({ value: MsgExecLegacyContentResponse.fromPartial(value) }) + let msg = this.vote({ value: Vote.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgExecLegacyContentResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendVote: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteEncryptedResponse({ value, fee, memo }: sendMsgVoteEncryptedResponseParams): Promise { + async sendMsgSubmitProposal({ value, fee, memo }: sendMsgSubmitProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteEncryptedResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteEncryptedResponse({ value: MsgVoteEncryptedResponse.fromPartial(value) }) + let msg = this.msgSubmitProposal({ value: MsgSubmitProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteEncryptedResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteWeightedResponse({ value, fee, memo }: sendMsgVoteWeightedResponseParams): Promise { + async sendMsgDepositResponse({ value, fee, memo }: sendMsgDepositResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteWeightedResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDepositResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteWeightedResponse({ value: MsgVoteWeightedResponse.fromPartial(value) }) + let msg = this.msgDepositResponse({ value: MsgDepositResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteWeightedResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDepositResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDepositsResponse({ value, fee, memo }: sendQueryDepositsResponseParams): Promise { + async sendMsgCancelProposal({ value, fee, memo }: sendMsgCancelProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDepositsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCancelProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDepositsResponse({ value: QueryDepositsResponse.fromPartial(value) }) + let msg = this.msgCancelProposal({ value: MsgCancelProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDepositsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCancelProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteResponse({ value, fee, memo }: sendMsgVoteResponseParams): Promise { + async sendQueryVotesResponse({ value, fee, memo }: sendQueryVotesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVotesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteResponse({ value: MsgVoteResponse.fromPartial(value) }) + let msg = this.queryVotesResponse({ value: QueryVotesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVotesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendProposal({ value, fee, memo }: sendProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.proposal({ value: Proposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendProposal: Could not broadcast Tx: '+ e.message) } }, - async sendDeposit({ value, fee, memo }: sendDepositParams): Promise { + async sendQueryVoteResponse({ value, fee, memo }: sendQueryVoteResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendDeposit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVoteResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.deposit({ value: Deposit.fromPartial(value) }) + let msg = this.queryVoteResponse({ value: QueryVoteResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDeposit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVoteResponse: Could not broadcast Tx: '+ e.message) } }, - async sendProposal({ value, fee, memo }: sendProposalParams): Promise { + async sendQueryDepositResponse({ value, fee, memo }: sendQueryDepositResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDepositResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.proposal({ value: Proposal.fromPartial(value) }) + let msg = this.queryDepositResponse({ value: QueryDepositResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDepositResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVote({ value, fee, memo }: sendMsgVoteParams): Promise { + async sendQueryDepositsResponse({ value, fee, memo }: sendQueryDepositsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDepositsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVote({ value: MsgVote.fromPartial(value) }) + let msg = this.queryDepositsResponse({ value: QueryDepositsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDepositsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendWeightedVoteOption({ value, fee, memo }: sendWeightedVoteOptionParams): Promise { + async sendQueryTallyResultResponse({ value, fee, memo }: sendQueryTallyResultResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendWeightedVoteOption: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTallyResultResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.weightedVoteOption({ value: WeightedVoteOption.fromPartial(value) }) + let msg = this.queryTallyResultResponse({ value: QueryTallyResultResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendWeightedVoteOption: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTallyResultResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalRequest({ value, fee, memo }: sendQueryProposalRequestParams): Promise { + async sendTallyResult({ value, fee, memo }: sendTallyResultParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTallyResult: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalRequest({ value: QueryProposalRequest.fromPartial(value) }) + let msg = this.tallyResult({ value: TallyResult.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTallyResult: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitProposalResponse({ value, fee, memo }: sendMsgSubmitProposalResponseParams): Promise { + async sendMsgVote({ value, fee, memo }: sendMsgVoteParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitProposalResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitProposalResponse({ value: MsgSubmitProposalResponse.fromPartial(value) }) + let msg = this.msgVote({ value: MsgVote.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitProposalResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteWeighted({ value, fee, memo }: sendMsgVoteWeightedParams): Promise { + async sendMsgCancelProposalResponse({ value, fee, memo }: sendMsgCancelProposalResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteWeighted: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCancelProposalResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteWeighted({ value: MsgVoteWeighted.fromPartial(value) }) + let msg = this.msgCancelProposalResponse({ value: MsgCancelProposalResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteWeighted: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCancelProposalResponse: Could not broadcast Tx: '+ e.message) } }, - async sendVote({ value, fee, memo }: sendVoteParams): Promise { + async sendQueryVotesRequest({ value, fee, memo }: sendQueryVotesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendVote: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVotesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.vote({ value: Vote.fromPartial(value) }) + let msg = this.queryVotesRequest({ value: QueryVotesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendVote: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVotesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendTallyParams({ value, fee, memo }: sendTallyParamsParams): Promise { + async sendMsgExecLegacyContentResponse({ value, fee, memo }: sendMsgExecLegacyContentResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendTallyParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgExecLegacyContentResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.tallyParams({ value: TallyParams.fromPartial(value) }) + let msg = this.msgExecLegacyContentResponse({ value: MsgExecLegacyContentResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTallyParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgExecLegacyContentResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDeposit({ value, fee, memo }: sendMsgDepositParams): Promise { + async sendMsgVoteEncryptedResponse({ value, fee, memo }: sendMsgVoteEncryptedResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDeposit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteEncryptedResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDeposit({ value: MsgDeposit.fromPartial(value) }) + let msg = this.msgVoteEncryptedResponse({ value: MsgVoteEncryptedResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDeposit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteEncryptedResponse: Could not broadcast Tx: '+ e.message) } }, - queryConstitutionResponse({ value }: queryConstitutionResponseParams): EncodeObject { + queryConstitutionRequest({ value }: queryConstitutionRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryConstitutionResponse", value: QueryConstitutionResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryConstitutionRequest", value: QueryConstitutionRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConstitutionResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConstitutionRequest: Could not create message: ' + e.message) } }, - queryVotesRequest({ value }: queryVotesRequestParams): EncodeObject { + trustedCounterParty({ value }: trustedCounterPartyParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryVotesRequest", value: QueryVotesRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.TrustedCounterParty", value: TrustedCounterParty.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVotesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:TrustedCounterParty: Could not create message: ' + e.message) } }, - queryVotesResponse({ value }: queryVotesResponseParams): EncodeObject { + msgExecLegacyContent({ value }: msgExecLegacyContentParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryVotesResponse", value: QueryVotesResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", value: MsgExecLegacyContent.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVotesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgExecLegacyContent: Could not create message: ' + e.message) } }, - msgDepositResponse({ value }: msgDepositResponseParams): EncodeObject { + depositParams({ value }: depositParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgDepositResponse", value: MsgDepositResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.DepositParams", value: DepositParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDepositResponse: Could not create message: ' + e.message) + throw new Error('TxClient:DepositParams: Could not create message: ' + e.message) } }, - queryTallyResultResponse({ value }: queryTallyResultResponseParams): EncodeObject { + votingParams({ value }: votingParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", value: QueryTallyResultResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.VotingParams", value: VotingParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTallyResultResponse: Could not create message: ' + e.message) + throw new Error('TxClient:VotingParams: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + decryptedVoteOption({ value }: decryptedVoteOptionParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.DecryptedVoteOption", value: DecryptedVoteOption.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:DecryptedVoteOption: Could not create message: ' + e.message) } }, - queryConstitutionRequest({ value }: queryConstitutionRequestParams): EncodeObject { + msgDeposit({ value }: msgDepositParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryConstitutionRequest", value: QueryConstitutionRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgDeposit", value: MsgDeposit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConstitutionRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDeposit: Could not create message: ' + e.message) } }, - queryVoteResponse({ value }: queryVoteResponseParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryVoteResponse", value: QueryVoteResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVoteResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + queryProposalsRequest({ value }: queryProposalsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", value: QueryProposalsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalsRequest: Could not create message: ' + e.message) } }, - msgVoteEncrypted({ value }: msgVoteEncryptedParams): EncodeObject { + msgVoteWeighted({ value }: msgVoteWeightedParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgVoteEncrypted", value: MsgVoteEncrypted.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteEncrypted: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteWeighted: Could not create message: ' + e.message) } }, - votingParams({ value }: votingParamsParams): EncodeObject { + msgVoteWeightedResponse({ value }: msgVoteWeightedResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.VotingParams", value: VotingParams.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", value: MsgVoteWeightedResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:VotingParams: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteWeightedResponse: Could not create message: ' + e.message) } }, - queryProposalsResponse({ value }: queryProposalsResponseParams): EncodeObject { + queryProposalResponse({ value }: queryProposalResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", value: QueryProposalsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryProposalResponse", value: QueryProposalResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalResponse: Could not create message: ' + e.message) } }, - queryTallyResultRequest({ value }: queryTallyResultRequestParams): EncodeObject { + queryDepositRequest({ value }: queryDepositRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", value: QueryTallyResultRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryDepositRequest", value: QueryDepositRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTallyResultRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDepositRequest: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryDepositsRequest({ value }: queryDepositsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", value: QueryDepositsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDepositsRequest: Could not create message: ' + e.message) } }, - queryProposalResponse({ value }: queryProposalResponseParams): EncodeObject { + msgVoteEncrypted({ value }: msgVoteEncryptedParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryProposalResponse", value: QueryProposalResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgVoteEncrypted", value: MsgVoteEncrypted.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteEncrypted: Could not create message: ' + e.message) } }, - queryDepositRequest({ value }: queryDepositRequestParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryDepositRequest", value: QueryDepositRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDepositRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - decryptedVoteOption({ value }: decryptedVoteOptionParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.DecryptedVoteOption", value: DecryptedVoteOption.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DecryptedVoteOption: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - trustedCounterParty({ value }: trustedCounterPartyParams): EncodeObject { + queryConstitutionResponse({ value }: queryConstitutionResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.TrustedCounterParty", value: TrustedCounterParty.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryConstitutionResponse", value: QueryConstitutionResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TrustedCounterParty: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConstitutionResponse: Could not create message: ' + e.message) } }, - queryVoteRequest({ value }: queryVoteRequestParams): EncodeObject { + queryTallyResultRequest({ value }: queryTallyResultRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryVoteRequest", value: QueryVoteRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", value: QueryTallyResultRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVoteRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTallyResultRequest: Could not create message: ' + e.message) } }, - queryDepositResponse({ value }: queryDepositResponseParams): EncodeObject { + queryProposalsResponse({ value }: queryProposalsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryDepositResponse", value: QueryDepositResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", value: QueryProposalsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDepositResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalsResponse: Could not create message: ' + e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + deposit({ value }: depositParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.Deposit", value: Deposit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Deposit: Could not create message: ' + e.message) } }, - queryDepositsRequest({ value }: queryDepositsRequestParams): EncodeObject { + queryVoteRequest({ value }: queryVoteRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", value: QueryDepositsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryVoteRequest", value: QueryVoteRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDepositsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVoteRequest: Could not create message: ' + e.message) } }, - msgExecLegacyContent({ value }: msgExecLegacyContentParams): EncodeObject { + tallyParams({ value }: tallyParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", value: MsgExecLegacyContent.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.TallyParams", value: TallyParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgExecLegacyContent: Could not create message: ' + e.message) + throw new Error('TxClient:TallyParams: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + msgVoteResponse({ value }: msgVoteResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgVoteResponse", value: MsgVoteResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteResponse: Could not create message: ' + e.message) } }, - tallyResult({ value }: tallyResultParams): EncodeObject { + queryProposalRequest({ value }: queryProposalRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.TallyResult", value: TallyResult.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryProposalRequest", value: QueryProposalRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TallyResult: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalRequest: Could not create message: ' + e.message) } }, - depositParams({ value }: depositParamsParams): EncodeObject { + msgSubmitProposalResponse({ value }: msgSubmitProposalResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.DepositParams", value: DepositParams.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DepositParams: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitProposalResponse: Could not create message: ' + e.message) } }, - msgCancelProposalResponse({ value }: msgCancelProposalResponseParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgCancelProposalResponse", value: MsgCancelProposalResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCancelProposalResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - queryProposalsRequest({ value }: queryProposalsRequestParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", value: QueryProposalsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - msgCancelProposal({ value }: msgCancelProposalParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgCancelProposal", value: MsgCancelProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCancelProposal: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - msgSubmitProposal({ value }: msgSubmitProposalParams): EncodeObject { + weightedVoteOption({ value }: weightedVoteOptionParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.WeightedVoteOption", value: WeightedVoteOption.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitProposal: Could not create message: ' + e.message) + throw new Error('TxClient:WeightedVoteOption: Could not create message: ' + e.message) } }, - msgExecLegacyContentResponse({ value }: msgExecLegacyContentResponseParams): EncodeObject { + vote({ value }: voteParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", value: MsgExecLegacyContentResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.Vote", value: Vote.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgExecLegacyContentResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Vote: Could not create message: ' + e.message) } }, - msgVoteEncryptedResponse({ value }: msgVoteEncryptedResponseParams): EncodeObject { + msgSubmitProposal({ value }: msgSubmitProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgVoteEncryptedResponse", value: MsgVoteEncryptedResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteEncryptedResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitProposal: Could not create message: ' + e.message) } }, - msgVoteWeightedResponse({ value }: msgVoteWeightedResponseParams): EncodeObject { + msgDepositResponse({ value }: msgDepositResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", value: MsgVoteWeightedResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgDepositResponse", value: MsgDepositResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteWeightedResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDepositResponse: Could not create message: ' + e.message) } }, - queryDepositsResponse({ value }: queryDepositsResponseParams): EncodeObject { + msgCancelProposal({ value }: msgCancelProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", value: QueryDepositsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgCancelProposal", value: MsgCancelProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDepositsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCancelProposal: Could not create message: ' + e.message) } }, - msgVoteResponse({ value }: msgVoteResponseParams): EncodeObject { + queryVotesResponse({ value }: queryVotesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgVoteResponse", value: MsgVoteResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryVotesResponse", value: QueryVotesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVotesResponse: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + proposal({ value }: proposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.Proposal", value: Proposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:Proposal: Could not create message: ' + e.message) } }, - deposit({ value }: depositParams): EncodeObject { + queryVoteResponse({ value }: queryVoteResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.Deposit", value: Deposit.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryVoteResponse", value: QueryVoteResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Deposit: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVoteResponse: Could not create message: ' + e.message) } }, - proposal({ value }: proposalParams): EncodeObject { + queryDepositResponse({ value }: queryDepositResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.Proposal", value: Proposal.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryDepositResponse", value: QueryDepositResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Proposal: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDepositResponse: Could not create message: ' + e.message) } }, - msgVote({ value }: msgVoteParams): EncodeObject { + queryDepositsResponse({ value }: queryDepositsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgVote", value: MsgVote.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", value: QueryDepositsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVote: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDepositsResponse: Could not create message: ' + e.message) } }, - weightedVoteOption({ value }: weightedVoteOptionParams): EncodeObject { + queryTallyResultResponse({ value }: queryTallyResultResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.WeightedVoteOption", value: WeightedVoteOption.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", value: QueryTallyResultResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:WeightedVoteOption: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTallyResultResponse: Could not create message: ' + e.message) } }, - queryProposalRequest({ value }: queryProposalRequestParams): EncodeObject { + tallyResult({ value }: tallyResultParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.QueryProposalRequest", value: QueryProposalRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.TallyResult", value: TallyResult.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalRequest: Could not create message: ' + e.message) + throw new Error('TxClient:TallyResult: Could not create message: ' + e.message) } }, - msgSubmitProposalResponse({ value }: msgSubmitProposalResponseParams): EncodeObject { + msgVote({ value }: msgVoteParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgVote", value: MsgVote.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitProposalResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVote: Could not create message: ' + e.message) } }, - msgVoteWeighted({ value }: msgVoteWeightedParams): EncodeObject { + msgCancelProposalResponse({ value }: msgCancelProposalResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgCancelProposalResponse", value: MsgCancelProposalResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteWeighted: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCancelProposalResponse: Could not create message: ' + e.message) } }, - vote({ value }: voteParams): EncodeObject { + queryVotesRequest({ value }: queryVotesRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.Vote", value: Vote.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.QueryVotesRequest", value: QueryVotesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Vote: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVotesRequest: Could not create message: ' + e.message) } }, - tallyParams({ value }: tallyParamsParams): EncodeObject { + msgExecLegacyContentResponse({ value }: msgExecLegacyContentResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.TallyParams", value: TallyParams.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", value: MsgExecLegacyContentResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TallyParams: Could not create message: ' + e.message) + throw new Error('TxClient:MsgExecLegacyContentResponse: Could not create message: ' + e.message) } }, - msgDeposit({ value }: msgDepositParams): EncodeObject { + msgVoteEncryptedResponse({ value }: msgVoteEncryptedResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1.MsgDeposit", value: MsgDeposit.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1.MsgVoteEncryptedResponse", value: MsgVoteEncryptedResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDeposit: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteEncryptedResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.gov.v1/registry.ts b/ts-client/cosmos.gov.v1/registry.ts index 15f92b4a..9793fc63 100755 --- a/ts-client/cosmos.gov.v1/registry.ts +++ b/ts-client/cosmos.gov.v1/registry.ts @@ -1,98 +1,98 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { QueryConstitutionResponse } from "./types/cosmos/gov/v1/query"; -import { QueryVotesRequest } from "./types/cosmos/gov/v1/query"; -import { QueryVotesResponse } from "./types/cosmos/gov/v1/query"; -import { MsgDepositResponse } from "./types/cosmos/gov/v1/tx"; -import { QueryTallyResultResponse } from "./types/cosmos/gov/v1/query"; -import { MsgUpdateParams } from "./types/cosmos/gov/v1/tx"; -import { QueryConstitutionRequest } from "./types/cosmos/gov/v1/query"; -import { QueryVoteResponse } from "./types/cosmos/gov/v1/query"; -import { QueryParamsRequest } from "./types/cosmos/gov/v1/query"; -import { MsgVoteEncrypted } from "./types/cosmos/gov/v1/tx"; -import { VotingParams } from "./types/cosmos/gov/v1/gov"; -import { QueryProposalsResponse } from "./types/cosmos/gov/v1/query"; -import { QueryTallyResultRequest } from "./types/cosmos/gov/v1/query"; -import { GenesisState } from "./types/cosmos/gov/v1/genesis"; -import { QueryProposalResponse } from "./types/cosmos/gov/v1/query"; -import { QueryDepositRequest } from "./types/cosmos/gov/v1/query"; -import { DecryptedVoteOption } from "./types/cosmos/gov/v1/gov"; -import { TrustedCounterParty } from "./types/cosmos/gov/v1/gov"; -import { QueryVoteRequest } from "./types/cosmos/gov/v1/query"; -import { QueryDepositResponse } from "./types/cosmos/gov/v1/query"; -import { QueryParamsResponse } from "./types/cosmos/gov/v1/query"; -import { QueryDepositsRequest } from "./types/cosmos/gov/v1/query"; -import { MsgExecLegacyContent } from "./types/cosmos/gov/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/cosmos/gov/v1/tx"; -import { TallyResult } from "./types/cosmos/gov/v1/gov"; -import { DepositParams } from "./types/cosmos/gov/v1/gov"; -import { MsgCancelProposalResponse } from "./types/cosmos/gov/v1/tx"; -import { QueryProposalsRequest } from "./types/cosmos/gov/v1/query"; -import { MsgCancelProposal } from "./types/cosmos/gov/v1/tx"; -import { MsgSubmitProposal } from "./types/cosmos/gov/v1/tx"; -import { MsgExecLegacyContentResponse } from "./types/cosmos/gov/v1/tx"; -import { MsgVoteEncryptedResponse } from "./types/cosmos/gov/v1/tx"; -import { MsgVoteWeightedResponse } from "./types/cosmos/gov/v1/tx"; -import { QueryDepositsResponse } from "./types/cosmos/gov/v1/query"; -import { MsgVoteResponse } from "./types/cosmos/gov/v1/tx"; -import { Params } from "./types/cosmos/gov/v1/gov"; -import { Deposit } from "./types/cosmos/gov/v1/gov"; -import { Proposal } from "./types/cosmos/gov/v1/gov"; -import { MsgVote } from "./types/cosmos/gov/v1/tx"; -import { WeightedVoteOption } from "./types/cosmos/gov/v1/gov"; -import { QueryProposalRequest } from "./types/cosmos/gov/v1/query"; -import { MsgSubmitProposalResponse } from "./types/cosmos/gov/v1/tx"; -import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx"; -import { Vote } from "./types/cosmos/gov/v1/gov"; -import { TallyParams } from "./types/cosmos/gov/v1/gov"; -import { MsgDeposit } from "./types/cosmos/gov/v1/tx"; +import { QueryConstitutionRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { TrustedCounterParty } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgExecLegacyContent } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { DepositParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { VotingParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { DecryptedVoteOption } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgDeposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryProposalsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { MsgVoteWeighted } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgVoteWeightedResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryDepositRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryDepositsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { MsgVoteEncrypted } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/genesis"; +import { QueryConstitutionResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryTallyResultRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryProposalsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { Deposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { QueryVoteRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { TallyParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryProposalRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { MsgSubmitProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { WeightedVoteOption } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { Vote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgSubmitProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgDepositResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgCancelProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryVotesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { Proposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { QueryVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryDepositResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryDepositsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { QueryTallyResultResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { TallyResult } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/gov"; +import { MsgVote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgCancelProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { QueryVotesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/query"; +import { MsgExecLegacyContentResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; +import { MsgVoteEncryptedResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.gov.v1.QueryConstitutionResponse", QueryConstitutionResponse], - ["/cosmos.gov.v1.QueryVotesRequest", QueryVotesRequest], - ["/cosmos.gov.v1.QueryVotesResponse", QueryVotesResponse], - ["/cosmos.gov.v1.MsgDepositResponse", MsgDepositResponse], - ["/cosmos.gov.v1.QueryTallyResultResponse", QueryTallyResultResponse], - ["/cosmos.gov.v1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.gov.v1.QueryConstitutionRequest", QueryConstitutionRequest], - ["/cosmos.gov.v1.QueryVoteResponse", QueryVoteResponse], - ["/cosmos.gov.v1.QueryParamsRequest", QueryParamsRequest], - ["/cosmos.gov.v1.MsgVoteEncrypted", MsgVoteEncrypted], - ["/cosmos.gov.v1.VotingParams", VotingParams], - ["/cosmos.gov.v1.QueryProposalsResponse", QueryProposalsResponse], - ["/cosmos.gov.v1.QueryTallyResultRequest", QueryTallyResultRequest], - ["/cosmos.gov.v1.GenesisState", GenesisState], - ["/cosmos.gov.v1.QueryProposalResponse", QueryProposalResponse], - ["/cosmos.gov.v1.QueryDepositRequest", QueryDepositRequest], - ["/cosmos.gov.v1.DecryptedVoteOption", DecryptedVoteOption], ["/cosmos.gov.v1.TrustedCounterParty", TrustedCounterParty], - ["/cosmos.gov.v1.QueryVoteRequest", QueryVoteRequest], - ["/cosmos.gov.v1.QueryDepositResponse", QueryDepositResponse], - ["/cosmos.gov.v1.QueryParamsResponse", QueryParamsResponse], - ["/cosmos.gov.v1.QueryDepositsRequest", QueryDepositsRequest], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], - ["/cosmos.gov.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/cosmos.gov.v1.TallyResult", TallyResult], ["/cosmos.gov.v1.DepositParams", DepositParams], - ["/cosmos.gov.v1.MsgCancelProposalResponse", MsgCancelProposalResponse], + ["/cosmos.gov.v1.VotingParams", VotingParams], + ["/cosmos.gov.v1.DecryptedVoteOption", DecryptedVoteOption], + ["/cosmos.gov.v1.MsgDeposit", MsgDeposit], + ["/cosmos.gov.v1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.gov.v1.QueryProposalsRequest", QueryProposalsRequest], - ["/cosmos.gov.v1.MsgCancelProposal", MsgCancelProposal], - ["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], - ["/cosmos.gov.v1.MsgExecLegacyContentResponse", MsgExecLegacyContentResponse], - ["/cosmos.gov.v1.MsgVoteEncryptedResponse", MsgVoteEncryptedResponse], + ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgVoteWeightedResponse", MsgVoteWeightedResponse], - ["/cosmos.gov.v1.QueryDepositsResponse", QueryDepositsResponse], - ["/cosmos.gov.v1.MsgVoteResponse", MsgVoteResponse], - ["/cosmos.gov.v1.Params", Params], + ["/cosmos.gov.v1.QueryProposalResponse", QueryProposalResponse], + ["/cosmos.gov.v1.QueryDepositRequest", QueryDepositRequest], + ["/cosmos.gov.v1.QueryDepositsRequest", QueryDepositsRequest], + ["/cosmos.gov.v1.MsgVoteEncrypted", MsgVoteEncrypted], + ["/cosmos.gov.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], + ["/cosmos.gov.v1.GenesisState", GenesisState], + ["/cosmos.gov.v1.QueryConstitutionResponse", QueryConstitutionResponse], + ["/cosmos.gov.v1.QueryTallyResultRequest", QueryTallyResultRequest], + ["/cosmos.gov.v1.QueryProposalsResponse", QueryProposalsResponse], ["/cosmos.gov.v1.Deposit", Deposit], - ["/cosmos.gov.v1.Proposal", Proposal], - ["/cosmos.gov.v1.MsgVote", MsgVote], - ["/cosmos.gov.v1.WeightedVoteOption", WeightedVoteOption], + ["/cosmos.gov.v1.QueryVoteRequest", QueryVoteRequest], + ["/cosmos.gov.v1.TallyParams", TallyParams], + ["/cosmos.gov.v1.MsgVoteResponse", MsgVoteResponse], ["/cosmos.gov.v1.QueryProposalRequest", QueryProposalRequest], ["/cosmos.gov.v1.MsgSubmitProposalResponse", MsgSubmitProposalResponse], - ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], + ["/cosmos.gov.v1.QueryParamsResponse", QueryParamsResponse], + ["/cosmos.gov.v1.Params", Params], + ["/cosmos.gov.v1.QueryParamsRequest", QueryParamsRequest], + ["/cosmos.gov.v1.WeightedVoteOption", WeightedVoteOption], ["/cosmos.gov.v1.Vote", Vote], - ["/cosmos.gov.v1.TallyParams", TallyParams], - ["/cosmos.gov.v1.MsgDeposit", MsgDeposit], + ["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], + ["/cosmos.gov.v1.MsgDepositResponse", MsgDepositResponse], + ["/cosmos.gov.v1.MsgCancelProposal", MsgCancelProposal], + ["/cosmos.gov.v1.QueryVotesResponse", QueryVotesResponse], + ["/cosmos.gov.v1.Proposal", Proposal], + ["/cosmos.gov.v1.QueryVoteResponse", QueryVoteResponse], + ["/cosmos.gov.v1.QueryDepositResponse", QueryDepositResponse], + ["/cosmos.gov.v1.QueryDepositsResponse", QueryDepositsResponse], + ["/cosmos.gov.v1.QueryTallyResultResponse", QueryTallyResultResponse], + ["/cosmos.gov.v1.TallyResult", TallyResult], + ["/cosmos.gov.v1.MsgVote", MsgVote], + ["/cosmos.gov.v1.MsgCancelProposalResponse", MsgCancelProposalResponse], + ["/cosmos.gov.v1.QueryVotesRequest", QueryVotesRequest], + ["/cosmos.gov.v1.MsgExecLegacyContentResponse", MsgExecLegacyContentResponse], + ["/cosmos.gov.v1.MsgVoteEncryptedResponse", MsgVoteEncryptedResponse], ]; diff --git a/ts-client/cosmos.gov.v1/types/amino/amino.ts b/ts-client/cosmos.gov.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.gov.v1/types/amino/amino.ts +++ b/ts-client/cosmos.gov.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.gov.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.gov.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.gov.v1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.gov.v1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.gov.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.gov.v1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/cosmos.gov.v1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmos.gov.v1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.gov.v1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.gov.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.gov.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.gov.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.gov.v1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.gov.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.gov.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.gov.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.gov.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.gov.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.gov.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.gov.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.gov.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/pep/params.ts b/ts-client/cosmos.gov.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.gov.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/pep/query.ts b/ts-client/cosmos.gov.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.gov.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/fairyring/pep/tx.ts b/ts-client/cosmos.gov.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/gogoproto/gogo.ts b/ts-client/cosmos.gov.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.gov.v1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.gov.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.gov.v1/types/google/api/annotations.ts b/ts-client/cosmos.gov.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.gov.v1/types/google/api/annotations.ts +++ b/ts-client/cosmos.gov.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.gov.v1/types/google/api/http.ts b/ts-client/cosmos.gov.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.gov.v1/types/google/api/http.ts +++ b/ts-client/cosmos.gov.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.gov.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.gov.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.gov.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/google/protobuf/duration.ts b/ts-client/cosmos.gov.v1/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/cosmos.gov.v1/types/google/protobuf/duration.ts +++ b/ts-client/cosmos.gov.v1/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1/types/route-name.eta b/ts-client/cosmos.gov.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.gov.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.gov.v1beta1/module.ts b/ts-client/cosmos.gov.v1beta1/module.ts index ab2765b3..486a3ac7 100755 --- a/ts-client/cosmos.gov.v1beta1/module.ts +++ b/ts-client/cosmos.gov.v1beta1/module.ts @@ -6,132 +6,132 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { TextProposal } from "./types/cosmos/gov/v1beta1/gov"; -import { MsgSubmitProposalResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgVoteEncryptedResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgVoteWeighted } from "./types/cosmos/gov/v1beta1/tx"; -import { GenesisState } from "./types/cosmos/gov/v1beta1/genesis"; -import { Deposit } from "./types/cosmos/gov/v1beta1/gov"; -import { QueryProposalsResponse } from "./types/cosmos/gov/v1beta1/query"; -import { MsgVote } from "./types/cosmos/gov/v1beta1/tx"; -import { QueryVotesRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryDepositsResponse } from "./types/cosmos/gov/v1beta1/query"; -import { QueryVotesResponse } from "./types/cosmos/gov/v1beta1/query"; -import { QueryTallyResultResponse } from "./types/cosmos/gov/v1beta1/query"; -import { VotingParams } from "./types/cosmos/gov/v1beta1/gov"; -import { TallyResult } from "./types/cosmos/gov/v1beta1/gov"; -import { DepositParams } from "./types/cosmos/gov/v1beta1/gov"; -import { QueryParamsResponse } from "./types/cosmos/gov/v1beta1/query"; -import { QueryTallyResultRequest } from "./types/cosmos/gov/v1beta1/query"; -import { Proposal } from "./types/cosmos/gov/v1beta1/gov"; -import { QueryProposalRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryParamsRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryDepositResponse } from "./types/cosmos/gov/v1beta1/query"; -import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx"; -import { Vote } from "./types/cosmos/gov/v1beta1/gov"; -import { WeightedVoteOption } from "./types/cosmos/gov/v1beta1/gov"; -import { MsgVoteResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgVoteEncrypted } from "./types/cosmos/gov/v1beta1/tx"; -import { QueryDepositRequest } from "./types/cosmos/gov/v1beta1/query"; -import { MsgVoteWeightedResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx"; -import { QueryProposalResponse } from "./types/cosmos/gov/v1beta1/query"; -import { QueryDepositsRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryVoteRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryProposalsRequest } from "./types/cosmos/gov/v1beta1/query"; -import { MsgDepositResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { TallyParams } from "./types/cosmos/gov/v1beta1/gov"; -import { QueryVoteResponse } from "./types/cosmos/gov/v1beta1/query"; - - -export { TextProposal, MsgSubmitProposalResponse, MsgVoteEncryptedResponse, MsgVoteWeighted, GenesisState, Deposit, QueryProposalsResponse, MsgVote, QueryVotesRequest, QueryDepositsResponse, QueryVotesResponse, QueryTallyResultResponse, VotingParams, TallyResult, DepositParams, QueryParamsResponse, QueryTallyResultRequest, Proposal, QueryProposalRequest, QueryParamsRequest, QueryDepositResponse, MsgSubmitProposal, Vote, WeightedVoteOption, MsgVoteResponse, MsgVoteEncrypted, QueryDepositRequest, MsgVoteWeightedResponse, MsgDeposit, QueryProposalResponse, QueryDepositsRequest, QueryVoteRequest, QueryProposalsRequest, MsgDepositResponse, TallyParams, QueryVoteResponse }; +import { QueryDepositRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { VotingParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryProposalRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryProposalsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { MsgVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgVoteEncryptedResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgDeposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { Proposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryVotesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { MsgSubmitProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgVoteWeightedResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { Vote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryProposalsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryVoteRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryDepositsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { MsgSubmitProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { DepositParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryDepositsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryTallyResultResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/genesis"; +import { MsgDepositResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { WeightedVoteOption } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { TallyResult } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryVotesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { TallyParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryTallyResultRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { MsgVote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgVoteEncrypted } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgVoteWeighted } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { TextProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { Deposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryDepositResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; + + +export { QueryDepositRequest, VotingParams, QueryProposalRequest, QueryProposalsResponse, QueryVoteResponse, MsgVoteResponse, MsgVoteEncryptedResponse, MsgDeposit, Proposal, QueryVotesResponse, MsgSubmitProposalResponse, MsgVoteWeightedResponse, Vote, QueryProposalsRequest, QueryVoteRequest, QueryParamsResponse, QueryDepositsRequest, MsgSubmitProposal, DepositParams, QueryDepositsResponse, QueryTallyResultResponse, GenesisState, MsgDepositResponse, WeightedVoteOption, QueryProposalResponse, TallyResult, QueryVotesRequest, TallyParams, QueryTallyResultRequest, MsgVote, MsgVoteEncrypted, MsgVoteWeighted, TextProposal, Deposit, QueryParamsRequest, QueryDepositResponse }; -type sendTextProposalParams = { - value: TextProposal, +type sendQueryDepositRequestParams = { + value: QueryDepositRequest, fee?: StdFee, memo?: string }; -type sendMsgSubmitProposalResponseParams = { - value: MsgSubmitProposalResponse, +type sendVotingParamsParams = { + value: VotingParams, fee?: StdFee, memo?: string }; -type sendMsgVoteEncryptedResponseParams = { - value: MsgVoteEncryptedResponse, +type sendQueryProposalRequestParams = { + value: QueryProposalRequest, fee?: StdFee, memo?: string }; -type sendMsgVoteWeightedParams = { - value: MsgVoteWeighted, +type sendQueryProposalsResponseParams = { + value: QueryProposalsResponse, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryVoteResponseParams = { + value: QueryVoteResponse, fee?: StdFee, memo?: string }; -type sendDepositParams = { - value: Deposit, +type sendMsgVoteResponseParams = { + value: MsgVoteResponse, fee?: StdFee, memo?: string }; -type sendQueryProposalsResponseParams = { - value: QueryProposalsResponse, +type sendMsgVoteEncryptedResponseParams = { + value: MsgVoteEncryptedResponse, fee?: StdFee, memo?: string }; -type sendMsgVoteParams = { - value: MsgVote, +type sendMsgDepositParams = { + value: MsgDeposit, fee?: StdFee, memo?: string }; -type sendQueryVotesRequestParams = { - value: QueryVotesRequest, +type sendProposalParams = { + value: Proposal, fee?: StdFee, memo?: string }; -type sendQueryDepositsResponseParams = { - value: QueryDepositsResponse, +type sendQueryVotesResponseParams = { + value: QueryVotesResponse, fee?: StdFee, memo?: string }; -type sendQueryVotesResponseParams = { - value: QueryVotesResponse, +type sendMsgSubmitProposalResponseParams = { + value: MsgSubmitProposalResponse, fee?: StdFee, memo?: string }; -type sendQueryTallyResultResponseParams = { - value: QueryTallyResultResponse, +type sendMsgVoteWeightedResponseParams = { + value: MsgVoteWeightedResponse, fee?: StdFee, memo?: string }; -type sendVotingParamsParams = { - value: VotingParams, +type sendVoteParams = { + value: Vote, fee?: StdFee, memo?: string }; -type sendTallyResultParams = { - value: TallyResult, +type sendQueryProposalsRequestParams = { + value: QueryProposalsRequest, fee?: StdFee, memo?: string }; -type sendDepositParamsParams = { - value: DepositParams, +type sendQueryVoteRequestParams = { + value: QueryVoteRequest, fee?: StdFee, memo?: string }; @@ -142,44 +142,44 @@ type sendQueryParamsResponseParams = { memo?: string }; -type sendQueryTallyResultRequestParams = { - value: QueryTallyResultRequest, +type sendQueryDepositsRequestParams = { + value: QueryDepositsRequest, fee?: StdFee, memo?: string }; -type sendProposalParams = { - value: Proposal, +type sendMsgSubmitProposalParams = { + value: MsgSubmitProposal, fee?: StdFee, memo?: string }; -type sendQueryProposalRequestParams = { - value: QueryProposalRequest, +type sendDepositParamsParams = { + value: DepositParams, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendQueryDepositsResponseParams = { + value: QueryDepositsResponse, fee?: StdFee, memo?: string }; -type sendQueryDepositResponseParams = { - value: QueryDepositResponse, +type sendQueryTallyResultResponseParams = { + value: QueryTallyResultResponse, fee?: StdFee, memo?: string }; -type sendMsgSubmitProposalParams = { - value: MsgSubmitProposal, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendVoteParams = { - value: Vote, +type sendMsgDepositResponseParams = { + value: MsgDepositResponse, fee?: StdFee, memo?: string }; @@ -190,221 +190,221 @@ type sendWeightedVoteOptionParams = { memo?: string }; -type sendMsgVoteResponseParams = { - value: MsgVoteResponse, +type sendQueryProposalResponseParams = { + value: QueryProposalResponse, fee?: StdFee, memo?: string }; -type sendMsgVoteEncryptedParams = { - value: MsgVoteEncrypted, +type sendTallyResultParams = { + value: TallyResult, fee?: StdFee, memo?: string }; -type sendQueryDepositRequestParams = { - value: QueryDepositRequest, +type sendQueryVotesRequestParams = { + value: QueryVotesRequest, fee?: StdFee, memo?: string }; -type sendMsgVoteWeightedResponseParams = { - value: MsgVoteWeightedResponse, +type sendTallyParamsParams = { + value: TallyParams, fee?: StdFee, memo?: string }; -type sendMsgDepositParams = { - value: MsgDeposit, +type sendQueryTallyResultRequestParams = { + value: QueryTallyResultRequest, fee?: StdFee, memo?: string }; -type sendQueryProposalResponseParams = { - value: QueryProposalResponse, +type sendMsgVoteParams = { + value: MsgVote, fee?: StdFee, memo?: string }; -type sendQueryDepositsRequestParams = { - value: QueryDepositsRequest, +type sendMsgVoteEncryptedParams = { + value: MsgVoteEncrypted, fee?: StdFee, memo?: string }; -type sendQueryVoteRequestParams = { - value: QueryVoteRequest, +type sendMsgVoteWeightedParams = { + value: MsgVoteWeighted, fee?: StdFee, memo?: string }; -type sendQueryProposalsRequestParams = { - value: QueryProposalsRequest, +type sendTextProposalParams = { + value: TextProposal, fee?: StdFee, memo?: string }; -type sendMsgDepositResponseParams = { - value: MsgDepositResponse, +type sendDepositParams = { + value: Deposit, fee?: StdFee, memo?: string }; -type sendTallyParamsParams = { - value: TallyParams, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendQueryVoteResponseParams = { - value: QueryVoteResponse, +type sendQueryDepositResponseParams = { + value: QueryDepositResponse, fee?: StdFee, memo?: string }; -type textProposalParams = { - value: TextProposal, -}; - -type msgSubmitProposalResponseParams = { - value: MsgSubmitProposalResponse, +type queryDepositRequestParams = { + value: QueryDepositRequest, }; -type msgVoteEncryptedResponseParams = { - value: MsgVoteEncryptedResponse, +type votingParamsParams = { + value: VotingParams, }; -type msgVoteWeightedParams = { - value: MsgVoteWeighted, +type queryProposalRequestParams = { + value: QueryProposalRequest, }; -type genesisStateParams = { - value: GenesisState, +type queryProposalsResponseParams = { + value: QueryProposalsResponse, }; -type depositParams = { - value: Deposit, +type queryVoteResponseParams = { + value: QueryVoteResponse, }; -type queryProposalsResponseParams = { - value: QueryProposalsResponse, +type msgVoteResponseParams = { + value: MsgVoteResponse, }; -type msgVoteParams = { - value: MsgVote, +type msgVoteEncryptedResponseParams = { + value: MsgVoteEncryptedResponse, }; -type queryVotesRequestParams = { - value: QueryVotesRequest, +type msgDepositParams = { + value: MsgDeposit, }; -type queryDepositsResponseParams = { - value: QueryDepositsResponse, +type proposalParams = { + value: Proposal, }; type queryVotesResponseParams = { value: QueryVotesResponse, }; -type queryTallyResultResponseParams = { - value: QueryTallyResultResponse, +type msgSubmitProposalResponseParams = { + value: MsgSubmitProposalResponse, }; -type votingParamsParams = { - value: VotingParams, +type msgVoteWeightedResponseParams = { + value: MsgVoteWeightedResponse, }; -type tallyResultParams = { - value: TallyResult, +type voteParams = { + value: Vote, }; -type depositParamsParams = { - value: DepositParams, +type queryProposalsRequestParams = { + value: QueryProposalsRequest, +}; + +type queryVoteRequestParams = { + value: QueryVoteRequest, }; type queryParamsResponseParams = { value: QueryParamsResponse, }; -type queryTallyResultRequestParams = { - value: QueryTallyResultRequest, +type queryDepositsRequestParams = { + value: QueryDepositsRequest, }; -type proposalParams = { - value: Proposal, +type msgSubmitProposalParams = { + value: MsgSubmitProposal, }; -type queryProposalRequestParams = { - value: QueryProposalRequest, +type depositParamsParams = { + value: DepositParams, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type queryDepositsResponseParams = { + value: QueryDepositsResponse, }; -type queryDepositResponseParams = { - value: QueryDepositResponse, +type queryTallyResultResponseParams = { + value: QueryTallyResultResponse, }; -type msgSubmitProposalParams = { - value: MsgSubmitProposal, +type genesisStateParams = { + value: GenesisState, }; -type voteParams = { - value: Vote, +type msgDepositResponseParams = { + value: MsgDepositResponse, }; type weightedVoteOptionParams = { value: WeightedVoteOption, }; -type msgVoteResponseParams = { - value: MsgVoteResponse, +type queryProposalResponseParams = { + value: QueryProposalResponse, }; -type msgVoteEncryptedParams = { - value: MsgVoteEncrypted, +type tallyResultParams = { + value: TallyResult, }; -type queryDepositRequestParams = { - value: QueryDepositRequest, +type queryVotesRequestParams = { + value: QueryVotesRequest, }; -type msgVoteWeightedResponseParams = { - value: MsgVoteWeightedResponse, +type tallyParamsParams = { + value: TallyParams, }; -type msgDepositParams = { - value: MsgDeposit, +type queryTallyResultRequestParams = { + value: QueryTallyResultRequest, }; -type queryProposalResponseParams = { - value: QueryProposalResponse, +type msgVoteParams = { + value: MsgVote, }; -type queryDepositsRequestParams = { - value: QueryDepositsRequest, +type msgVoteEncryptedParams = { + value: MsgVoteEncrypted, }; -type queryVoteRequestParams = { - value: QueryVoteRequest, +type msgVoteWeightedParams = { + value: MsgVoteWeighted, }; -type queryProposalsRequestParams = { - value: QueryProposalsRequest, +type textProposalParams = { + value: TextProposal, }; -type msgDepositResponseParams = { - value: MsgDepositResponse, +type depositParams = { + value: Deposit, }; -type tallyParamsParams = { - value: TallyParams, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; -type queryVoteResponseParams = { - value: QueryVoteResponse, +type queryDepositResponseParams = { + value: QueryDepositResponse, }; @@ -437,213 +437,213 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendTextProposal({ value, fee, memo }: sendTextProposalParams): Promise { + async sendQueryDepositRequest({ value, fee, memo }: sendQueryDepositRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTextProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDepositRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.textProposal({ value: TextProposal.fromPartial(value) }) + let msg = this.queryDepositRequest({ value: QueryDepositRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTextProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDepositRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitProposalResponse({ value, fee, memo }: sendMsgSubmitProposalResponseParams): Promise { + async sendVotingParams({ value, fee, memo }: sendVotingParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitProposalResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendVotingParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitProposalResponse({ value: MsgSubmitProposalResponse.fromPartial(value) }) + let msg = this.votingParams({ value: VotingParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitProposalResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendVotingParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteEncryptedResponse({ value, fee, memo }: sendMsgVoteEncryptedResponseParams): Promise { + async sendQueryProposalRequest({ value, fee, memo }: sendQueryProposalRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteEncryptedResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteEncryptedResponse({ value: MsgVoteEncryptedResponse.fromPartial(value) }) + let msg = this.queryProposalRequest({ value: QueryProposalRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteEncryptedResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteWeighted({ value, fee, memo }: sendMsgVoteWeightedParams): Promise { + async sendQueryProposalsResponse({ value, fee, memo }: sendQueryProposalsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteWeighted: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteWeighted({ value: MsgVoteWeighted.fromPartial(value) }) + let msg = this.queryProposalsResponse({ value: QueryProposalsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteWeighted: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryVoteResponse({ value, fee, memo }: sendQueryVoteResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVoteResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryVoteResponse({ value: QueryVoteResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVoteResponse: Could not broadcast Tx: '+ e.message) } }, - async sendDeposit({ value, fee, memo }: sendDepositParams): Promise { + async sendMsgVoteResponse({ value, fee, memo }: sendMsgVoteResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendDeposit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.deposit({ value: Deposit.fromPartial(value) }) + let msg = this.msgVoteResponse({ value: MsgVoteResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDeposit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalsResponse({ value, fee, memo }: sendQueryProposalsResponseParams): Promise { + async sendMsgVoteEncryptedResponse({ value, fee, memo }: sendMsgVoteEncryptedResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteEncryptedResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalsResponse({ value: QueryProposalsResponse.fromPartial(value) }) + let msg = this.msgVoteEncryptedResponse({ value: MsgVoteEncryptedResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteEncryptedResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVote({ value, fee, memo }: sendMsgVoteParams): Promise { + async sendMsgDeposit({ value, fee, memo }: sendMsgDepositParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDeposit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVote({ value: MsgVote.fromPartial(value) }) + let msg = this.msgDeposit({ value: MsgDeposit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDeposit: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVotesRequest({ value, fee, memo }: sendQueryVotesRequestParams): Promise { + async sendProposal({ value, fee, memo }: sendProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVotesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVotesRequest({ value: QueryVotesRequest.fromPartial(value) }) + let msg = this.proposal({ value: Proposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVotesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendProposal: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDepositsResponse({ value, fee, memo }: sendQueryDepositsResponseParams): Promise { + async sendQueryVotesResponse({ value, fee, memo }: sendQueryVotesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDepositsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVotesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDepositsResponse({ value: QueryDepositsResponse.fromPartial(value) }) + let msg = this.queryVotesResponse({ value: QueryVotesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDepositsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVotesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVotesResponse({ value, fee, memo }: sendQueryVotesResponseParams): Promise { + async sendMsgSubmitProposalResponse({ value, fee, memo }: sendMsgSubmitProposalResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVotesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitProposalResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVotesResponse({ value: QueryVotesResponse.fromPartial(value) }) + let msg = this.msgSubmitProposalResponse({ value: MsgSubmitProposalResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVotesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitProposalResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTallyResultResponse({ value, fee, memo }: sendQueryTallyResultResponseParams): Promise { + async sendMsgVoteWeightedResponse({ value, fee, memo }: sendMsgVoteWeightedResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTallyResultResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteWeightedResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTallyResultResponse({ value: QueryTallyResultResponse.fromPartial(value) }) + let msg = this.msgVoteWeightedResponse({ value: MsgVoteWeightedResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTallyResultResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteWeightedResponse: Could not broadcast Tx: '+ e.message) } }, - async sendVotingParams({ value, fee, memo }: sendVotingParamsParams): Promise { + async sendVote({ value, fee, memo }: sendVoteParams): Promise { if (!signer) { - throw new Error('TxClient:sendVotingParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendVote: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.votingParams({ value: VotingParams.fromPartial(value) }) + let msg = this.vote({ value: Vote.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendVotingParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendVote: Could not broadcast Tx: '+ e.message) } }, - async sendTallyResult({ value, fee, memo }: sendTallyResultParams): Promise { + async sendQueryProposalsRequest({ value, fee, memo }: sendQueryProposalsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTallyResult: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.tallyResult({ value: TallyResult.fromPartial(value) }) + let msg = this.queryProposalsRequest({ value: QueryProposalsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTallyResult: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendDepositParams({ value, fee, memo }: sendDepositParamsParams): Promise { + async sendQueryVoteRequest({ value, fee, memo }: sendQueryVoteRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendDepositParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVoteRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.depositParams({ value: DepositParams.fromPartial(value) }) + let msg = this.queryVoteRequest({ value: QueryVoteRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDepositParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVoteRequest: Could not broadcast Tx: '+ e.message) } }, @@ -661,101 +661,101 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryTallyResultRequest({ value, fee, memo }: sendQueryTallyResultRequestParams): Promise { + async sendQueryDepositsRequest({ value, fee, memo }: sendQueryDepositsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTallyResultRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDepositsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTallyResultRequest({ value: QueryTallyResultRequest.fromPartial(value) }) + let msg = this.queryDepositsRequest({ value: QueryDepositsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTallyResultRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDepositsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendProposal({ value, fee, memo }: sendProposalParams): Promise { + async sendMsgSubmitProposal({ value, fee, memo }: sendMsgSubmitProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.proposal({ value: Proposal.fromPartial(value) }) + let msg = this.msgSubmitProposal({ value: MsgSubmitProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitProposal: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalRequest({ value, fee, memo }: sendQueryProposalRequestParams): Promise { + async sendDepositParams({ value, fee, memo }: sendDepositParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDepositParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalRequest({ value: QueryProposalRequest.fromPartial(value) }) + let msg = this.depositParams({ value: DepositParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDepositParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendQueryDepositsResponse({ value, fee, memo }: sendQueryDepositsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDepositsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.queryDepositsResponse({ value: QueryDepositsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDepositsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDepositResponse({ value, fee, memo }: sendQueryDepositResponseParams): Promise { + async sendQueryTallyResultResponse({ value, fee, memo }: sendQueryTallyResultResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDepositResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTallyResultResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDepositResponse({ value: QueryDepositResponse.fromPartial(value) }) + let msg = this.queryTallyResultResponse({ value: QueryTallyResultResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDepositResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTallyResultResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitProposal({ value, fee, memo }: sendMsgSubmitProposalParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitProposal({ value: MsgSubmitProposal.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendVote({ value, fee, memo }: sendVoteParams): Promise { + async sendMsgDepositResponse({ value, fee, memo }: sendMsgDepositResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendVote: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDepositResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.vote({ value: Vote.fromPartial(value) }) + let msg = this.msgDepositResponse({ value: MsgDepositResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendVote: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDepositResponse: Could not broadcast Tx: '+ e.message) } }, @@ -773,292 +773,292 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgVoteResponse({ value, fee, memo }: sendMsgVoteResponseParams): Promise { + async sendQueryProposalResponse({ value, fee, memo }: sendQueryProposalResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteResponse({ value: MsgVoteResponse.fromPartial(value) }) + let msg = this.queryProposalResponse({ value: QueryProposalResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteEncrypted({ value, fee, memo }: sendMsgVoteEncryptedParams): Promise { + async sendTallyResult({ value, fee, memo }: sendTallyResultParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteEncrypted: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTallyResult: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteEncrypted({ value: MsgVoteEncrypted.fromPartial(value) }) + let msg = this.tallyResult({ value: TallyResult.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteEncrypted: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTallyResult: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDepositRequest({ value, fee, memo }: sendQueryDepositRequestParams): Promise { + async sendQueryVotesRequest({ value, fee, memo }: sendQueryVotesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDepositRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVotesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDepositRequest({ value: QueryDepositRequest.fromPartial(value) }) + let msg = this.queryVotesRequest({ value: QueryVotesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDepositRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVotesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteWeightedResponse({ value, fee, memo }: sendMsgVoteWeightedResponseParams): Promise { + async sendTallyParams({ value, fee, memo }: sendTallyParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteWeightedResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTallyParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteWeightedResponse({ value: MsgVoteWeightedResponse.fromPartial(value) }) + let msg = this.tallyParams({ value: TallyParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteWeightedResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTallyParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDeposit({ value, fee, memo }: sendMsgDepositParams): Promise { + async sendQueryTallyResultRequest({ value, fee, memo }: sendQueryTallyResultRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDeposit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTallyResultRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDeposit({ value: MsgDeposit.fromPartial(value) }) + let msg = this.queryTallyResultRequest({ value: QueryTallyResultRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDeposit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTallyResultRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalResponse({ value, fee, memo }: sendQueryProposalResponseParams): Promise { + async sendMsgVote({ value, fee, memo }: sendMsgVoteParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalResponse({ value: QueryProposalResponse.fromPartial(value) }) + let msg = this.msgVote({ value: MsgVote.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDepositsRequest({ value, fee, memo }: sendQueryDepositsRequestParams): Promise { + async sendMsgVoteEncrypted({ value, fee, memo }: sendMsgVoteEncryptedParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDepositsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteEncrypted: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDepositsRequest({ value: QueryDepositsRequest.fromPartial(value) }) + let msg = this.msgVoteEncrypted({ value: MsgVoteEncrypted.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDepositsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteEncrypted: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVoteRequest({ value, fee, memo }: sendQueryVoteRequestParams): Promise { + async sendMsgVoteWeighted({ value, fee, memo }: sendMsgVoteWeightedParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVoteRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteWeighted: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVoteRequest({ value: QueryVoteRequest.fromPartial(value) }) + let msg = this.msgVoteWeighted({ value: MsgVoteWeighted.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVoteRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteWeighted: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalsRequest({ value, fee, memo }: sendQueryProposalsRequestParams): Promise { + async sendTextProposal({ value, fee, memo }: sendTextProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTextProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalsRequest({ value: QueryProposalsRequest.fromPartial(value) }) + let msg = this.textProposal({ value: TextProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTextProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDepositResponse({ value, fee, memo }: sendMsgDepositResponseParams): Promise { + async sendDeposit({ value, fee, memo }: sendDepositParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDepositResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDeposit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDepositResponse({ value: MsgDepositResponse.fromPartial(value) }) + let msg = this.deposit({ value: Deposit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDepositResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDeposit: Could not broadcast Tx: '+ e.message) } }, - async sendTallyParams({ value, fee, memo }: sendTallyParamsParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTallyParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.tallyParams({ value: TallyParams.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTallyParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVoteResponse({ value, fee, memo }: sendQueryVoteResponseParams): Promise { + async sendQueryDepositResponse({ value, fee, memo }: sendQueryDepositResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVoteResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDepositResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVoteResponse({ value: QueryVoteResponse.fromPartial(value) }) + let msg = this.queryDepositResponse({ value: QueryDepositResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVoteResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDepositResponse: Could not broadcast Tx: '+ e.message) } }, - textProposal({ value }: textProposalParams): EncodeObject { + queryDepositRequest({ value }: queryDepositRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.TextProposal", value: TextProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", value: QueryDepositRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TextProposal: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDepositRequest: Could not create message: ' + e.message) } }, - msgSubmitProposalResponse({ value }: msgSubmitProposalResponseParams): EncodeObject { + votingParams({ value }: votingParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.VotingParams", value: VotingParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitProposalResponse: Could not create message: ' + e.message) + throw new Error('TxClient:VotingParams: Could not create message: ' + e.message) } }, - msgVoteEncryptedResponse({ value }: msgVoteEncryptedResponseParams): EncodeObject { + queryProposalRequest({ value }: queryProposalRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteEncryptedResponse", value: MsgVoteEncryptedResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", value: QueryProposalRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteEncryptedResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalRequest: Could not create message: ' + e.message) } }, - msgVoteWeighted({ value }: msgVoteWeightedParams): EncodeObject { + queryProposalsResponse({ value }: queryProposalsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", value: QueryProposalsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteWeighted: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalsResponse: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryVoteResponse({ value }: queryVoteResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", value: QueryVoteResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVoteResponse: Could not create message: ' + e.message) } }, - deposit({ value }: depositParams): EncodeObject { + msgVoteResponse({ value }: msgVoteResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.Deposit", value: Deposit.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", value: MsgVoteResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Deposit: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteResponse: Could not create message: ' + e.message) } }, - queryProposalsResponse({ value }: queryProposalsResponseParams): EncodeObject { + msgVoteEncryptedResponse({ value }: msgVoteEncryptedResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", value: QueryProposalsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteEncryptedResponse", value: MsgVoteEncryptedResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteEncryptedResponse: Could not create message: ' + e.message) } }, - msgVote({ value }: msgVoteParams): EncodeObject { + msgDeposit({ value }: msgDepositParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: MsgDeposit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVote: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDeposit: Could not create message: ' + e.message) } }, - queryVotesRequest({ value }: queryVotesRequestParams): EncodeObject { + proposal({ value }: proposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", value: QueryVotesRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.Proposal", value: Proposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVotesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Proposal: Could not create message: ' + e.message) } }, - queryDepositsResponse({ value }: queryDepositsResponseParams): EncodeObject { + queryVotesResponse({ value }: queryVotesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", value: QueryDepositsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", value: QueryVotesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDepositsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVotesResponse: Could not create message: ' + e.message) } }, - queryVotesResponse({ value }: queryVotesResponseParams): EncodeObject { + msgSubmitProposalResponse({ value }: msgSubmitProposalResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", value: QueryVotesResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVotesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitProposalResponse: Could not create message: ' + e.message) } }, - queryTallyResultResponse({ value }: queryTallyResultResponseParams): EncodeObject { + msgVoteWeightedResponse({ value }: msgVoteWeightedResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", value: QueryTallyResultResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", value: MsgVoteWeightedResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTallyResultResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteWeightedResponse: Could not create message: ' + e.message) } }, - votingParams({ value }: votingParamsParams): EncodeObject { + vote({ value }: voteParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.VotingParams", value: VotingParams.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.Vote", value: Vote.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:VotingParams: Could not create message: ' + e.message) + throw new Error('TxClient:Vote: Could not create message: ' + e.message) } }, - tallyResult({ value }: tallyResultParams): EncodeObject { + queryProposalsRequest({ value }: queryProposalsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.TallyResult", value: TallyResult.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", value: QueryProposalsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TallyResult: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalsRequest: Could not create message: ' + e.message) } }, - depositParams({ value }: depositParamsParams): EncodeObject { + queryVoteRequest({ value }: queryVoteRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.DepositParams", value: DepositParams.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", value: QueryVoteRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DepositParams: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVoteRequest: Could not create message: ' + e.message) } }, @@ -1070,59 +1070,59 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryTallyResultRequest({ value }: queryTallyResultRequestParams): EncodeObject { + queryDepositsRequest({ value }: queryDepositsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", value: QueryTallyResultRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", value: QueryDepositsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTallyResultRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDepositsRequest: Could not create message: ' + e.message) } }, - proposal({ value }: proposalParams): EncodeObject { + msgSubmitProposal({ value }: msgSubmitProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.Proposal", value: Proposal.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Proposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitProposal: Could not create message: ' + e.message) } }, - queryProposalRequest({ value }: queryProposalRequestParams): EncodeObject { + depositParams({ value }: depositParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", value: QueryProposalRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.DepositParams", value: DepositParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalRequest: Could not create message: ' + e.message) + throw new Error('TxClient:DepositParams: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + queryDepositsResponse({ value }: queryDepositsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", value: QueryDepositsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDepositsResponse: Could not create message: ' + e.message) } }, - queryDepositResponse({ value }: queryDepositResponseParams): EncodeObject { + queryTallyResultResponse({ value }: queryTallyResultResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", value: QueryDepositResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", value: QueryTallyResultResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDepositResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTallyResultResponse: Could not create message: ' + e.message) } }, - msgSubmitProposal({ value }: msgSubmitProposalParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitProposal: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - vote({ value }: voteParams): EncodeObject { + msgDepositResponse({ value }: msgDepositResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.Vote", value: Vote.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", value: MsgDepositResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Vote: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDepositResponse: Could not create message: ' + e.message) } }, @@ -1134,99 +1134,99 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgVoteResponse({ value }: msgVoteResponseParams): EncodeObject { + queryProposalResponse({ value }: queryProposalResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", value: MsgVoteResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", value: QueryProposalResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalResponse: Could not create message: ' + e.message) } }, - msgVoteEncrypted({ value }: msgVoteEncryptedParams): EncodeObject { + tallyResult({ value }: tallyResultParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteEncrypted", value: MsgVoteEncrypted.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.TallyResult", value: TallyResult.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteEncrypted: Could not create message: ' + e.message) + throw new Error('TxClient:TallyResult: Could not create message: ' + e.message) } }, - queryDepositRequest({ value }: queryDepositRequestParams): EncodeObject { + queryVotesRequest({ value }: queryVotesRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", value: QueryDepositRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", value: QueryVotesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDepositRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVotesRequest: Could not create message: ' + e.message) } }, - msgVoteWeightedResponse({ value }: msgVoteWeightedResponseParams): EncodeObject { + tallyParams({ value }: tallyParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", value: MsgVoteWeightedResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.TallyParams", value: TallyParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteWeightedResponse: Could not create message: ' + e.message) + throw new Error('TxClient:TallyParams: Could not create message: ' + e.message) } }, - msgDeposit({ value }: msgDepositParams): EncodeObject { + queryTallyResultRequest({ value }: queryTallyResultRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: MsgDeposit.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", value: QueryTallyResultRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDeposit: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTallyResultRequest: Could not create message: ' + e.message) } }, - queryProposalResponse({ value }: queryProposalResponseParams): EncodeObject { + msgVote({ value }: msgVoteParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", value: QueryProposalResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVote: Could not create message: ' + e.message) } }, - queryDepositsRequest({ value }: queryDepositsRequestParams): EncodeObject { + msgVoteEncrypted({ value }: msgVoteEncryptedParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", value: QueryDepositsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteEncrypted", value: MsgVoteEncrypted.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDepositsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteEncrypted: Could not create message: ' + e.message) } }, - queryVoteRequest({ value }: queryVoteRequestParams): EncodeObject { + msgVoteWeighted({ value }: msgVoteWeightedParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", value: QueryVoteRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVoteRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteWeighted: Could not create message: ' + e.message) } }, - queryProposalsRequest({ value }: queryProposalsRequestParams): EncodeObject { + textProposal({ value }: textProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", value: QueryProposalsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.TextProposal", value: TextProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:TextProposal: Could not create message: ' + e.message) } }, - msgDepositResponse({ value }: msgDepositResponseParams): EncodeObject { + deposit({ value }: depositParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", value: MsgDepositResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.Deposit", value: Deposit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDepositResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Deposit: Could not create message: ' + e.message) } }, - tallyParams({ value }: tallyParamsParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.TallyParams", value: TallyParams.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TallyParams: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - queryVoteResponse({ value }: queryVoteResponseParams): EncodeObject { + queryDepositResponse({ value }: queryDepositResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", value: QueryVoteResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", value: QueryDepositResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVoteResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDepositResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.gov.v1beta1/registry.ts b/ts-client/cosmos.gov.v1beta1/registry.ts index e05f2c63..d0b86e78 100755 --- a/ts-client/cosmos.gov.v1beta1/registry.ts +++ b/ts-client/cosmos.gov.v1beta1/registry.ts @@ -1,78 +1,78 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { TextProposal } from "./types/cosmos/gov/v1beta1/gov"; -import { MsgSubmitProposalResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgVoteEncryptedResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgVoteWeighted } from "./types/cosmos/gov/v1beta1/tx"; -import { GenesisState } from "./types/cosmos/gov/v1beta1/genesis"; -import { Deposit } from "./types/cosmos/gov/v1beta1/gov"; -import { QueryProposalsResponse } from "./types/cosmos/gov/v1beta1/query"; -import { MsgVote } from "./types/cosmos/gov/v1beta1/tx"; -import { QueryVotesRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryDepositsResponse } from "./types/cosmos/gov/v1beta1/query"; -import { QueryVotesResponse } from "./types/cosmos/gov/v1beta1/query"; -import { QueryTallyResultResponse } from "./types/cosmos/gov/v1beta1/query"; -import { VotingParams } from "./types/cosmos/gov/v1beta1/gov"; -import { TallyResult } from "./types/cosmos/gov/v1beta1/gov"; -import { DepositParams } from "./types/cosmos/gov/v1beta1/gov"; -import { QueryParamsResponse } from "./types/cosmos/gov/v1beta1/query"; -import { QueryTallyResultRequest } from "./types/cosmos/gov/v1beta1/query"; -import { Proposal } from "./types/cosmos/gov/v1beta1/gov"; -import { QueryProposalRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryParamsRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryDepositResponse } from "./types/cosmos/gov/v1beta1/query"; -import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx"; -import { Vote } from "./types/cosmos/gov/v1beta1/gov"; -import { WeightedVoteOption } from "./types/cosmos/gov/v1beta1/gov"; -import { MsgVoteResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgVoteEncrypted } from "./types/cosmos/gov/v1beta1/tx"; -import { QueryDepositRequest } from "./types/cosmos/gov/v1beta1/query"; -import { MsgVoteWeightedResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx"; -import { QueryProposalResponse } from "./types/cosmos/gov/v1beta1/query"; -import { QueryDepositsRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryVoteRequest } from "./types/cosmos/gov/v1beta1/query"; -import { QueryProposalsRequest } from "./types/cosmos/gov/v1beta1/query"; -import { MsgDepositResponse } from "./types/cosmos/gov/v1beta1/tx"; -import { TallyParams } from "./types/cosmos/gov/v1beta1/gov"; -import { QueryVoteResponse } from "./types/cosmos/gov/v1beta1/query"; +import { QueryDepositRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { VotingParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryProposalRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryProposalsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { MsgVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgVoteEncryptedResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgDeposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { Proposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryVotesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { MsgSubmitProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgVoteWeightedResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { Vote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryProposalsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryVoteRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryDepositsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { MsgSubmitProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { DepositParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryDepositsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryTallyResultResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/genesis"; +import { MsgDepositResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { WeightedVoteOption } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { TallyResult } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryVotesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { TallyParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryTallyResultRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { MsgVote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgVoteEncrypted } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { MsgVoteWeighted } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/tx"; +import { TextProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { Deposit } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/gov"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; +import { QueryDepositResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/gov/v1beta1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.gov.v1beta1.TextProposal", TextProposal], - ["/cosmos.gov.v1beta1.MsgSubmitProposalResponse", MsgSubmitProposalResponse], - ["/cosmos.gov.v1beta1.MsgVoteEncryptedResponse", MsgVoteEncryptedResponse], - ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], - ["/cosmos.gov.v1beta1.GenesisState", GenesisState], - ["/cosmos.gov.v1beta1.Deposit", Deposit], - ["/cosmos.gov.v1beta1.QueryProposalsResponse", QueryProposalsResponse], - ["/cosmos.gov.v1beta1.MsgVote", MsgVote], - ["/cosmos.gov.v1beta1.QueryVotesRequest", QueryVotesRequest], - ["/cosmos.gov.v1beta1.QueryDepositsResponse", QueryDepositsResponse], - ["/cosmos.gov.v1beta1.QueryVotesResponse", QueryVotesResponse], - ["/cosmos.gov.v1beta1.QueryTallyResultResponse", QueryTallyResultResponse], + ["/cosmos.gov.v1beta1.QueryDepositRequest", QueryDepositRequest], ["/cosmos.gov.v1beta1.VotingParams", VotingParams], - ["/cosmos.gov.v1beta1.TallyResult", TallyResult], - ["/cosmos.gov.v1beta1.DepositParams", DepositParams], - ["/cosmos.gov.v1beta1.QueryParamsResponse", QueryParamsResponse], - ["/cosmos.gov.v1beta1.QueryTallyResultRequest", QueryTallyResultRequest], - ["/cosmos.gov.v1beta1.Proposal", Proposal], ["/cosmos.gov.v1beta1.QueryProposalRequest", QueryProposalRequest], - ["/cosmos.gov.v1beta1.QueryParamsRequest", QueryParamsRequest], - ["/cosmos.gov.v1beta1.QueryDepositResponse", QueryDepositResponse], - ["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], - ["/cosmos.gov.v1beta1.Vote", Vote], - ["/cosmos.gov.v1beta1.WeightedVoteOption", WeightedVoteOption], + ["/cosmos.gov.v1beta1.QueryProposalsResponse", QueryProposalsResponse], + ["/cosmos.gov.v1beta1.QueryVoteResponse", QueryVoteResponse], ["/cosmos.gov.v1beta1.MsgVoteResponse", MsgVoteResponse], - ["/cosmos.gov.v1beta1.MsgVoteEncrypted", MsgVoteEncrypted], - ["/cosmos.gov.v1beta1.QueryDepositRequest", QueryDepositRequest], - ["/cosmos.gov.v1beta1.MsgVoteWeightedResponse", MsgVoteWeightedResponse], + ["/cosmos.gov.v1beta1.MsgVoteEncryptedResponse", MsgVoteEncryptedResponse], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit], - ["/cosmos.gov.v1beta1.QueryProposalResponse", QueryProposalResponse], - ["/cosmos.gov.v1beta1.QueryDepositsRequest", QueryDepositsRequest], - ["/cosmos.gov.v1beta1.QueryVoteRequest", QueryVoteRequest], + ["/cosmos.gov.v1beta1.Proposal", Proposal], + ["/cosmos.gov.v1beta1.QueryVotesResponse", QueryVotesResponse], + ["/cosmos.gov.v1beta1.MsgSubmitProposalResponse", MsgSubmitProposalResponse], + ["/cosmos.gov.v1beta1.MsgVoteWeightedResponse", MsgVoteWeightedResponse], + ["/cosmos.gov.v1beta1.Vote", Vote], ["/cosmos.gov.v1beta1.QueryProposalsRequest", QueryProposalsRequest], + ["/cosmos.gov.v1beta1.QueryVoteRequest", QueryVoteRequest], + ["/cosmos.gov.v1beta1.QueryParamsResponse", QueryParamsResponse], + ["/cosmos.gov.v1beta1.QueryDepositsRequest", QueryDepositsRequest], + ["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], + ["/cosmos.gov.v1beta1.DepositParams", DepositParams], + ["/cosmos.gov.v1beta1.QueryDepositsResponse", QueryDepositsResponse], + ["/cosmos.gov.v1beta1.QueryTallyResultResponse", QueryTallyResultResponse], + ["/cosmos.gov.v1beta1.GenesisState", GenesisState], ["/cosmos.gov.v1beta1.MsgDepositResponse", MsgDepositResponse], + ["/cosmos.gov.v1beta1.WeightedVoteOption", WeightedVoteOption], + ["/cosmos.gov.v1beta1.QueryProposalResponse", QueryProposalResponse], + ["/cosmos.gov.v1beta1.TallyResult", TallyResult], + ["/cosmos.gov.v1beta1.QueryVotesRequest", QueryVotesRequest], ["/cosmos.gov.v1beta1.TallyParams", TallyParams], - ["/cosmos.gov.v1beta1.QueryVoteResponse", QueryVoteResponse], + ["/cosmos.gov.v1beta1.QueryTallyResultRequest", QueryTallyResultRequest], + ["/cosmos.gov.v1beta1.MsgVote", MsgVote], + ["/cosmos.gov.v1beta1.MsgVoteEncrypted", MsgVoteEncrypted], + ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], + ["/cosmos.gov.v1beta1.TextProposal", TextProposal], + ["/cosmos.gov.v1beta1.Deposit", Deposit], + ["/cosmos.gov.v1beta1.QueryParamsRequest", QueryParamsRequest], + ["/cosmos.gov.v1beta1.QueryDepositResponse", QueryDepositResponse], ]; diff --git a/ts-client/cosmos.gov.v1beta1/types/amino/amino.ts b/ts-client/cosmos.gov.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.gov.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.gov.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.gov.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.gov.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.gov.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.gov.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.gov.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.gov.v1beta1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/cosmos.gov.v1beta1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmos.gov.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.gov.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.gov.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.gov.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.gov.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.gov.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.gov.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.gov.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.gov.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.gov.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.gov.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.gov.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.gov.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.gov.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.gov.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.gov.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.gov.v1beta1/types/google/api/http.ts b/ts-client/cosmos.gov.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.gov.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.gov.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.gov.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.gov.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.gov.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.gov.v1beta1/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/cosmos.gov.v1beta1/types/google/protobuf/duration.ts +++ b/ts-client/cosmos.gov.v1beta1/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.gov.v1beta1/types/route-name.eta b/ts-client/cosmos.gov.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.gov.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.group.v1/module.ts b/ts-client/cosmos.group.v1/module.ts index 5b184124..950a38b8 100755 --- a/ts-client/cosmos.group.v1/module.ts +++ b/ts-client/cosmos.group.v1/module.ts @@ -6,132 +6,126 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { QueryGroupMembersResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupPolicyAdminResponse } from "./types/cosmos/group/v1/tx"; -import { MsgWithdrawProposalResponse } from "./types/cosmos/group/v1/tx"; -import { QueryGroupInfoRequest } from "./types/cosmos/group/v1/query"; -import { QueryGroupsByAdminResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupMembersResponse } from "./types/cosmos/group/v1/tx"; -import { EventCreateGroup } from "./types/cosmos/group/v1/events"; -import { MsgUpdateGroupMetadataResponse } from "./types/cosmos/group/v1/tx"; -import { EventUpdateGroup } from "./types/cosmos/group/v1/events"; -import { Member } from "./types/cosmos/group/v1/types"; -import { GroupMember } from "./types/cosmos/group/v1/types"; -import { Proposal } from "./types/cosmos/group/v1/types"; -import { QueryTallyResultResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupAdminResponse } from "./types/cosmos/group/v1/tx"; -import { QueryVotesByProposalResponse } from "./types/cosmos/group/v1/query"; -import { QueryGroupsByMemberRequest } from "./types/cosmos/group/v1/query"; -import { QueryTallyResultRequest } from "./types/cosmos/group/v1/query"; -import { MsgLeaveGroup } from "./types/cosmos/group/v1/tx"; -import { DecisionPolicyWindows } from "./types/cosmos/group/v1/types"; -import { QueryGroupPolicyInfoResponse } from "./types/cosmos/group/v1/query"; -import { MsgCreateGroupWithPolicy } from "./types/cosmos/group/v1/tx"; -import { MsgExec } from "./types/cosmos/group/v1/tx"; -import { MsgExecResponse } from "./types/cosmos/group/v1/tx"; -import { QueryGroupsRequest } from "./types/cosmos/group/v1/query"; -import { MsgSubmitProposalResponse } from "./types/cosmos/group/v1/tx"; -import { GenesisState } from "./types/cosmos/group/v1/genesis"; -import { MsgUpdateGroupAdmin } from "./types/cosmos/group/v1/tx"; -import { MsgUpdateGroupPolicyDecisionPolicyResponse } from "./types/cosmos/group/v1/tx"; -import { MsgSubmitProposal } from "./types/cosmos/group/v1/tx"; -import { MsgWithdrawProposal } from "./types/cosmos/group/v1/tx"; -import { EventCreateGroupPolicy } from "./types/cosmos/group/v1/events"; -import { EventUpdateGroupPolicy } from "./types/cosmos/group/v1/events"; -import { MemberRequest } from "./types/cosmos/group/v1/types"; -import { QueryGroupsResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupMembers } from "./types/cosmos/group/v1/tx"; -import { MsgUpdateGroupPolicyAdmin } from "./types/cosmos/group/v1/tx"; -import { EventSubmitProposal } from "./types/cosmos/group/v1/events"; -import { GroupInfo } from "./types/cosmos/group/v1/types"; -import { QueryGroupMembersRequest } from "./types/cosmos/group/v1/query"; -import { QueryGroupsByAdminRequest } from "./types/cosmos/group/v1/query"; -import { QueryVoteByProposalVoterResponse } from "./types/cosmos/group/v1/query"; -import { QueryVotesByVoterRequest } from "./types/cosmos/group/v1/query"; -import { ThresholdDecisionPolicy } from "./types/cosmos/group/v1/types"; -import { QueryGroupPolicyInfoRequest } from "./types/cosmos/group/v1/query"; -import { QueryVotesByVoterResponse } from "./types/cosmos/group/v1/query"; -import { QueryProposalsByGroupPolicyRequest } from "./types/cosmos/group/v1/query"; -import { MsgCreateGroup } from "./types/cosmos/group/v1/tx"; -import { MsgVoteResponse } from "./types/cosmos/group/v1/tx"; -import { EventVote } from "./types/cosmos/group/v1/events"; -import { EventExec } from "./types/cosmos/group/v1/events"; -import { GroupPolicyInfo } from "./types/cosmos/group/v1/types"; -import { TallyResult } from "./types/cosmos/group/v1/types"; -import { QueryGroupPoliciesByAdminResponse } from "./types/cosmos/group/v1/query"; -import { MsgCreateGroupResponse } from "./types/cosmos/group/v1/tx"; -import { MsgCreateGroupPolicy } from "./types/cosmos/group/v1/tx"; -import { EventProposalPruned } from "./types/cosmos/group/v1/events"; -import { MsgUpdateGroupPolicyMetadata } from "./types/cosmos/group/v1/tx"; -import { MsgLeaveGroupResponse } from "./types/cosmos/group/v1/tx"; -import { QueryGroupPoliciesByGroupResponse } from "./types/cosmos/group/v1/query"; -import { QueryGroupPoliciesByAdminRequest } from "./types/cosmos/group/v1/query"; -import { QueryGroupsByMemberResponse } from "./types/cosmos/group/v1/query"; -import { MsgCreateGroupWithPolicyResponse } from "./types/cosmos/group/v1/tx"; -import { Vote } from "./types/cosmos/group/v1/types"; -import { QueryProposalResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupPolicyMetadataResponse } from "./types/cosmos/group/v1/tx"; -import { MsgVote } from "./types/cosmos/group/v1/tx"; -import { QueryProposalRequest } from "./types/cosmos/group/v1/query"; -import { EventWithdrawProposal } from "./types/cosmos/group/v1/events"; -import { EventLeaveGroup } from "./types/cosmos/group/v1/events"; -import { QueryVotesByProposalRequest } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupMetadata } from "./types/cosmos/group/v1/tx"; -import { MsgCreateGroupPolicyResponse } from "./types/cosmos/group/v1/tx"; -import { PercentageDecisionPolicy } from "./types/cosmos/group/v1/types"; -import { QueryGroupInfoResponse } from "./types/cosmos/group/v1/query"; -import { QueryGroupPoliciesByGroupRequest } from "./types/cosmos/group/v1/query"; -import { QueryProposalsByGroupPolicyResponse } from "./types/cosmos/group/v1/query"; -import { QueryVoteByProposalVoterRequest } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupPolicyDecisionPolicy } from "./types/cosmos/group/v1/tx"; - - -export { QueryGroupMembersResponse, MsgUpdateGroupPolicyAdminResponse, MsgWithdrawProposalResponse, QueryGroupInfoRequest, QueryGroupsByAdminResponse, MsgUpdateGroupMembersResponse, EventCreateGroup, MsgUpdateGroupMetadataResponse, EventUpdateGroup, Member, GroupMember, Proposal, QueryTallyResultResponse, MsgUpdateGroupAdminResponse, QueryVotesByProposalResponse, QueryGroupsByMemberRequest, QueryTallyResultRequest, MsgLeaveGroup, DecisionPolicyWindows, QueryGroupPolicyInfoResponse, MsgCreateGroupWithPolicy, MsgExec, MsgExecResponse, QueryGroupsRequest, MsgSubmitProposalResponse, GenesisState, MsgUpdateGroupAdmin, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgSubmitProposal, MsgWithdrawProposal, EventCreateGroupPolicy, EventUpdateGroupPolicy, MemberRequest, QueryGroupsResponse, MsgUpdateGroupMembers, MsgUpdateGroupPolicyAdmin, EventSubmitProposal, GroupInfo, QueryGroupMembersRequest, QueryGroupsByAdminRequest, QueryVoteByProposalVoterResponse, QueryVotesByVoterRequest, ThresholdDecisionPolicy, QueryGroupPolicyInfoRequest, QueryVotesByVoterResponse, QueryProposalsByGroupPolicyRequest, MsgCreateGroup, MsgVoteResponse, EventVote, EventExec, GroupPolicyInfo, TallyResult, QueryGroupPoliciesByAdminResponse, MsgCreateGroupResponse, MsgCreateGroupPolicy, EventProposalPruned, MsgUpdateGroupPolicyMetadata, MsgLeaveGroupResponse, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByAdminRequest, QueryGroupsByMemberResponse, MsgCreateGroupWithPolicyResponse, Vote, QueryProposalResponse, MsgUpdateGroupPolicyMetadataResponse, MsgVote, QueryProposalRequest, EventWithdrawProposal, EventLeaveGroup, QueryVotesByProposalRequest, MsgUpdateGroupMetadata, MsgCreateGroupPolicyResponse, PercentageDecisionPolicy, QueryGroupInfoResponse, QueryGroupPoliciesByGroupRequest, QueryProposalsByGroupPolicyResponse, QueryVoteByProposalVoterRequest, MsgUpdateGroupPolicyDecisionPolicy }; +import { MsgCreateGroupResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { GroupInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { EventVote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryVoteByProposalVoterResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { EventLeaveGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupPoliciesByAdminRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgCreateGroupWithPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventUpdateGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { EventExec } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { PercentageDecisionPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { EventSubmitProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryTallyResultResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgLeaveGroupResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { QueryVotesByVoterRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupPolicyDecisionPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { QueryGroupMembersRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupPoliciesByAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgCreateGroupWithPolicyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventCreateGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupMetadataResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MemberRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { DecisionPolicyWindows } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { QueryGroupsByAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgExecResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { Vote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { QueryGroupsByMemberRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupAdmin } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { QueryGroupMembersResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryProposalsByGroupPolicyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryVotesByProposalRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { Proposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { MsgUpdateGroupPolicyAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgSubmitProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { QueryGroupInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupPolicyInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryProposalsByGroupPolicyRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryVoteByProposalVoterRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupsByMemberResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupMembers } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgLeaveGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventCreateGroupPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupPolicyInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgCreateGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgUpdateGroupMetadata } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgCreateGroupPolicyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgUpdateGroupPolicyMetadata } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgVote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventProposalPruned } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupsByAdminRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { Member } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { MsgExec } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { TallyResult } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { QueryGroupPoliciesByGroupRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgCreateGroupPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgWithdrawProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { ThresholdDecisionPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { GroupPolicyInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { QueryProposalRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryVotesByProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryVotesByVoterResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryTallyResultRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/genesis"; +import { MsgUpdateGroupMembersResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgUpdateGroupPolicyAdmin } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventWithdrawProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgWithdrawProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { GroupMember } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { MsgUpdateGroupPolicyDecisionPolicyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgUpdateGroupPolicyMetadataResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgSubmitProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventUpdateGroupPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupPoliciesByGroupResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; + + +export { MsgCreateGroupResponse, GroupInfo, EventVote, QueryVoteByProposalVoterResponse, EventLeaveGroup, QueryGroupPoliciesByAdminRequest, MsgCreateGroupWithPolicy, EventUpdateGroup, EventExec, PercentageDecisionPolicy, EventSubmitProposal, QueryTallyResultResponse, MsgLeaveGroupResponse, QueryVotesByVoterRequest, MsgUpdateGroupPolicyDecisionPolicy, QueryGroupMembersRequest, QueryGroupPoliciesByAdminResponse, MsgCreateGroupWithPolicyResponse, EventCreateGroup, QueryGroupInfoRequest, MsgUpdateGroupMetadataResponse, MemberRequest, DecisionPolicyWindows, QueryGroupsByAdminResponse, QueryGroupsResponse, MsgExecResponse, Vote, QueryGroupsByMemberRequest, MsgUpdateGroupAdmin, QueryGroupMembersResponse, QueryProposalsByGroupPolicyResponse, QueryVotesByProposalRequest, Proposal, MsgUpdateGroupPolicyAdminResponse, MsgSubmitProposalResponse, QueryGroupInfoResponse, QueryGroupPolicyInfoRequest, QueryProposalsByGroupPolicyRequest, QueryVoteByProposalVoterRequest, QueryGroupsByMemberResponse, MsgUpdateGroupMembers, MsgLeaveGroup, EventCreateGroupPolicy, QueryGroupPolicyInfoResponse, MsgCreateGroup, MsgUpdateGroupMetadata, MsgCreateGroupPolicyResponse, MsgUpdateGroupPolicyMetadata, MsgVote, EventProposalPruned, QueryGroupsByAdminRequest, Member, MsgExec, TallyResult, QueryGroupPoliciesByGroupRequest, MsgUpdateGroupAdminResponse, MsgCreateGroupPolicy, MsgWithdrawProposalResponse, ThresholdDecisionPolicy, GroupPolicyInfo, QueryProposalRequest, QueryGroupsRequest, QueryVotesByProposalResponse, QueryVotesByVoterResponse, QueryTallyResultRequest, GenesisState, MsgUpdateGroupMembersResponse, MsgUpdateGroupPolicyAdmin, EventWithdrawProposal, QueryProposalResponse, MsgWithdrawProposal, GroupMember, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyMetadataResponse, MsgSubmitProposal, MsgVoteResponse, EventUpdateGroupPolicy, QueryGroupPoliciesByGroupResponse }; -type sendQueryGroupMembersResponseParams = { - value: QueryGroupMembersResponse, - fee?: StdFee, - memo?: string -}; - -type sendMsgUpdateGroupPolicyAdminResponseParams = { - value: MsgUpdateGroupPolicyAdminResponse, +type sendMsgCreateGroupResponseParams = { + value: MsgCreateGroupResponse, fee?: StdFee, memo?: string }; -type sendMsgWithdrawProposalResponseParams = { - value: MsgWithdrawProposalResponse, +type sendGroupInfoParams = { + value: GroupInfo, fee?: StdFee, memo?: string }; -type sendQueryGroupInfoRequestParams = { - value: QueryGroupInfoRequest, +type sendEventVoteParams = { + value: EventVote, fee?: StdFee, memo?: string }; -type sendQueryGroupsByAdminResponseParams = { - value: QueryGroupsByAdminResponse, +type sendQueryVoteByProposalVoterResponseParams = { + value: QueryVoteByProposalVoterResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupMembersResponseParams = { - value: MsgUpdateGroupMembersResponse, +type sendEventLeaveGroupParams = { + value: EventLeaveGroup, fee?: StdFee, memo?: string }; -type sendEventCreateGroupParams = { - value: EventCreateGroup, +type sendQueryGroupPoliciesByAdminRequestParams = { + value: QueryGroupPoliciesByAdminRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupMetadataResponseParams = { - value: MsgUpdateGroupMetadataResponse, +type sendMsgCreateGroupWithPolicyParams = { + value: MsgCreateGroupWithPolicy, fee?: StdFee, memo?: string }; @@ -142,20 +136,20 @@ type sendEventUpdateGroupParams = { memo?: string }; -type sendMemberParams = { - value: Member, +type sendEventExecParams = { + value: EventExec, fee?: StdFee, memo?: string }; -type sendGroupMemberParams = { - value: GroupMember, +type sendPercentageDecisionPolicyParams = { + value: PercentageDecisionPolicy, fee?: StdFee, memo?: string }; -type sendProposalParams = { - value: Proposal, +type sendEventSubmitProposalParams = { + value: EventSubmitProposal, fee?: StdFee, memo?: string }; @@ -166,200 +160,194 @@ type sendQueryTallyResultResponseParams = { memo?: string }; -type sendMsgUpdateGroupAdminResponseParams = { - value: MsgUpdateGroupAdminResponse, - fee?: StdFee, - memo?: string -}; - -type sendQueryVotesByProposalResponseParams = { - value: QueryVotesByProposalResponse, +type sendMsgLeaveGroupResponseParams = { + value: MsgLeaveGroupResponse, fee?: StdFee, memo?: string }; -type sendQueryGroupsByMemberRequestParams = { - value: QueryGroupsByMemberRequest, +type sendQueryVotesByVoterRequestParams = { + value: QueryVotesByVoterRequest, fee?: StdFee, memo?: string }; -type sendQueryTallyResultRequestParams = { - value: QueryTallyResultRequest, +type sendMsgUpdateGroupPolicyDecisionPolicyParams = { + value: MsgUpdateGroupPolicyDecisionPolicy, fee?: StdFee, memo?: string }; -type sendMsgLeaveGroupParams = { - value: MsgLeaveGroup, +type sendQueryGroupMembersRequestParams = { + value: QueryGroupMembersRequest, fee?: StdFee, memo?: string }; -type sendDecisionPolicyWindowsParams = { - value: DecisionPolicyWindows, +type sendQueryGroupPoliciesByAdminResponseParams = { + value: QueryGroupPoliciesByAdminResponse, fee?: StdFee, memo?: string }; -type sendQueryGroupPolicyInfoResponseParams = { - value: QueryGroupPolicyInfoResponse, +type sendMsgCreateGroupWithPolicyResponseParams = { + value: MsgCreateGroupWithPolicyResponse, fee?: StdFee, memo?: string }; -type sendMsgCreateGroupWithPolicyParams = { - value: MsgCreateGroupWithPolicy, +type sendEventCreateGroupParams = { + value: EventCreateGroup, fee?: StdFee, memo?: string }; -type sendMsgExecParams = { - value: MsgExec, +type sendQueryGroupInfoRequestParams = { + value: QueryGroupInfoRequest, fee?: StdFee, memo?: string }; -type sendMsgExecResponseParams = { - value: MsgExecResponse, +type sendMsgUpdateGroupMetadataResponseParams = { + value: MsgUpdateGroupMetadataResponse, fee?: StdFee, memo?: string }; -type sendQueryGroupsRequestParams = { - value: QueryGroupsRequest, +type sendMemberRequestParams = { + value: MemberRequest, fee?: StdFee, memo?: string }; -type sendMsgSubmitProposalResponseParams = { - value: MsgSubmitProposalResponse, +type sendDecisionPolicyWindowsParams = { + value: DecisionPolicyWindows, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryGroupsByAdminResponseParams = { + value: QueryGroupsByAdminResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupAdminParams = { - value: MsgUpdateGroupAdmin, +type sendQueryGroupsResponseParams = { + value: QueryGroupsResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupPolicyDecisionPolicyResponseParams = { - value: MsgUpdateGroupPolicyDecisionPolicyResponse, +type sendMsgExecResponseParams = { + value: MsgExecResponse, fee?: StdFee, memo?: string }; -type sendMsgSubmitProposalParams = { - value: MsgSubmitProposal, +type sendVoteParams = { + value: Vote, fee?: StdFee, memo?: string }; -type sendMsgWithdrawProposalParams = { - value: MsgWithdrawProposal, +type sendQueryGroupsByMemberRequestParams = { + value: QueryGroupsByMemberRequest, fee?: StdFee, memo?: string }; -type sendEventCreateGroupPolicyParams = { - value: EventCreateGroupPolicy, +type sendMsgUpdateGroupAdminParams = { + value: MsgUpdateGroupAdmin, fee?: StdFee, memo?: string }; -type sendEventUpdateGroupPolicyParams = { - value: EventUpdateGroupPolicy, +type sendQueryGroupMembersResponseParams = { + value: QueryGroupMembersResponse, fee?: StdFee, memo?: string }; -type sendMemberRequestParams = { - value: MemberRequest, +type sendQueryProposalsByGroupPolicyResponseParams = { + value: QueryProposalsByGroupPolicyResponse, fee?: StdFee, memo?: string }; -type sendQueryGroupsResponseParams = { - value: QueryGroupsResponse, +type sendQueryVotesByProposalRequestParams = { + value: QueryVotesByProposalRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupMembersParams = { - value: MsgUpdateGroupMembers, +type sendProposalParams = { + value: Proposal, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupPolicyAdminParams = { - value: MsgUpdateGroupPolicyAdmin, +type sendMsgUpdateGroupPolicyAdminResponseParams = { + value: MsgUpdateGroupPolicyAdminResponse, fee?: StdFee, memo?: string }; -type sendEventSubmitProposalParams = { - value: EventSubmitProposal, +type sendMsgSubmitProposalResponseParams = { + value: MsgSubmitProposalResponse, fee?: StdFee, memo?: string }; -type sendGroupInfoParams = { - value: GroupInfo, +type sendQueryGroupInfoResponseParams = { + value: QueryGroupInfoResponse, fee?: StdFee, memo?: string }; -type sendQueryGroupMembersRequestParams = { - value: QueryGroupMembersRequest, +type sendQueryGroupPolicyInfoRequestParams = { + value: QueryGroupPolicyInfoRequest, fee?: StdFee, memo?: string }; -type sendQueryGroupsByAdminRequestParams = { - value: QueryGroupsByAdminRequest, +type sendQueryProposalsByGroupPolicyRequestParams = { + value: QueryProposalsByGroupPolicyRequest, fee?: StdFee, memo?: string }; -type sendQueryVoteByProposalVoterResponseParams = { - value: QueryVoteByProposalVoterResponse, +type sendQueryVoteByProposalVoterRequestParams = { + value: QueryVoteByProposalVoterRequest, fee?: StdFee, memo?: string }; -type sendQueryVotesByVoterRequestParams = { - value: QueryVotesByVoterRequest, +type sendQueryGroupsByMemberResponseParams = { + value: QueryGroupsByMemberResponse, fee?: StdFee, memo?: string }; -type sendThresholdDecisionPolicyParams = { - value: ThresholdDecisionPolicy, +type sendMsgUpdateGroupMembersParams = { + value: MsgUpdateGroupMembers, fee?: StdFee, memo?: string }; -type sendQueryGroupPolicyInfoRequestParams = { - value: QueryGroupPolicyInfoRequest, +type sendMsgLeaveGroupParams = { + value: MsgLeaveGroup, fee?: StdFee, memo?: string }; -type sendQueryVotesByVoterResponseParams = { - value: QueryVotesByVoterResponse, +type sendEventCreateGroupPolicyParams = { + value: EventCreateGroupPolicy, fee?: StdFee, memo?: string }; -type sendQueryProposalsByGroupPolicyRequestParams = { - value: QueryProposalsByGroupPolicyRequest, +type sendQueryGroupPolicyInfoResponseParams = { + value: QueryGroupPolicyInfoResponse, fee?: StdFee, memo?: string }; @@ -370,503 +358,515 @@ type sendMsgCreateGroupParams = { memo?: string }; -type sendMsgVoteResponseParams = { - value: MsgVoteResponse, +type sendMsgUpdateGroupMetadataParams = { + value: MsgUpdateGroupMetadata, fee?: StdFee, memo?: string }; -type sendEventVoteParams = { - value: EventVote, +type sendMsgCreateGroupPolicyResponseParams = { + value: MsgCreateGroupPolicyResponse, fee?: StdFee, memo?: string }; -type sendEventExecParams = { - value: EventExec, +type sendMsgUpdateGroupPolicyMetadataParams = { + value: MsgUpdateGroupPolicyMetadata, fee?: StdFee, memo?: string }; -type sendGroupPolicyInfoParams = { - value: GroupPolicyInfo, +type sendMsgVoteParams = { + value: MsgVote, fee?: StdFee, memo?: string }; -type sendTallyResultParams = { - value: TallyResult, +type sendEventProposalPrunedParams = { + value: EventProposalPruned, fee?: StdFee, memo?: string }; -type sendQueryGroupPoliciesByAdminResponseParams = { - value: QueryGroupPoliciesByAdminResponse, +type sendQueryGroupsByAdminRequestParams = { + value: QueryGroupsByAdminRequest, fee?: StdFee, memo?: string }; -type sendMsgCreateGroupResponseParams = { - value: MsgCreateGroupResponse, +type sendMemberParams = { + value: Member, fee?: StdFee, memo?: string }; -type sendMsgCreateGroupPolicyParams = { - value: MsgCreateGroupPolicy, +type sendMsgExecParams = { + value: MsgExec, fee?: StdFee, memo?: string }; -type sendEventProposalPrunedParams = { - value: EventProposalPruned, +type sendTallyResultParams = { + value: TallyResult, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupPolicyMetadataParams = { - value: MsgUpdateGroupPolicyMetadata, +type sendQueryGroupPoliciesByGroupRequestParams = { + value: QueryGroupPoliciesByGroupRequest, fee?: StdFee, memo?: string }; -type sendMsgLeaveGroupResponseParams = { - value: MsgLeaveGroupResponse, +type sendMsgUpdateGroupAdminResponseParams = { + value: MsgUpdateGroupAdminResponse, fee?: StdFee, memo?: string }; -type sendQueryGroupPoliciesByGroupResponseParams = { - value: QueryGroupPoliciesByGroupResponse, +type sendMsgCreateGroupPolicyParams = { + value: MsgCreateGroupPolicy, fee?: StdFee, memo?: string }; -type sendQueryGroupPoliciesByAdminRequestParams = { - value: QueryGroupPoliciesByAdminRequest, +type sendMsgWithdrawProposalResponseParams = { + value: MsgWithdrawProposalResponse, fee?: StdFee, memo?: string }; -type sendQueryGroupsByMemberResponseParams = { - value: QueryGroupsByMemberResponse, +type sendThresholdDecisionPolicyParams = { + value: ThresholdDecisionPolicy, fee?: StdFee, memo?: string }; -type sendMsgCreateGroupWithPolicyResponseParams = { - value: MsgCreateGroupWithPolicyResponse, +type sendGroupPolicyInfoParams = { + value: GroupPolicyInfo, fee?: StdFee, memo?: string }; -type sendVoteParams = { - value: Vote, +type sendQueryProposalRequestParams = { + value: QueryProposalRequest, fee?: StdFee, memo?: string }; -type sendQueryProposalResponseParams = { - value: QueryProposalResponse, +type sendQueryGroupsRequestParams = { + value: QueryGroupsRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupPolicyMetadataResponseParams = { - value: MsgUpdateGroupPolicyMetadataResponse, +type sendQueryVotesByProposalResponseParams = { + value: QueryVotesByProposalResponse, fee?: StdFee, memo?: string }; -type sendMsgVoteParams = { - value: MsgVote, +type sendQueryVotesByVoterResponseParams = { + value: QueryVotesByVoterResponse, fee?: StdFee, memo?: string }; -type sendQueryProposalRequestParams = { - value: QueryProposalRequest, +type sendQueryTallyResultRequestParams = { + value: QueryTallyResultRequest, fee?: StdFee, memo?: string }; -type sendEventWithdrawProposalParams = { - value: EventWithdrawProposal, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendEventLeaveGroupParams = { - value: EventLeaveGroup, +type sendMsgUpdateGroupMembersResponseParams = { + value: MsgUpdateGroupMembersResponse, fee?: StdFee, memo?: string }; -type sendQueryVotesByProposalRequestParams = { - value: QueryVotesByProposalRequest, +type sendMsgUpdateGroupPolicyAdminParams = { + value: MsgUpdateGroupPolicyAdmin, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupMetadataParams = { - value: MsgUpdateGroupMetadata, +type sendEventWithdrawProposalParams = { + value: EventWithdrawProposal, fee?: StdFee, memo?: string }; -type sendMsgCreateGroupPolicyResponseParams = { - value: MsgCreateGroupPolicyResponse, +type sendQueryProposalResponseParams = { + value: QueryProposalResponse, fee?: StdFee, memo?: string }; -type sendPercentageDecisionPolicyParams = { - value: PercentageDecisionPolicy, +type sendMsgWithdrawProposalParams = { + value: MsgWithdrawProposal, fee?: StdFee, memo?: string }; -type sendQueryGroupInfoResponseParams = { - value: QueryGroupInfoResponse, +type sendGroupMemberParams = { + value: GroupMember, fee?: StdFee, memo?: string }; -type sendQueryGroupPoliciesByGroupRequestParams = { - value: QueryGroupPoliciesByGroupRequest, +type sendMsgUpdateGroupPolicyDecisionPolicyResponseParams = { + value: MsgUpdateGroupPolicyDecisionPolicyResponse, fee?: StdFee, memo?: string }; -type sendQueryProposalsByGroupPolicyResponseParams = { - value: QueryProposalsByGroupPolicyResponse, +type sendMsgUpdateGroupPolicyMetadataResponseParams = { + value: MsgUpdateGroupPolicyMetadataResponse, fee?: StdFee, memo?: string }; -type sendQueryVoteByProposalVoterRequestParams = { - value: QueryVoteByProposalVoterRequest, +type sendMsgSubmitProposalParams = { + value: MsgSubmitProposal, fee?: StdFee, memo?: string }; -type sendMsgUpdateGroupPolicyDecisionPolicyParams = { - value: MsgUpdateGroupPolicyDecisionPolicy, +type sendMsgVoteResponseParams = { + value: MsgVoteResponse, fee?: StdFee, memo?: string }; +type sendEventUpdateGroupPolicyParams = { + value: EventUpdateGroupPolicy, + fee?: StdFee, + memo?: string +}; -type queryGroupMembersResponseParams = { - value: QueryGroupMembersResponse, +type sendQueryGroupPoliciesByGroupResponseParams = { + value: QueryGroupPoliciesByGroupResponse, + fee?: StdFee, + memo?: string }; -type msgUpdateGroupPolicyAdminResponseParams = { - value: MsgUpdateGroupPolicyAdminResponse, + +type msgCreateGroupResponseParams = { + value: MsgCreateGroupResponse, }; -type msgWithdrawProposalResponseParams = { - value: MsgWithdrawProposalResponse, +type groupInfoParams = { + value: GroupInfo, }; -type queryGroupInfoRequestParams = { - value: QueryGroupInfoRequest, +type eventVoteParams = { + value: EventVote, }; -type queryGroupsByAdminResponseParams = { - value: QueryGroupsByAdminResponse, +type queryVoteByProposalVoterResponseParams = { + value: QueryVoteByProposalVoterResponse, }; -type msgUpdateGroupMembersResponseParams = { - value: MsgUpdateGroupMembersResponse, +type eventLeaveGroupParams = { + value: EventLeaveGroup, }; -type eventCreateGroupParams = { - value: EventCreateGroup, +type queryGroupPoliciesByAdminRequestParams = { + value: QueryGroupPoliciesByAdminRequest, }; -type msgUpdateGroupMetadataResponseParams = { - value: MsgUpdateGroupMetadataResponse, +type msgCreateGroupWithPolicyParams = { + value: MsgCreateGroupWithPolicy, }; type eventUpdateGroupParams = { value: EventUpdateGroup, }; -type memberParams = { - value: Member, +type eventExecParams = { + value: EventExec, }; -type groupMemberParams = { - value: GroupMember, +type percentageDecisionPolicyParams = { + value: PercentageDecisionPolicy, }; -type proposalParams = { - value: Proposal, +type eventSubmitProposalParams = { + value: EventSubmitProposal, }; type queryTallyResultResponseParams = { value: QueryTallyResultResponse, }; -type msgUpdateGroupAdminResponseParams = { - value: MsgUpdateGroupAdminResponse, +type msgLeaveGroupResponseParams = { + value: MsgLeaveGroupResponse, }; -type queryVotesByProposalResponseParams = { - value: QueryVotesByProposalResponse, +type queryVotesByVoterRequestParams = { + value: QueryVotesByVoterRequest, }; -type queryGroupsByMemberRequestParams = { - value: QueryGroupsByMemberRequest, +type msgUpdateGroupPolicyDecisionPolicyParams = { + value: MsgUpdateGroupPolicyDecisionPolicy, }; -type queryTallyResultRequestParams = { - value: QueryTallyResultRequest, +type queryGroupMembersRequestParams = { + value: QueryGroupMembersRequest, }; -type msgLeaveGroupParams = { - value: MsgLeaveGroup, +type queryGroupPoliciesByAdminResponseParams = { + value: QueryGroupPoliciesByAdminResponse, }; -type decisionPolicyWindowsParams = { - value: DecisionPolicyWindows, +type msgCreateGroupWithPolicyResponseParams = { + value: MsgCreateGroupWithPolicyResponse, }; -type queryGroupPolicyInfoResponseParams = { - value: QueryGroupPolicyInfoResponse, +type eventCreateGroupParams = { + value: EventCreateGroup, }; -type msgCreateGroupWithPolicyParams = { - value: MsgCreateGroupWithPolicy, +type queryGroupInfoRequestParams = { + value: QueryGroupInfoRequest, }; -type msgExecParams = { - value: MsgExec, +type msgUpdateGroupMetadataResponseParams = { + value: MsgUpdateGroupMetadataResponse, }; -type msgExecResponseParams = { - value: MsgExecResponse, +type memberRequestParams = { + value: MemberRequest, }; -type queryGroupsRequestParams = { - value: QueryGroupsRequest, +type decisionPolicyWindowsParams = { + value: DecisionPolicyWindows, }; -type msgSubmitProposalResponseParams = { - value: MsgSubmitProposalResponse, +type queryGroupsByAdminResponseParams = { + value: QueryGroupsByAdminResponse, }; -type genesisStateParams = { - value: GenesisState, +type queryGroupsResponseParams = { + value: QueryGroupsResponse, +}; + +type msgExecResponseParams = { + value: MsgExecResponse, +}; + +type voteParams = { + value: Vote, +}; + +type queryGroupsByMemberRequestParams = { + value: QueryGroupsByMemberRequest, }; type msgUpdateGroupAdminParams = { value: MsgUpdateGroupAdmin, }; -type msgUpdateGroupPolicyDecisionPolicyResponseParams = { - value: MsgUpdateGroupPolicyDecisionPolicyResponse, +type queryGroupMembersResponseParams = { + value: QueryGroupMembersResponse, }; -type msgSubmitProposalParams = { - value: MsgSubmitProposal, +type queryProposalsByGroupPolicyResponseParams = { + value: QueryProposalsByGroupPolicyResponse, }; -type msgWithdrawProposalParams = { - value: MsgWithdrawProposal, +type queryVotesByProposalRequestParams = { + value: QueryVotesByProposalRequest, }; -type eventCreateGroupPolicyParams = { - value: EventCreateGroupPolicy, +type proposalParams = { + value: Proposal, }; -type eventUpdateGroupPolicyParams = { - value: EventUpdateGroupPolicy, +type msgUpdateGroupPolicyAdminResponseParams = { + value: MsgUpdateGroupPolicyAdminResponse, }; -type memberRequestParams = { - value: MemberRequest, +type msgSubmitProposalResponseParams = { + value: MsgSubmitProposalResponse, }; -type queryGroupsResponseParams = { - value: QueryGroupsResponse, +type queryGroupInfoResponseParams = { + value: QueryGroupInfoResponse, }; -type msgUpdateGroupMembersParams = { - value: MsgUpdateGroupMembers, +type queryGroupPolicyInfoRequestParams = { + value: QueryGroupPolicyInfoRequest, }; -type msgUpdateGroupPolicyAdminParams = { - value: MsgUpdateGroupPolicyAdmin, +type queryProposalsByGroupPolicyRequestParams = { + value: QueryProposalsByGroupPolicyRequest, }; -type eventSubmitProposalParams = { - value: EventSubmitProposal, +type queryVoteByProposalVoterRequestParams = { + value: QueryVoteByProposalVoterRequest, }; -type groupInfoParams = { - value: GroupInfo, +type queryGroupsByMemberResponseParams = { + value: QueryGroupsByMemberResponse, }; -type queryGroupMembersRequestParams = { - value: QueryGroupMembersRequest, +type msgUpdateGroupMembersParams = { + value: MsgUpdateGroupMembers, }; -type queryGroupsByAdminRequestParams = { - value: QueryGroupsByAdminRequest, +type msgLeaveGroupParams = { + value: MsgLeaveGroup, }; -type queryVoteByProposalVoterResponseParams = { - value: QueryVoteByProposalVoterResponse, +type eventCreateGroupPolicyParams = { + value: EventCreateGroupPolicy, }; -type queryVotesByVoterRequestParams = { - value: QueryVotesByVoterRequest, +type queryGroupPolicyInfoResponseParams = { + value: QueryGroupPolicyInfoResponse, }; -type thresholdDecisionPolicyParams = { - value: ThresholdDecisionPolicy, +type msgCreateGroupParams = { + value: MsgCreateGroup, }; -type queryGroupPolicyInfoRequestParams = { - value: QueryGroupPolicyInfoRequest, +type msgUpdateGroupMetadataParams = { + value: MsgUpdateGroupMetadata, }; -type queryVotesByVoterResponseParams = { - value: QueryVotesByVoterResponse, +type msgCreateGroupPolicyResponseParams = { + value: MsgCreateGroupPolicyResponse, }; -type queryProposalsByGroupPolicyRequestParams = { - value: QueryProposalsByGroupPolicyRequest, +type msgUpdateGroupPolicyMetadataParams = { + value: MsgUpdateGroupPolicyMetadata, }; -type msgCreateGroupParams = { - value: MsgCreateGroup, +type msgVoteParams = { + value: MsgVote, }; -type msgVoteResponseParams = { - value: MsgVoteResponse, +type eventProposalPrunedParams = { + value: EventProposalPruned, }; -type eventVoteParams = { - value: EventVote, +type queryGroupsByAdminRequestParams = { + value: QueryGroupsByAdminRequest, }; -type eventExecParams = { - value: EventExec, +type memberParams = { + value: Member, }; -type groupPolicyInfoParams = { - value: GroupPolicyInfo, +type msgExecParams = { + value: MsgExec, }; type tallyResultParams = { value: TallyResult, }; -type queryGroupPoliciesByAdminResponseParams = { - value: QueryGroupPoliciesByAdminResponse, +type queryGroupPoliciesByGroupRequestParams = { + value: QueryGroupPoliciesByGroupRequest, }; -type msgCreateGroupResponseParams = { - value: MsgCreateGroupResponse, +type msgUpdateGroupAdminResponseParams = { + value: MsgUpdateGroupAdminResponse, }; type msgCreateGroupPolicyParams = { value: MsgCreateGroupPolicy, }; -type eventProposalPrunedParams = { - value: EventProposalPruned, -}; - -type msgUpdateGroupPolicyMetadataParams = { - value: MsgUpdateGroupPolicyMetadata, +type msgWithdrawProposalResponseParams = { + value: MsgWithdrawProposalResponse, }; -type msgLeaveGroupResponseParams = { - value: MsgLeaveGroupResponse, +type thresholdDecisionPolicyParams = { + value: ThresholdDecisionPolicy, }; -type queryGroupPoliciesByGroupResponseParams = { - value: QueryGroupPoliciesByGroupResponse, +type groupPolicyInfoParams = { + value: GroupPolicyInfo, }; -type queryGroupPoliciesByAdminRequestParams = { - value: QueryGroupPoliciesByAdminRequest, +type queryProposalRequestParams = { + value: QueryProposalRequest, }; -type queryGroupsByMemberResponseParams = { - value: QueryGroupsByMemberResponse, +type queryGroupsRequestParams = { + value: QueryGroupsRequest, }; -type msgCreateGroupWithPolicyResponseParams = { - value: MsgCreateGroupWithPolicyResponse, +type queryVotesByProposalResponseParams = { + value: QueryVotesByProposalResponse, }; -type voteParams = { - value: Vote, +type queryVotesByVoterResponseParams = { + value: QueryVotesByVoterResponse, }; -type queryProposalResponseParams = { - value: QueryProposalResponse, +type queryTallyResultRequestParams = { + value: QueryTallyResultRequest, }; -type msgUpdateGroupPolicyMetadataResponseParams = { - value: MsgUpdateGroupPolicyMetadataResponse, +type genesisStateParams = { + value: GenesisState, }; -type msgVoteParams = { - value: MsgVote, +type msgUpdateGroupMembersResponseParams = { + value: MsgUpdateGroupMembersResponse, }; -type queryProposalRequestParams = { - value: QueryProposalRequest, +type msgUpdateGroupPolicyAdminParams = { + value: MsgUpdateGroupPolicyAdmin, }; type eventWithdrawProposalParams = { value: EventWithdrawProposal, }; -type eventLeaveGroupParams = { - value: EventLeaveGroup, -}; - -type queryVotesByProposalRequestParams = { - value: QueryVotesByProposalRequest, +type queryProposalResponseParams = { + value: QueryProposalResponse, }; -type msgUpdateGroupMetadataParams = { - value: MsgUpdateGroupMetadata, +type msgWithdrawProposalParams = { + value: MsgWithdrawProposal, }; -type msgCreateGroupPolicyResponseParams = { - value: MsgCreateGroupPolicyResponse, +type groupMemberParams = { + value: GroupMember, }; -type percentageDecisionPolicyParams = { - value: PercentageDecisionPolicy, +type msgUpdateGroupPolicyDecisionPolicyResponseParams = { + value: MsgUpdateGroupPolicyDecisionPolicyResponse, }; -type queryGroupInfoResponseParams = { - value: QueryGroupInfoResponse, +type msgUpdateGroupPolicyMetadataResponseParams = { + value: MsgUpdateGroupPolicyMetadataResponse, }; -type queryGroupPoliciesByGroupRequestParams = { - value: QueryGroupPoliciesByGroupRequest, +type msgSubmitProposalParams = { + value: MsgSubmitProposal, }; -type queryProposalsByGroupPolicyResponseParams = { - value: QueryProposalsByGroupPolicyResponse, +type msgVoteResponseParams = { + value: MsgVoteResponse, }; -type queryVoteByProposalVoterRequestParams = { - value: QueryVoteByProposalVoterRequest, +type eventUpdateGroupPolicyParams = { + value: EventUpdateGroupPolicy, }; -type msgUpdateGroupPolicyDecisionPolicyParams = { - value: MsgUpdateGroupPolicyDecisionPolicy, +type queryGroupPoliciesByGroupResponseParams = { + value: QueryGroupPoliciesByGroupResponse, }; @@ -899,367 +899,395 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendQueryGroupMembersResponse({ value, fee, memo }: sendQueryGroupMembersResponseParams): Promise { + async sendMsgCreateGroupResponse({ value, fee, memo }: sendMsgCreateGroupResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupMembersResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateGroupResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupMembersResponse({ value: QueryGroupMembersResponse.fromPartial(value) }) + let msg = this.msgCreateGroupResponse({ value: MsgCreateGroupResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupMembersResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateGroupResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGroupPolicyAdminResponse({ value, fee, memo }: sendMsgUpdateGroupPolicyAdminResponseParams): Promise { + async sendGroupInfo({ value, fee, memo }: sendGroupInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyAdminResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGroupInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupPolicyAdminResponse({ value: MsgUpdateGroupPolicyAdminResponse.fromPartial(value) }) + let msg = this.groupInfo({ value: GroupInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyAdminResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGroupInfo: Could not broadcast Tx: '+ e.message) } }, - async sendMsgWithdrawProposalResponse({ value, fee, memo }: sendMsgWithdrawProposalResponseParams): Promise { + async sendEventVote({ value, fee, memo }: sendEventVoteParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgWithdrawProposalResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventVote: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgWithdrawProposalResponse({ value: MsgWithdrawProposalResponse.fromPartial(value) }) + let msg = this.eventVote({ value: EventVote.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgWithdrawProposalResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventVote: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupInfoRequest({ value, fee, memo }: sendQueryGroupInfoRequestParams): Promise { + async sendQueryVoteByProposalVoterResponse({ value, fee, memo }: sendQueryVoteByProposalVoterResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupInfoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVoteByProposalVoterResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupInfoRequest({ value: QueryGroupInfoRequest.fromPartial(value) }) + let msg = this.queryVoteByProposalVoterResponse({ value: QueryVoteByProposalVoterResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupInfoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVoteByProposalVoterResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupsByAdminResponse({ value, fee, memo }: sendQueryGroupsByAdminResponseParams): Promise { + async sendEventLeaveGroup({ value, fee, memo }: sendEventLeaveGroupParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupsByAdminResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventLeaveGroup: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupsByAdminResponse({ value: QueryGroupsByAdminResponse.fromPartial(value) }) + let msg = this.eventLeaveGroup({ value: EventLeaveGroup.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupsByAdminResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventLeaveGroup: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGroupMembersResponse({ value, fee, memo }: sendMsgUpdateGroupMembersResponseParams): Promise { + async sendQueryGroupPoliciesByAdminRequest({ value, fee, memo }: sendQueryGroupPoliciesByAdminRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryGroupPoliciesByAdminRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryGroupPoliciesByAdminRequest({ value: QueryGroupPoliciesByAdminRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryGroupPoliciesByAdminRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendMsgCreateGroupWithPolicy({ value, fee, memo }: sendMsgCreateGroupWithPolicyParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgCreateGroupWithPolicy: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgCreateGroupWithPolicy({ value: MsgCreateGroupWithPolicy.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgCreateGroupWithPolicy: Could not broadcast Tx: '+ e.message) + } + }, + + async sendEventUpdateGroup({ value, fee, memo }: sendEventUpdateGroupParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupMembersResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventUpdateGroup: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupMembersResponse({ value: MsgUpdateGroupMembersResponse.fromPartial(value) }) + let msg = this.eventUpdateGroup({ value: EventUpdateGroup.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupMembersResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventUpdateGroup: Could not broadcast Tx: '+ e.message) } }, - async sendEventCreateGroup({ value, fee, memo }: sendEventCreateGroupParams): Promise { + async sendEventExec({ value, fee, memo }: sendEventExecParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventCreateGroup: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventExec: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventCreateGroup({ value: EventCreateGroup.fromPartial(value) }) + let msg = this.eventExec({ value: EventExec.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventCreateGroup: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventExec: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGroupMetadataResponse({ value, fee, memo }: sendMsgUpdateGroupMetadataResponseParams): Promise { + async sendPercentageDecisionPolicy({ value, fee, memo }: sendPercentageDecisionPolicyParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupMetadataResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPercentageDecisionPolicy: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupMetadataResponse({ value: MsgUpdateGroupMetadataResponse.fromPartial(value) }) + let msg = this.percentageDecisionPolicy({ value: PercentageDecisionPolicy.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupMetadataResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPercentageDecisionPolicy: Could not broadcast Tx: '+ e.message) } }, - async sendEventUpdateGroup({ value, fee, memo }: sendEventUpdateGroupParams): Promise { + async sendEventSubmitProposal({ value, fee, memo }: sendEventSubmitProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventUpdateGroup: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventSubmitProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventUpdateGroup({ value: EventUpdateGroup.fromPartial(value) }) + let msg = this.eventSubmitProposal({ value: EventSubmitProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventUpdateGroup: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventSubmitProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMember({ value, fee, memo }: sendMemberParams): Promise { + async sendQueryTallyResultResponse({ value, fee, memo }: sendQueryTallyResultResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMember: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTallyResultResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.member({ value: Member.fromPartial(value) }) + let msg = this.queryTallyResultResponse({ value: QueryTallyResultResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMember: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTallyResultResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGroupMember({ value, fee, memo }: sendGroupMemberParams): Promise { + async sendMsgLeaveGroupResponse({ value, fee, memo }: sendMsgLeaveGroupResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGroupMember: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgLeaveGroupResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.groupMember({ value: GroupMember.fromPartial(value) }) + let msg = this.msgLeaveGroupResponse({ value: MsgLeaveGroupResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGroupMember: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgLeaveGroupResponse: Could not broadcast Tx: '+ e.message) } }, - async sendProposal({ value, fee, memo }: sendProposalParams): Promise { + async sendQueryVotesByVoterRequest({ value, fee, memo }: sendQueryVotesByVoterRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVotesByVoterRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.proposal({ value: Proposal.fromPartial(value) }) + let msg = this.queryVotesByVoterRequest({ value: QueryVotesByVoterRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVotesByVoterRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTallyResultResponse({ value, fee, memo }: sendQueryTallyResultResponseParams): Promise { + async sendMsgUpdateGroupPolicyDecisionPolicy({ value, fee, memo }: sendMsgUpdateGroupPolicyDecisionPolicyParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTallyResultResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupPolicyDecisionPolicy: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTallyResultResponse({ value: QueryTallyResultResponse.fromPartial(value) }) + let msg = this.msgUpdateGroupPolicyDecisionPolicy({ value: MsgUpdateGroupPolicyDecisionPolicy.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTallyResultResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupPolicyDecisionPolicy: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGroupAdminResponse({ value, fee, memo }: sendMsgUpdateGroupAdminResponseParams): Promise { + async sendQueryGroupMembersRequest({ value, fee, memo }: sendQueryGroupMembersRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupAdminResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupMembersRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupAdminResponse({ value: MsgUpdateGroupAdminResponse.fromPartial(value) }) + let msg = this.queryGroupMembersRequest({ value: QueryGroupMembersRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupAdminResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupMembersRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVotesByProposalResponse({ value, fee, memo }: sendQueryVotesByProposalResponseParams): Promise { + async sendQueryGroupPoliciesByAdminResponse({ value, fee, memo }: sendQueryGroupPoliciesByAdminResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVotesByProposalResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupPoliciesByAdminResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVotesByProposalResponse({ value: QueryVotesByProposalResponse.fromPartial(value) }) + let msg = this.queryGroupPoliciesByAdminResponse({ value: QueryGroupPoliciesByAdminResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVotesByProposalResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupPoliciesByAdminResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupsByMemberRequest({ value, fee, memo }: sendQueryGroupsByMemberRequestParams): Promise { + async sendMsgCreateGroupWithPolicyResponse({ value, fee, memo }: sendMsgCreateGroupWithPolicyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupsByMemberRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateGroupWithPolicyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupsByMemberRequest({ value: QueryGroupsByMemberRequest.fromPartial(value) }) + let msg = this.msgCreateGroupWithPolicyResponse({ value: MsgCreateGroupWithPolicyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupsByMemberRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateGroupWithPolicyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTallyResultRequest({ value, fee, memo }: sendQueryTallyResultRequestParams): Promise { + async sendEventCreateGroup({ value, fee, memo }: sendEventCreateGroupParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTallyResultRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventCreateGroup: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTallyResultRequest({ value: QueryTallyResultRequest.fromPartial(value) }) + let msg = this.eventCreateGroup({ value: EventCreateGroup.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTallyResultRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventCreateGroup: Could not broadcast Tx: '+ e.message) } }, - async sendMsgLeaveGroup({ value, fee, memo }: sendMsgLeaveGroupParams): Promise { + async sendQueryGroupInfoRequest({ value, fee, memo }: sendQueryGroupInfoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgLeaveGroup: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupInfoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgLeaveGroup({ value: MsgLeaveGroup.fromPartial(value) }) + let msg = this.queryGroupInfoRequest({ value: QueryGroupInfoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgLeaveGroup: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupInfoRequest: Could not broadcast Tx: '+ e.message) } }, - async sendDecisionPolicyWindows({ value, fee, memo }: sendDecisionPolicyWindowsParams): Promise { + async sendMsgUpdateGroupMetadataResponse({ value, fee, memo }: sendMsgUpdateGroupMetadataResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendDecisionPolicyWindows: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupMetadataResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.decisionPolicyWindows({ value: DecisionPolicyWindows.fromPartial(value) }) + let msg = this.msgUpdateGroupMetadataResponse({ value: MsgUpdateGroupMetadataResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDecisionPolicyWindows: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupMetadataResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupPolicyInfoResponse({ value, fee, memo }: sendQueryGroupPolicyInfoResponseParams): Promise { + async sendMemberRequest({ value, fee, memo }: sendMemberRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupPolicyInfoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMemberRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupPolicyInfoResponse({ value: QueryGroupPolicyInfoResponse.fromPartial(value) }) + let msg = this.memberRequest({ value: MemberRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupPolicyInfoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMemberRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateGroupWithPolicy({ value, fee, memo }: sendMsgCreateGroupWithPolicyParams): Promise { + async sendDecisionPolicyWindows({ value, fee, memo }: sendDecisionPolicyWindowsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateGroupWithPolicy: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDecisionPolicyWindows: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateGroupWithPolicy({ value: MsgCreateGroupWithPolicy.fromPartial(value) }) + let msg = this.decisionPolicyWindows({ value: DecisionPolicyWindows.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateGroupWithPolicy: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDecisionPolicyWindows: Could not broadcast Tx: '+ e.message) } }, - async sendMsgExec({ value, fee, memo }: sendMsgExecParams): Promise { + async sendQueryGroupsByAdminResponse({ value, fee, memo }: sendQueryGroupsByAdminResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgExec: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupsByAdminResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgExec({ value: MsgExec.fromPartial(value) }) + let msg = this.queryGroupsByAdminResponse({ value: QueryGroupsByAdminResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgExec: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupsByAdminResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgExecResponse({ value, fee, memo }: sendMsgExecResponseParams): Promise { + async sendQueryGroupsResponse({ value, fee, memo }: sendQueryGroupsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgExecResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgExecResponse({ value: MsgExecResponse.fromPartial(value) }) + let msg = this.queryGroupsResponse({ value: QueryGroupsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgExecResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupsRequest({ value, fee, memo }: sendQueryGroupsRequestParams): Promise { + async sendMsgExecResponse({ value, fee, memo }: sendMsgExecResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgExecResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupsRequest({ value: QueryGroupsRequest.fromPartial(value) }) + let msg = this.msgExecResponse({ value: MsgExecResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgExecResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitProposalResponse({ value, fee, memo }: sendMsgSubmitProposalResponseParams): Promise { + async sendVote({ value, fee, memo }: sendVoteParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitProposalResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendVote: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitProposalResponse({ value: MsgSubmitProposalResponse.fromPartial(value) }) + let msg = this.vote({ value: Vote.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitProposalResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendVote: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryGroupsByMemberRequest({ value, fee, memo }: sendQueryGroupsByMemberRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupsByMemberRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryGroupsByMemberRequest({ value: QueryGroupsByMemberRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupsByMemberRequest: Could not broadcast Tx: '+ e.message) } }, @@ -1277,339 +1305,339 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgUpdateGroupPolicyDecisionPolicyResponse({ value, fee, memo }: sendMsgUpdateGroupPolicyDecisionPolicyResponseParams): Promise { + async sendQueryGroupMembersResponse({ value, fee, memo }: sendQueryGroupMembersResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyDecisionPolicyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupMembersResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupPolicyDecisionPolicyResponse({ value: MsgUpdateGroupPolicyDecisionPolicyResponse.fromPartial(value) }) + let msg = this.queryGroupMembersResponse({ value: QueryGroupMembersResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyDecisionPolicyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupMembersResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitProposal({ value, fee, memo }: sendMsgSubmitProposalParams): Promise { + async sendQueryProposalsByGroupPolicyResponse({ value, fee, memo }: sendQueryProposalsByGroupPolicyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalsByGroupPolicyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitProposal({ value: MsgSubmitProposal.fromPartial(value) }) + let msg = this.queryProposalsByGroupPolicyResponse({ value: QueryProposalsByGroupPolicyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalsByGroupPolicyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgWithdrawProposal({ value, fee, memo }: sendMsgWithdrawProposalParams): Promise { + async sendQueryVotesByProposalRequest({ value, fee, memo }: sendQueryVotesByProposalRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgWithdrawProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVotesByProposalRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgWithdrawProposal({ value: MsgWithdrawProposal.fromPartial(value) }) + let msg = this.queryVotesByProposalRequest({ value: QueryVotesByProposalRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgWithdrawProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVotesByProposalRequest: Could not broadcast Tx: '+ e.message) } }, - async sendEventCreateGroupPolicy({ value, fee, memo }: sendEventCreateGroupPolicyParams): Promise { + async sendProposal({ value, fee, memo }: sendProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventCreateGroupPolicy: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventCreateGroupPolicy({ value: EventCreateGroupPolicy.fromPartial(value) }) + let msg = this.proposal({ value: Proposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventCreateGroupPolicy: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendProposal: Could not broadcast Tx: '+ e.message) } }, - async sendEventUpdateGroupPolicy({ value, fee, memo }: sendEventUpdateGroupPolicyParams): Promise { + async sendMsgUpdateGroupPolicyAdminResponse({ value, fee, memo }: sendMsgUpdateGroupPolicyAdminResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventUpdateGroupPolicy: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupPolicyAdminResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventUpdateGroupPolicy({ value: EventUpdateGroupPolicy.fromPartial(value) }) + let msg = this.msgUpdateGroupPolicyAdminResponse({ value: MsgUpdateGroupPolicyAdminResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventUpdateGroupPolicy: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupPolicyAdminResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMemberRequest({ value, fee, memo }: sendMemberRequestParams): Promise { + async sendMsgSubmitProposalResponse({ value, fee, memo }: sendMsgSubmitProposalResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMemberRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitProposalResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.memberRequest({ value: MemberRequest.fromPartial(value) }) + let msg = this.msgSubmitProposalResponse({ value: MsgSubmitProposalResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMemberRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitProposalResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupsResponse({ value, fee, memo }: sendQueryGroupsResponseParams): Promise { + async sendQueryGroupInfoResponse({ value, fee, memo }: sendQueryGroupInfoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupInfoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupsResponse({ value: QueryGroupsResponse.fromPartial(value) }) + let msg = this.queryGroupInfoResponse({ value: QueryGroupInfoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupInfoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGroupMembers({ value, fee, memo }: sendMsgUpdateGroupMembersParams): Promise { + async sendQueryGroupPolicyInfoRequest({ value, fee, memo }: sendQueryGroupPolicyInfoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupMembers: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupPolicyInfoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupMembers({ value: MsgUpdateGroupMembers.fromPartial(value) }) + let msg = this.queryGroupPolicyInfoRequest({ value: QueryGroupPolicyInfoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupMembers: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupPolicyInfoRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGroupPolicyAdmin({ value, fee, memo }: sendMsgUpdateGroupPolicyAdminParams): Promise { + async sendQueryProposalsByGroupPolicyRequest({ value, fee, memo }: sendQueryProposalsByGroupPolicyRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyAdmin: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalsByGroupPolicyRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupPolicyAdmin({ value: MsgUpdateGroupPolicyAdmin.fromPartial(value) }) + let msg = this.queryProposalsByGroupPolicyRequest({ value: QueryProposalsByGroupPolicyRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyAdmin: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalsByGroupPolicyRequest: Could not broadcast Tx: '+ e.message) } }, - async sendEventSubmitProposal({ value, fee, memo }: sendEventSubmitProposalParams): Promise { + async sendQueryVoteByProposalVoterRequest({ value, fee, memo }: sendQueryVoteByProposalVoterRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventSubmitProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVoteByProposalVoterRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventSubmitProposal({ value: EventSubmitProposal.fromPartial(value) }) + let msg = this.queryVoteByProposalVoterRequest({ value: QueryVoteByProposalVoterRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventSubmitProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVoteByProposalVoterRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGroupInfo({ value, fee, memo }: sendGroupInfoParams): Promise { + async sendQueryGroupsByMemberResponse({ value, fee, memo }: sendQueryGroupsByMemberResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGroupInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupsByMemberResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.groupInfo({ value: GroupInfo.fromPartial(value) }) + let msg = this.queryGroupsByMemberResponse({ value: QueryGroupsByMemberResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGroupInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupsByMemberResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupMembersRequest({ value, fee, memo }: sendQueryGroupMembersRequestParams): Promise { + async sendMsgUpdateGroupMembers({ value, fee, memo }: sendMsgUpdateGroupMembersParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupMembersRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupMembers: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupMembersRequest({ value: QueryGroupMembersRequest.fromPartial(value) }) + let msg = this.msgUpdateGroupMembers({ value: MsgUpdateGroupMembers.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupMembersRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupMembers: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupsByAdminRequest({ value, fee, memo }: sendQueryGroupsByAdminRequestParams): Promise { + async sendMsgLeaveGroup({ value, fee, memo }: sendMsgLeaveGroupParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupsByAdminRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgLeaveGroup: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupsByAdminRequest({ value: QueryGroupsByAdminRequest.fromPartial(value) }) + let msg = this.msgLeaveGroup({ value: MsgLeaveGroup.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupsByAdminRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgLeaveGroup: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVoteByProposalVoterResponse({ value, fee, memo }: sendQueryVoteByProposalVoterResponseParams): Promise { + async sendEventCreateGroupPolicy({ value, fee, memo }: sendEventCreateGroupPolicyParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVoteByProposalVoterResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventCreateGroupPolicy: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVoteByProposalVoterResponse({ value: QueryVoteByProposalVoterResponse.fromPartial(value) }) + let msg = this.eventCreateGroupPolicy({ value: EventCreateGroupPolicy.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVoteByProposalVoterResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventCreateGroupPolicy: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVotesByVoterRequest({ value, fee, memo }: sendQueryVotesByVoterRequestParams): Promise { + async sendQueryGroupPolicyInfoResponse({ value, fee, memo }: sendQueryGroupPolicyInfoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVotesByVoterRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupPolicyInfoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVotesByVoterRequest({ value: QueryVotesByVoterRequest.fromPartial(value) }) + let msg = this.queryGroupPolicyInfoResponse({ value: QueryGroupPolicyInfoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVotesByVoterRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupPolicyInfoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendThresholdDecisionPolicy({ value, fee, memo }: sendThresholdDecisionPolicyParams): Promise { + async sendMsgCreateGroup({ value, fee, memo }: sendMsgCreateGroupParams): Promise { if (!signer) { - throw new Error('TxClient:sendThresholdDecisionPolicy: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateGroup: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.thresholdDecisionPolicy({ value: ThresholdDecisionPolicy.fromPartial(value) }) + let msg = this.msgCreateGroup({ value: MsgCreateGroup.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendThresholdDecisionPolicy: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateGroup: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupPolicyInfoRequest({ value, fee, memo }: sendQueryGroupPolicyInfoRequestParams): Promise { + async sendMsgUpdateGroupMetadata({ value, fee, memo }: sendMsgUpdateGroupMetadataParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupPolicyInfoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupMetadata: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupPolicyInfoRequest({ value: QueryGroupPolicyInfoRequest.fromPartial(value) }) + let msg = this.msgUpdateGroupMetadata({ value: MsgUpdateGroupMetadata.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupPolicyInfoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupMetadata: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVotesByVoterResponse({ value, fee, memo }: sendQueryVotesByVoterResponseParams): Promise { + async sendMsgCreateGroupPolicyResponse({ value, fee, memo }: sendMsgCreateGroupPolicyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVotesByVoterResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateGroupPolicyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVotesByVoterResponse({ value: QueryVotesByVoterResponse.fromPartial(value) }) + let msg = this.msgCreateGroupPolicyResponse({ value: MsgCreateGroupPolicyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVotesByVoterResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateGroupPolicyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalsByGroupPolicyRequest({ value, fee, memo }: sendQueryProposalsByGroupPolicyRequestParams): Promise { + async sendMsgUpdateGroupPolicyMetadata({ value, fee, memo }: sendMsgUpdateGroupPolicyMetadataParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalsByGroupPolicyRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupPolicyMetadata: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalsByGroupPolicyRequest({ value: QueryProposalsByGroupPolicyRequest.fromPartial(value) }) + let msg = this.msgUpdateGroupPolicyMetadata({ value: MsgUpdateGroupPolicyMetadata.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalsByGroupPolicyRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupPolicyMetadata: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateGroup({ value, fee, memo }: sendMsgCreateGroupParams): Promise { + async sendMsgVote({ value, fee, memo }: sendMsgVoteParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateGroup: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateGroup({ value: MsgCreateGroup.fromPartial(value) }) + let msg = this.msgVote({ value: MsgVote.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateGroup: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVoteResponse({ value, fee, memo }: sendMsgVoteResponseParams): Promise { + async sendEventProposalPruned({ value, fee, memo }: sendEventProposalPrunedParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVoteResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventProposalPruned: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVoteResponse({ value: MsgVoteResponse.fromPartial(value) }) + let msg = this.eventProposalPruned({ value: EventProposalPruned.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVoteResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventProposalPruned: Could not broadcast Tx: '+ e.message) } }, - async sendEventVote({ value, fee, memo }: sendEventVoteParams): Promise { + async sendQueryGroupsByAdminRequest({ value, fee, memo }: sendQueryGroupsByAdminRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventVote: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupsByAdminRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventVote({ value: EventVote.fromPartial(value) }) + let msg = this.queryGroupsByAdminRequest({ value: QueryGroupsByAdminRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventVote: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupsByAdminRequest: Could not broadcast Tx: '+ e.message) } }, - async sendEventExec({ value, fee, memo }: sendEventExecParams): Promise { + async sendMember({ value, fee, memo }: sendMemberParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventExec: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMember: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventExec({ value: EventExec.fromPartial(value) }) + let msg = this.member({ value: Member.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventExec: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMember: Could not broadcast Tx: '+ e.message) } }, - async sendGroupPolicyInfo({ value, fee, memo }: sendGroupPolicyInfoParams): Promise { + async sendMsgExec({ value, fee, memo }: sendMsgExecParams): Promise { if (!signer) { - throw new Error('TxClient:sendGroupPolicyInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgExec: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.groupPolicyInfo({ value: GroupPolicyInfo.fromPartial(value) }) + let msg = this.msgExec({ value: MsgExec.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGroupPolicyInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgExec: Could not broadcast Tx: '+ e.message) } }, @@ -1627,31 +1655,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryGroupPoliciesByAdminResponse({ value, fee, memo }: sendQueryGroupPoliciesByAdminResponseParams): Promise { + async sendQueryGroupPoliciesByGroupRequest({ value, fee, memo }: sendQueryGroupPoliciesByGroupRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupPoliciesByAdminResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupPoliciesByGroupRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupPoliciesByAdminResponse({ value: QueryGroupPoliciesByAdminResponse.fromPartial(value) }) + let msg = this.queryGroupPoliciesByGroupRequest({ value: QueryGroupPoliciesByGroupRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupPoliciesByAdminResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupPoliciesByGroupRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateGroupResponse({ value, fee, memo }: sendMsgCreateGroupResponseParams): Promise { + async sendMsgUpdateGroupAdminResponse({ value, fee, memo }: sendMsgUpdateGroupAdminResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateGroupResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupAdminResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateGroupResponse({ value: MsgCreateGroupResponse.fromPartial(value) }) + let msg = this.msgUpdateGroupAdminResponse({ value: MsgUpdateGroupAdminResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateGroupResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupAdminResponse: Could not broadcast Tx: '+ e.message) } }, @@ -1669,171 +1697,157 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendEventProposalPruned({ value, fee, memo }: sendEventProposalPrunedParams): Promise { - if (!signer) { - throw new Error('TxClient:sendEventProposalPruned: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventProposalPruned({ value: EventProposalPruned.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendEventProposalPruned: Could not broadcast Tx: '+ e.message) - } - }, - - async sendMsgUpdateGroupPolicyMetadata({ value, fee, memo }: sendMsgUpdateGroupPolicyMetadataParams): Promise { + async sendMsgWithdrawProposalResponse({ value, fee, memo }: sendMsgWithdrawProposalResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyMetadata: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgWithdrawProposalResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupPolicyMetadata({ value: MsgUpdateGroupPolicyMetadata.fromPartial(value) }) + let msg = this.msgWithdrawProposalResponse({ value: MsgWithdrawProposalResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyMetadata: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgWithdrawProposalResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgLeaveGroupResponse({ value, fee, memo }: sendMsgLeaveGroupResponseParams): Promise { + async sendThresholdDecisionPolicy({ value, fee, memo }: sendThresholdDecisionPolicyParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgLeaveGroupResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendThresholdDecisionPolicy: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgLeaveGroupResponse({ value: MsgLeaveGroupResponse.fromPartial(value) }) + let msg = this.thresholdDecisionPolicy({ value: ThresholdDecisionPolicy.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgLeaveGroupResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendThresholdDecisionPolicy: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupPoliciesByGroupResponse({ value, fee, memo }: sendQueryGroupPoliciesByGroupResponseParams): Promise { + async sendGroupPolicyInfo({ value, fee, memo }: sendGroupPolicyInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupPoliciesByGroupResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGroupPolicyInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupPoliciesByGroupResponse({ value: QueryGroupPoliciesByGroupResponse.fromPartial(value) }) + let msg = this.groupPolicyInfo({ value: GroupPolicyInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupPoliciesByGroupResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGroupPolicyInfo: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupPoliciesByAdminRequest({ value, fee, memo }: sendQueryGroupPoliciesByAdminRequestParams): Promise { + async sendQueryProposalRequest({ value, fee, memo }: sendQueryProposalRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupPoliciesByAdminRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupPoliciesByAdminRequest({ value: QueryGroupPoliciesByAdminRequest.fromPartial(value) }) + let msg = this.queryProposalRequest({ value: QueryProposalRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupPoliciesByAdminRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupsByMemberResponse({ value, fee, memo }: sendQueryGroupsByMemberResponseParams): Promise { + async sendQueryGroupsRequest({ value, fee, memo }: sendQueryGroupsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupsByMemberResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupsByMemberResponse({ value: QueryGroupsByMemberResponse.fromPartial(value) }) + let msg = this.queryGroupsRequest({ value: QueryGroupsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupsByMemberResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateGroupWithPolicyResponse({ value, fee, memo }: sendMsgCreateGroupWithPolicyResponseParams): Promise { + async sendQueryVotesByProposalResponse({ value, fee, memo }: sendQueryVotesByProposalResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateGroupWithPolicyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVotesByProposalResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateGroupWithPolicyResponse({ value: MsgCreateGroupWithPolicyResponse.fromPartial(value) }) + let msg = this.queryVotesByProposalResponse({ value: QueryVotesByProposalResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateGroupWithPolicyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVotesByProposalResponse: Could not broadcast Tx: '+ e.message) } }, - async sendVote({ value, fee, memo }: sendVoteParams): Promise { + async sendQueryVotesByVoterResponse({ value, fee, memo }: sendQueryVotesByVoterResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendVote: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVotesByVoterResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.vote({ value: Vote.fromPartial(value) }) + let msg = this.queryVotesByVoterResponse({ value: QueryVotesByVoterResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendVote: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVotesByVoterResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalResponse({ value, fee, memo }: sendQueryProposalResponseParams): Promise { + async sendQueryTallyResultRequest({ value, fee, memo }: sendQueryTallyResultRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTallyResultRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalResponse({ value: QueryProposalResponse.fromPartial(value) }) + let msg = this.queryTallyResultRequest({ value: QueryTallyResultRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTallyResultRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGroupPolicyMetadataResponse({ value, fee, memo }: sendMsgUpdateGroupPolicyMetadataResponseParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyMetadataResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupPolicyMetadataResponse({ value: MsgUpdateGroupPolicyMetadataResponse.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyMetadataResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendMsgVote({ value, fee, memo }: sendMsgVoteParams): Promise { + async sendMsgUpdateGroupMembersResponse({ value, fee, memo }: sendMsgUpdateGroupMembersResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupMembersResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgVote({ value: MsgVote.fromPartial(value) }) + let msg = this.msgUpdateGroupMembersResponse({ value: MsgUpdateGroupMembersResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupMembersResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalRequest({ value, fee, memo }: sendQueryProposalRequestParams): Promise { + async sendMsgUpdateGroupPolicyAdmin({ value, fee, memo }: sendMsgUpdateGroupPolicyAdminParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupPolicyAdmin: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalRequest({ value: QueryProposalRequest.fromPartial(value) }) + let msg = this.msgUpdateGroupPolicyAdmin({ value: MsgUpdateGroupPolicyAdmin.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupPolicyAdmin: Could not broadcast Tx: '+ e.message) } }, @@ -1851,208 +1865,186 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendEventLeaveGroup({ value, fee, memo }: sendEventLeaveGroupParams): Promise { - if (!signer) { - throw new Error('TxClient:sendEventLeaveGroup: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventLeaveGroup({ value: EventLeaveGroup.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendEventLeaveGroup: Could not broadcast Tx: '+ e.message) - } - }, - - async sendQueryVotesByProposalRequest({ value, fee, memo }: sendQueryVotesByProposalRequestParams): Promise { + async sendQueryProposalResponse({ value, fee, memo }: sendQueryProposalResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVotesByProposalRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryProposalResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVotesByProposalRequest({ value: QueryVotesByProposalRequest.fromPartial(value) }) + let msg = this.queryProposalResponse({ value: QueryProposalResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVotesByProposalRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryProposalResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGroupMetadata({ value, fee, memo }: sendMsgUpdateGroupMetadataParams): Promise { + async sendMsgWithdrawProposal({ value, fee, memo }: sendMsgWithdrawProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupMetadata: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgWithdrawProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupMetadata({ value: MsgUpdateGroupMetadata.fromPartial(value) }) + let msg = this.msgWithdrawProposal({ value: MsgWithdrawProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupMetadata: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgWithdrawProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateGroupPolicyResponse({ value, fee, memo }: sendMsgCreateGroupPolicyResponseParams): Promise { + async sendGroupMember({ value, fee, memo }: sendGroupMemberParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateGroupPolicyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGroupMember: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateGroupPolicyResponse({ value: MsgCreateGroupPolicyResponse.fromPartial(value) }) + let msg = this.groupMember({ value: GroupMember.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateGroupPolicyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGroupMember: Could not broadcast Tx: '+ e.message) } }, - async sendPercentageDecisionPolicy({ value, fee, memo }: sendPercentageDecisionPolicyParams): Promise { + async sendMsgUpdateGroupPolicyDecisionPolicyResponse({ value, fee, memo }: sendMsgUpdateGroupPolicyDecisionPolicyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendPercentageDecisionPolicy: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupPolicyDecisionPolicyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.percentageDecisionPolicy({ value: PercentageDecisionPolicy.fromPartial(value) }) + let msg = this.msgUpdateGroupPolicyDecisionPolicyResponse({ value: MsgUpdateGroupPolicyDecisionPolicyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPercentageDecisionPolicy: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupPolicyDecisionPolicyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupInfoResponse({ value, fee, memo }: sendQueryGroupInfoResponseParams): Promise { + async sendMsgUpdateGroupPolicyMetadataResponse({ value, fee, memo }: sendMsgUpdateGroupPolicyMetadataResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupInfoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateGroupPolicyMetadataResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupInfoResponse({ value: QueryGroupInfoResponse.fromPartial(value) }) + let msg = this.msgUpdateGroupPolicyMetadataResponse({ value: MsgUpdateGroupPolicyMetadataResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupInfoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateGroupPolicyMetadataResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGroupPoliciesByGroupRequest({ value, fee, memo }: sendQueryGroupPoliciesByGroupRequestParams): Promise { + async sendMsgSubmitProposal({ value, fee, memo }: sendMsgSubmitProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGroupPoliciesByGroupRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGroupPoliciesByGroupRequest({ value: QueryGroupPoliciesByGroupRequest.fromPartial(value) }) + let msg = this.msgSubmitProposal({ value: MsgSubmitProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGroupPoliciesByGroupRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitProposal: Could not broadcast Tx: '+ e.message) } }, - async sendQueryProposalsByGroupPolicyResponse({ value, fee, memo }: sendQueryProposalsByGroupPolicyResponseParams): Promise { + async sendMsgVoteResponse({ value, fee, memo }: sendMsgVoteResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryProposalsByGroupPolicyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgVoteResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryProposalsByGroupPolicyResponse({ value: QueryProposalsByGroupPolicyResponse.fromPartial(value) }) + let msg = this.msgVoteResponse({ value: MsgVoteResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryProposalsByGroupPolicyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgVoteResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVoteByProposalVoterRequest({ value, fee, memo }: sendQueryVoteByProposalVoterRequestParams): Promise { + async sendEventUpdateGroupPolicy({ value, fee, memo }: sendEventUpdateGroupPolicyParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVoteByProposalVoterRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventUpdateGroupPolicy: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVoteByProposalVoterRequest({ value: QueryVoteByProposalVoterRequest.fromPartial(value) }) + let msg = this.eventUpdateGroupPolicy({ value: EventUpdateGroupPolicy.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVoteByProposalVoterRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventUpdateGroupPolicy: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGroupPolicyDecisionPolicy({ value, fee, memo }: sendMsgUpdateGroupPolicyDecisionPolicyParams): Promise { + async sendQueryGroupPoliciesByGroupResponse({ value, fee, memo }: sendQueryGroupPoliciesByGroupResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyDecisionPolicy: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGroupPoliciesByGroupResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateGroupPolicyDecisionPolicy({ value: MsgUpdateGroupPolicyDecisionPolicy.fromPartial(value) }) + let msg = this.queryGroupPoliciesByGroupResponse({ value: QueryGroupPoliciesByGroupResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGroupPolicyDecisionPolicy: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGroupPoliciesByGroupResponse: Could not broadcast Tx: '+ e.message) } }, - queryGroupMembersResponse({ value }: queryGroupMembersResponseParams): EncodeObject { - try { - return { typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", value: QueryGroupMembersResponse.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:QueryGroupMembersResponse: Could not create message: ' + e.message) - } - }, - - msgUpdateGroupPolicyAdminResponse({ value }: msgUpdateGroupPolicyAdminResponseParams): EncodeObject { + msgCreateGroupResponse({ value }: msgCreateGroupResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", value: MsgUpdateGroupPolicyAdminResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", value: MsgCreateGroupResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupPolicyAdminResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateGroupResponse: Could not create message: ' + e.message) } }, - msgWithdrawProposalResponse({ value }: msgWithdrawProposalResponseParams): EncodeObject { + groupInfo({ value }: groupInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", value: MsgWithdrawProposalResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.GroupInfo", value: GroupInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgWithdrawProposalResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GroupInfo: Could not create message: ' + e.message) } }, - queryGroupInfoRequest({ value }: queryGroupInfoRequestParams): EncodeObject { + eventVote({ value }: eventVoteParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", value: QueryGroupInfoRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.EventVote", value: EventVote.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupInfoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:EventVote: Could not create message: ' + e.message) } }, - queryGroupsByAdminResponse({ value }: queryGroupsByAdminResponseParams): EncodeObject { + queryVoteByProposalVoterResponse({ value }: queryVoteByProposalVoterResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", value: QueryGroupsByAdminResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", value: QueryVoteByProposalVoterResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupsByAdminResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVoteByProposalVoterResponse: Could not create message: ' + e.message) } }, - msgUpdateGroupMembersResponse({ value }: msgUpdateGroupMembersResponseParams): EncodeObject { + eventLeaveGroup({ value }: eventLeaveGroupParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", value: MsgUpdateGroupMembersResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.EventLeaveGroup", value: EventLeaveGroup.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupMembersResponse: Could not create message: ' + e.message) + throw new Error('TxClient:EventLeaveGroup: Could not create message: ' + e.message) } }, - eventCreateGroup({ value }: eventCreateGroupParams): EncodeObject { + queryGroupPoliciesByAdminRequest({ value }: queryGroupPoliciesByAdminRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.EventCreateGroup", value: EventCreateGroup.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", value: QueryGroupPoliciesByAdminRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventCreateGroup: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupPoliciesByAdminRequest: Could not create message: ' + e.message) } }, - msgUpdateGroupMetadataResponse({ value }: msgUpdateGroupMetadataResponseParams): EncodeObject { + msgCreateGroupWithPolicy({ value }: msgCreateGroupWithPolicyParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", value: MsgUpdateGroupMetadataResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", value: MsgCreateGroupWithPolicy.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupMetadataResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateGroupWithPolicy: Could not create message: ' + e.message) } }, @@ -2064,27 +2056,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - member({ value }: memberParams): EncodeObject { + eventExec({ value }: eventExecParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.Member", value: Member.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.EventExec", value: EventExec.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Member: Could not create message: ' + e.message) + throw new Error('TxClient:EventExec: Could not create message: ' + e.message) } }, - groupMember({ value }: groupMemberParams): EncodeObject { + percentageDecisionPolicy({ value }: percentageDecisionPolicyParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.GroupMember", value: GroupMember.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", value: PercentageDecisionPolicy.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GroupMember: Could not create message: ' + e.message) + throw new Error('TxClient:PercentageDecisionPolicy: Could not create message: ' + e.message) } }, - proposal({ value }: proposalParams): EncodeObject { + eventSubmitProposal({ value }: eventSubmitProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.Proposal", value: Proposal.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.EventSubmitProposal", value: EventSubmitProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Proposal: Could not create message: ' + e.message) + throw new Error('TxClient:EventSubmitProposal: Could not create message: ' + e.message) } }, @@ -2096,107 +2088,131 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgUpdateGroupAdminResponse({ value }: msgUpdateGroupAdminResponseParams): EncodeObject { + msgLeaveGroupResponse({ value }: msgLeaveGroupResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", value: MsgUpdateGroupAdminResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", value: MsgLeaveGroupResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupAdminResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgLeaveGroupResponse: Could not create message: ' + e.message) } }, - queryVotesByProposalResponse({ value }: queryVotesByProposalResponseParams): EncodeObject { + queryVotesByVoterRequest({ value }: queryVotesByVoterRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", value: QueryVotesByProposalResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", value: QueryVotesByVoterRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVotesByProposalResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVotesByVoterRequest: Could not create message: ' + e.message) } }, - queryGroupsByMemberRequest({ value }: queryGroupsByMemberRequestParams): EncodeObject { + msgUpdateGroupPolicyDecisionPolicy({ value }: msgUpdateGroupPolicyDecisionPolicyParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", value: QueryGroupsByMemberRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", value: MsgUpdateGroupPolicyDecisionPolicy.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupsByMemberRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupPolicyDecisionPolicy: Could not create message: ' + e.message) } }, - queryTallyResultRequest({ value }: queryTallyResultRequestParams): EncodeObject { + queryGroupMembersRequest({ value }: queryGroupMembersRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", value: QueryTallyResultRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", value: QueryGroupMembersRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTallyResultRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupMembersRequest: Could not create message: ' + e.message) } }, - msgLeaveGroup({ value }: msgLeaveGroupParams): EncodeObject { + queryGroupPoliciesByAdminResponse({ value }: queryGroupPoliciesByAdminResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", value: MsgLeaveGroup.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", value: QueryGroupPoliciesByAdminResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgLeaveGroup: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupPoliciesByAdminResponse: Could not create message: ' + e.message) } }, - decisionPolicyWindows({ value }: decisionPolicyWindowsParams): EncodeObject { + msgCreateGroupWithPolicyResponse({ value }: msgCreateGroupWithPolicyResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", value: DecisionPolicyWindows.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", value: MsgCreateGroupWithPolicyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DecisionPolicyWindows: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateGroupWithPolicyResponse: Could not create message: ' + e.message) } }, - queryGroupPolicyInfoResponse({ value }: queryGroupPolicyInfoResponseParams): EncodeObject { + eventCreateGroup({ value }: eventCreateGroupParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", value: QueryGroupPolicyInfoResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.EventCreateGroup", value: EventCreateGroup.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupPolicyInfoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:EventCreateGroup: Could not create message: ' + e.message) } }, - msgCreateGroupWithPolicy({ value }: msgCreateGroupWithPolicyParams): EncodeObject { + queryGroupInfoRequest({ value }: queryGroupInfoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", value: MsgCreateGroupWithPolicy.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", value: QueryGroupInfoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateGroupWithPolicy: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupInfoRequest: Could not create message: ' + e.message) } }, - msgExec({ value }: msgExecParams): EncodeObject { + msgUpdateGroupMetadataResponse({ value }: msgUpdateGroupMetadataResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgExec", value: MsgExec.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", value: MsgUpdateGroupMetadataResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgExec: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupMetadataResponse: Could not create message: ' + e.message) } }, - msgExecResponse({ value }: msgExecResponseParams): EncodeObject { + memberRequest({ value }: memberRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgExecResponse", value: MsgExecResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MemberRequest", value: MemberRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgExecResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MemberRequest: Could not create message: ' + e.message) } }, - queryGroupsRequest({ value }: queryGroupsRequestParams): EncodeObject { + decisionPolicyWindows({ value }: decisionPolicyWindowsParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupsRequest", value: QueryGroupsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", value: DecisionPolicyWindows.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:DecisionPolicyWindows: Could not create message: ' + e.message) } }, - msgSubmitProposalResponse({ value }: msgSubmitProposalResponseParams): EncodeObject { + queryGroupsByAdminResponse({ value }: queryGroupsByAdminResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", value: QueryGroupsByAdminResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitProposalResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupsByAdminResponse: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryGroupsResponse({ value }: queryGroupsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupsResponse", value: QueryGroupsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupsResponse: Could not create message: ' + e.message) + } + }, + + msgExecResponse({ value }: msgExecResponseParams): EncodeObject { + try { + return { typeUrl: "/cosmos.group.v1.MsgExecResponse", value: MsgExecResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgExecResponse: Could not create message: ' + e.message) + } + }, + + vote({ value }: voteParams): EncodeObject { + try { + return { typeUrl: "/cosmos.group.v1.Vote", value: Vote.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:Vote: Could not create message: ' + e.message) + } + }, + + queryGroupsByMemberRequest({ value }: queryGroupsByMemberRequestParams): EncodeObject { + try { + return { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", value: QueryGroupsByMemberRequest.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryGroupsByMemberRequest: Could not create message: ' + e.message) } }, @@ -2208,195 +2224,195 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgUpdateGroupPolicyDecisionPolicyResponse({ value }: msgUpdateGroupPolicyDecisionPolicyResponseParams): EncodeObject { + queryGroupMembersResponse({ value }: queryGroupMembersResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", value: MsgUpdateGroupPolicyDecisionPolicyResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", value: QueryGroupMembersResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupPolicyDecisionPolicyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupMembersResponse: Could not create message: ' + e.message) } }, - msgSubmitProposal({ value }: msgSubmitProposalParams): EncodeObject { + queryProposalsByGroupPolicyResponse({ value }: queryProposalsByGroupPolicyResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", value: QueryProposalsByGroupPolicyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitProposal: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalsByGroupPolicyResponse: Could not create message: ' + e.message) } }, - msgWithdrawProposal({ value }: msgWithdrawProposalParams): EncodeObject { + queryVotesByProposalRequest({ value }: queryVotesByProposalRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", value: MsgWithdrawProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", value: QueryVotesByProposalRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgWithdrawProposal: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVotesByProposalRequest: Could not create message: ' + e.message) } }, - eventCreateGroupPolicy({ value }: eventCreateGroupPolicyParams): EncodeObject { + proposal({ value }: proposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", value: EventCreateGroupPolicy.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.Proposal", value: Proposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventCreateGroupPolicy: Could not create message: ' + e.message) + throw new Error('TxClient:Proposal: Could not create message: ' + e.message) } }, - eventUpdateGroupPolicy({ value }: eventUpdateGroupPolicyParams): EncodeObject { + msgUpdateGroupPolicyAdminResponse({ value }: msgUpdateGroupPolicyAdminResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", value: EventUpdateGroupPolicy.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", value: MsgUpdateGroupPolicyAdminResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventUpdateGroupPolicy: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupPolicyAdminResponse: Could not create message: ' + e.message) } }, - memberRequest({ value }: memberRequestParams): EncodeObject { + msgSubmitProposalResponse({ value }: msgSubmitProposalResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MemberRequest", value: MemberRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MemberRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitProposalResponse: Could not create message: ' + e.message) } }, - queryGroupsResponse({ value }: queryGroupsResponseParams): EncodeObject { + queryGroupInfoResponse({ value }: queryGroupInfoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupsResponse", value: QueryGroupsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", value: QueryGroupInfoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupInfoResponse: Could not create message: ' + e.message) } }, - msgUpdateGroupMembers({ value }: msgUpdateGroupMembersParams): EncodeObject { + queryGroupPolicyInfoRequest({ value }: queryGroupPolicyInfoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", value: MsgUpdateGroupMembers.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", value: QueryGroupPolicyInfoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupMembers: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupPolicyInfoRequest: Could not create message: ' + e.message) } }, - msgUpdateGroupPolicyAdmin({ value }: msgUpdateGroupPolicyAdminParams): EncodeObject { + queryProposalsByGroupPolicyRequest({ value }: queryProposalsByGroupPolicyRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", value: MsgUpdateGroupPolicyAdmin.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", value: QueryProposalsByGroupPolicyRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupPolicyAdmin: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalsByGroupPolicyRequest: Could not create message: ' + e.message) } }, - eventSubmitProposal({ value }: eventSubmitProposalParams): EncodeObject { + queryVoteByProposalVoterRequest({ value }: queryVoteByProposalVoterRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.EventSubmitProposal", value: EventSubmitProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", value: QueryVoteByProposalVoterRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventSubmitProposal: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVoteByProposalVoterRequest: Could not create message: ' + e.message) } }, - groupInfo({ value }: groupInfoParams): EncodeObject { + queryGroupsByMemberResponse({ value }: queryGroupsByMemberResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.GroupInfo", value: GroupInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", value: QueryGroupsByMemberResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GroupInfo: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupsByMemberResponse: Could not create message: ' + e.message) } }, - queryGroupMembersRequest({ value }: queryGroupMembersRequestParams): EncodeObject { + msgUpdateGroupMembers({ value }: msgUpdateGroupMembersParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", value: QueryGroupMembersRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", value: MsgUpdateGroupMembers.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupMembersRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupMembers: Could not create message: ' + e.message) } }, - queryGroupsByAdminRequest({ value }: queryGroupsByAdminRequestParams): EncodeObject { + msgLeaveGroup({ value }: msgLeaveGroupParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", value: QueryGroupsByAdminRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", value: MsgLeaveGroup.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupsByAdminRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgLeaveGroup: Could not create message: ' + e.message) } }, - queryVoteByProposalVoterResponse({ value }: queryVoteByProposalVoterResponseParams): EncodeObject { + eventCreateGroupPolicy({ value }: eventCreateGroupPolicyParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", value: QueryVoteByProposalVoterResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", value: EventCreateGroupPolicy.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVoteByProposalVoterResponse: Could not create message: ' + e.message) + throw new Error('TxClient:EventCreateGroupPolicy: Could not create message: ' + e.message) } }, - queryVotesByVoterRequest({ value }: queryVotesByVoterRequestParams): EncodeObject { + queryGroupPolicyInfoResponse({ value }: queryGroupPolicyInfoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", value: QueryVotesByVoterRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", value: QueryGroupPolicyInfoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVotesByVoterRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupPolicyInfoResponse: Could not create message: ' + e.message) } }, - thresholdDecisionPolicy({ value }: thresholdDecisionPolicyParams): EncodeObject { + msgCreateGroup({ value }: msgCreateGroupParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", value: ThresholdDecisionPolicy.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgCreateGroup", value: MsgCreateGroup.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ThresholdDecisionPolicy: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateGroup: Could not create message: ' + e.message) } }, - queryGroupPolicyInfoRequest({ value }: queryGroupPolicyInfoRequestParams): EncodeObject { + msgUpdateGroupMetadata({ value }: msgUpdateGroupMetadataParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", value: QueryGroupPolicyInfoRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", value: MsgUpdateGroupMetadata.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupPolicyInfoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupMetadata: Could not create message: ' + e.message) } }, - queryVotesByVoterResponse({ value }: queryVotesByVoterResponseParams): EncodeObject { + msgCreateGroupPolicyResponse({ value }: msgCreateGroupPolicyResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", value: QueryVotesByVoterResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", value: MsgCreateGroupPolicyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVotesByVoterResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateGroupPolicyResponse: Could not create message: ' + e.message) } }, - queryProposalsByGroupPolicyRequest({ value }: queryProposalsByGroupPolicyRequestParams): EncodeObject { + msgUpdateGroupPolicyMetadata({ value }: msgUpdateGroupPolicyMetadataParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", value: QueryProposalsByGroupPolicyRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", value: MsgUpdateGroupPolicyMetadata.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalsByGroupPolicyRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupPolicyMetadata: Could not create message: ' + e.message) } }, - msgCreateGroup({ value }: msgCreateGroupParams): EncodeObject { + msgVote({ value }: msgVoteParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgCreateGroup", value: MsgCreateGroup.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgVote", value: MsgVote.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateGroup: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVote: Could not create message: ' + e.message) } }, - msgVoteResponse({ value }: msgVoteResponseParams): EncodeObject { + eventProposalPruned({ value }: eventProposalPrunedParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgVoteResponse", value: MsgVoteResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.EventProposalPruned", value: EventProposalPruned.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVoteResponse: Could not create message: ' + e.message) + throw new Error('TxClient:EventProposalPruned: Could not create message: ' + e.message) } }, - eventVote({ value }: eventVoteParams): EncodeObject { + queryGroupsByAdminRequest({ value }: queryGroupsByAdminRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.EventVote", value: EventVote.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", value: QueryGroupsByAdminRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventVote: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupsByAdminRequest: Could not create message: ' + e.message) } }, - eventExec({ value }: eventExecParams): EncodeObject { + member({ value }: memberParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.EventExec", value: EventExec.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.Member", value: Member.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventExec: Could not create message: ' + e.message) + throw new Error('TxClient:Member: Could not create message: ' + e.message) } }, - groupPolicyInfo({ value }: groupPolicyInfoParams): EncodeObject { + msgExec({ value }: msgExecParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.GroupPolicyInfo", value: GroupPolicyInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgExec", value: MsgExec.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GroupPolicyInfo: Could not create message: ' + e.message) + throw new Error('TxClient:MsgExec: Could not create message: ' + e.message) } }, @@ -2408,19 +2424,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryGroupPoliciesByAdminResponse({ value }: queryGroupPoliciesByAdminResponseParams): EncodeObject { + queryGroupPoliciesByGroupRequest({ value }: queryGroupPoliciesByGroupRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", value: QueryGroupPoliciesByAdminResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", value: QueryGroupPoliciesByGroupRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupPoliciesByAdminResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupPoliciesByGroupRequest: Could not create message: ' + e.message) } }, - msgCreateGroupResponse({ value }: msgCreateGroupResponseParams): EncodeObject { + msgUpdateGroupAdminResponse({ value }: msgUpdateGroupAdminResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", value: MsgCreateGroupResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", value: MsgUpdateGroupAdminResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateGroupResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupAdminResponse: Could not create message: ' + e.message) } }, @@ -2432,99 +2448,91 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - eventProposalPruned({ value }: eventProposalPrunedParams): EncodeObject { - try { - return { typeUrl: "/cosmos.group.v1.EventProposalPruned", value: EventProposalPruned.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:EventProposalPruned: Could not create message: ' + e.message) - } - }, - - msgUpdateGroupPolicyMetadata({ value }: msgUpdateGroupPolicyMetadataParams): EncodeObject { + msgWithdrawProposalResponse({ value }: msgWithdrawProposalResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", value: MsgUpdateGroupPolicyMetadata.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", value: MsgWithdrawProposalResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupPolicyMetadata: Could not create message: ' + e.message) + throw new Error('TxClient:MsgWithdrawProposalResponse: Could not create message: ' + e.message) } }, - msgLeaveGroupResponse({ value }: msgLeaveGroupResponseParams): EncodeObject { + thresholdDecisionPolicy({ value }: thresholdDecisionPolicyParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", value: MsgLeaveGroupResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", value: ThresholdDecisionPolicy.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgLeaveGroupResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ThresholdDecisionPolicy: Could not create message: ' + e.message) } }, - queryGroupPoliciesByGroupResponse({ value }: queryGroupPoliciesByGroupResponseParams): EncodeObject { + groupPolicyInfo({ value }: groupPolicyInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", value: QueryGroupPoliciesByGroupResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.GroupPolicyInfo", value: GroupPolicyInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupPoliciesByGroupResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GroupPolicyInfo: Could not create message: ' + e.message) } }, - queryGroupPoliciesByAdminRequest({ value }: queryGroupPoliciesByAdminRequestParams): EncodeObject { + queryProposalRequest({ value }: queryProposalRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", value: QueryGroupPoliciesByAdminRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryProposalRequest", value: QueryProposalRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupPoliciesByAdminRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalRequest: Could not create message: ' + e.message) } }, - queryGroupsByMemberResponse({ value }: queryGroupsByMemberResponseParams): EncodeObject { + queryGroupsRequest({ value }: queryGroupsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", value: QueryGroupsByMemberResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupsRequest", value: QueryGroupsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupsByMemberResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupsRequest: Could not create message: ' + e.message) } }, - msgCreateGroupWithPolicyResponse({ value }: msgCreateGroupWithPolicyResponseParams): EncodeObject { + queryVotesByProposalResponse({ value }: queryVotesByProposalResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", value: MsgCreateGroupWithPolicyResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", value: QueryVotesByProposalResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateGroupWithPolicyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVotesByProposalResponse: Could not create message: ' + e.message) } }, - vote({ value }: voteParams): EncodeObject { + queryVotesByVoterResponse({ value }: queryVotesByVoterResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.Vote", value: Vote.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", value: QueryVotesByVoterResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Vote: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVotesByVoterResponse: Could not create message: ' + e.message) } }, - queryProposalResponse({ value }: queryProposalResponseParams): EncodeObject { + queryTallyResultRequest({ value }: queryTallyResultRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryProposalResponse", value: QueryProposalResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", value: QueryTallyResultRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTallyResultRequest: Could not create message: ' + e.message) } }, - msgUpdateGroupPolicyMetadataResponse({ value }: msgUpdateGroupPolicyMetadataResponseParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", value: MsgUpdateGroupPolicyMetadataResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupPolicyMetadataResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - msgVote({ value }: msgVoteParams): EncodeObject { + msgUpdateGroupMembersResponse({ value }: msgUpdateGroupMembersResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgVote", value: MsgVote.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", value: MsgUpdateGroupMembersResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgVote: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupMembersResponse: Could not create message: ' + e.message) } }, - queryProposalRequest({ value }: queryProposalRequestParams): EncodeObject { + msgUpdateGroupPolicyAdmin({ value }: msgUpdateGroupPolicyAdminParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryProposalRequest", value: QueryProposalRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", value: MsgUpdateGroupPolicyAdmin.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupPolicyAdmin: Could not create message: ' + e.message) } }, @@ -2536,83 +2544,75 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - eventLeaveGroup({ value }: eventLeaveGroupParams): EncodeObject { - try { - return { typeUrl: "/cosmos.group.v1.EventLeaveGroup", value: EventLeaveGroup.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:EventLeaveGroup: Could not create message: ' + e.message) - } - }, - - queryVotesByProposalRequest({ value }: queryVotesByProposalRequestParams): EncodeObject { + queryProposalResponse({ value }: queryProposalResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", value: QueryVotesByProposalRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryProposalResponse", value: QueryProposalResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVotesByProposalRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryProposalResponse: Could not create message: ' + e.message) } }, - msgUpdateGroupMetadata({ value }: msgUpdateGroupMetadataParams): EncodeObject { + msgWithdrawProposal({ value }: msgWithdrawProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", value: MsgUpdateGroupMetadata.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", value: MsgWithdrawProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupMetadata: Could not create message: ' + e.message) + throw new Error('TxClient:MsgWithdrawProposal: Could not create message: ' + e.message) } }, - msgCreateGroupPolicyResponse({ value }: msgCreateGroupPolicyResponseParams): EncodeObject { + groupMember({ value }: groupMemberParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", value: MsgCreateGroupPolicyResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.GroupMember", value: GroupMember.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateGroupPolicyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GroupMember: Could not create message: ' + e.message) } }, - percentageDecisionPolicy({ value }: percentageDecisionPolicyParams): EncodeObject { + msgUpdateGroupPolicyDecisionPolicyResponse({ value }: msgUpdateGroupPolicyDecisionPolicyResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", value: PercentageDecisionPolicy.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", value: MsgUpdateGroupPolicyDecisionPolicyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:PercentageDecisionPolicy: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupPolicyDecisionPolicyResponse: Could not create message: ' + e.message) } }, - queryGroupInfoResponse({ value }: queryGroupInfoResponseParams): EncodeObject { + msgUpdateGroupPolicyMetadataResponse({ value }: msgUpdateGroupPolicyMetadataResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", value: QueryGroupInfoResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", value: MsgUpdateGroupPolicyMetadataResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupInfoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateGroupPolicyMetadataResponse: Could not create message: ' + e.message) } }, - queryGroupPoliciesByGroupRequest({ value }: queryGroupPoliciesByGroupRequestParams): EncodeObject { + msgSubmitProposal({ value }: msgSubmitProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", value: QueryGroupPoliciesByGroupRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGroupPoliciesByGroupRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitProposal: Could not create message: ' + e.message) } }, - queryProposalsByGroupPolicyResponse({ value }: queryProposalsByGroupPolicyResponseParams): EncodeObject { + msgVoteResponse({ value }: msgVoteResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", value: QueryProposalsByGroupPolicyResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.MsgVoteResponse", value: MsgVoteResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryProposalsByGroupPolicyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgVoteResponse: Could not create message: ' + e.message) } }, - queryVoteByProposalVoterRequest({ value }: queryVoteByProposalVoterRequestParams): EncodeObject { + eventUpdateGroupPolicy({ value }: eventUpdateGroupPolicyParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", value: QueryVoteByProposalVoterRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", value: EventUpdateGroupPolicy.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVoteByProposalVoterRequest: Could not create message: ' + e.message) + throw new Error('TxClient:EventUpdateGroupPolicy: Could not create message: ' + e.message) } }, - msgUpdateGroupPolicyDecisionPolicy({ value }: msgUpdateGroupPolicyDecisionPolicyParams): EncodeObject { + queryGroupPoliciesByGroupResponse({ value }: queryGroupPoliciesByGroupResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", value: MsgUpdateGroupPolicyDecisionPolicy.fromPartial( value ) } + return { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", value: QueryGroupPoliciesByGroupResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGroupPolicyDecisionPolicy: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGroupPoliciesByGroupResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.group.v1/registry.ts b/ts-client/cosmos.group.v1/registry.ts index 21ad2939..47e41880 100755 --- a/ts-client/cosmos.group.v1/registry.ts +++ b/ts-client/cosmos.group.v1/registry.ts @@ -1,162 +1,162 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { QueryGroupMembersResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupPolicyAdminResponse } from "./types/cosmos/group/v1/tx"; -import { MsgWithdrawProposalResponse } from "./types/cosmos/group/v1/tx"; -import { QueryGroupInfoRequest } from "./types/cosmos/group/v1/query"; -import { QueryGroupsByAdminResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupMembersResponse } from "./types/cosmos/group/v1/tx"; -import { EventCreateGroup } from "./types/cosmos/group/v1/events"; -import { MsgUpdateGroupMetadataResponse } from "./types/cosmos/group/v1/tx"; -import { EventUpdateGroup } from "./types/cosmos/group/v1/events"; -import { Member } from "./types/cosmos/group/v1/types"; -import { GroupMember } from "./types/cosmos/group/v1/types"; -import { Proposal } from "./types/cosmos/group/v1/types"; -import { QueryTallyResultResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupAdminResponse } from "./types/cosmos/group/v1/tx"; -import { QueryVotesByProposalResponse } from "./types/cosmos/group/v1/query"; -import { QueryGroupsByMemberRequest } from "./types/cosmos/group/v1/query"; -import { QueryTallyResultRequest } from "./types/cosmos/group/v1/query"; -import { MsgLeaveGroup } from "./types/cosmos/group/v1/tx"; -import { DecisionPolicyWindows } from "./types/cosmos/group/v1/types"; -import { QueryGroupPolicyInfoResponse } from "./types/cosmos/group/v1/query"; -import { MsgCreateGroupWithPolicy } from "./types/cosmos/group/v1/tx"; -import { MsgExec } from "./types/cosmos/group/v1/tx"; -import { MsgExecResponse } from "./types/cosmos/group/v1/tx"; -import { QueryGroupsRequest } from "./types/cosmos/group/v1/query"; -import { MsgSubmitProposalResponse } from "./types/cosmos/group/v1/tx"; -import { GenesisState } from "./types/cosmos/group/v1/genesis"; -import { MsgUpdateGroupAdmin } from "./types/cosmos/group/v1/tx"; -import { MsgUpdateGroupPolicyDecisionPolicyResponse } from "./types/cosmos/group/v1/tx"; -import { MsgSubmitProposal } from "./types/cosmos/group/v1/tx"; -import { MsgWithdrawProposal } from "./types/cosmos/group/v1/tx"; -import { EventCreateGroupPolicy } from "./types/cosmos/group/v1/events"; -import { EventUpdateGroupPolicy } from "./types/cosmos/group/v1/events"; -import { MemberRequest } from "./types/cosmos/group/v1/types"; -import { QueryGroupsResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupMembers } from "./types/cosmos/group/v1/tx"; -import { MsgUpdateGroupPolicyAdmin } from "./types/cosmos/group/v1/tx"; -import { EventSubmitProposal } from "./types/cosmos/group/v1/events"; -import { GroupInfo } from "./types/cosmos/group/v1/types"; -import { QueryGroupMembersRequest } from "./types/cosmos/group/v1/query"; -import { QueryGroupsByAdminRequest } from "./types/cosmos/group/v1/query"; -import { QueryVoteByProposalVoterResponse } from "./types/cosmos/group/v1/query"; -import { QueryVotesByVoterRequest } from "./types/cosmos/group/v1/query"; -import { ThresholdDecisionPolicy } from "./types/cosmos/group/v1/types"; -import { QueryGroupPolicyInfoRequest } from "./types/cosmos/group/v1/query"; -import { QueryVotesByVoterResponse } from "./types/cosmos/group/v1/query"; -import { QueryProposalsByGroupPolicyRequest } from "./types/cosmos/group/v1/query"; -import { MsgCreateGroup } from "./types/cosmos/group/v1/tx"; -import { MsgVoteResponse } from "./types/cosmos/group/v1/tx"; -import { EventVote } from "./types/cosmos/group/v1/events"; -import { EventExec } from "./types/cosmos/group/v1/events"; -import { GroupPolicyInfo } from "./types/cosmos/group/v1/types"; -import { TallyResult } from "./types/cosmos/group/v1/types"; -import { QueryGroupPoliciesByAdminResponse } from "./types/cosmos/group/v1/query"; -import { MsgCreateGroupResponse } from "./types/cosmos/group/v1/tx"; -import { MsgCreateGroupPolicy } from "./types/cosmos/group/v1/tx"; -import { EventProposalPruned } from "./types/cosmos/group/v1/events"; -import { MsgUpdateGroupPolicyMetadata } from "./types/cosmos/group/v1/tx"; -import { MsgLeaveGroupResponse } from "./types/cosmos/group/v1/tx"; -import { QueryGroupPoliciesByGroupResponse } from "./types/cosmos/group/v1/query"; -import { QueryGroupPoliciesByAdminRequest } from "./types/cosmos/group/v1/query"; -import { QueryGroupsByMemberResponse } from "./types/cosmos/group/v1/query"; -import { MsgCreateGroupWithPolicyResponse } from "./types/cosmos/group/v1/tx"; -import { Vote } from "./types/cosmos/group/v1/types"; -import { QueryProposalResponse } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupPolicyMetadataResponse } from "./types/cosmos/group/v1/tx"; -import { MsgVote } from "./types/cosmos/group/v1/tx"; -import { QueryProposalRequest } from "./types/cosmos/group/v1/query"; -import { EventWithdrawProposal } from "./types/cosmos/group/v1/events"; -import { EventLeaveGroup } from "./types/cosmos/group/v1/events"; -import { QueryVotesByProposalRequest } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupMetadata } from "./types/cosmos/group/v1/tx"; -import { MsgCreateGroupPolicyResponse } from "./types/cosmos/group/v1/tx"; -import { PercentageDecisionPolicy } from "./types/cosmos/group/v1/types"; -import { QueryGroupInfoResponse } from "./types/cosmos/group/v1/query"; -import { QueryGroupPoliciesByGroupRequest } from "./types/cosmos/group/v1/query"; -import { QueryProposalsByGroupPolicyResponse } from "./types/cosmos/group/v1/query"; -import { QueryVoteByProposalVoterRequest } from "./types/cosmos/group/v1/query"; -import { MsgUpdateGroupPolicyDecisionPolicy } from "./types/cosmos/group/v1/tx"; +import { MsgCreateGroupResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { GroupInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { EventVote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryVoteByProposalVoterResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { EventLeaveGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupPoliciesByAdminRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgCreateGroupWithPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventUpdateGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { EventExec } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { PercentageDecisionPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { EventSubmitProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryTallyResultResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgLeaveGroupResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { QueryVotesByVoterRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupPolicyDecisionPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { QueryGroupMembersRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupPoliciesByAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgCreateGroupWithPolicyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventCreateGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupMetadataResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MemberRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { DecisionPolicyWindows } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { QueryGroupsByAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgExecResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { Vote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { QueryGroupsByMemberRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupAdmin } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { QueryGroupMembersResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryProposalsByGroupPolicyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryVotesByProposalRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { Proposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { MsgUpdateGroupPolicyAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgSubmitProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { QueryGroupInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupPolicyInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryProposalsByGroupPolicyRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryVoteByProposalVoterRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupsByMemberResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupMembers } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgLeaveGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventCreateGroupPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupPolicyInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgCreateGroup } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgUpdateGroupMetadata } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgCreateGroupPolicyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgUpdateGroupPolicyMetadata } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgVote } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventProposalPruned } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupsByAdminRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { Member } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { MsgExec } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { TallyResult } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { QueryGroupPoliciesByGroupRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgUpdateGroupAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgCreateGroupPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgWithdrawProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { ThresholdDecisionPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { GroupPolicyInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { QueryProposalRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryGroupsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryVotesByProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryVotesByVoterResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { QueryTallyResultRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/genesis"; +import { MsgUpdateGroupMembersResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgUpdateGroupPolicyAdmin } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventWithdrawProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryProposalResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; +import { MsgWithdrawProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { GroupMember } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/types"; +import { MsgUpdateGroupPolicyDecisionPolicyResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgUpdateGroupPolicyMetadataResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgSubmitProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { MsgVoteResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/tx"; +import { EventUpdateGroupPolicy } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/events"; +import { QueryGroupPoliciesByGroupResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/group/v1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.group.v1.QueryGroupMembersResponse", QueryGroupMembersResponse], - ["/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", MsgUpdateGroupPolicyAdminResponse], - ["/cosmos.group.v1.MsgWithdrawProposalResponse", MsgWithdrawProposalResponse], - ["/cosmos.group.v1.QueryGroupInfoRequest", QueryGroupInfoRequest], - ["/cosmos.group.v1.QueryGroupsByAdminResponse", QueryGroupsByAdminResponse], - ["/cosmos.group.v1.MsgUpdateGroupMembersResponse", MsgUpdateGroupMembersResponse], - ["/cosmos.group.v1.EventCreateGroup", EventCreateGroup], - ["/cosmos.group.v1.MsgUpdateGroupMetadataResponse", MsgUpdateGroupMetadataResponse], + ["/cosmos.group.v1.MsgCreateGroupResponse", MsgCreateGroupResponse], + ["/cosmos.group.v1.GroupInfo", GroupInfo], + ["/cosmos.group.v1.EventVote", EventVote], + ["/cosmos.group.v1.QueryVoteByProposalVoterResponse", QueryVoteByProposalVoterResponse], + ["/cosmos.group.v1.EventLeaveGroup", EventLeaveGroup], + ["/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", QueryGroupPoliciesByAdminRequest], + ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.EventUpdateGroup", EventUpdateGroup], - ["/cosmos.group.v1.Member", Member], - ["/cosmos.group.v1.GroupMember", GroupMember], - ["/cosmos.group.v1.Proposal", Proposal], + ["/cosmos.group.v1.EventExec", EventExec], + ["/cosmos.group.v1.PercentageDecisionPolicy", PercentageDecisionPolicy], + ["/cosmos.group.v1.EventSubmitProposal", EventSubmitProposal], ["/cosmos.group.v1.QueryTallyResultResponse", QueryTallyResultResponse], - ["/cosmos.group.v1.MsgUpdateGroupAdminResponse", MsgUpdateGroupAdminResponse], - ["/cosmos.group.v1.QueryVotesByProposalResponse", QueryVotesByProposalResponse], - ["/cosmos.group.v1.QueryGroupsByMemberRequest", QueryGroupsByMemberRequest], - ["/cosmos.group.v1.QueryTallyResultRequest", QueryTallyResultRequest], - ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup], + ["/cosmos.group.v1.MsgLeaveGroupResponse", MsgLeaveGroupResponse], + ["/cosmos.group.v1.QueryVotesByVoterRequest", QueryVotesByVoterRequest], + ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], + ["/cosmos.group.v1.QueryGroupMembersRequest", QueryGroupMembersRequest], + ["/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", QueryGroupPoliciesByAdminResponse], + ["/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", MsgCreateGroupWithPolicyResponse], + ["/cosmos.group.v1.EventCreateGroup", EventCreateGroup], + ["/cosmos.group.v1.QueryGroupInfoRequest", QueryGroupInfoRequest], + ["/cosmos.group.v1.MsgUpdateGroupMetadataResponse", MsgUpdateGroupMetadataResponse], + ["/cosmos.group.v1.MemberRequest", MemberRequest], ["/cosmos.group.v1.DecisionPolicyWindows", DecisionPolicyWindows], - ["/cosmos.group.v1.QueryGroupPolicyInfoResponse", QueryGroupPolicyInfoResponse], - ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], - ["/cosmos.group.v1.MsgExec", MsgExec], + ["/cosmos.group.v1.QueryGroupsByAdminResponse", QueryGroupsByAdminResponse], + ["/cosmos.group.v1.QueryGroupsResponse", QueryGroupsResponse], ["/cosmos.group.v1.MsgExecResponse", MsgExecResponse], - ["/cosmos.group.v1.QueryGroupsRequest", QueryGroupsRequest], - ["/cosmos.group.v1.MsgSubmitProposalResponse", MsgSubmitProposalResponse], - ["/cosmos.group.v1.GenesisState", GenesisState], + ["/cosmos.group.v1.Vote", Vote], + ["/cosmos.group.v1.QueryGroupsByMemberRequest", QueryGroupsByMemberRequest], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], - ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", MsgUpdateGroupPolicyDecisionPolicyResponse], - ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], - ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], - ["/cosmos.group.v1.EventCreateGroupPolicy", EventCreateGroupPolicy], - ["/cosmos.group.v1.EventUpdateGroupPolicy", EventUpdateGroupPolicy], - ["/cosmos.group.v1.MemberRequest", MemberRequest], - ["/cosmos.group.v1.QueryGroupsResponse", QueryGroupsResponse], - ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], - ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], - ["/cosmos.group.v1.EventSubmitProposal", EventSubmitProposal], - ["/cosmos.group.v1.GroupInfo", GroupInfo], - ["/cosmos.group.v1.QueryGroupMembersRequest", QueryGroupMembersRequest], - ["/cosmos.group.v1.QueryGroupsByAdminRequest", QueryGroupsByAdminRequest], - ["/cosmos.group.v1.QueryVoteByProposalVoterResponse", QueryVoteByProposalVoterResponse], - ["/cosmos.group.v1.QueryVotesByVoterRequest", QueryVotesByVoterRequest], - ["/cosmos.group.v1.ThresholdDecisionPolicy", ThresholdDecisionPolicy], + ["/cosmos.group.v1.QueryGroupMembersResponse", QueryGroupMembersResponse], + ["/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", QueryProposalsByGroupPolicyResponse], + ["/cosmos.group.v1.QueryVotesByProposalRequest", QueryVotesByProposalRequest], + ["/cosmos.group.v1.Proposal", Proposal], + ["/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", MsgUpdateGroupPolicyAdminResponse], + ["/cosmos.group.v1.MsgSubmitProposalResponse", MsgSubmitProposalResponse], + ["/cosmos.group.v1.QueryGroupInfoResponse", QueryGroupInfoResponse], ["/cosmos.group.v1.QueryGroupPolicyInfoRequest", QueryGroupPolicyInfoRequest], - ["/cosmos.group.v1.QueryVotesByVoterResponse", QueryVotesByVoterResponse], ["/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", QueryProposalsByGroupPolicyRequest], + ["/cosmos.group.v1.QueryVoteByProposalVoterRequest", QueryVoteByProposalVoterRequest], + ["/cosmos.group.v1.QueryGroupsByMemberResponse", QueryGroupsByMemberResponse], + ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], + ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup], + ["/cosmos.group.v1.EventCreateGroupPolicy", EventCreateGroupPolicy], + ["/cosmos.group.v1.QueryGroupPolicyInfoResponse", QueryGroupPolicyInfoResponse], ["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], - ["/cosmos.group.v1.MsgVoteResponse", MsgVoteResponse], - ["/cosmos.group.v1.EventVote", EventVote], - ["/cosmos.group.v1.EventExec", EventExec], - ["/cosmos.group.v1.GroupPolicyInfo", GroupPolicyInfo], - ["/cosmos.group.v1.TallyResult", TallyResult], - ["/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", QueryGroupPoliciesByAdminResponse], - ["/cosmos.group.v1.MsgCreateGroupResponse", MsgCreateGroupResponse], - ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], - ["/cosmos.group.v1.EventProposalPruned", EventProposalPruned], + ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], + ["/cosmos.group.v1.MsgCreateGroupPolicyResponse", MsgCreateGroupPolicyResponse], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], - ["/cosmos.group.v1.MsgLeaveGroupResponse", MsgLeaveGroupResponse], - ["/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", QueryGroupPoliciesByGroupResponse], - ["/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", QueryGroupPoliciesByAdminRequest], - ["/cosmos.group.v1.QueryGroupsByMemberResponse", QueryGroupsByMemberResponse], - ["/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", MsgCreateGroupWithPolicyResponse], - ["/cosmos.group.v1.Vote", Vote], - ["/cosmos.group.v1.QueryProposalResponse", QueryProposalResponse], - ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", MsgUpdateGroupPolicyMetadataResponse], ["/cosmos.group.v1.MsgVote", MsgVote], + ["/cosmos.group.v1.EventProposalPruned", EventProposalPruned], + ["/cosmos.group.v1.QueryGroupsByAdminRequest", QueryGroupsByAdminRequest], + ["/cosmos.group.v1.Member", Member], + ["/cosmos.group.v1.MsgExec", MsgExec], + ["/cosmos.group.v1.TallyResult", TallyResult], + ["/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", QueryGroupPoliciesByGroupRequest], + ["/cosmos.group.v1.MsgUpdateGroupAdminResponse", MsgUpdateGroupAdminResponse], + ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], + ["/cosmos.group.v1.MsgWithdrawProposalResponse", MsgWithdrawProposalResponse], + ["/cosmos.group.v1.ThresholdDecisionPolicy", ThresholdDecisionPolicy], + ["/cosmos.group.v1.GroupPolicyInfo", GroupPolicyInfo], ["/cosmos.group.v1.QueryProposalRequest", QueryProposalRequest], + ["/cosmos.group.v1.QueryGroupsRequest", QueryGroupsRequest], + ["/cosmos.group.v1.QueryVotesByProposalResponse", QueryVotesByProposalResponse], + ["/cosmos.group.v1.QueryVotesByVoterResponse", QueryVotesByVoterResponse], + ["/cosmos.group.v1.QueryTallyResultRequest", QueryTallyResultRequest], + ["/cosmos.group.v1.GenesisState", GenesisState], + ["/cosmos.group.v1.MsgUpdateGroupMembersResponse", MsgUpdateGroupMembersResponse], + ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.EventWithdrawProposal", EventWithdrawProposal], - ["/cosmos.group.v1.EventLeaveGroup", EventLeaveGroup], - ["/cosmos.group.v1.QueryVotesByProposalRequest", QueryVotesByProposalRequest], - ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], - ["/cosmos.group.v1.MsgCreateGroupPolicyResponse", MsgCreateGroupPolicyResponse], - ["/cosmos.group.v1.PercentageDecisionPolicy", PercentageDecisionPolicy], - ["/cosmos.group.v1.QueryGroupInfoResponse", QueryGroupInfoResponse], - ["/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", QueryGroupPoliciesByGroupRequest], - ["/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", QueryProposalsByGroupPolicyResponse], - ["/cosmos.group.v1.QueryVoteByProposalVoterRequest", QueryVoteByProposalVoterRequest], - ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], + ["/cosmos.group.v1.QueryProposalResponse", QueryProposalResponse], + ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], + ["/cosmos.group.v1.GroupMember", GroupMember], + ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", MsgUpdateGroupPolicyDecisionPolicyResponse], + ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", MsgUpdateGroupPolicyMetadataResponse], + ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], + ["/cosmos.group.v1.MsgVoteResponse", MsgVoteResponse], + ["/cosmos.group.v1.EventUpdateGroupPolicy", EventUpdateGroupPolicy], + ["/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", QueryGroupPoliciesByGroupResponse], ]; diff --git a/ts-client/cosmos.group.v1/types/amino/amino.ts b/ts-client/cosmos.group.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.group.v1/types/amino/amino.ts +++ b/ts-client/cosmos.group.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.group.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.group.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.group.v1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.group.v1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.group.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.group.v1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.group.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.group.v1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.group.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.group.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.group.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.group.v1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.group.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.group.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.group.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.group.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.group.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.group.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.group.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.group.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.group.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/pep/params.ts b/ts-client/cosmos.group.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.group.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/pep/query.ts b/ts-client/cosmos.group.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.group.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/fairyring/pep/tx.ts b/ts-client/cosmos.group.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.group.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/gogoproto/gogo.ts b/ts-client/cosmos.group.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.group.v1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.group.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.group.v1/types/google/api/annotations.ts b/ts-client/cosmos.group.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.group.v1/types/google/api/annotations.ts +++ b/ts-client/cosmos.group.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.group.v1/types/google/api/http.ts b/ts-client/cosmos.group.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.group.v1/types/google/api/http.ts +++ b/ts-client/cosmos.group.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.group.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.group.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.group.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/google/protobuf/duration.ts b/ts-client/cosmos.group.v1/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/cosmos.group.v1/types/google/protobuf/duration.ts +++ b/ts-client/cosmos.group.v1/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.group.v1/types/route-name.eta b/ts-client/cosmos.group.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.group.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.mint.v1beta1/module.ts b/ts-client/cosmos.mint.v1beta1/module.ts index 239211ae..0a8d8421 100755 --- a/ts-client/cosmos.mint.v1beta1/module.ts +++ b/ts-client/cosmos.mint.v1beta1/module.ts @@ -6,65 +6,65 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { QueryInflationResponse } from "./types/cosmos/mint/v1beta1/query"; -import { MsgUpdateParams } from "./types/cosmos/mint/v1beta1/tx"; -import { QueryAnnualProvisionsRequest } from "./types/cosmos/mint/v1beta1/query"; -import { QueryInflationRequest } from "./types/cosmos/mint/v1beta1/query"; -import { Params } from "./types/cosmos/mint/v1beta1/mint"; -import { GenesisState } from "./types/cosmos/mint/v1beta1/genesis"; -import { MsgUpdateParamsResponse } from "./types/cosmos/mint/v1beta1/tx"; -import { QueryParamsRequest } from "./types/cosmos/mint/v1beta1/query"; -import { Minter } from "./types/cosmos/mint/v1beta1/mint"; -import { QueryParamsResponse } from "./types/cosmos/mint/v1beta1/query"; -import { QueryAnnualProvisionsResponse } from "./types/cosmos/mint/v1beta1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/mint"; +import { QueryInflationRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { QueryInflationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { QueryAnnualProvisionsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/tx"; +import { QueryAnnualProvisionsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { Minter } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/mint"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/genesis"; -export { QueryInflationResponse, MsgUpdateParams, QueryAnnualProvisionsRequest, QueryInflationRequest, Params, GenesisState, MsgUpdateParamsResponse, QueryParamsRequest, Minter, QueryParamsResponse, QueryAnnualProvisionsResponse }; +export { MsgUpdateParamsResponse, Params, QueryInflationRequest, QueryInflationResponse, QueryAnnualProvisionsResponse, MsgUpdateParams, QueryAnnualProvisionsRequest, QueryParamsResponse, Minter, QueryParamsRequest, GenesisState }; -type sendQueryInflationResponseParams = { - value: QueryInflationResponse, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendQueryAnnualProvisionsRequestParams = { - value: QueryAnnualProvisionsRequest, +type sendQueryInflationRequestParams = { + value: QueryInflationRequest, fee?: StdFee, memo?: string }; -type sendQueryInflationRequestParams = { - value: QueryInflationRequest, +type sendQueryInflationResponseParams = { + value: QueryInflationResponse, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendQueryAnnualProvisionsResponseParams = { + value: QueryAnnualProvisionsResponse, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendQueryAnnualProvisionsRequestParams = { + value: QueryAnnualProvisionsRequest, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; @@ -75,61 +75,61 @@ type sendMinterParams = { memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendQueryAnnualProvisionsResponseParams = { - value: QueryAnnualProvisionsResponse, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type queryInflationResponseParams = { - value: QueryInflationResponse, -}; - -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; -type queryAnnualProvisionsRequestParams = { - value: QueryAnnualProvisionsRequest, +type paramsParams = { + value: Params, }; type queryInflationRequestParams = { value: QueryInflationRequest, }; -type paramsParams = { - value: Params, +type queryInflationResponseParams = { + value: QueryInflationResponse, }; -type genesisStateParams = { - value: GenesisState, +type queryAnnualProvisionsResponseParams = { + value: QueryAnnualProvisionsResponse, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type queryAnnualProvisionsRequestParams = { + value: QueryAnnualProvisionsRequest, +}; + +type queryParamsResponseParams = { + value: QueryParamsResponse, }; type minterParams = { value: Minter, }; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; -type queryAnnualProvisionsResponseParams = { - value: QueryAnnualProvisionsResponse, +type genesisStateParams = { + value: GenesisState, }; @@ -162,115 +162,115 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendQueryInflationResponse({ value, fee, memo }: sendQueryInflationResponseParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryInflationResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryInflationResponse({ value: QueryInflationResponse.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryInflationResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAnnualProvisionsRequest({ value, fee, memo }: sendQueryAnnualProvisionsRequestParams): Promise { + async sendQueryInflationRequest({ value, fee, memo }: sendQueryInflationRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAnnualProvisionsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryInflationRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAnnualProvisionsRequest({ value: QueryAnnualProvisionsRequest.fromPartial(value) }) + let msg = this.queryInflationRequest({ value: QueryInflationRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAnnualProvisionsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryInflationRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryInflationRequest({ value, fee, memo }: sendQueryInflationRequestParams): Promise { + async sendQueryInflationResponse({ value, fee, memo }: sendQueryInflationResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryInflationRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryInflationResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryInflationRequest({ value: QueryInflationRequest.fromPartial(value) }) + let msg = this.queryInflationResponse({ value: QueryInflationResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryInflationRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryInflationResponse: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendQueryAnnualProvisionsResponse({ value, fee, memo }: sendQueryAnnualProvisionsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAnnualProvisionsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.queryAnnualProvisionsResponse({ value: QueryAnnualProvisionsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAnnualProvisionsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendQueryAnnualProvisionsRequest({ value, fee, memo }: sendQueryAnnualProvisionsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAnnualProvisionsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.queryAnnualProvisionsRequest({ value: QueryAnnualProvisionsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAnnualProvisionsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, @@ -288,96 +288,96 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAnnualProvisionsResponse({ value, fee, memo }: sendQueryAnnualProvisionsResponseParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAnnualProvisionsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAnnualProvisionsResponse({ value: QueryAnnualProvisionsResponse.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAnnualProvisionsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - queryInflationResponse({ value }: queryInflationResponseParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", value: QueryInflationResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryInflationResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - queryAnnualProvisionsRequest({ value }: queryAnnualProvisionsRequestParams): EncodeObject { + queryInflationRequest({ value }: queryInflationRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", value: QueryAnnualProvisionsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", value: QueryInflationRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAnnualProvisionsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryInflationRequest: Could not create message: ' + e.message) } }, - queryInflationRequest({ value }: queryInflationRequestParams): EncodeObject { + queryInflationResponse({ value }: queryInflationResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", value: QueryInflationRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", value: QueryInflationResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryInflationRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryInflationResponse: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + queryAnnualProvisionsResponse({ value }: queryAnnualProvisionsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", value: QueryAnnualProvisionsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAnnualProvisionsResponse: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + queryAnnualProvisionsRequest({ value }: queryAnnualProvisionsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", value: QueryAnnualProvisionsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAnnualProvisionsRequest: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, @@ -389,19 +389,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - queryAnnualProvisionsResponse({ value }: queryAnnualProvisionsResponseParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", value: QueryAnnualProvisionsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.mint.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAnnualProvisionsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.mint.v1beta1/registry.ts b/ts-client/cosmos.mint.v1beta1/registry.ts index 67ad05f6..f126f692 100755 --- a/ts-client/cosmos.mint.v1beta1/registry.ts +++ b/ts-client/cosmos.mint.v1beta1/registry.ts @@ -1,28 +1,28 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { QueryInflationResponse } from "./types/cosmos/mint/v1beta1/query"; -import { MsgUpdateParams } from "./types/cosmos/mint/v1beta1/tx"; -import { QueryAnnualProvisionsRequest } from "./types/cosmos/mint/v1beta1/query"; -import { QueryInflationRequest } from "./types/cosmos/mint/v1beta1/query"; -import { Params } from "./types/cosmos/mint/v1beta1/mint"; -import { GenesisState } from "./types/cosmos/mint/v1beta1/genesis"; -import { MsgUpdateParamsResponse } from "./types/cosmos/mint/v1beta1/tx"; -import { QueryParamsRequest } from "./types/cosmos/mint/v1beta1/query"; -import { Minter } from "./types/cosmos/mint/v1beta1/mint"; -import { QueryParamsResponse } from "./types/cosmos/mint/v1beta1/query"; -import { QueryAnnualProvisionsResponse } from "./types/cosmos/mint/v1beta1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/mint"; +import { QueryInflationRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { QueryInflationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { QueryAnnualProvisionsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/tx"; +import { QueryAnnualProvisionsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { Minter } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/mint"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/mint/v1beta1/genesis"; const msgTypes: Array<[string, GeneratedType]> = [ + ["/cosmos.mint.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], + ["/cosmos.mint.v1beta1.Params", Params], + ["/cosmos.mint.v1beta1.QueryInflationRequest", QueryInflationRequest], ["/cosmos.mint.v1beta1.QueryInflationResponse", QueryInflationResponse], + ["/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", QueryAnnualProvisionsResponse], ["/cosmos.mint.v1beta1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", QueryAnnualProvisionsRequest], - ["/cosmos.mint.v1beta1.QueryInflationRequest", QueryInflationRequest], - ["/cosmos.mint.v1beta1.Params", Params], - ["/cosmos.mint.v1beta1.GenesisState", GenesisState], - ["/cosmos.mint.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/cosmos.mint.v1beta1.QueryParamsRequest", QueryParamsRequest], - ["/cosmos.mint.v1beta1.Minter", Minter], ["/cosmos.mint.v1beta1.QueryParamsResponse", QueryParamsResponse], - ["/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", QueryAnnualProvisionsResponse], + ["/cosmos.mint.v1beta1.Minter", Minter], + ["/cosmos.mint.v1beta1.QueryParamsRequest", QueryParamsRequest], + ["/cosmos.mint.v1beta1.GenesisState", GenesisState], ]; diff --git a/ts-client/cosmos.mint.v1beta1/types/amino/amino.ts b/ts-client/cosmos.mint.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.mint.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.mint.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.mint.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.mint.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.mint.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..effd5449 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} + +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + 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(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: 0 }; +} + +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.mint.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.mint.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.mint.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.mint.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.mint.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.mint.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.mint.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.mint.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.mint.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.mint.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.mint.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.mint.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.mint.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.mint.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.mint.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.mint.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.mint.v1beta1/types/google/api/http.ts b/ts-client/cosmos.mint.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.mint.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.mint.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.mint.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.mint.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.mint.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.mint.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.mint.v1beta1/types/route-name.eta b/ts-client/cosmos.mint.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.mint.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.nft.v1beta1/module.ts b/ts-client/cosmos.nft.v1beta1/module.ts index cee6cd39..10b07935 100755 --- a/ts-client/cosmos.nft.v1beta1/module.ts +++ b/ts-client/cosmos.nft.v1beta1/module.ts @@ -7,31 +7,31 @@ import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; import { QueryBalanceRequest } from "./types/cosmos/nft/v1beta1/query"; -import { QueryBalanceResponse } from "./types/cosmos/nft/v1beta1/query"; import { QueryNFTsRequest } from "./types/cosmos/nft/v1beta1/query"; +import { QueryNFTRequest } from "./types/cosmos/nft/v1beta1/query"; +import { Class } from "./types/cosmos/nft/v1beta1/nft"; +import { EventMint } from "./types/cosmos/nft/v1beta1/event"; +import { EventBurn } from "./types/cosmos/nft/v1beta1/event"; import { MsgSend } from "./types/cosmos/nft/v1beta1/tx"; -import { QuerySupplyResponse } from "./types/cosmos/nft/v1beta1/query"; -import { QueryClassRequest } from "./types/cosmos/nft/v1beta1/query"; -import { QuerySupplyRequest } from "./types/cosmos/nft/v1beta1/query"; -import { Entry } from "./types/cosmos/nft/v1beta1/genesis"; -import { NFT } from "./types/cosmos/nft/v1beta1/nft"; import { MsgSendResponse } from "./types/cosmos/nft/v1beta1/tx"; -import { Class } from "./types/cosmos/nft/v1beta1/nft"; +import { QueryBalanceResponse } from "./types/cosmos/nft/v1beta1/query"; import { QueryOwnerRequest } from "./types/cosmos/nft/v1beta1/query"; -import { QueryNFTsResponse } from "./types/cosmos/nft/v1beta1/query"; -import { QueryClassesResponse } from "./types/cosmos/nft/v1beta1/query"; -import { EventMint } from "./types/cosmos/nft/v1beta1/event"; import { QueryOwnerResponse } from "./types/cosmos/nft/v1beta1/query"; +import { QuerySupplyRequest } from "./types/cosmos/nft/v1beta1/query"; +import { QueryNFTResponse } from "./types/cosmos/nft/v1beta1/query"; +import { EventSend } from "./types/cosmos/nft/v1beta1/event"; +import { QuerySupplyResponse } from "./types/cosmos/nft/v1beta1/query"; +import { QueryClassRequest } from "./types/cosmos/nft/v1beta1/query"; import { QueryClassesRequest } from "./types/cosmos/nft/v1beta1/query"; +import { QueryNFTsResponse } from "./types/cosmos/nft/v1beta1/query"; import { GenesisState } from "./types/cosmos/nft/v1beta1/genesis"; -import { QueryNFTRequest } from "./types/cosmos/nft/v1beta1/query"; import { QueryClassResponse } from "./types/cosmos/nft/v1beta1/query"; -import { EventSend } from "./types/cosmos/nft/v1beta1/event"; -import { EventBurn } from "./types/cosmos/nft/v1beta1/event"; -import { QueryNFTResponse } from "./types/cosmos/nft/v1beta1/query"; +import { QueryClassesResponse } from "./types/cosmos/nft/v1beta1/query"; +import { NFT } from "./types/cosmos/nft/v1beta1/nft"; +import { Entry } from "./types/cosmos/nft/v1beta1/genesis"; -export { QueryBalanceRequest, QueryBalanceResponse, QueryNFTsRequest, MsgSend, QuerySupplyResponse, QueryClassRequest, QuerySupplyRequest, Entry, NFT, MsgSendResponse, Class, QueryOwnerRequest, QueryNFTsResponse, QueryClassesResponse, EventMint, QueryOwnerResponse, QueryClassesRequest, GenesisState, QueryNFTRequest, QueryClassResponse, EventSend, EventBurn, QueryNFTResponse }; +export { QueryBalanceRequest, QueryNFTsRequest, QueryNFTRequest, Class, EventMint, EventBurn, MsgSend, MsgSendResponse, QueryBalanceResponse, QueryOwnerRequest, QueryOwnerResponse, QuerySupplyRequest, QueryNFTResponse, EventSend, QuerySupplyResponse, QueryClassRequest, QueryClassesRequest, QueryNFTsResponse, GenesisState, QueryClassResponse, QueryClassesResponse, NFT, Entry }; type sendQueryBalanceRequestParams = { value: QueryBalanceRequest, @@ -39,92 +39,92 @@ type sendQueryBalanceRequestParams = { memo?: string }; -type sendQueryBalanceResponseParams = { - value: QueryBalanceResponse, +type sendQueryNFTsRequestParams = { + value: QueryNFTsRequest, fee?: StdFee, memo?: string }; -type sendQueryNFTsRequestParams = { - value: QueryNFTsRequest, +type sendQueryNFTRequestParams = { + value: QueryNFTRequest, fee?: StdFee, memo?: string }; -type sendMsgSendParams = { - value: MsgSend, +type sendClassParams = { + value: Class, fee?: StdFee, memo?: string }; -type sendQuerySupplyResponseParams = { - value: QuerySupplyResponse, +type sendEventMintParams = { + value: EventMint, fee?: StdFee, memo?: string }; -type sendQueryClassRequestParams = { - value: QueryClassRequest, +type sendEventBurnParams = { + value: EventBurn, fee?: StdFee, memo?: string }; -type sendQuerySupplyRequestParams = { - value: QuerySupplyRequest, +type sendMsgSendParams = { + value: MsgSend, fee?: StdFee, memo?: string }; -type sendEntryParams = { - value: Entry, +type sendMsgSendResponseParams = { + value: MsgSendResponse, fee?: StdFee, memo?: string }; -type sendNFTParams = { - value: NFT, +type sendQueryBalanceResponseParams = { + value: QueryBalanceResponse, fee?: StdFee, memo?: string }; -type sendMsgSendResponseParams = { - value: MsgSendResponse, +type sendQueryOwnerRequestParams = { + value: QueryOwnerRequest, fee?: StdFee, memo?: string }; -type sendClassParams = { - value: Class, +type sendQueryOwnerResponseParams = { + value: QueryOwnerResponse, fee?: StdFee, memo?: string }; -type sendQueryOwnerRequestParams = { - value: QueryOwnerRequest, +type sendQuerySupplyRequestParams = { + value: QuerySupplyRequest, fee?: StdFee, memo?: string }; -type sendQueryNFTsResponseParams = { - value: QueryNFTsResponse, +type sendQueryNFTResponseParams = { + value: QueryNFTResponse, fee?: StdFee, memo?: string }; -type sendQueryClassesResponseParams = { - value: QueryClassesResponse, +type sendEventSendParams = { + value: EventSend, fee?: StdFee, memo?: string }; -type sendEventMintParams = { - value: EventMint, +type sendQuerySupplyResponseParams = { + value: QuerySupplyResponse, fee?: StdFee, memo?: string }; -type sendQueryOwnerResponseParams = { - value: QueryOwnerResponse, +type sendQueryClassRequestParams = { + value: QueryClassRequest, fee?: StdFee, memo?: string }; @@ -135,14 +135,14 @@ type sendQueryClassesRequestParams = { memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryNFTsResponseParams = { + value: QueryNFTsResponse, fee?: StdFee, memo?: string }; -type sendQueryNFTRequestParams = { - value: QueryNFTRequest, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; @@ -153,20 +153,20 @@ type sendQueryClassResponseParams = { memo?: string }; -type sendEventSendParams = { - value: EventSend, +type sendQueryClassesResponseParams = { + value: QueryClassesResponse, fee?: StdFee, memo?: string }; -type sendEventBurnParams = { - value: EventBurn, +type sendNFTParams = { + value: NFT, fee?: StdFee, memo?: string }; -type sendQueryNFTResponseParams = { - value: QueryNFTResponse, +type sendEntryParams = { + value: Entry, fee?: StdFee, memo?: string }; @@ -176,92 +176,92 @@ type queryBalanceRequestParams = { value: QueryBalanceRequest, }; -type queryBalanceResponseParams = { - value: QueryBalanceResponse, -}; - type queryNftsRequestParams = { value: QueryNFTsRequest, }; -type msgSendParams = { - value: MsgSend, -}; - -type querySupplyResponseParams = { - value: QuerySupplyResponse, +type queryNftrequestParams = { + value: QueryNFTRequest, }; -type queryClassRequestParams = { - value: QueryClassRequest, +type classParams = { + value: Class, }; -type querySupplyRequestParams = { - value: QuerySupplyRequest, +type eventMintParams = { + value: EventMint, }; -type entryParams = { - value: Entry, +type eventBurnParams = { + value: EventBurn, }; -type nftParams = { - value: NFT, +type msgSendParams = { + value: MsgSend, }; type msgSendResponseParams = { value: MsgSendResponse, }; -type classParams = { - value: Class, +type queryBalanceResponseParams = { + value: QueryBalanceResponse, }; type queryOwnerRequestParams = { value: QueryOwnerRequest, }; -type queryNftsResponseParams = { - value: QueryNFTsResponse, +type queryOwnerResponseParams = { + value: QueryOwnerResponse, }; -type queryClassesResponseParams = { - value: QueryClassesResponse, +type querySupplyRequestParams = { + value: QuerySupplyRequest, }; -type eventMintParams = { - value: EventMint, +type queryNftresponseParams = { + value: QueryNFTResponse, }; -type queryOwnerResponseParams = { - value: QueryOwnerResponse, +type eventSendParams = { + value: EventSend, +}; + +type querySupplyResponseParams = { + value: QuerySupplyResponse, +}; + +type queryClassRequestParams = { + value: QueryClassRequest, }; type queryClassesRequestParams = { value: QueryClassesRequest, }; -type genesisStateParams = { - value: GenesisState, +type queryNftsResponseParams = { + value: QueryNFTsResponse, }; -type queryNftrequestParams = { - value: QueryNFTRequest, +type genesisStateParams = { + value: GenesisState, }; type queryClassResponseParams = { value: QueryClassResponse, }; -type eventSendParams = { - value: EventSend, +type queryClassesResponseParams = { + value: QueryClassesResponse, }; -type eventBurnParams = { - value: EventBurn, +type nftParams = { + value: NFT, }; -type queryNftresponseParams = { - value: QueryNFTResponse, +type entryParams = { + value: Entry, }; @@ -308,213 +308,213 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryBalanceResponse({ value, fee, memo }: sendQueryBalanceResponseParams): Promise { + async sendQueryNFTsRequest({ value, fee, memo }: sendQueryNFTsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryBalanceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryNFTsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryBalanceResponse({ value: QueryBalanceResponse.fromPartial(value) }) + let msg = this.queryNftsRequest({ value: QueryNFTsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryBalanceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryNFTsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryNFTsRequest({ value, fee, memo }: sendQueryNFTsRequestParams): Promise { + async sendQueryNFTRequest({ value, fee, memo }: sendQueryNFTRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryNFTsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryNFTRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryNftsRequest({ value: QueryNFTsRequest.fromPartial(value) }) + let msg = this.queryNftrequest({ value: QueryNFTRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryNFTsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryNFTRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSend({ value, fee, memo }: sendMsgSendParams): Promise { + async sendClass({ value, fee, memo }: sendClassParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSend: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendClass: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSend({ value: MsgSend.fromPartial(value) }) + let msg = this.class({ value: Class.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSend: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendClass: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySupplyResponse({ value, fee, memo }: sendQuerySupplyResponseParams): Promise { + async sendEventMint({ value, fee, memo }: sendEventMintParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySupplyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventMint: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySupplyResponse({ value: QuerySupplyResponse.fromPartial(value) }) + let msg = this.eventMint({ value: EventMint.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySupplyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventMint: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClassRequest({ value, fee, memo }: sendQueryClassRequestParams): Promise { + async sendEventBurn({ value, fee, memo }: sendEventBurnParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClassRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventBurn: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClassRequest({ value: QueryClassRequest.fromPartial(value) }) + let msg = this.eventBurn({ value: EventBurn.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClassRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventBurn: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySupplyRequest({ value, fee, memo }: sendQuerySupplyRequestParams): Promise { + async sendMsgSend({ value, fee, memo }: sendMsgSendParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySupplyRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSend: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySupplyRequest({ value: QuerySupplyRequest.fromPartial(value) }) + let msg = this.msgSend({ value: MsgSend.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySupplyRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSend: Could not broadcast Tx: '+ e.message) } }, - async sendEntry({ value, fee, memo }: sendEntryParams): Promise { + async sendMsgSendResponse({ value, fee, memo }: sendMsgSendResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendEntry: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSendResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.entry({ value: Entry.fromPartial(value) }) + let msg = this.msgSendResponse({ value: MsgSendResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEntry: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSendResponse: Could not broadcast Tx: '+ e.message) } }, - async sendNFT({ value, fee, memo }: sendNFTParams): Promise { + async sendQueryBalanceResponse({ value, fee, memo }: sendQueryBalanceResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendNFT: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryBalanceResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.nft({ value: NFT.fromPartial(value) }) + let msg = this.queryBalanceResponse({ value: QueryBalanceResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendNFT: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryBalanceResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSendResponse({ value, fee, memo }: sendMsgSendResponseParams): Promise { + async sendQueryOwnerRequest({ value, fee, memo }: sendQueryOwnerRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSendResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryOwnerRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSendResponse({ value: MsgSendResponse.fromPartial(value) }) + let msg = this.queryOwnerRequest({ value: QueryOwnerRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSendResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryOwnerRequest: Could not broadcast Tx: '+ e.message) } }, - async sendClass({ value, fee, memo }: sendClassParams): Promise { + async sendQueryOwnerResponse({ value, fee, memo }: sendQueryOwnerResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendClass: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryOwnerResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.class({ value: Class.fromPartial(value) }) + let msg = this.queryOwnerResponse({ value: QueryOwnerResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendClass: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryOwnerResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryOwnerRequest({ value, fee, memo }: sendQueryOwnerRequestParams): Promise { + async sendQuerySupplyRequest({ value, fee, memo }: sendQuerySupplyRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryOwnerRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySupplyRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryOwnerRequest({ value: QueryOwnerRequest.fromPartial(value) }) + let msg = this.querySupplyRequest({ value: QuerySupplyRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryOwnerRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySupplyRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryNFTsResponse({ value, fee, memo }: sendQueryNFTsResponseParams): Promise { + async sendQueryNFTResponse({ value, fee, memo }: sendQueryNFTResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryNFTsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryNFTResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryNftsResponse({ value: QueryNFTsResponse.fromPartial(value) }) + let msg = this.queryNftresponse({ value: QueryNFTResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryNFTsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryNFTResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClassesResponse({ value, fee, memo }: sendQueryClassesResponseParams): Promise { + async sendEventSend({ value, fee, memo }: sendEventSendParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClassesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEventSend: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClassesResponse({ value: QueryClassesResponse.fromPartial(value) }) + let msg = this.eventSend({ value: EventSend.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClassesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEventSend: Could not broadcast Tx: '+ e.message) } }, - async sendEventMint({ value, fee, memo }: sendEventMintParams): Promise { + async sendQuerySupplyResponse({ value, fee, memo }: sendQuerySupplyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventMint: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySupplyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventMint({ value: EventMint.fromPartial(value) }) + let msg = this.querySupplyResponse({ value: QuerySupplyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventMint: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySupplyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryOwnerResponse({ value, fee, memo }: sendQueryOwnerResponseParams): Promise { + async sendQueryClassRequest({ value, fee, memo }: sendQueryClassRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryOwnerResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClassRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryOwnerResponse({ value: QueryOwnerResponse.fromPartial(value) }) + let msg = this.queryClassRequest({ value: QueryClassRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryOwnerResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClassRequest: Could not broadcast Tx: '+ e.message) } }, @@ -532,31 +532,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryNFTsResponse({ value, fee, memo }: sendQueryNFTsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryNFTsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryNftsResponse({ value: QueryNFTsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryNFTsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryNFTRequest({ value, fee, memo }: sendQueryNFTRequestParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryNFTRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryNftrequest({ value: QueryNFTRequest.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryNFTRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, @@ -574,45 +574,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendEventSend({ value, fee, memo }: sendEventSendParams): Promise { + async sendQueryClassesResponse({ value, fee, memo }: sendQueryClassesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventSend: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClassesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventSend({ value: EventSend.fromPartial(value) }) + let msg = this.queryClassesResponse({ value: QueryClassesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventSend: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClassesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendEventBurn({ value, fee, memo }: sendEventBurnParams): Promise { + async sendNFT({ value, fee, memo }: sendNFTParams): Promise { if (!signer) { - throw new Error('TxClient:sendEventBurn: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendNFT: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.eventBurn({ value: EventBurn.fromPartial(value) }) + let msg = this.nft({ value: NFT.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEventBurn: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendNFT: Could not broadcast Tx: '+ e.message) } }, - async sendQueryNFTResponse({ value, fee, memo }: sendQueryNFTResponseParams): Promise { + async sendEntry({ value, fee, memo }: sendEntryParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryNFTResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEntry: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryNftresponse({ value: QueryNFTResponse.fromPartial(value) }) + let msg = this.entry({ value: Entry.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryNFTResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEntry: Could not broadcast Tx: '+ e.message) } }, @@ -625,123 +625,123 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryBalanceResponse({ value }: queryBalanceResponseParams): EncodeObject { + queryNftsRequest({ value }: queryNftsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", value: QueryBalanceResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", value: QueryNFTsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryBalanceResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryNFTsRequest: Could not create message: ' + e.message) } }, - queryNftsRequest({ value }: queryNftsRequestParams): EncodeObject { + queryNftrequest({ value }: queryNftrequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", value: QueryNFTsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", value: QueryNFTRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryNFTsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryNFTRequest: Could not create message: ' + e.message) } }, - msgSend({ value }: msgSendParams): EncodeObject { + class({ value }: classParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.MsgSend", value: MsgSend.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.Class", value: Class.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSend: Could not create message: ' + e.message) + throw new Error('TxClient:Class: Could not create message: ' + e.message) } }, - querySupplyResponse({ value }: querySupplyResponseParams): EncodeObject { + eventMint({ value }: eventMintParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", value: QuerySupplyResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.EventMint", value: EventMint.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySupplyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:EventMint: Could not create message: ' + e.message) } }, - queryClassRequest({ value }: queryClassRequestParams): EncodeObject { + eventBurn({ value }: eventBurnParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", value: QueryClassRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.EventBurn", value: EventBurn.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClassRequest: Could not create message: ' + e.message) + throw new Error('TxClient:EventBurn: Could not create message: ' + e.message) } }, - querySupplyRequest({ value }: querySupplyRequestParams): EncodeObject { + msgSend({ value }: msgSendParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", value: QuerySupplyRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.MsgSend", value: MsgSend.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySupplyRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSend: Could not create message: ' + e.message) } }, - entry({ value }: entryParams): EncodeObject { + msgSendResponse({ value }: msgSendResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.Entry", value: Entry.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse", value: MsgSendResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Entry: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSendResponse: Could not create message: ' + e.message) } }, - nft({ value }: nftParams): EncodeObject { + queryBalanceResponse({ value }: queryBalanceResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.NFT", value: NFT.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", value: QueryBalanceResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:NFT: Could not create message: ' + e.message) + throw new Error('TxClient:QueryBalanceResponse: Could not create message: ' + e.message) } }, - msgSendResponse({ value }: msgSendResponseParams): EncodeObject { + queryOwnerRequest({ value }: queryOwnerRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse", value: MsgSendResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", value: QueryOwnerRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSendResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryOwnerRequest: Could not create message: ' + e.message) } }, - class({ value }: classParams): EncodeObject { + queryOwnerResponse({ value }: queryOwnerResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.Class", value: Class.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", value: QueryOwnerResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Class: Could not create message: ' + e.message) + throw new Error('TxClient:QueryOwnerResponse: Could not create message: ' + e.message) } }, - queryOwnerRequest({ value }: queryOwnerRequestParams): EncodeObject { + querySupplyRequest({ value }: querySupplyRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", value: QueryOwnerRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", value: QuerySupplyRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryOwnerRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySupplyRequest: Could not create message: ' + e.message) } }, - queryNftsResponse({ value }: queryNftsResponseParams): EncodeObject { + queryNftresponse({ value }: queryNftresponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse", value: QueryNFTsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse", value: QueryNFTResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryNFTsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryNFTResponse: Could not create message: ' + e.message) } }, - queryClassesResponse({ value }: queryClassesResponseParams): EncodeObject { + eventSend({ value }: eventSendParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse", value: QueryClassesResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.EventSend", value: EventSend.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClassesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:EventSend: Could not create message: ' + e.message) } }, - eventMint({ value }: eventMintParams): EncodeObject { + querySupplyResponse({ value }: querySupplyResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.EventMint", value: EventMint.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", value: QuerySupplyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventMint: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySupplyResponse: Could not create message: ' + e.message) } }, - queryOwnerResponse({ value }: queryOwnerResponseParams): EncodeObject { + queryClassRequest({ value }: queryClassRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", value: QueryOwnerResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", value: QueryClassRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryOwnerResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClassRequest: Could not create message: ' + e.message) } }, @@ -753,19 +753,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryNftsResponse({ value }: queryNftsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse", value: QueryNFTsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryNFTsResponse: Could not create message: ' + e.message) } }, - queryNftrequest({ value }: queryNftrequestParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", value: QueryNFTRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryNFTRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, @@ -777,27 +777,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - eventSend({ value }: eventSendParams): EncodeObject { + queryClassesResponse({ value }: queryClassesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.EventSend", value: EventSend.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse", value: QueryClassesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventSend: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClassesResponse: Could not create message: ' + e.message) } }, - eventBurn({ value }: eventBurnParams): EncodeObject { + nft({ value }: nftParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.EventBurn", value: EventBurn.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.NFT", value: NFT.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EventBurn: Could not create message: ' + e.message) + throw new Error('TxClient:NFT: Could not create message: ' + e.message) } }, - queryNftresponse({ value }: queryNftresponseParams): EncodeObject { + entry({ value }: entryParams): EncodeObject { try { - return { typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse", value: QueryNFTResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.nft.v1beta1.Entry", value: Entry.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryNFTResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Entry: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.nft.v1beta1/registry.ts b/ts-client/cosmos.nft.v1beta1/registry.ts index 80517b7a..aa0f1d46 100755 --- a/ts-client/cosmos.nft.v1beta1/registry.ts +++ b/ts-client/cosmos.nft.v1beta1/registry.ts @@ -1,52 +1,52 @@ import { GeneratedType } from "@cosmjs/proto-signing"; import { QueryBalanceRequest } from "./types/cosmos/nft/v1beta1/query"; -import { QueryBalanceResponse } from "./types/cosmos/nft/v1beta1/query"; import { QueryNFTsRequest } from "./types/cosmos/nft/v1beta1/query"; +import { QueryNFTRequest } from "./types/cosmos/nft/v1beta1/query"; +import { Class } from "./types/cosmos/nft/v1beta1/nft"; +import { EventMint } from "./types/cosmos/nft/v1beta1/event"; +import { EventBurn } from "./types/cosmos/nft/v1beta1/event"; import { MsgSend } from "./types/cosmos/nft/v1beta1/tx"; -import { QuerySupplyResponse } from "./types/cosmos/nft/v1beta1/query"; -import { QueryClassRequest } from "./types/cosmos/nft/v1beta1/query"; -import { QuerySupplyRequest } from "./types/cosmos/nft/v1beta1/query"; -import { Entry } from "./types/cosmos/nft/v1beta1/genesis"; -import { NFT } from "./types/cosmos/nft/v1beta1/nft"; import { MsgSendResponse } from "./types/cosmos/nft/v1beta1/tx"; -import { Class } from "./types/cosmos/nft/v1beta1/nft"; +import { QueryBalanceResponse } from "./types/cosmos/nft/v1beta1/query"; import { QueryOwnerRequest } from "./types/cosmos/nft/v1beta1/query"; -import { QueryNFTsResponse } from "./types/cosmos/nft/v1beta1/query"; -import { QueryClassesResponse } from "./types/cosmos/nft/v1beta1/query"; -import { EventMint } from "./types/cosmos/nft/v1beta1/event"; import { QueryOwnerResponse } from "./types/cosmos/nft/v1beta1/query"; +import { QuerySupplyRequest } from "./types/cosmos/nft/v1beta1/query"; +import { QueryNFTResponse } from "./types/cosmos/nft/v1beta1/query"; +import { EventSend } from "./types/cosmos/nft/v1beta1/event"; +import { QuerySupplyResponse } from "./types/cosmos/nft/v1beta1/query"; +import { QueryClassRequest } from "./types/cosmos/nft/v1beta1/query"; import { QueryClassesRequest } from "./types/cosmos/nft/v1beta1/query"; +import { QueryNFTsResponse } from "./types/cosmos/nft/v1beta1/query"; import { GenesisState } from "./types/cosmos/nft/v1beta1/genesis"; -import { QueryNFTRequest } from "./types/cosmos/nft/v1beta1/query"; import { QueryClassResponse } from "./types/cosmos/nft/v1beta1/query"; -import { EventSend } from "./types/cosmos/nft/v1beta1/event"; -import { EventBurn } from "./types/cosmos/nft/v1beta1/event"; -import { QueryNFTResponse } from "./types/cosmos/nft/v1beta1/query"; +import { QueryClassesResponse } from "./types/cosmos/nft/v1beta1/query"; +import { NFT } from "./types/cosmos/nft/v1beta1/nft"; +import { Entry } from "./types/cosmos/nft/v1beta1/genesis"; const msgTypes: Array<[string, GeneratedType]> = [ ["/cosmos.nft.v1beta1.QueryBalanceRequest", QueryBalanceRequest], - ["/cosmos.nft.v1beta1.QueryBalanceResponse", QueryBalanceResponse], ["/cosmos.nft.v1beta1.QueryNFTsRequest", QueryNFTsRequest], + ["/cosmos.nft.v1beta1.QueryNFTRequest", QueryNFTRequest], + ["/cosmos.nft.v1beta1.Class", Class], + ["/cosmos.nft.v1beta1.EventMint", EventMint], + ["/cosmos.nft.v1beta1.EventBurn", EventBurn], ["/cosmos.nft.v1beta1.MsgSend", MsgSend], - ["/cosmos.nft.v1beta1.QuerySupplyResponse", QuerySupplyResponse], - ["/cosmos.nft.v1beta1.QueryClassRequest", QueryClassRequest], - ["/cosmos.nft.v1beta1.QuerySupplyRequest", QuerySupplyRequest], - ["/cosmos.nft.v1beta1.Entry", Entry], - ["/cosmos.nft.v1beta1.NFT", NFT], ["/cosmos.nft.v1beta1.MsgSendResponse", MsgSendResponse], - ["/cosmos.nft.v1beta1.Class", Class], + ["/cosmos.nft.v1beta1.QueryBalanceResponse", QueryBalanceResponse], ["/cosmos.nft.v1beta1.QueryOwnerRequest", QueryOwnerRequest], - ["/cosmos.nft.v1beta1.QueryNFTsResponse", QueryNFTsResponse], - ["/cosmos.nft.v1beta1.QueryClassesResponse", QueryClassesResponse], - ["/cosmos.nft.v1beta1.EventMint", EventMint], ["/cosmos.nft.v1beta1.QueryOwnerResponse", QueryOwnerResponse], + ["/cosmos.nft.v1beta1.QuerySupplyRequest", QuerySupplyRequest], + ["/cosmos.nft.v1beta1.QueryNFTResponse", QueryNFTResponse], + ["/cosmos.nft.v1beta1.EventSend", EventSend], + ["/cosmos.nft.v1beta1.QuerySupplyResponse", QuerySupplyResponse], + ["/cosmos.nft.v1beta1.QueryClassRequest", QueryClassRequest], ["/cosmos.nft.v1beta1.QueryClassesRequest", QueryClassesRequest], + ["/cosmos.nft.v1beta1.QueryNFTsResponse", QueryNFTsResponse], ["/cosmos.nft.v1beta1.GenesisState", GenesisState], - ["/cosmos.nft.v1beta1.QueryNFTRequest", QueryNFTRequest], ["/cosmos.nft.v1beta1.QueryClassResponse", QueryClassResponse], - ["/cosmos.nft.v1beta1.EventSend", EventSend], - ["/cosmos.nft.v1beta1.EventBurn", EventBurn], - ["/cosmos.nft.v1beta1.QueryNFTResponse", QueryNFTResponse], + ["/cosmos.nft.v1beta1.QueryClassesResponse", QueryClassesResponse], + ["/cosmos.nft.v1beta1.NFT", NFT], + ["/cosmos.nft.v1beta1.Entry", Entry], ]; diff --git a/ts-client/cosmos.nft.v1beta1/types/amino/amino.ts b/ts-client/cosmos.nft.v1beta1/types/amino/amino.ts new file mode 100644 index 00000000..4a505674 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/amino/amino.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + +/* eslint-disable */ + +export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts new file mode 100644 index 00000000..0dddf30c --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts @@ -0,0 +1,378 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/runtime/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.app.runtime.v1alpha1"; + +/** Module is the config object for the runtime module. */ +export interface Module { + /** app_name is the name of the app. */ + appName: string; + /** + * begin_blockers specifies the module names of begin blockers + * to call in the order in which they should be called. If this is left empty + * no begin blocker will be registered. + */ + beginBlockers: string[]; + /** + * end_blockers specifies the module names of the end blockers + * to call in the order in which they should be called. If this is left empty + * no end blocker will be registered. + */ + endBlockers: string[]; + /** + * init_genesis specifies the module names of init genesis functions + * to call in the order in which they should be called. If this is left empty + * no init genesis function will be registered. + */ + initGenesis: string[]; + /** + * export_genesis specifies the order in which to export module genesis data. + * If this is left empty, the init_genesis order will be used for export genesis + * if it is specified. + */ + exportGenesis: string[]; + /** + * override_store_keys is an optional list of overrides for the module store keys + * to be used in keeper construction. + */ + overrideStoreKeys: StoreKeyConfig[]; + /** + * order_migrations defines the order in which module migrations are performed. + * If this is left empty, it uses the default migration order. + * https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.0-alpha2/types/module#DefaultMigrationsOrder + */ + orderMigrations: string[]; + /** + * precommiters specifies the module names of the precommiters + * to call in the order in which they should be called. If this is left empty + * no precommit function will be registered. + */ + precommiters: string[]; + /** + * prepare_check_staters specifies the module names of the prepare_check_staters + * to call in the order in which they should be called. If this is left empty + * no preparecheckstate function will be registered. + */ + prepareCheckStaters: string[]; +} + +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfig { + /** name of the module to override the store key of */ + moduleName: string; + /** the kv store key to use instead of the module name. */ + kvStoreKey: string; +} + +function createBaseModule(): Module { + return { + appName: "", + beginBlockers: [], + endBlockers: [], + initGenesis: [], + exportGenesis: [], + overrideStoreKeys: [], + orderMigrations: [], + precommiters: [], + prepareCheckStaters: [], + }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + for (const v of message.beginBlockers) { + writer.uint32(18).string(v!); + } + for (const v of message.endBlockers) { + writer.uint32(26).string(v!); + } + for (const v of message.initGenesis) { + writer.uint32(34).string(v!); + } + for (const v of message.exportGenesis) { + writer.uint32(42).string(v!); + } + for (const v of message.overrideStoreKeys) { + StoreKeyConfig.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.orderMigrations) { + writer.uint32(58).string(v!); + } + for (const v of message.precommiters) { + writer.uint32(66).string(v!); + } + for (const v of message.prepareCheckStaters) { + writer.uint32(74).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.appName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.beginBlockers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.endBlockers.push(reader.string()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.initGenesis.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.exportGenesis.push(reader.string()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.overrideStoreKeys.push(StoreKeyConfig.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.orderMigrations.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.precommiters.push(reader.string()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.prepareCheckStaters.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + beginBlockers: globalThis.Array.isArray(object?.beginBlockers) + ? object.beginBlockers.map((e: any) => globalThis.String(e)) + : [], + endBlockers: globalThis.Array.isArray(object?.endBlockers) + ? object.endBlockers.map((e: any) => globalThis.String(e)) + : [], + initGenesis: globalThis.Array.isArray(object?.initGenesis) + ? object.initGenesis.map((e: any) => globalThis.String(e)) + : [], + exportGenesis: globalThis.Array.isArray(object?.exportGenesis) + ? object.exportGenesis.map((e: any) => globalThis.String(e)) + : [], + overrideStoreKeys: globalThis.Array.isArray(object?.overrideStoreKeys) + ? object.overrideStoreKeys.map((e: any) => StoreKeyConfig.fromJSON(e)) + : [], + orderMigrations: globalThis.Array.isArray(object?.orderMigrations) + ? object.orderMigrations.map((e: any) => globalThis.String(e)) + : [], + precommiters: globalThis.Array.isArray(object?.precommiters) + ? object.precommiters.map((e: any) => globalThis.String(e)) + : [], + prepareCheckStaters: globalThis.Array.isArray(object?.prepareCheckStaters) + ? object.prepareCheckStaters.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.beginBlockers?.length) { + obj.beginBlockers = message.beginBlockers; + } + if (message.endBlockers?.length) { + obj.endBlockers = message.endBlockers; + } + if (message.initGenesis?.length) { + obj.initGenesis = message.initGenesis; + } + if (message.exportGenesis?.length) { + obj.exportGenesis = message.exportGenesis; + } + if (message.overrideStoreKeys?.length) { + obj.overrideStoreKeys = message.overrideStoreKeys.map((e) => StoreKeyConfig.toJSON(e)); + } + if (message.orderMigrations?.length) { + obj.orderMigrations = message.orderMigrations; + } + if (message.precommiters?.length) { + obj.precommiters = message.precommiters; + } + if (message.prepareCheckStaters?.length) { + obj.prepareCheckStaters = message.prepareCheckStaters; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.appName = object.appName ?? ""; + message.beginBlockers = object.beginBlockers?.map((e) => e) || []; + message.endBlockers = object.endBlockers?.map((e) => e) || []; + message.initGenesis = object.initGenesis?.map((e) => e) || []; + message.exportGenesis = object.exportGenesis?.map((e) => e) || []; + message.overrideStoreKeys = object.overrideStoreKeys?.map((e) => StoreKeyConfig.fromPartial(e)) || []; + message.orderMigrations = object.orderMigrations?.map((e) => e) || []; + message.precommiters = object.precommiters?.map((e) => e) || []; + message.prepareCheckStaters = object.prepareCheckStaters?.map((e) => e) || []; + return message; + }, +}; + +function createBaseStoreKeyConfig(): StoreKeyConfig { + return { moduleName: "", kvStoreKey: "" }; +} + +export const StoreKeyConfig: MessageFns = { + encode(message: StoreKeyConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.kvStoreKey !== "") { + writer.uint32(18).string(message.kvStoreKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreKeyConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKeyConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.kvStoreKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKeyConfig { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + kvStoreKey: isSet(object.kvStoreKey) ? globalThis.String(object.kvStoreKey) : "", + }; + }, + + toJSON(message: StoreKeyConfig): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.kvStoreKey !== "") { + obj.kvStoreKey = message.kvStoreKey; + } + return obj; + }, + + create, I>>(base?: I): StoreKeyConfig { + return StoreKeyConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKeyConfig { + const message = createBaseStoreKeyConfig(); + message.moduleName = object.moduleName ?? ""; + message.kvStoreKey = object.kvStoreKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/config.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/config.ts new file mode 100644 index 00000000..da9f2893 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/config.ts @@ -0,0 +1,339 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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[]; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is global (not module specific). + */ + golangBindings: GolangBinding[]; +} + +/** 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 + | undefined; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is module specific. + */ + golangBindings: GolangBinding[]; +} + +/** GolangBinding is an explicit interface type to implementing type binding for dependency injection. */ +export interface GolangBinding { + /** interface_type is the interface type which will be bound to a specific implementation type */ + interfaceType: string; + /** implementation is the implementing type which will be supplied when an input of type interface is requested */ + implementation: string; +} + +function createBaseConfig(): Config { + return { modules: [], golangBindings: [] }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.modules) { + ModuleConfig.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.modules.push(ModuleConfig.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + modules: globalThis.Array.isArray(object?.modules) + ? object.modules.map((e: any) => ModuleConfig.fromJSON(e)) + : [], + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.modules?.length) { + obj.modules = message.modules.map((e) => ModuleConfig.toJSON(e)); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.modules = object.modules?.map((e) => ModuleConfig.fromPartial(e)) || []; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseModuleConfig(): ModuleConfig { + return { name: "", config: undefined, golangBindings: [] }; +} + +export const ModuleConfig: MessageFns = { + encode(message: ModuleConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.config !== undefined) { + Any.encode(message.config, writer.uint32(18).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.config = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleConfig { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + config: isSet(object.config) ? Any.fromJSON(object.config) : undefined, + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleConfig): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.config !== undefined) { + obj.config = Any.toJSON(message.config); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleConfig { + return ModuleConfig.fromPartial(base ?? ({} as any)); + }, + 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; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGolangBinding(): GolangBinding { + return { interfaceType: "", implementation: "" }; +} + +export const GolangBinding: MessageFns = { + encode(message: GolangBinding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceType !== "") { + writer.uint32(10).string(message.interfaceType); + } + if (message.implementation !== "") { + writer.uint32(18).string(message.implementation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GolangBinding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGolangBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.interfaceType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.implementation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GolangBinding { + return { + interfaceType: isSet(object.interfaceType) ? globalThis.String(object.interfaceType) : "", + implementation: isSet(object.implementation) ? globalThis.String(object.implementation) : "", + }; + }, + + toJSON(message: GolangBinding): unknown { + const obj: any = {}; + if (message.interfaceType !== "") { + obj.interfaceType = message.interfaceType; + } + if (message.implementation !== "") { + obj.implementation = message.implementation; + } + return obj; + }, + + create, I>>(base?: I): GolangBinding { + return GolangBinding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GolangBinding { + const message = createBaseGolangBinding(); + message.interfaceType = object.interfaceType ?? ""; + message.implementation = object.implementation ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/query.ts new file mode 100644 index 00000000..3a172979 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/app/v1alpha1/query.ts @@ -0,0 +1,174 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +function createBaseQueryConfigRequest(): QueryConfigRequest { + return {}; +} + +export const QueryConfigRequest: MessageFns = { + encode(_: QueryConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConfigRequest { + return {}; + }, + + toJSON(_: QueryConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConfigRequest { + return QueryConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConfigRequest { + const message = createBaseQueryConfigRequest(); + return message; + }, +}; + +function createBaseQueryConfigResponse(): QueryConfigResponse { + return { config: undefined }; +} + +export const QueryConfigResponse: MessageFns = { + encode(message: QueryConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + Config.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = Config.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConfigResponse { + return { config: isSet(object.config) ? Config.fromJSON(object.config) : undefined }; + }, + + toJSON(message: QueryConfigResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = Config.toJSON(message.config); + } + return obj; + }, + + create, I>>(base?: I): QueryConfigResponse { + return QueryConfigResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.app.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/module/v1/module.ts new file mode 100644 index 00000000..c426dc68 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/module/v1/module.ts @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.auth.module.v1"; + +/** Module is the config object for the auth module. */ +export interface Module { + /** bech32_prefix is the bech32 account prefix for the app. */ + bech32Prefix: string; + /** module_account_permissions are module account permissions. */ + moduleAccountPermissions: ModuleAccountPermission[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermission { + /** account is the name of the module. */ + account: string; + /** + * permissions are the permissions this module has. Currently recognized + * values are minter, burner and staking. + */ + permissions: string[]; +} + +function createBaseModule(): Module { + return { bech32Prefix: "", moduleAccountPermissions: [], authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + for (const v of message.moduleAccountPermissions) { + ModuleAccountPermission.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(26).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.moduleAccountPermissions.push(ModuleAccountPermission.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "", + moduleAccountPermissions: globalThis.Array.isArray(object?.moduleAccountPermissions) + ? object.moduleAccountPermissions.map((e: any) => ModuleAccountPermission.fromJSON(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + if (message.moduleAccountPermissions?.length) { + obj.moduleAccountPermissions = message.moduleAccountPermissions.map((e) => ModuleAccountPermission.toJSON(e)); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.bech32Prefix = object.bech32Prefix ?? ""; + message.moduleAccountPermissions = + object.moduleAccountPermissions?.map((e) => ModuleAccountPermission.fromPartial(e)) || []; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseModuleAccountPermission(): ModuleAccountPermission { + return { account: "", permissions: [] }; +} + +export const ModuleAccountPermission: MessageFns = { + encode(message: ModuleAccountPermission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + for (const v of message.permissions) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccountPermission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccountPermission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccountPermission { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccountPermission): unknown { + const obj: any = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccountPermission { + return ModuleAccountPermission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccountPermission { + const message = createBaseModuleAccountPermission(); + message.account = object.account ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/auth.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..4dd78b9e --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,517 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/auth.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + pubKey: Any | undefined; + accountNumber: number; + sequence: number; +} + +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + baseAccount: BaseAccount | undefined; + name: string; + permissions: string[]; +} + +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredential { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + moduleName: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivationKeys: Uint8Array[]; +} + +/** Params defines the parameters for the auth module. */ +export interface Params { + maxMemoCharacters: number; + txSigLimit: number; + txSizeCostPerByte: number; + sigVerifyCostEd25519: number; + sigVerifyCostSecp256k1: number; +} + +function createBaseBaseAccount(): BaseAccount { + return { address: "", pubKey: undefined, accountNumber: 0, sequence: 0 }; +} + +export const BaseAccount: MessageFns = { + encode(message: BaseAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.accountNumber !== 0) { + writer.uint32(24).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseAccount { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): BaseAccount { + return BaseAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.accountNumber = object.accountNumber ?? 0; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModuleAccount(): ModuleAccount { + return { baseAccount: undefined, name: "", permissions: [] }; +} + +export const ModuleAccount: MessageFns = { + encode(message: ModuleAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + for (const v of message.permissions) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + name: isSet(object.name) ? globalThis.String(object.name) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccount { + return ModuleAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccount { + const message = createBaseModuleAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseModuleCredential(): ModuleCredential { + return { moduleName: "", derivationKeys: [] }; +} + +export const ModuleCredential: MessageFns = { + encode(message: ModuleCredential, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + for (const v of message.derivationKeys) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleCredential { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.derivationKeys.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleCredential { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + derivationKeys: globalThis.Array.isArray(object?.derivationKeys) + ? object.derivationKeys.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: ModuleCredential): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.derivationKeys?.length) { + obj.derivationKeys = message.derivationKeys.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleCredential { + return ModuleCredential.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleCredential { + const message = createBaseModuleCredential(); + message.moduleName = object.moduleName ?? ""; + message.derivationKeys = object.derivationKeys?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + maxMemoCharacters: 0, + txSigLimit: 0, + txSizeCostPerByte: 0, + sigVerifyCostEd25519: 0, + sigVerifyCostSecp256k1: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMemoCharacters !== 0) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxMemoCharacters = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.txSigLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.txSizeCostPerByte = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sigVerifyCostEd25519 = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sigVerifyCostSecp256k1 = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + maxMemoCharacters: isSet(object.maxMemoCharacters) ? globalThis.Number(object.maxMemoCharacters) : 0, + txSigLimit: isSet(object.txSigLimit) ? globalThis.Number(object.txSigLimit) : 0, + txSizeCostPerByte: isSet(object.txSizeCostPerByte) ? globalThis.Number(object.txSizeCostPerByte) : 0, + sigVerifyCostEd25519: isSet(object.sigVerifyCostEd25519) ? globalThis.Number(object.sigVerifyCostEd25519) : 0, + sigVerifyCostSecp256k1: isSet(object.sigVerifyCostSecp256k1) + ? globalThis.Number(object.sigVerifyCostSecp256k1) + : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.maxMemoCharacters !== 0) { + obj.maxMemoCharacters = Math.round(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + obj.txSigLimit = Math.round(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + obj.txSizeCostPerByte = Math.round(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + obj.sigVerifyCostEd25519 = Math.round(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + obj.sigVerifyCostSecp256k1 = Math.round(message.sigVerifyCostSecp256k1); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.maxMemoCharacters = object.maxMemoCharacters ?? 0; + message.txSigLimit = object.txSigLimit ?? 0; + message.txSizeCostPerByte = object.txSizeCostPerByte ?? 0; + message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 ?? 0; + message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 00000000..d165dd08 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** accounts are the accounts present at genesis. */ + accounts: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, accounts: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.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) + ? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/query.ts new file mode 100644 index 00000000..e187ff09 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,1545 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { BaseAccount, 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} + +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account: Any | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequest { +} + +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponse { + accounts: Any[]; +} + +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequest { + name: string; +} + +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponse { + account: Any | undefined; +} + +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequest { +} + +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponse { + bech32Prefix: string; +} + +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequest { + addressBytes: Uint8Array; +} + +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponse { + addressString: string; +} + +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequest { + addressString: string; +} + +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponse { + addressBytes: Uint8Array; +} + +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequest { + /** + * Deprecated, use account_id instead + * + * id is the account number of the address to be queried. This field + * should have been an uint64 (like all account numbers), and will be + * updated to uint64 in a future version of the auth query. + * + * @deprecated + */ + id: number; + /** + * account_id is the account number of the address to be queried. + * + * Since: cosmos-sdk 0.47 + */ + accountId: number; +} + +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponse { + accountAddress: string; +} + +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequest { + /** address is the account address string. */ + address: string; +} + +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponse { + /** info is the account info which is represented by BaseAccount. */ + info: BaseAccount | undefined; +} + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsResponse { + return { + accounts: globalThis.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?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsResponse { + return QueryAccountsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { account: undefined }; +} + +export const QueryAccountResponse: MessageFns = { + encode(message: QueryAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryAccountResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountResponse { + return QueryAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { + return {}; +} + +export const QueryModuleAccountsRequest: MessageFns = { + encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryModuleAccountsRequest { + return {}; + }, + + toJSON(_: QueryModuleAccountsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, +}; + +function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { + return { accounts: [] }; +} + +export const QueryModuleAccountsResponse: MessageFns = { + encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryModuleAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameRequest(): QueryModuleAccountByNameRequest { + return { name: "" }; +} + +export const QueryModuleAccountByNameRequest: MessageFns = { + encode(message: QueryModuleAccountByNameRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryModuleAccountByNameRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountByNameRequest { + return QueryModuleAccountByNameRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameRequest { + const message = createBaseQueryModuleAccountByNameRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameResponse(): QueryModuleAccountByNameResponse { + return { account: undefined }; +} + +export const QueryModuleAccountByNameResponse: MessageFns = { + encode(message: QueryModuleAccountByNameResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryModuleAccountByNameResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryModuleAccountByNameResponse { + return QueryModuleAccountByNameResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameResponse { + const message = createBaseQueryModuleAccountByNameResponse(); + message.account = (object.account !== undefined && object.account !== null) + ? Any.fromPartial(object.account) + : undefined; + return message; + }, +}; + +function createBaseBech32PrefixRequest(): Bech32PrefixRequest { + return {}; +} + +export const Bech32PrefixRequest: MessageFns = { + encode(_: Bech32PrefixRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Bech32PrefixRequest { + return {}; + }, + + toJSON(_: Bech32PrefixRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Bech32PrefixRequest { + return Bech32PrefixRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, +}; + +function createBaseBech32PrefixResponse(): Bech32PrefixResponse { + return { bech32Prefix: "" }; +} + +export const Bech32PrefixResponse: MessageFns = { + encode(message: Bech32PrefixResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Bech32PrefixResponse { + return { bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "" }; + }, + + toJSON(message: Bech32PrefixResponse): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + return obj; + }, + + create, I>>(base?: I): Bech32PrefixResponse { + return Bech32PrefixResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + message.bech32Prefix = object.bech32Prefix ?? ""; + return message; + }, +}; + +function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressBytesToStringRequest: MessageFns = { + encode(message: AddressBytesToStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringRequest { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressBytesToStringRequest): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringRequest { + return AddressBytesToStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { + return { addressString: "" }; +} + +export const AddressBytesToStringResponse: MessageFns = { + encode(message: AddressBytesToStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringResponse { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressBytesToStringResponse): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringResponse { + return AddressBytesToStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { + return { addressString: "" }; +} + +export const AddressStringToBytesRequest: MessageFns = { + encode(message: AddressStringToBytesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesRequest { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressStringToBytesRequest): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesRequest { + return AddressStringToBytesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressStringToBytesResponse: MessageFns = { + encode(message: AddressStringToBytesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesResponse { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressStringToBytesResponse): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesResponse { + return AddressStringToBytesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAccountAddressByIDRequest(): QueryAccountAddressByIDRequest { + return { id: 0, accountId: 0 }; +} + +export const QueryAccountAddressByIDRequest: MessageFns = { + encode(message: QueryAccountAddressByIDRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int64(message.id); + } + if (message.accountId !== 0) { + writer.uint32(16).uint64(message.accountId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.accountId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDRequest { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0, + }; + }, + + toJSON(message: QueryAccountAddressByIDRequest): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.accountId !== 0) { + obj.accountId = Math.round(message.accountId); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDRequest { + return QueryAccountAddressByIDRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDRequest { + const message = createBaseQueryAccountAddressByIDRequest(); + message.id = object.id ?? 0; + message.accountId = object.accountId ?? 0; + return message; + }, +}; + +function createBaseQueryAccountAddressByIDResponse(): QueryAccountAddressByIDResponse { + return { accountAddress: "" }; +} + +export const QueryAccountAddressByIDResponse: MessageFns = { + encode(message: QueryAccountAddressByIDResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.accountAddress !== "") { + writer.uint32(10).string(message.accountAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accountAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDResponse { + return { accountAddress: isSet(object.accountAddress) ? globalThis.String(object.accountAddress) : "" }; + }, + + toJSON(message: QueryAccountAddressByIDResponse): unknown { + const obj: any = {}; + if (message.accountAddress !== "") { + obj.accountAddress = message.accountAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDResponse { + return QueryAccountAddressByIDResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDResponse { + const message = createBaseQueryAccountAddressByIDResponse(); + message.accountAddress = object.accountAddress ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoRequest(): QueryAccountInfoRequest { + return { address: "" }; +} + +export const QueryAccountInfoRequest: MessageFns = { + encode(message: QueryAccountInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoRequest { + return QueryAccountInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoResponse(): QueryAccountInfoResponse { + return { info: undefined }; +} + +export const QueryAccountInfoResponse: MessageFns = { + encode(message: QueryAccountInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + BaseAccount.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.info = BaseAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoResponse { + return { info: isSet(object.info) ? BaseAccount.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryAccountInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = BaseAccount.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoResponse { + return QueryAccountInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + message.info = (object.info !== undefined && object.info !== null) + ? BaseAccount.fromPartial(object.info) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Accounts returns all the existing accounts. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.43 + */ + Accounts(request: QueryAccountsRequest): Promise; + /** Account returns account details based on address. */ + Account(request: QueryAccountRequest): Promise; + /** + * AccountAddressByID returns account address based on account number. + * + * Since: cosmos-sdk 0.46.2 + */ + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise; + /** Params queries all parameters. */ + Params(request: QueryParamsRequest): Promise; + /** + * ModuleAccounts returns all the existing module accounts. + * + * Since: cosmos-sdk 0.46 + */ + ModuleAccounts(request: QueryModuleAccountsRequest): Promise; + /** ModuleAccountByName returns the module account info by module name */ + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise; + /** + * Bech32Prefix queries bech32Prefix + * + * Since: cosmos-sdk 0.46 + */ + Bech32Prefix(request: Bech32PrefixRequest): Promise; + /** + * AddressBytesToString converts Account Address bytes to string + * + * Since: cosmos-sdk 0.46 + */ + AddressBytesToString(request: AddressBytesToStringRequest): Promise; + /** + * AddressStringToBytes converts Address string to bytes + * + * Since: cosmos-sdk 0.46 + */ + AddressStringToBytes(request: AddressStringToBytesRequest): Promise; + /** + * AccountInfo queries account info which is common to all account types. + * + * Since: cosmos-sdk 0.47 + */ + AccountInfo(request: QueryAccountInfoRequest): Promise; +} + +export const QueryServiceName = "cosmos.auth.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 || QueryServiceName; + this.rpc = rpc; + this.Accounts = this.Accounts.bind(this); + this.Account = this.Account.bind(this); + this.AccountAddressByID = this.AccountAddressByID.bind(this); + this.Params = this.Params.bind(this); + this.ModuleAccounts = this.ModuleAccounts.bind(this); + this.ModuleAccountByName = this.ModuleAccountByName.bind(this); + this.Bech32Prefix = this.Bech32Prefix.bind(this); + this.AddressBytesToString = this.AddressBytesToString.bind(this); + this.AddressStringToBytes = this.AddressStringToBytes.bind(this); + this.AccountInfo = this.AccountInfo.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 BinaryReader(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 BinaryReader(data))); + } + + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise { + const data = QueryAccountAddressByIDRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountAddressByID", data); + return promise.then((data) => QueryAccountAddressByIDResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise { + const data = QueryModuleAccountByNameRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ModuleAccountByName", data); + return promise.then((data) => QueryModuleAccountByNameResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + AccountInfo(request: QueryAccountInfoRequest): Promise { + const data = QueryAccountInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountInfo", data); + return promise.then((data) => QueryAccountInfoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/tx.ts new file mode 100644 index 00000000..535a19af --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/auth/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./auth"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/auth parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/auth Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the x/auth module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.auth.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/module/v1/module.ts new file mode 100644 index 00000000..053622ff --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.authz.module.v1"; + +/** Module is the config object of the authz module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/authz.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 00000000..a3685068 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * time when the grant will expire and will be pruned. If null, then the grant + * doesn't have a time expiration (other conditions in `authorization` + * may apply to invalidate the grant) + */ + expiration: Date | undefined; +} + +/** + * GrantAuthorization extends a grant with both the addresses of the grantee and granter. + * It is used in genesis.proto and query.proto + */ +export interface GrantAuthorization { + granter: string; + grantee: string; + authorization: Any | undefined; + expiration: Date | undefined; +} + +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItem { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msgTypeUrls: string[]; +} + +function createBaseGenericAuthorization(): GenericAuthorization { + return { msg: "" }; +} + +export const GenericAuthorization: MessageFns = { + encode(message: GenericAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msg = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenericAuthorization { + return { msg: isSet(object.msg) ? globalThis.String(object.msg) : "" }; + }, + + toJSON(message: GenericAuthorization): unknown { + const obj: any = {}; + if (message.msg !== "") { + obj.msg = message.msg; + } + return obj; + }, + + create, I>>(base?: I): GenericAuthorization { + return GenericAuthorization.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: GrantAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(26).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantAuthorization { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.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 = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GrantAuthorization { + return GrantAuthorization.fromPartial(base ?? ({} as any)); + }, + 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 { msgTypeUrls: [] }; +} + +export const GrantQueueItem: MessageFns = { + encode(message: GrantQueueItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.msgTypeUrls) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantQueueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantQueueItem { + return { + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: GrantQueueItem): unknown { + const obj: any = {}; + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): GrantQueueItem { + return GrantQueueItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/event.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/event.ts new file mode 100644 index 00000000..42e74923 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,235 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 */ + msgTypeUrl: 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 */ + msgTypeUrl: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} + +function createBaseEventGrant(): EventGrant { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventGrant: MessageFns = { + encode(message: EventGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventGrant { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventGrant): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventGrant { + return EventGrant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventGrant { + const message = createBaseEventGrant(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseEventRevoke(): EventRevoke { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventRevoke: MessageFns = { + encode(message: EventRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventRevoke { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventRevoke): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventRevoke { + return EventRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventRevoke { + const message = createBaseEventRevoke(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 00000000..96e4d5bf --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorization) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.authorization.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + authorization: globalThis.Array.isArray(object?.authorization) + ? object.authorization.map((e: any) => GrantAuthorization.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.authorization?.length) { + obj.authorization = message.authorization.map((e) => GrantAuthorization.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/query.ts new file mode 100644 index 00000000..ef3cc0e5 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,629 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + msgTypeUrl: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryGrantsRequest(): QueryGrantsRequest { + return { granter: "", grantee: "", msgTypeUrl: "", pagination: undefined }; +} + +export const QueryGrantsRequest: MessageFns = { + encode(message: QueryGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsRequest { + return QueryGrantsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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: MessageFns = { + encode(message: QueryGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsResponse { + return QueryGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.authz.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 00000000..10bc628d --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,565 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse { +} + +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExec { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; +} + +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} + +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevoke { + granter: string; + grantee: string; + msgTypeUrl: string; +} + +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponse { +} + +function createBaseMsgGrant(): MsgGrant { + return { granter: "", grantee: "", grant: undefined }; +} + +export const MsgGrant: MessageFns = { + encode(message: MsgGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + Grant.encode(message.grant, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.grant = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined, + }; + }, + + toJSON(message: MsgGrant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.grant !== undefined) { + obj.grant = Grant.toJSON(message.grant); + } + return obj; + }, + + create, I>>(base?: I): MsgGrant { + return MsgGrant.fromPartial(base ?? ({} as any)); + }, + 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 createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} + +export const MsgGrantResponse: MessageFns = { + encode(_: MsgGrantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantResponse { + return {}; + }, + + toJSON(_: MsgGrantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantResponse { + return MsgGrantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { grantee: "", msgs: [] }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { results: [] }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgRevoke(): MsgRevoke { + return { granter: "", grantee: "", msgTypeUrl: "" }; +} + +export const MsgRevoke: MessageFns = { + encode(message: MsgRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevoke { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + }; + }, + + toJSON(message: MsgRevoke): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgRevoke { + return MsgRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} + +export const MsgRevokeResponse: MessageFns = { + encode(_: MsgRevokeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeResponse { + return {}; + }, + + toJSON(_: MsgRevokeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeResponse { + return MsgRevokeResponse.fromPartial(base ?? ({} as any)); + }, + 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 const MsgServiceName = "cosmos.authz.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/autocli/v1/options.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/autocli/v1/options.ts new file mode 100644 index 00000000..4ad6ac83 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/autocli/v1/options.ts @@ -0,0 +1,1019 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/options.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** ModuleOptions describes the CLI options for a Cosmos SDK module. */ +export interface ModuleOptions { + /** tx describes the tx commands for the module. */ + tx: + | ServiceCommandDescriptor + | undefined; + /** query describes the queries commands for the module. */ + query: ServiceCommandDescriptor | undefined; +} + +/** ServiceCommandDescriptor describes a CLI command based on a protobuf service. */ +export interface ServiceCommandDescriptor { + /** + * service is the fully qualified name of the protobuf service to build + * the command from. It can be left empty if sub_commands are used instead + * which may be the case if a module provides multiple tx and/or query services. + */ + service: string; + /** + * rpc_command_options are options for commands generated from rpc methods. + * If no options are specified for a given rpc method on the service, a + * command will be generated for that method with the default options. + */ + rpcCommandOptions: RpcCommandOptions[]; + /** + * sub_commands is a map of optional sub-commands for this command based on + * different protobuf services. The map key is used as the name of the + * sub-command. + */ + subCommands: { [key: string]: ServiceCommandDescriptor }; +} + +export interface ServiceCommandDescriptor_SubCommandsEntry { + key: string; + value: ServiceCommandDescriptor | undefined; +} + +/** + * RpcCommandOptions specifies options for commands generated from protobuf + * rpc methods. + */ +export interface RpcCommandOptions { + /** + * rpc_method is short name of the protobuf rpc method that this command is + * generated from. + */ + rpcMethod: string; + /** + * use is the one-line usage method. It also allows specifying an alternate + * name for the command as the first word of the usage text. + * + * By default the name of an rpc command is the kebab-case short name of the + * rpc method. + */ + use: string; + /** long is the long message shown in the 'help ' output. */ + long: string; + /** short is the short description shown in the 'help' output. */ + short: string; + /** example is examples of how to use the command. */ + example: string; + /** alias is an array of aliases that can be used instead of the first word in Use. */ + alias: string[]; + /** + * suggest_for is an array of command names for which this command will be suggested - + * similar to aliases but only suggests. + */ + suggestFor: string[]; + /** deprecated defines, if this command is deprecated and should print this string when used. */ + deprecated: string; + /** + * version defines the version for this command. If this value is non-empty and the command does not + * define a "version" flag, a "version" boolean flag will be added to the command and, if specified, + * will print content of the "Version" variable. A shorthand "v" flag will also be added if the + * command does not define one. + */ + version: string; + /** + * flag_options are options for flags generated from rpc request fields. + * By default all request fields are configured as flags. They can + * also be configured as positional args instead using positional_args. + */ + flagOptions: { [key: string]: FlagOptions }; + /** positional_args specifies positional arguments for the command. */ + positionalArgs: PositionalArgDescriptor[]; + /** skip specifies whether to skip this rpc method when generating commands. */ + skip: boolean; +} + +export interface RpcCommandOptions_FlagOptionsEntry { + key: string; + value: FlagOptions | undefined; +} + +/** + * FlagOptions are options for flags generated from rpc request fields. + * By default, all request fields are configured as flags based on the + * kebab-case name of the field. Fields can be turned into positional arguments + * instead by using RpcCommandOptions.positional_args. + */ +export interface FlagOptions { + /** name is an alternate name to use for the field flag. */ + name: string; + /** shorthand is a one-letter abbreviated flag. */ + shorthand: string; + /** usage is the help message. */ + usage: string; + /** default_value is the default value as text. */ + defaultValue: string; + /** deprecated is the usage text to show if this flag is deprecated. */ + deprecated: string; + /** shorthand_deprecated is the usage text to show if the shorthand of this flag is deprecated. */ + shorthandDeprecated: string; + /** hidden hides the flag from help/usage text */ + hidden: boolean; +} + +/** PositionalArgDescriptor describes a positional argument. */ +export interface PositionalArgDescriptor { + /** + * proto_field specifies the proto field to use as the positional arg. Any + * fields used as positional args will not have a flag generated. + */ + protoField: string; + /** + * varargs makes a positional parameter a varargs parameter. This can only be + * applied to last positional parameter and the proto_field must a repeated + * field. + */ + varargs: boolean; +} + +function createBaseModuleOptions(): ModuleOptions { + return { tx: undefined, query: undefined }; +} + +export const ModuleOptions: MessageFns = { + encode(message: ModuleOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + ServiceCommandDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.query !== undefined) { + ServiceCommandDescriptor.encode(message.query, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.query = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleOptions { + return { + tx: isSet(object.tx) ? ServiceCommandDescriptor.fromJSON(object.tx) : undefined, + query: isSet(object.query) ? ServiceCommandDescriptor.fromJSON(object.query) : undefined, + }; + }, + + toJSON(message: ModuleOptions): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = ServiceCommandDescriptor.toJSON(message.tx); + } + if (message.query !== undefined) { + obj.query = ServiceCommandDescriptor.toJSON(message.query); + } + return obj; + }, + + create, I>>(base?: I): ModuleOptions { + return ModuleOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleOptions { + const message = createBaseModuleOptions(); + message.tx = (object.tx !== undefined && object.tx !== null) + ? ServiceCommandDescriptor.fromPartial(object.tx) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ServiceCommandDescriptor.fromPartial(object.query) + : undefined; + return message; + }, +}; + +function createBaseServiceCommandDescriptor(): ServiceCommandDescriptor { + return { service: "", rpcCommandOptions: [], subCommands: {} }; +} + +export const ServiceCommandDescriptor: MessageFns = { + encode(message: ServiceCommandDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.service !== "") { + writer.uint32(10).string(message.service); + } + for (const v of message.rpcCommandOptions) { + RpcCommandOptions.encode(v!, writer.uint32(18).fork()).join(); + } + Object.entries(message.subCommands).forEach(([key, value]) => { + ServiceCommandDescriptor_SubCommandsEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.service = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcCommandOptions.push(RpcCommandOptions.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + const entry3 = ServiceCommandDescriptor_SubCommandsEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.subCommands[entry3.key] = entry3.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor { + return { + service: isSet(object.service) ? globalThis.String(object.service) : "", + rpcCommandOptions: globalThis.Array.isArray(object?.rpcCommandOptions) + ? object.rpcCommandOptions.map((e: any) => RpcCommandOptions.fromJSON(e)) + : [], + subCommands: isObject(object.subCommands) + ? Object.entries(object.subCommands).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + acc[key] = ServiceCommandDescriptor.fromJSON(value); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: ServiceCommandDescriptor): unknown { + const obj: any = {}; + if (message.service !== "") { + obj.service = message.service; + } + if (message.rpcCommandOptions?.length) { + obj.rpcCommandOptions = message.rpcCommandOptions.map((e) => RpcCommandOptions.toJSON(e)); + } + if (message.subCommands) { + const entries = Object.entries(message.subCommands); + if (entries.length > 0) { + obj.subCommands = {}; + entries.forEach(([k, v]) => { + obj.subCommands[k] = ServiceCommandDescriptor.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): ServiceCommandDescriptor { + return ServiceCommandDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceCommandDescriptor { + const message = createBaseServiceCommandDescriptor(); + message.service = object.service ?? ""; + message.rpcCommandOptions = object.rpcCommandOptions?.map((e) => RpcCommandOptions.fromPartial(e)) || []; + message.subCommands = Object.entries(object.subCommands ?? {}).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ServiceCommandDescriptor.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseServiceCommandDescriptor_SubCommandsEntry(): ServiceCommandDescriptor_SubCommandsEntry { + return { key: "", value: undefined }; +} + +export const ServiceCommandDescriptor_SubCommandsEntry: MessageFns = { + encode(message: ServiceCommandDescriptor_SubCommandsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ServiceCommandDescriptor.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor_SubCommandsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor_SubCommandsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ServiceCommandDescriptor.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ServiceCommandDescriptor_SubCommandsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ServiceCommandDescriptor.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + return ServiceCommandDescriptor_SubCommandsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ServiceCommandDescriptor.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseRpcCommandOptions(): RpcCommandOptions { + return { + rpcMethod: "", + use: "", + long: "", + short: "", + example: "", + alias: [], + suggestFor: [], + deprecated: "", + version: "", + flagOptions: {}, + positionalArgs: [], + skip: false, + }; +} + +export const RpcCommandOptions: MessageFns = { + encode(message: RpcCommandOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rpcMethod !== "") { + writer.uint32(10).string(message.rpcMethod); + } + if (message.use !== "") { + writer.uint32(18).string(message.use); + } + if (message.long !== "") { + writer.uint32(26).string(message.long); + } + if (message.short !== "") { + writer.uint32(34).string(message.short); + } + if (message.example !== "") { + writer.uint32(42).string(message.example); + } + for (const v of message.alias) { + writer.uint32(50).string(v!); + } + for (const v of message.suggestFor) { + writer.uint32(58).string(v!); + } + if (message.deprecated !== "") { + writer.uint32(66).string(message.deprecated); + } + if (message.version !== "") { + writer.uint32(74).string(message.version); + } + Object.entries(message.flagOptions).forEach(([key, value]) => { + RpcCommandOptions_FlagOptionsEntry.encode({ key: key as any, value }, writer.uint32(82).fork()).join(); + }); + for (const v of message.positionalArgs) { + PositionalArgDescriptor.encode(v!, writer.uint32(90).fork()).join(); + } + if (message.skip !== false) { + writer.uint32(96).bool(message.skip); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rpcMethod = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.use = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.long = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.short = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.example = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.alias.push(reader.string()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.suggestFor.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.deprecated = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.version = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + const entry10 = RpcCommandOptions_FlagOptionsEntry.decode(reader, reader.uint32()); + if (entry10.value !== undefined) { + message.flagOptions[entry10.key] = entry10.value; + } + continue; + case 11: + if (tag !== 90) { + break; + } + + message.positionalArgs.push(PositionalArgDescriptor.decode(reader, reader.uint32())); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.skip = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions { + return { + rpcMethod: isSet(object.rpcMethod) ? globalThis.String(object.rpcMethod) : "", + use: isSet(object.use) ? globalThis.String(object.use) : "", + long: isSet(object.long) ? globalThis.String(object.long) : "", + short: isSet(object.short) ? globalThis.String(object.short) : "", + example: isSet(object.example) ? globalThis.String(object.example) : "", + alias: globalThis.Array.isArray(object?.alias) ? object.alias.map((e: any) => globalThis.String(e)) : [], + suggestFor: globalThis.Array.isArray(object?.suggestFor) + ? object.suggestFor.map((e: any) => globalThis.String(e)) + : [], + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + flagOptions: isObject(object.flagOptions) + ? Object.entries(object.flagOptions).reduce<{ [key: string]: FlagOptions }>((acc, [key, value]) => { + acc[key] = FlagOptions.fromJSON(value); + return acc; + }, {}) + : {}, + positionalArgs: globalThis.Array.isArray(object?.positionalArgs) + ? object.positionalArgs.map((e: any) => PositionalArgDescriptor.fromJSON(e)) + : [], + skip: isSet(object.skip) ? globalThis.Boolean(object.skip) : false, + }; + }, + + toJSON(message: RpcCommandOptions): unknown { + const obj: any = {}; + if (message.rpcMethod !== "") { + obj.rpcMethod = message.rpcMethod; + } + if (message.use !== "") { + obj.use = message.use; + } + if (message.long !== "") { + obj.long = message.long; + } + if (message.short !== "") { + obj.short = message.short; + } + if (message.example !== "") { + obj.example = message.example; + } + if (message.alias?.length) { + obj.alias = message.alias; + } + if (message.suggestFor?.length) { + obj.suggestFor = message.suggestFor; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.flagOptions) { + const entries = Object.entries(message.flagOptions); + if (entries.length > 0) { + obj.flagOptions = {}; + entries.forEach(([k, v]) => { + obj.flagOptions[k] = FlagOptions.toJSON(v); + }); + } + } + if (message.positionalArgs?.length) { + obj.positionalArgs = message.positionalArgs.map((e) => PositionalArgDescriptor.toJSON(e)); + } + if (message.skip !== false) { + obj.skip = message.skip; + } + return obj; + }, + + create, I>>(base?: I): RpcCommandOptions { + return RpcCommandOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RpcCommandOptions { + const message = createBaseRpcCommandOptions(); + message.rpcMethod = object.rpcMethod ?? ""; + message.use = object.use ?? ""; + message.long = object.long ?? ""; + message.short = object.short ?? ""; + message.example = object.example ?? ""; + message.alias = object.alias?.map((e) => e) || []; + message.suggestFor = object.suggestFor?.map((e) => e) || []; + message.deprecated = object.deprecated ?? ""; + message.version = object.version ?? ""; + message.flagOptions = Object.entries(object.flagOptions ?? {}).reduce<{ [key: string]: FlagOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = FlagOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + message.positionalArgs = object.positionalArgs?.map((e) => PositionalArgDescriptor.fromPartial(e)) || []; + message.skip = object.skip ?? false; + return message; + }, +}; + +function createBaseRpcCommandOptions_FlagOptionsEntry(): RpcCommandOptions_FlagOptionsEntry { + return { key: "", value: undefined }; +} + +export const RpcCommandOptions_FlagOptionsEntry: MessageFns = { + encode(message: RpcCommandOptions_FlagOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + FlagOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions_FlagOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = FlagOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions_FlagOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? FlagOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: RpcCommandOptions_FlagOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = FlagOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): RpcCommandOptions_FlagOptionsEntry { + return RpcCommandOptions_FlagOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RpcCommandOptions_FlagOptionsEntry { + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? FlagOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseFlagOptions(): FlagOptions { + return { + name: "", + shorthand: "", + usage: "", + defaultValue: "", + deprecated: "", + shorthandDeprecated: "", + hidden: false, + }; +} + +export const FlagOptions: MessageFns = { + encode(message: FlagOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.shorthand !== "") { + writer.uint32(18).string(message.shorthand); + } + if (message.usage !== "") { + writer.uint32(26).string(message.usage); + } + if (message.defaultValue !== "") { + writer.uint32(34).string(message.defaultValue); + } + if (message.deprecated !== "") { + writer.uint32(50).string(message.deprecated); + } + if (message.shorthandDeprecated !== "") { + writer.uint32(58).string(message.shorthandDeprecated); + } + if (message.hidden !== false) { + writer.uint32(64).bool(message.hidden); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlagOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlagOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.shorthand = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.usage = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.defaultValue = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.deprecated = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.shorthandDeprecated = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.hidden = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FlagOptions { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + shorthand: isSet(object.shorthand) ? globalThis.String(object.shorthand) : "", + usage: isSet(object.usage) ? globalThis.String(object.usage) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + shorthandDeprecated: isSet(object.shorthandDeprecated) ? globalThis.String(object.shorthandDeprecated) : "", + hidden: isSet(object.hidden) ? globalThis.Boolean(object.hidden) : false, + }; + }, + + toJSON(message: FlagOptions): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.shorthand !== "") { + obj.shorthand = message.shorthand; + } + if (message.usage !== "") { + obj.usage = message.usage; + } + if (message.defaultValue !== "") { + obj.defaultValue = message.defaultValue; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.shorthandDeprecated !== "") { + obj.shorthandDeprecated = message.shorthandDeprecated; + } + if (message.hidden !== false) { + obj.hidden = message.hidden; + } + return obj; + }, + + create, I>>(base?: I): FlagOptions { + return FlagOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlagOptions { + const message = createBaseFlagOptions(); + message.name = object.name ?? ""; + message.shorthand = object.shorthand ?? ""; + message.usage = object.usage ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.deprecated = object.deprecated ?? ""; + message.shorthandDeprecated = object.shorthandDeprecated ?? ""; + message.hidden = object.hidden ?? false; + return message; + }, +}; + +function createBasePositionalArgDescriptor(): PositionalArgDescriptor { + return { protoField: "", varargs: false }; +} + +export const PositionalArgDescriptor: MessageFns = { + encode(message: PositionalArgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protoField !== "") { + writer.uint32(10).string(message.protoField); + } + if (message.varargs !== false) { + writer.uint32(16).bool(message.varargs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PositionalArgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePositionalArgDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protoField = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.varargs = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PositionalArgDescriptor { + return { + protoField: isSet(object.protoField) ? globalThis.String(object.protoField) : "", + varargs: isSet(object.varargs) ? globalThis.Boolean(object.varargs) : false, + }; + }, + + toJSON(message: PositionalArgDescriptor): unknown { + const obj: any = {}; + if (message.protoField !== "") { + obj.protoField = message.protoField; + } + if (message.varargs !== false) { + obj.varargs = message.varargs; + } + return obj; + }, + + create, I>>(base?: I): PositionalArgDescriptor { + return PositionalArgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PositionalArgDescriptor { + const message = createBasePositionalArgDescriptor(); + message.protoField = object.protoField ?? ""; + message.varargs = object.varargs ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/autocli/v1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/autocli/v1/query.ts new file mode 100644 index 00000000..5fcd821c --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/autocli/v1/query.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ModuleOptions } from "./options"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** AppOptionsRequest is the RemoteInfoService/AppOptions request type. */ +export interface AppOptionsRequest { +} + +/** AppOptionsResponse is the RemoteInfoService/AppOptions response type. */ +export interface AppOptionsResponse { + /** module_options is a map of module name to autocli module options. */ + moduleOptions: { [key: string]: ModuleOptions }; +} + +export interface AppOptionsResponse_ModuleOptionsEntry { + key: string; + value: ModuleOptions | undefined; +} + +function createBaseAppOptionsRequest(): AppOptionsRequest { + return {}; +} + +export const AppOptionsRequest: MessageFns = { + encode(_: AppOptionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): AppOptionsRequest { + return {}; + }, + + toJSON(_: AppOptionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): AppOptionsRequest { + return AppOptionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): AppOptionsRequest { + const message = createBaseAppOptionsRequest(); + return message; + }, +}; + +function createBaseAppOptionsResponse(): AppOptionsResponse { + return { moduleOptions: {} }; +} + +export const AppOptionsResponse: MessageFns = { + encode(message: AppOptionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.moduleOptions).forEach(([key, value]) => { + AppOptionsResponse_ModuleOptionsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = AppOptionsResponse_ModuleOptionsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.moduleOptions[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse { + return { + moduleOptions: isObject(object.moduleOptions) + ? Object.entries(object.moduleOptions).reduce<{ [key: string]: ModuleOptions }>((acc, [key, value]) => { + acc[key] = ModuleOptions.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: AppOptionsResponse): unknown { + const obj: any = {}; + if (message.moduleOptions) { + const entries = Object.entries(message.moduleOptions); + if (entries.length > 0) { + obj.moduleOptions = {}; + entries.forEach(([k, v]) => { + obj.moduleOptions[k] = ModuleOptions.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): AppOptionsResponse { + return AppOptionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AppOptionsResponse { + const message = createBaseAppOptionsResponse(); + message.moduleOptions = Object.entries(object.moduleOptions ?? {}).reduce<{ [key: string]: ModuleOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ModuleOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseAppOptionsResponse_ModuleOptionsEntry(): AppOptionsResponse_ModuleOptionsEntry { + return { key: "", value: undefined }; +} + +export const AppOptionsResponse_ModuleOptionsEntry: MessageFns = { + encode(message: AppOptionsResponse_ModuleOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ModuleOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse_ModuleOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ModuleOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse_ModuleOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ModuleOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: AppOptionsResponse_ModuleOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ModuleOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): AppOptionsResponse_ModuleOptionsEntry { + return AppOptionsResponse_ModuleOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): AppOptionsResponse_ModuleOptionsEntry { + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ModuleOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +/** + * RemoteInfoService provides clients with the information they need + * to build dynamically CLI clients for remote chains. + */ +export interface Query { + /** AppOptions returns the autocli options for all of the modules in an app. */ + AppOptions(request: AppOptionsRequest): Promise; +} + +export const QueryServiceName = "cosmos.autocli.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 || QueryServiceName; + this.rpc = rpc; + this.AppOptions = this.AppOptions.bind(this); + } + AppOptions(request: AppOptionsRequest): Promise { + const data = AppOptionsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AppOptions", data); + return promise.then((data) => AppOptionsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/module/v1/module.ts new file mode 100644 index 00000000..18dd6917 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/module/v1/module.ts @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.bank.module.v1"; + +/** Module is the config object of the bank module. */ +export interface Module { + /** + * blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving + * funds. If left empty it defaults to the list of account names supplied in the auth module configuration as + * module_account_permissions + */ + blockedModuleAccountsOverride: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** + * restrictions_order specifies the order of send restrictions and should be + * a list of module names which provide a send restriction instance. If no + * order is provided, then restrictions will be applied in alphabetical order + * of module names. + */ + restrictionsOrder: string[]; +} + +function createBaseModule(): Module { + return { blockedModuleAccountsOverride: [], authority: "", restrictionsOrder: [] }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.blockedModuleAccountsOverride) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + for (const v of message.restrictionsOrder) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockedModuleAccountsOverride.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.restrictionsOrder.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + blockedModuleAccountsOverride: globalThis.Array.isArray(object?.blockedModuleAccountsOverride) + ? object.blockedModuleAccountsOverride.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + restrictionsOrder: globalThis.Array.isArray(object?.restrictionsOrder) + ? object.restrictionsOrder.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.blockedModuleAccountsOverride?.length) { + obj.blockedModuleAccountsOverride = message.blockedModuleAccountsOverride; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.restrictionsOrder?.length) { + obj.restrictionsOrder = message.restrictionsOrder; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.blockedModuleAccountsOverride = object.blockedModuleAccountsOverride?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.restrictionsOrder = object.restrictionsOrder?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/authz.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 00000000..3437ed53 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,127 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + spendLimit: Coin[]; + /** + * allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + * granter. If omitted, any recipient is allowed. + * + * Since: cosmos-sdk 0.47 + */ + allowList: string[]; +} + +function createBaseSendAuthorization(): SendAuthorization { + return { spendLimit: [], allowList: [] }; +} + +export const SendAuthorization: MessageFns = { + encode(message: SendAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.allowList) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendAuthorization { + return { + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + allowList: globalThis.Array.isArray(object?.allowList) + ? object.allowList.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: SendAuthorization): unknown { + const obj: any = {}; + if (message.spendLimit?.length) { + obj.spendLimit = message.spendLimit.map((e) => Coin.toJSON(e)); + } + if (message.allowList?.length) { + obj.allowList = message.allowList; + } + return obj; + }, + + create, I>>(base?: I): SendAuthorization { + return SendAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.allowList = object.allowList?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/bank.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..92e997fb --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,755 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/bank.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** Params defines the parameters for the bank module. */ +export interface Params { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + * + * @deprecated + */ + sendEnabled: SendEnabled[]; + defaultSendEnabled: boolean; +} + +/** + * 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 */ + denomUnits: DenomUnit[]; + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ + base: string; + /** + * display indicates the suggested denom that should be + * displayed in clients. + */ + display: string; + /** + * name defines the name of the token (eg: Cosmos Atom) + * + * Since: cosmos-sdk 0.43 + */ + name: string; + /** + * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + * be the same as the display. + * + * Since: cosmos-sdk 0.43 + */ + symbol: string; + /** + * URI to a document (on or off-chain) that contains additional information. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uri: string; + /** + * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + * the document didn't change. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uriHash: string; +} + +function createBaseParams(): Params { + return { sendEnabled: [], defaultSendEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.defaultSendEnabled !== false) { + writer.uint32(16).bool(message.defaultSendEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.defaultSendEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + defaultSendEnabled: isSet(object.defaultSendEnabled) ? globalThis.Boolean(object.defaultSendEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.defaultSendEnabled !== false) { + obj.defaultSendEnabled = message.defaultSendEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.defaultSendEnabled = object.defaultSendEnabled ?? false; + return message; + }, +}; + +function createBaseSendEnabled(): SendEnabled { + return { denom: "", enabled: false }; +} + +export const SendEnabled: MessageFns = { + encode(message: SendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled !== false) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendEnabled { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false, + }; + }, + + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.enabled !== false) { + obj.enabled = message.enabled; + } + return obj; + }, + + create, I>>(base?: I): SendEnabled { + return SendEnabled.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Input, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Input { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Input { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Input): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Input { + return Input.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Output, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Output { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Output { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Output): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Output { + return Output.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Supply, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Supply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSupply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.total.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Supply { + return { total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: Supply): unknown { + const obj: any = {}; + if (message.total?.length) { + obj.total = message.total.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Supply { + return Supply.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomUnit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } + for (const v of message.aliases) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomUnit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.exponent = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.aliases.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomUnit { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + exponent: isSet(object.exponent) ? globalThis.Number(object.exponent) : 0, + aliases: globalThis.Array.isArray(object?.aliases) ? object.aliases.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.exponent !== 0) { + obj.exponent = Math.round(message.exponent); + } + if (message.aliases?.length) { + obj.aliases = message.aliases; + } + return obj; + }, + + create, I>>(base?: I): DenomUnit { + return DenomUnit.fromPartial(base ?? ({} as any)); + }, + 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: "", denomUnits: [], base: "", display: "", name: "", symbol: "", uri: "", uriHash: "" }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denomUnits) { + DenomUnit.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } + if (message.name !== "") { + writer.uint32(42).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(50).string(message.symbol); + } + if (message.uri !== "") { + writer.uint32(58).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(66).string(message.uriHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denomUnits.push(DenomUnit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.base = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.display = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.symbol = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.uri = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.uriHash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + description: isSet(object.description) ? globalThis.String(object.description) : "", + denomUnits: globalThis.Array.isArray(object?.denomUnits) + ? object.denomUnits.map((e: any) => DenomUnit.fromJSON(e)) + : [], + base: isSet(object.base) ? globalThis.String(object.base) : "", + display: isSet(object.display) ? globalThis.String(object.display) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.description !== "") { + obj.description = message.description; + } + if (message.denomUnits?.length) { + obj.denomUnits = message.denomUnits.map((e) => DenomUnit.toJSON(e)); + } + if (message.base !== "") { + obj.base = message.base; + } + if (message.display !== "") { + obj.display = message.display; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denomUnits = object.denomUnits?.map((e) => DenomUnit.fromPartial(e)) || []; + message.base = object.base ?? ""; + message.display = object.display ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 00000000..b9d9a434 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,270 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** 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 different coins. */ + denomMetadata: Metadata[]; + /** + * send_enabled defines the denoms where send is enabled or disabled. + * + * Since: cosmos-sdk 0.47 + */ + sendEnabled: SendEnabled[]; +} + +/** + * 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: [], denomMetadata: [], sendEnabled: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.balances) { + Balance.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.denomMetadata) { + Metadata.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balances.push(Balance.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.denomMetadata.push(Metadata.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + balances: globalThis.Array.isArray(object?.balances) ? object.balances.map((e: any) => Balance.fromJSON(e)) : [], + supply: globalThis.Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + denomMetadata: globalThis.Array.isArray(object?.denomMetadata) + ? object.denomMetadata.map((e: any) => Metadata.fromJSON(e)) + : [], + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Balance.toJSON(e)); + } + if (message.supply?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.denomMetadata?.length) { + obj.denomMetadata = message.denomMetadata.map((e) => Metadata.toJSON(e)); + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.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) + ? Params.fromPartial(object.params) + : undefined; + message.balances = object.balances?.map((e) => Balance.fromPartial(e)) || []; + message.supply = object.supply?.map((e) => Coin.fromPartial(e)) || []; + message.denomMetadata = object.denomMetadata?.map((e) => Metadata.fromPartial(e)) || []; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBalance(): Balance { + return { address: "", coins: [] }; +} + +export const Balance: MessageFns = { + encode(message: Balance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Balance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Balance { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Balance): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Balance { + return Balance.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/query.ts new file mode 100644 index 00000000..67edba9b --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,2382 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } 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 | undefined; +} + +/** 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 + | undefined; + /** + * resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. + * + * Since: cosmos-sdk 0.50 + */ + resolveDenom: boolean; +} + +/** + * 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 | undefined; +} + +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} + +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponse { + /** balance is the balance of the coin. */ + balance: Coin | undefined; +} + +/** + * 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 provides the parameters of the bank module. */ + params: Params | undefined; +} + +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} + +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata: Metadata | undefined; +} + +/** + * 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 | undefined; +} + +/** + * DenomOwner defines structure representing an account that owns or holds a + * particular denominated token. It contains the account address and account + * balance of the denominated token. + * + * Since: cosmos-sdk 0.46 + */ +export interface DenomOwner { + /** address defines the address that owns a particular denomination. */ + address: string; + /** balance is the balance of the denominated coin for an account. */ + balance: Coin | undefined; +} + +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryRequest { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequest { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination: PageRequest | undefined; +} + +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponse { + sendEnabled: SendEnabled[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination: PageResponse | undefined; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { address: "", denom: "" }; +} + +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + 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, resolveDenom: false }; +} + +export const QueryAllBalancesRequest: MessageFns = { + encode(message: QueryAllBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.resolveDenom !== false) { + writer.uint32(24).bool(message.resolveDenom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.resolveDenom = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + resolveDenom: isSet(object.resolveDenom) ? globalThis.Boolean(object.resolveDenom) : false, + }; + }, + + toJSON(message: QueryAllBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.resolveDenom !== false) { + obj.resolveDenom = message.resolveDenom; + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesRequest { + return QueryAllBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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; + message.resolveDenom = object.resolveDenom ?? false; + return message; + }, +}; + +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { balances: [], pagination: undefined }; +} + +export const QueryAllBalancesResponse: MessageFns = { + encode(message: QueryAllBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesResponse { + return QueryAllBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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 createBaseQuerySpendableBalanceByDenomRequest(): QuerySpendableBalanceByDenomRequest { + return { address: "", denom: "" }; +} + +export const QuerySpendableBalanceByDenomRequest: MessageFns = { + encode(message: QuerySpendableBalanceByDenomRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QuerySpendableBalanceByDenomRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySpendableBalanceByDenomResponse(): QuerySpendableBalanceByDenomResponse { + return { balance: undefined }; +} + +export const QuerySpendableBalanceByDenomResponse: MessageFns = { + encode(message: QuerySpendableBalanceByDenomResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QuerySpendableBalanceByDenomResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + message.balance = (object.balance !== undefined && object.balance !== null) + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; + +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { pagination: undefined }; +} + +export const QueryTotalSupplyRequest: MessageFns = { + encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryTotalSupplyRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyResponse { + return { + supply: globalThis.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?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySupplyOfRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QuerySupplyOfRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfRequest { + return QuerySupplyOfRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { amount: undefined }; +} + +export const QuerySupplyOfResponse: MessageFns = { + encode(message: QuerySupplyOfResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfResponse { + return { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; + }, + + toJSON(message: QuerySupplyOfResponse): unknown { + const obj: any = {}; + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfResponse { + return QuerySupplyOfResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { pagination: undefined }; +} + +export const QueryDenomsMetadataRequest: MessageFns = { + encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDenomsMetadataRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.metadatas) { + Metadata.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadatas.push(Metadata.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataResponse { + return { + metadatas: globalThis.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?.length) { + obj.metadatas = message.metadatas.map((e) => Metadata.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataResponse: MessageFns = { + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringRequest(): QueryDenomMetadataByQueryStringRequest { + return { denom: "" }; +} + +export const QueryDenomMetadataByQueryStringRequest: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringRequest { + return QueryDenomMetadataByQueryStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringRequest { + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringResponse(): QueryDenomMetadataByQueryStringResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataByQueryStringResponse: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringResponse { + return QueryDenomMetadataByQueryStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringResponse { + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + 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: MessageFns = { + encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomOwner, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomOwner(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomOwner { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DenomOwner): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DenomOwner { + return DenomOwner.fromPartial(base ?? ({} as any)); + }, + 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 { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersResponse: MessageFns = { + encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryRequest(): QueryDenomOwnersByQueryRequest { + return { denom: "", pagination: undefined }; +} + +export const QueryDenomOwnersByQueryRequest: MessageFns = { + encode(message: QueryDenomOwnersByQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryRequest { + return QueryDenomOwnersByQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryRequest { + const message = createBaseQueryDenomOwnersByQueryRequest(); + message.denom = object.denom ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryResponse(): QueryDenomOwnersByQueryResponse { + return { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersByQueryResponse: MessageFns = { + encode(message: QueryDenomOwnersByQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryResponse { + return QueryDenomOwnersByQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryResponse { + const message = createBaseQueryDenomOwnersByQueryResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledRequest(): QuerySendEnabledRequest { + return { denoms: [], pagination: undefined }; +} + +export const QuerySendEnabledRequest: MessageFns = { + encode(message: QuerySendEnabledRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denoms.push(reader.string()); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledRequest { + return { + denoms: globalThis.Array.isArray(object?.denoms) ? object.denoms.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledRequest): unknown { + const obj: any = {}; + if (message.denoms?.length) { + obj.denoms = message.denoms; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledRequest { + return QuerySendEnabledRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map((e) => e) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledResponse(): QuerySendEnabledResponse { + return { sendEnabled: [], pagination: undefined }; +} + +export const QuerySendEnabledResponse: MessageFns = { + encode(message: QuerySendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledResponse { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledResponse): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledResponse { + return QuerySendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + AllBalances(request: QueryAllBalancesRequest): Promise; + /** + * SpendableBalances queries the spendable balance of all coins for a single + * account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + SpendableBalances(request: QuerySpendableBalancesRequest): Promise; + /** + * SpendableBalanceByDenom queries the spendable balance of a single denom for + * a single account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.47 + */ + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise; + /** + * TotalSupply queries the total supply of all coins. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + TotalSupply(request: QueryTotalSupplyRequest): Promise; + /** + * SupplyOf queries the supply of a single coin. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + SupplyOf(request: QuerySupplyOfRequest): Promise; + /** Params queries the parameters of x/bank module. */ + Params(request: QueryParamsRequest): Promise; + /** DenomMetadata queries the client metadata of a given coin denomination. */ + DenomMetadata(request: QueryDenomMetadataRequest): Promise; + /** DenomMetadataByQueryString queries the client metadata of a given coin denomination. */ + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + DenomOwners(request: QueryDenomOwnersRequest): Promise; + /** + * DenomOwnersByQuery queries for all account addresses that own a particular token + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise; + /** + * SendEnabled queries for SendEnabled entries. + * + * This query only returns denominations that have specific SendEnabled settings. + * Any denomination that does not have a specific setting will use the default + * params.default_send_enabled, and will not be returned by this query. + * + * Since: cosmos-sdk 0.47 + */ + SendEnabled(request: QuerySendEnabledRequest): Promise; +} + +export const QueryServiceName = "cosmos.bank.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 || QueryServiceName; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.AllBalances = this.AllBalances.bind(this); + this.SpendableBalances = this.SpendableBalances.bind(this); + this.SpendableBalanceByDenom = this.SpendableBalanceByDenom.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.DenomMetadataByQueryString = this.DenomMetadataByQueryString.bind(this); + this.DenomsMetadata = this.DenomsMetadata.bind(this); + this.DenomOwners = this.DenomOwners.bind(this); + this.DenomOwnersByQuery = this.DenomOwnersByQuery.bind(this); + this.SendEnabled = this.SendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise { + const data = QuerySpendableBalanceByDenomRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SpendableBalanceByDenom", data); + return promise.then((data) => QuerySpendableBalanceByDenomResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): Promise { + const data = QueryDenomMetadataByQueryStringRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomMetadataByQueryString", data); + return promise.then((data) => QueryDenomMetadataByQueryStringResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise { + const data = QueryDenomOwnersByQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomOwnersByQuery", data); + return promise.then((data) => QueryDenomOwnersByQueryResponse.decode(new BinaryReader(data))); + } + + SendEnabled(request: QuerySendEnabledRequest): Promise { + const data = QuerySendEnabledRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendEnabled", data); + return promise.then((data) => QuerySendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 00000000..1f1637f5 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,687 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Input, Output, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSend { + fromAddress: string; + toAddress: 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, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: Input[]; + outputs: Output[]; +} + +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabled { + /** authority is the address that controls the module. */ + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; +} + +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponse { +} + +function createBaseMsgSend(): MsgSend { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +function createBaseMsgMultiSend(): MsgMultiSend { + return { inputs: [], outputs: [] }; +} + +export const MsgMultiSend: MessageFns = { + encode(message: MsgMultiSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.inputs) { + Input.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.outputs) { + Output.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inputs.push(Input.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outputs.push(Output.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgMultiSend { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e: any) => Input.fromJSON(e)) : [], + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e: any) => Output.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgMultiSend): unknown { + const obj: any = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => Input.toJSON(e)); + } + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => Output.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgMultiSend { + return MsgMultiSend.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgMultiSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgMultiSendResponse { + return {}; + }, + + toJSON(_: MsgMultiSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgMultiSendResponse { + return MsgMultiSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSetSendEnabled(): MsgSetSendEnabled { + return { authority: "", sendEnabled: [], useDefaultFor: [] }; +} + +export const MsgSetSendEnabled: MessageFns = { + encode(message: MsgSetSendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.useDefaultFor) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.useDefaultFor.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetSendEnabled { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + useDefaultFor: globalThis.Array.isArray(object?.useDefaultFor) + ? object.useDefaultFor.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgSetSendEnabled): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.useDefaultFor?.length) { + obj.useDefaultFor = message.useDefaultFor; + } + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabled { + return MsgSetSendEnabled.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + message.authority = object.authority ?? ""; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.useDefaultFor = object.useDefaultFor?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgSetSendEnabledResponse(): MsgSetSendEnabledResponse { + return {}; +} + +export const MsgSetSendEnabledResponse: MessageFns = { + encode(_: MsgSetSendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetSendEnabledResponse { + return {}; + }, + + toJSON(_: MsgSetSendEnabledResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/bank module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SetSendEnabled is a governance operation for setting the SendEnabled flag + * on any number of Denoms. Only the entries to add or update should be + * included. Entries that already exist in the store, but that aren't + * included in this message, will be left unchanged. + * + * Since: cosmos-sdk 0.47 + */ + SetSendEnabled(request: MsgSetSendEnabled): Promise; +} + +export const MsgServiceName = "cosmos.bank.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 || MsgServiceName; + this.rpc = rpc; + this.Send = this.Send.bind(this); + this.MultiSend = this.MultiSend.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.SetSendEnabled = this.SetSendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SetSendEnabled(request: MsgSetSendEnabled): Promise { + const data = MsgSetSendEnabled.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetSendEnabled", data); + return promise.then((data) => MsgSetSendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 00000000..6da88804 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1425 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/abci/v1beta1/abci.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Event } from "../../../../tendermint/abci/types"; +import { Block } from "../../../../tendermint/types/block"; + +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: number; + /** The transaction hash. */ + txhash: string; + /** Namespace for the Code */ + codespace: string; + /** Response code. */ + code: number; + /** Result bytes, if any. */ + data: string; + /** + * The output of the application's logger (raw string). May be + * non-deterministic. + */ + rawLog: string; + /** The output of the application's logger (typed). May be non-deterministic. */ + logs: ABCIMessageLog[]; + /** Additional information. May be non-deterministic. */ + info: string; + /** Amount of gas requested for transaction. */ + gasWanted: number; + /** Amount of gas consumed by transaction. */ + gasUsed: number; + /** The request transaction bytes. */ + tx: + | Any + | undefined; + /** + * Time of the previous block. For heights > 1, it's the weighted median of + * the timestamps of the valid votes in the block.LastCommit. For height == 1, + * it's genesis time. + */ + timestamp: string; + /** + * Events defines all the events emitted by processing a transaction. Note, + * these events include those emitted by processing all the messages and those + * emitted from the ante. Whereas Logs contains the events, with + * additional metadata, emitted only by processing the messages. + * + * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + */ + events: Event[]; +} + +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLog { + msgIndex: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEvent[]; +} + +/** + * 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. */ + gasWanted: number; + /** GasUsed is the amount of gas actually consumed. */ + gasUsed: number; +} + +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface Result { + /** + * Data is any data returned from message or handler execution. It MUST be + * length prefixed in order to separate data from multiple message executions. + * Deprecated. This field is still populated, but prefer msg_response instead + * because it also contains the Msg response typeURL. + * + * @deprecated + */ + data: Uint8Array; + /** Log contains the log information from message or handler execution. */ + log: string; + /** + * Events contains a slice of Event objects that were emitted during message + * or handler execution. + */ + events: Event[]; + /** + * msg_responses contains the Msg handler responses type packed in Anys. + * + * Since: cosmos-sdk 0.46 + */ + msgResponses: Any[]; +} + +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponse { + gasInfo: GasInfo | undefined; + result: Result | undefined; +} + +/** + * MsgData defines the data returned in a Result object during message + * execution. + * + * @deprecated + */ +export interface MsgData { + msgType: 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 + */ + msgResponses: Any[]; +} + +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResult { + /** Count of all txs */ + totalCount: number; + /** Count of txs in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count txs per page */ + limit: number; + /** List of txs in current page */ + txs: TxResponse[]; +} + +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResult { + /** Count of all blocks */ + totalCount: number; + /** Count of blocks in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count blocks per page */ + limit: number; + /** List of blocks in current page */ + blocks: Block[]; +} + +function createBaseTxResponse(): TxResponse { + return { + height: 0, + txhash: "", + codespace: "", + code: 0, + data: "", + rawLog: "", + logs: [], + info: "", + gasWanted: 0, + gasUsed: 0, + tx: undefined, + timestamp: "", + events: [], + }; +} + +export const TxResponse: MessageFns = { + encode(message: TxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.rawLog !== "") { + writer.uint32(50).string(message.rawLog); + } + for (const v of message.logs) { + ABCIMessageLog.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.info !== "") { + writer.uint32(66).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(72).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(80).int64(message.gasUsed); + } + if (message.tx !== undefined) { + Any.encode(message.tx, writer.uint32(90).fork()).join(); + } + if (message.timestamp !== "") { + writer.uint32(98).string(message.timestamp); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(106).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txhash = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codespace = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.code = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.data = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.rawLog = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.info = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.tx = Any.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.timestamp = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResponse { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + txhash: isSet(object.txhash) ? globalThis.String(object.txhash) : "", + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + rawLog: isSet(object.rawLog) ? globalThis.String(object.rawLog) : "", + logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => ABCIMessageLog.fromJSON(e)) : [], + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + tx: isSet(object.tx) ? Any.fromJSON(object.tx) : undefined, + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.txhash !== "") { + obj.txhash = message.txhash; + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.rawLog !== "") { + obj.rawLog = message.rawLog; + } + if (message.logs?.length) { + obj.logs = message.logs.map((e) => ABCIMessageLog.toJSON(e)); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + if (message.tx !== undefined) { + obj.tx = Any.toJSON(message.tx); + } + if (message.timestamp !== "") { + obj.timestamp = message.timestamp; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxResponse { + return TxResponse.fromPartial(base ?? ({} as any)); + }, + 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.rawLog = object.rawLog ?? ""; + message.logs = object.logs?.map((e) => ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 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 { msgIndex: 0, log: "", events: [] }; +} + +export const ABCIMessageLog: MessageFns = { + encode(message: ABCIMessageLog, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgIndex !== 0) { + writer.uint32(8).uint32(message.msgIndex); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + StringEvent.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIMessageLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.msgIndex = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(StringEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIMessageLog { + return { + msgIndex: isSet(object.msgIndex) ? globalThis.Number(object.msgIndex) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => StringEvent.fromJSON(e)) : [], + }; + }, + + toJSON(message: ABCIMessageLog): unknown { + const obj: any = {}; + if (message.msgIndex !== 0) { + obj.msgIndex = Math.round(message.msgIndex); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => StringEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ABCIMessageLog { + return ABCIMessageLog.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msgIndex = object.msgIndex ?? 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: MessageFns = { + encode(message: StringEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + Attribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(Attribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StringEvent { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => Attribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: StringEvent): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => Attribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): StringEvent { + return StringEvent.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Attribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Attribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Attribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: Attribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Attribute { + return Attribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseGasInfo(): GasInfo { + return { gasWanted: 0, gasUsed: 0 }; +} + +export const GasInfo: MessageFns = { + encode(message: GasInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasWanted !== 0) { + writer.uint32(8).uint64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(16).uint64(message.gasUsed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.gasWanted = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasUsed = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GasInfo { + return { + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + }; + }, + + toJSON(message: GasInfo): unknown { + const obj: any = {}; + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + return obj; + }, + + create, I>>(base?: I): GasInfo { + return GasInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GasInfo { + const message = createBaseGasInfo(); + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + return message; + }, +}; + +function createBaseResult(): Result { + return { data: new Uint8Array(0), log: "", events: [], msgResponses: [] }; +} + +export const Result: MessageFns = { + encode(message: Result, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Result { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Result { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Result): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Result { + return Result.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Result { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSimulationResponse(): SimulationResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulationResponse: MessageFns = { + encode(message: SimulationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulationResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulationResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulationResponse { + return SimulationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulationResponse { + const message = createBaseSimulationResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseMsgData(): MsgData { + return { msgType: "", data: new Uint8Array(0) }; +} + +export const MsgData: MessageFns = { + encode(message: MsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgType !== "") { + writer.uint32(10).string(message.msgType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgData { + return { + msgType: isSet(object.msgType) ? globalThis.String(object.msgType) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: MsgData): unknown { + const obj: any = {}; + if (message.msgType !== "") { + obj.msgType = message.msgType; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): MsgData { + return MsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgData { + const message = createBaseMsgData(); + message.msgType = object.msgType ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxMsgData(): TxMsgData { + return { data: [], msgResponses: [] }; +} + +export const TxMsgData: MessageFns = { + encode(message: TxMsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.data) { + MsgData.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data.push(MsgData.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxMsgData { + return { + data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => MsgData.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxMsgData): unknown { + const obj: any = {}; + if (message.data?.length) { + obj.data = message.data.map((e) => MsgData.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxMsgData { + return TxMsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map((e) => MsgData.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchTxsResult(): SearchTxsResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, txs: [] }; +} + +export const SearchTxsResult: MessageFns = { + encode(message: SearchTxsResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).uint64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).uint64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).uint64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).uint64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + for (const v of message.txs) { + TxResponse.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchTxsResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.txs.push(TxResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchTxsResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => TxResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchTxsResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => TxResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchTxsResult { + return SearchTxsResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.txs = object.txs?.map((e) => TxResponse.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchBlocksResult(): SearchBlocksResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, blocks: [] }; +} + +export const SearchBlocksResult: MessageFns = { + encode(message: SearchBlocksResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).int64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).int64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).int64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).int64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).int64(message.limit); + } + for (const v of message.blocks) { + Block.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchBlocksResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchBlocksResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.blocks.push(Block.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchBlocksResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e: any) => Block.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchBlocksResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.blocks?.length) { + obj.blocks = message.blocks.map((e) => Block.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchBlocksResult { + return SearchBlocksResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchBlocksResult { + const message = createBaseSearchBlocksResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.blocks = object.blocks?.map((e) => Block.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/base/node/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/node/v1beta1/query.ts new file mode 100644 index 00000000..ee56c0a8 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/node/v1beta1/query.ts @@ -0,0 +1,476 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/node/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.base.node.v1beta1"; + +/** ConfigRequest defines the request structure for the Config gRPC query. */ +export interface ConfigRequest { +} + +/** ConfigResponse defines the response structure for the Config gRPC query. */ +export interface ConfigResponse { + minimumGasPrice: string; + pruningKeepRecent: string; + pruningInterval: string; + haltHeight: number; +} + +/** StateRequest defines the request structure for the status of a node. */ +export interface StatusRequest { +} + +/** StateResponse defines the response structure for the status of a node. */ +export interface StatusResponse { + /** earliest block height available in the store */ + earliestStoreHeight: number; + /** current block height */ + height: number; + /** block height timestamp */ + timestamp: + | Date + | undefined; + /** app hash of the current block */ + appHash: Uint8Array; + /** validator hash provided by the consensus header */ + validatorHash: Uint8Array; +} + +function createBaseConfigRequest(): ConfigRequest { + return {}; +} + +export const ConfigRequest: MessageFns = { + encode(_: ConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ConfigRequest { + return {}; + }, + + toJSON(_: ConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ConfigRequest { + return ConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ConfigRequest { + const message = createBaseConfigRequest(); + return message; + }, +}; + +function createBaseConfigResponse(): ConfigResponse { + return { minimumGasPrice: "", pruningKeepRecent: "", pruningInterval: "", haltHeight: 0 }; +} + +export const ConfigResponse: MessageFns = { + encode(message: ConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minimumGasPrice !== "") { + writer.uint32(10).string(message.minimumGasPrice); + } + if (message.pruningKeepRecent !== "") { + writer.uint32(18).string(message.pruningKeepRecent); + } + if (message.pruningInterval !== "") { + writer.uint32(26).string(message.pruningInterval); + } + if (message.haltHeight !== 0) { + writer.uint32(32).uint64(message.haltHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minimumGasPrice = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pruningKeepRecent = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pruningInterval = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.haltHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigResponse { + return { + minimumGasPrice: isSet(object.minimumGasPrice) ? globalThis.String(object.minimumGasPrice) : "", + pruningKeepRecent: isSet(object.pruningKeepRecent) ? globalThis.String(object.pruningKeepRecent) : "", + pruningInterval: isSet(object.pruningInterval) ? globalThis.String(object.pruningInterval) : "", + haltHeight: isSet(object.haltHeight) ? globalThis.Number(object.haltHeight) : 0, + }; + }, + + toJSON(message: ConfigResponse): unknown { + const obj: any = {}; + if (message.minimumGasPrice !== "") { + obj.minimumGasPrice = message.minimumGasPrice; + } + if (message.pruningKeepRecent !== "") { + obj.pruningKeepRecent = message.pruningKeepRecent; + } + if (message.pruningInterval !== "") { + obj.pruningInterval = message.pruningInterval; + } + if (message.haltHeight !== 0) { + obj.haltHeight = Math.round(message.haltHeight); + } + return obj; + }, + + create, I>>(base?: I): ConfigResponse { + return ConfigResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigResponse { + const message = createBaseConfigResponse(); + message.minimumGasPrice = object.minimumGasPrice ?? ""; + message.pruningKeepRecent = object.pruningKeepRecent ?? ""; + message.pruningInterval = object.pruningInterval ?? ""; + message.haltHeight = object.haltHeight ?? 0; + return message; + }, +}; + +function createBaseStatusRequest(): StatusRequest { + return {}; +} + +export const StatusRequest: MessageFns = { + encode(_: StatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): StatusRequest { + return {}; + }, + + toJSON(_: StatusRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): StatusRequest { + return StatusRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): StatusRequest { + const message = createBaseStatusRequest(); + return message; + }, +}; + +function createBaseStatusResponse(): StatusResponse { + return { + earliestStoreHeight: 0, + height: 0, + timestamp: undefined, + appHash: new Uint8Array(0), + validatorHash: new Uint8Array(0), + }; +} + +export const StatusResponse: MessageFns = { + encode(message: StatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.earliestStoreHeight !== 0) { + writer.uint32(8).uint64(message.earliestStoreHeight); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(34).bytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + writer.uint32(42).bytes(message.validatorHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.earliestStoreHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StatusResponse { + return { + earliestStoreHeight: isSet(object.earliestStoreHeight) ? globalThis.Number(object.earliestStoreHeight) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + validatorHash: isSet(object.validatorHash) ? bytesFromBase64(object.validatorHash) : new Uint8Array(0), + }; + }, + + toJSON(message: StatusResponse): unknown { + const obj: any = {}; + if (message.earliestStoreHeight !== 0) { + obj.earliestStoreHeight = Math.round(message.earliestStoreHeight); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + obj.validatorHash = base64FromBytes(message.validatorHash); + } + return obj; + }, + + create, I>>(base?: I): StatusResponse { + return StatusResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatusResponse { + const message = createBaseStatusResponse(); + message.earliestStoreHeight = object.earliestStoreHeight ?? 0; + message.height = object.height ?? 0; + message.timestamp = object.timestamp ?? undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + message.validatorHash = object.validatorHash ?? new Uint8Array(0); + return message; + }, +}; + +/** Service defines the gRPC querier service for node related queries. */ +export interface Service { + /** Config queries for the operator configuration. */ + Config(request: ConfigRequest): Promise; + /** Status queries for the node status. */ + Status(request: StatusRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.node.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + this.rpc = rpc; + this.Config = this.Config.bind(this); + this.Status = this.Status.bind(this); + } + Config(request: ConfigRequest): Promise { + const data = ConfigRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Config", data); + return promise.then((data) => ConfigResponse.decode(new BinaryReader(data))); + } + + Status(request: StatusRequest): Promise { + const data = StatusRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Status", data); + return promise.then((data) => StatusResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.nft.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts new file mode 100644 index 00000000..ebb67be4 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v1beta1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. */ + interfaceNames: string[]; +} + +/** + * ListImplementationsRequest is the request type of the ListImplementations + * RPC. + */ +export interface ListImplementationsRequest { + /** interface_name defines the interface to query the implementations for. */ + interfaceName: string; +} + +/** + * ListImplementationsResponse is the response type of the ListImplementations + * RPC. + */ +export interface ListImplementationsResponse { + implementationMessageNames: string[]; +} + +function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { + return {}; +} + +export const ListAllInterfacesRequest: MessageFns = { + encode(_: ListAllInterfacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListAllInterfacesRequest { + return {}; + }, + + toJSON(_: ListAllInterfacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesRequest { + return ListAllInterfacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListAllInterfacesRequest { + const message = createBaseListAllInterfacesRequest(); + return message; + }, +}; + +function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { + return { interfaceNames: [] }; +} + +export const ListAllInterfacesResponse: MessageFns = { + encode(message: ListAllInterfacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaceNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAllInterfacesResponse { + return { + interfaceNames: globalThis.Array.isArray(object?.interfaceNames) + ? object.interfaceNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListAllInterfacesResponse): unknown { + const obj: any = {}; + if (message.interfaceNames?.length) { + obj.interfaceNames = message.interfaceNames; + } + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesResponse { + return ListAllInterfacesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListAllInterfacesResponse { + const message = createBaseListAllInterfacesResponse(); + message.interfaceNames = object.interfaceNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListImplementationsRequest(): ListImplementationsRequest { + return { interfaceName: "" }; +} + +export const ListImplementationsRequest: MessageFns = { + encode(message: ListImplementationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceName !== "") { + writer.uint32(10).string(message.interfaceName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsRequest { + return { interfaceName: isSet(object.interfaceName) ? globalThis.String(object.interfaceName) : "" }; + }, + + toJSON(message: ListImplementationsRequest): unknown { + const obj: any = {}; + if (message.interfaceName !== "") { + obj.interfaceName = message.interfaceName; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsRequest { + return ListImplementationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsRequest { + const message = createBaseListImplementationsRequest(); + message.interfaceName = object.interfaceName ?? ""; + return message; + }, +}; + +function createBaseListImplementationsResponse(): ListImplementationsResponse { + return { implementationMessageNames: [] }; +} + +export const ListImplementationsResponse: MessageFns = { + encode(message: ListImplementationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.implementationMessageNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.implementationMessageNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsResponse { + return { + implementationMessageNames: globalThis.Array.isArray(object?.implementationMessageNames) + ? object.implementationMessageNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListImplementationsResponse): unknown { + const obj: any = {}; + if (message.implementationMessageNames?.length) { + obj.implementationMessageNames = message.implementationMessageNames; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsResponse { + return ListImplementationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsResponse { + const message = createBaseListImplementationsResponse(); + message.implementationMessageNames = object.implementationMessageNames?.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 const ReflectionServiceServiceName = "cosmos.base.reflection.v1beta1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 00000000..23a7ca89 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,2057 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v2alpha1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 + | undefined; + /** chain provides the chain descriptor */ + chain: + | ChainDescriptor + | undefined; + /** codec provides metadata information regarding codec related types */ + codec: + | CodecDescriptor + | undefined; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration: + | ConfigurationDescriptor + | undefined; + /** query_services provides metadata information regarding the available queriable endpoints */ + queryServices: + | QueryServicesDescriptor + | undefined; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx: TxDescriptor | undefined; +} + +/** 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 */ + signModes: 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 + */ + authnInfoProviderMethodFullname: 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 + */ + interfaceAcceptingMessages: InterfaceAcceptingMessageDescriptor[]; + /** interface_implementers is a list of the descriptors of the interface implementers */ + interfaceImplementers: 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 + */ + typeUrl: 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) + */ + fieldDescriptorNames: string[]; +} + +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptor { + /** bech32_account_address_prefix is the account address prefix */ + bech32AccountAddressPrefix: 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. */ + msgTypeUrl: 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptor { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + queryServices: 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 */ + isModule: 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 + */ + fullQueryPath: string; +} + +function createBaseAppDescriptor(): AppDescriptor { + return { + authn: undefined, + chain: undefined, + codec: undefined, + configuration: undefined, + queryServices: undefined, + tx: undefined, + }; +} + +export const AppDescriptor: MessageFns = { + encode(message: AppDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).join(); + } + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).join(); + } + if (message.configuration !== undefined) { + ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).join(); + } + if (message.queryServices !== undefined) { + QueryServicesDescriptor.encode(message.queryServices, writer.uint32(42).fork()).join(); + } + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.queryServices = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + queryServices: isSet(object.queryServices) ? QueryServicesDescriptor.fromJSON(object.queryServices) : undefined, + tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined, + }; + }, + + toJSON(message: AppDescriptor): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + if (message.configuration !== undefined) { + obj.configuration = ConfigurationDescriptor.toJSON(message.configuration); + } + if (message.queryServices !== undefined) { + obj.queryServices = QueryServicesDescriptor.toJSON(message.queryServices); + } + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): AppDescriptor { + return AppDescriptor.fromPartial(base ?? ({} as any)); + }, + 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.queryServices = (object.queryServices !== undefined && object.queryServices !== null) + ? QueryServicesDescriptor.fromPartial(object.queryServices) + : 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: MessageFns = { + encode(message: TxDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.msgs) { + MsgDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(MsgDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => MsgDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => MsgDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxDescriptor { + return TxDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 { signModes: [] }; +} + +export const AuthnDescriptor: MessageFns = { + encode(message: AuthnDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signModes) { + SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthnDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.signModes.push(SigningModeDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthnDescriptor { + return { + signModes: globalThis.Array.isArray(object?.signModes) + ? object.signModes.map((e: any) => SigningModeDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AuthnDescriptor): unknown { + const obj: any = {}; + if (message.signModes?.length) { + obj.signModes = message.signModes.map((e) => SigningModeDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): AuthnDescriptor { + return AuthnDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.signModes = object.signModes?.map((e) => SigningModeDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningModeDescriptor(): SigningModeDescriptor { + return { name: "", number: 0, authnInfoProviderMethodFullname: "" }; +} + +export const SigningModeDescriptor: MessageFns = { + encode(message: SigningModeDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + writer.uint32(26).string(message.authnInfoProviderMethodFullname); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningModeDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authnInfoProviderMethodFullname = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningModeDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + authnInfoProviderMethodFullname: isSet(object.authnInfoProviderMethodFullname) + ? globalThis.String(object.authnInfoProviderMethodFullname) + : "", + }; + }, + + toJSON(message: SigningModeDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + obj.authnInfoProviderMethodFullname = message.authnInfoProviderMethodFullname; + } + return obj; + }, + + create, I>>(base?: I): SigningModeDescriptor { + return SigningModeDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.authnInfoProviderMethodFullname = object.authnInfoProviderMethodFullname ?? ""; + return message; + }, +}; + +function createBaseChainDescriptor(): ChainDescriptor { + return { id: "" }; +} + +export const ChainDescriptor: MessageFns = { + encode(message: ChainDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChainDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChainDescriptor { + return { id: isSet(object.id) ? globalThis.String(object.id) : "" }; + }, + + toJSON(message: ChainDescriptor): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): ChainDescriptor { + return ChainDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ChainDescriptor { + const message = createBaseChainDescriptor(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseCodecDescriptor(): CodecDescriptor { + return { interfaces: [] }; +} + +export const CodecDescriptor: MessageFns = { + encode(message: CodecDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaces) { + InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CodecDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CodecDescriptor { + return { + interfaces: globalThis.Array.isArray(object?.interfaces) + ? object.interfaces.map((e: any) => InterfaceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: CodecDescriptor): unknown { + const obj: any = {}; + if (message.interfaces?.length) { + obj.interfaces = message.interfaces.map((e) => InterfaceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CodecDescriptor { + return CodecDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map((e) => InterfaceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { fullname: "", interfaceAcceptingMessages: [], interfaceImplementers: [] }; +} + +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.interfaceAcceptingMessages) { + InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.interfaceImplementers) { + InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.interfaceAcceptingMessages.push(InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.interfaceImplementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + interfaceAcceptingMessages: globalThis.Array.isArray(object?.interfaceAcceptingMessages) + ? object.interfaceAcceptingMessages.map((e: any) => InterfaceAcceptingMessageDescriptor.fromJSON(e)) + : [], + interfaceImplementers: globalThis.Array.isArray(object?.interfaceImplementers) + ? object.interfaceImplementers.map((e: any) => InterfaceImplementerDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.interfaceAcceptingMessages?.length) { + obj.interfaceAcceptingMessages = message.interfaceAcceptingMessages.map((e) => + InterfaceAcceptingMessageDescriptor.toJSON(e) + ); + } + if (message.interfaceImplementers?.length) { + obj.interfaceImplementers = message.interfaceImplementers.map((e) => InterfaceImplementerDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): InterfaceDescriptor { + return InterfaceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.fullname = object.fullname ?? ""; + message.interfaceAcceptingMessages = + object.interfaceAcceptingMessages?.map((e) => InterfaceAcceptingMessageDescriptor.fromPartial(e)) || []; + message.interfaceImplementers = + object.interfaceImplementers?.map((e) => InterfaceImplementerDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { + return { fullname: "", typeUrl: "" }; +} + +export const InterfaceImplementerDescriptor: MessageFns = { + encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.typeUrl !== "") { + writer.uint32(18).string(message.typeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceImplementerDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.typeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceImplementerDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", + }; + }, + + toJSON(message: InterfaceImplementerDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.typeUrl !== "") { + obj.typeUrl = message.typeUrl; + } + return obj; + }, + + create, I>>(base?: I): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + message.fullname = object.fullname ?? ""; + message.typeUrl = object.typeUrl ?? ""; + return message; + }, +}; + +function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { + return { fullname: "", fieldDescriptorNames: [] }; +} + +export const InterfaceAcceptingMessageDescriptor: MessageFns = { + encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.fieldDescriptorNames) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fieldDescriptorNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceAcceptingMessageDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + fieldDescriptorNames: globalThis.Array.isArray(object?.fieldDescriptorNames) + ? object.fieldDescriptorNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: InterfaceAcceptingMessageDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.fieldDescriptorNames?.length) { + obj.fieldDescriptorNames = message.fieldDescriptorNames; + } + return obj; + }, + + create, I>>( + base?: I, + ): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + message.fullname = object.fullname ?? ""; + message.fieldDescriptorNames = object.fieldDescriptorNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseConfigurationDescriptor(): ConfigurationDescriptor { + return { bech32AccountAddressPrefix: "" }; +} + +export const ConfigurationDescriptor: MessageFns = { + encode(message: ConfigurationDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32AccountAddressPrefix !== "") { + writer.uint32(10).string(message.bech32AccountAddressPrefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigurationDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32AccountAddressPrefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigurationDescriptor { + return { + bech32AccountAddressPrefix: isSet(object.bech32AccountAddressPrefix) + ? globalThis.String(object.bech32AccountAddressPrefix) + : "", + }; + }, + + toJSON(message: ConfigurationDescriptor): unknown { + const obj: any = {}; + if (message.bech32AccountAddressPrefix !== "") { + obj.bech32AccountAddressPrefix = message.bech32AccountAddressPrefix; + } + return obj; + }, + + create, I>>(base?: I): ConfigurationDescriptor { + return ConfigurationDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + message.bech32AccountAddressPrefix = object.bech32AccountAddressPrefix ?? ""; + return message; + }, +}; + +function createBaseMsgDescriptor(): MsgDescriptor { + return { msgTypeUrl: "" }; +} + +export const MsgDescriptor: MessageFns = { + encode(message: MsgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(10).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDescriptor { + return { msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "" }; + }, + + toJSON(message: MsgDescriptor): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgDescriptor { + return MsgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDescriptor { + const message = createBaseMsgDescriptor(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { + return {}; +} + +export const GetAuthnDescriptorRequest: MessageFns = { + encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetAuthnDescriptorRequest { + return {}; + }, + + toJSON(_: GetAuthnDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, +}; + +function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { + return { authn: undefined }; +} + +export const GetAuthnDescriptorResponse: MessageFns = { + encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetAuthnDescriptorResponse { + return { authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined }; + }, + + toJSON(message: GetAuthnDescriptorResponse): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetChainDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetChainDescriptorRequest { + return {}; + }, + + toJSON(_: GetChainDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorRequest { + return GetChainDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, +}; + +function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { + return { chain: undefined }; +} + +export const GetChainDescriptorResponse: MessageFns = { + encode(message: GetChainDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetChainDescriptorResponse { + return { chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined }; + }, + + toJSON(message: GetChainDescriptorResponse): unknown { + const obj: any = {}; + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorResponse { + return GetChainDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetCodecDescriptorRequest { + return {}; + }, + + toJSON(_: GetCodecDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, +}; + +function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { + return { codec: undefined }; +} + +export const GetCodecDescriptorResponse: MessageFns = { + encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCodecDescriptorResponse { + return { codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined }; + }, + + toJSON(message: GetCodecDescriptorResponse): unknown { + const obj: any = {}; + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetConfigurationDescriptorRequest { + return {}; + }, + + toJSON(_: GetConfigurationDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, +}; + +function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { + return { config: undefined }; +} + +export const GetConfigurationDescriptorResponse: MessageFns = { + encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetConfigurationDescriptorResponse { + return { config: isSet(object.config) ? ConfigurationDescriptor.fromJSON(object.config) : undefined }; + }, + + toJSON(message: GetConfigurationDescriptorResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = ConfigurationDescriptor.toJSON(message.config); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetQueryServicesDescriptorRequest { + return {}; + }, + + toJSON(_: GetQueryServicesDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, +}; + +function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { + return { queries: undefined }; +} + +export const GetQueryServicesDescriptorResponse: MessageFns = { + encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.queries !== undefined) { + QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetQueryServicesDescriptorResponse { + return { queries: isSet(object.queries) ? QueryServicesDescriptor.fromJSON(object.queries) : undefined }; + }, + + toJSON(message: GetQueryServicesDescriptorResponse): unknown { + const obj: any = {}; + if (message.queries !== undefined) { + obj.queries = QueryServicesDescriptor.toJSON(message.queries); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetTxDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetTxDescriptorRequest { + return {}; + }, + + toJSON(_: GetTxDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorRequest { + return GetTxDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, +}; + +function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { + return { tx: undefined }; +} + +export const GetTxDescriptorResponse: MessageFns = { + encode(message: GetTxDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxDescriptorResponse { + return { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: GetTxDescriptorResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorResponse { + return GetTxDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { queryServices: [] }; +} + +export const QueryServicesDescriptor: MessageFns = { + encode(message: QueryServicesDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.queryServices) { + QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServicesDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queryServices.push(QueryServiceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServicesDescriptor { + return { + queryServices: globalThis.Array.isArray(object?.queryServices) + ? object.queryServices.map((e: any) => QueryServiceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServicesDescriptor): unknown { + const obj: any = {}; + if (message.queryServices?.length) { + obj.queryServices = message.queryServices.map((e) => QueryServiceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServicesDescriptor { + return QueryServicesDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.queryServices = object.queryServices?.map((e) => QueryServiceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { + return { fullname: "", isModule: false, methods: [] }; +} + +export const QueryServiceDescriptor: MessageFns = { + encode(message: QueryServiceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.isModule !== false) { + writer.uint32(16).bool(message.isModule); + } + for (const v of message.methods) { + QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServiceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isModule = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServiceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + isModule: isSet(object.isModule) ? globalThis.Boolean(object.isModule) : false, + methods: globalThis.Array.isArray(object?.methods) + ? object.methods.map((e: any) => QueryMethodDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServiceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.isModule !== false) { + obj.isModule = message.isModule; + } + if (message.methods?.length) { + obj.methods = message.methods.map((e) => QueryMethodDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServiceDescriptor { + return QueryServiceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + message.fullname = object.fullname ?? ""; + message.isModule = object.isModule ?? false; + message.methods = object.methods?.map((e) => QueryMethodDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { + return { name: "", fullQueryPath: "" }; +} + +export const QueryMethodDescriptor: MessageFns = { + encode(message: QueryMethodDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.fullQueryPath !== "") { + writer.uint32(18).string(message.fullQueryPath); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryMethodDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullQueryPath = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryMethodDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + fullQueryPath: isSet(object.fullQueryPath) ? globalThis.String(object.fullQueryPath) : "", + }; + }, + + toJSON(message: QueryMethodDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.fullQueryPath !== "") { + obj.fullQueryPath = message.fullQueryPath; + } + return obj; + }, + + create, I>>(base?: I): QueryMethodDescriptor { + return QueryMethodDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + message.name = object.name ?? ""; + message.fullQueryPath = object.fullQueryPath ?? ""; + 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 const ReflectionServiceServiceName = "cosmos.base.reflection.v2alpha1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts new file mode 100644 index 00000000..f58dfb17 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts @@ -0,0 +1,1974 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { DefaultNodeInfo } from "../../../../tendermint/p2p/types"; +import { Block } from "../../../../tendermint/types/block"; +import { BlockID } from "../../../../tendermint/types/types"; +import { PageRequest, PageResponse } from "../../query/v1beta1/pagination"; +import { Block as Block1 } from "./types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightRequest { + height: number; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetRequest { + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** Validator is the type for the validator-set. */ +export interface Validator { + address: string; + pubKey: Any | undefined; + votingPower: number; + proposerPriority: number; +} + +/** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightRequest { + height: number; +} + +/** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightResponse { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + defaultNodeInfo: DefaultNodeInfo | undefined; + applicationVersion: VersionInfo | undefined; +} + +/** VersionInfo is the type for the GetNodeInfoResponse message. */ +export interface VersionInfo { + name: string; + appName: string; + version: string; + gitCommit: string; + buildTags: string; + goVersion: string; + buildDeps: Module[]; + /** Since: cosmos-sdk 0.43 */ + cosmosSdkVersion: string; +} + +/** Module is the type for VersionInfo */ +export interface Module { + /** module path */ + path: string; + /** module version */ + version: string; + /** checksum */ + sum: string; +} + +/** ABCIQueryRequest defines the request structure for the ABCIQuery gRPC query. */ +export interface ABCIQueryRequest { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +/** + * ABCIQueryResponse defines the response structure for the ABCIQuery gRPC query. + * + * Note: This type is a duplicate of the ResponseQuery proto type defined in + * Tendermint. + */ +export interface ABCIQueryResponse { + code: number; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +/** + * ProofOp defines an operation used for calculating Merkle root. The data could + * be arbitrary format, providing necessary data for example neighbouring node + * hash. + * + * Note: This type is a duplicate of the ProofOp proto type defined in Tendermint. + */ +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} + +/** + * ProofOps is Merkle proof defined by the list of ProofOps. + * + * Note: This type is a duplicate of the ProofOps proto type defined in Tendermint. + */ +export interface ProofOps { + ops: ProofOp[]; +} + +function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequest { + return { height: 0, pagination: undefined }; +} + +export const GetValidatorSetByHeightRequest: MessageFns = { + encode(message: GetValidatorSetByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightRequest { + return GetValidatorSetByHeightRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetValidatorSetByHeightResponse: MessageFns = { + encode(message: GetValidatorSetByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightResponse { + return GetValidatorSetByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetValidatorSetByHeightResponse { + const message = createBaseGetValidatorSetByHeightResponse(); + message.blockHeight = object.blockHeight ?? 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: MessageFns = { + encode(message: GetLatestValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: GetLatestValidatorSetRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetRequest { + return GetLatestValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetLatestValidatorSetResponse: MessageFns = { + encode(message: GetLatestValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetResponse { + return GetLatestValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetLatestValidatorSetResponse { + const message = createBaseGetLatestValidatorSetResponse(); + message.blockHeight = object.blockHeight ?? 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: "", pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { + return { height: 0 }; +} + +export const GetBlockByHeightRequest: MessageFns = { + encode(message: GetBlockByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: GetBlockByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightRequest { + return GetBlockByHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightRequest { + const message = createBaseGetBlockByHeightRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetBlockByHeightResponse: MessageFns = { + encode(message: GetBlockByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetBlockByHeightResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightResponse { + return GetBlockByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightResponse { + const message = createBaseGetBlockByHeightResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { + return {}; +} + +export const GetLatestBlockRequest: MessageFns = { + encode(_: GetLatestBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetLatestBlockRequest { + return {}; + }, + + toJSON(_: GetLatestBlockRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetLatestBlockRequest { + return GetLatestBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetLatestBlockRequest { + const message = createBaseGetLatestBlockRequest(); + return message; + }, +}; + +function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetLatestBlockResponse: MessageFns = { + encode(message: GetLatestBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestBlockResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetLatestBlockResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetLatestBlockResponse { + return GetLatestBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetLatestBlockResponse { + const message = createBaseGetLatestBlockResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetSyncingRequest(): GetSyncingRequest { + return {}; +} + +export const GetSyncingRequest: MessageFns = { + encode(_: GetSyncingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetSyncingRequest { + return {}; + }, + + toJSON(_: GetSyncingRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetSyncingRequest { + return GetSyncingRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetSyncingRequest { + const message = createBaseGetSyncingRequest(); + return message; + }, +}; + +function createBaseGetSyncingResponse(): GetSyncingResponse { + return { syncing: false }; +} + +export const GetSyncingResponse: MessageFns = { + encode(message: GetSyncingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.syncing !== false) { + writer.uint32(8).bool(message.syncing); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.syncing = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetSyncingResponse { + return { syncing: isSet(object.syncing) ? globalThis.Boolean(object.syncing) : false }; + }, + + toJSON(message: GetSyncingResponse): unknown { + const obj: any = {}; + if (message.syncing !== false) { + obj.syncing = message.syncing; + } + return obj; + }, + + create, I>>(base?: I): GetSyncingResponse { + return GetSyncingResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetSyncingResponse { + const message = createBaseGetSyncingResponse(); + message.syncing = object.syncing ?? false; + return message; + }, +}; + +function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { + return {}; +} + +export const GetNodeInfoRequest: MessageFns = { + encode(_: GetNodeInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetNodeInfoRequest { + return {}; + }, + + toJSON(_: GetNodeInfoRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetNodeInfoRequest { + return GetNodeInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetNodeInfoRequest { + const message = createBaseGetNodeInfoRequest(); + return message; + }, +}; + +function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { + return { defaultNodeInfo: undefined, applicationVersion: undefined }; +} + +export const GetNodeInfoResponse: MessageFns = { + encode(message: GetNodeInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.defaultNodeInfo !== undefined) { + DefaultNodeInfo.encode(message.defaultNodeInfo, writer.uint32(10).fork()).join(); + } + if (message.applicationVersion !== undefined) { + VersionInfo.encode(message.applicationVersion, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.defaultNodeInfo = DefaultNodeInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.applicationVersion = VersionInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetNodeInfoResponse { + return { + defaultNodeInfo: isSet(object.defaultNodeInfo) ? DefaultNodeInfo.fromJSON(object.defaultNodeInfo) : undefined, + applicationVersion: isSet(object.applicationVersion) + ? VersionInfo.fromJSON(object.applicationVersion) + : undefined, + }; + }, + + toJSON(message: GetNodeInfoResponse): unknown { + const obj: any = {}; + if (message.defaultNodeInfo !== undefined) { + obj.defaultNodeInfo = DefaultNodeInfo.toJSON(message.defaultNodeInfo); + } + if (message.applicationVersion !== undefined) { + obj.applicationVersion = VersionInfo.toJSON(message.applicationVersion); + } + return obj; + }, + + create, I>>(base?: I): GetNodeInfoResponse { + return GetNodeInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetNodeInfoResponse { + const message = createBaseGetNodeInfoResponse(); + message.defaultNodeInfo = (object.defaultNodeInfo !== undefined && object.defaultNodeInfo !== null) + ? DefaultNodeInfo.fromPartial(object.defaultNodeInfo) + : undefined; + message.applicationVersion = (object.applicationVersion !== undefined && object.applicationVersion !== null) + ? VersionInfo.fromPartial(object.applicationVersion) + : undefined; + return message; + }, +}; + +function createBaseVersionInfo(): VersionInfo { + return { + name: "", + appName: "", + version: "", + gitCommit: "", + buildTags: "", + goVersion: "", + buildDeps: [], + cosmosSdkVersion: "", + }; +} + +export const VersionInfo: MessageFns = { + encode(message: VersionInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.appName !== "") { + writer.uint32(18).string(message.appName); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.gitCommit !== "") { + writer.uint32(34).string(message.gitCommit); + } + if (message.buildTags !== "") { + writer.uint32(42).string(message.buildTags); + } + if (message.goVersion !== "") { + writer.uint32(50).string(message.goVersion); + } + for (const v of message.buildDeps) { + Module.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.cosmosSdkVersion !== "") { + writer.uint32(66).string(message.cosmosSdkVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.version = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gitCommit = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.buildTags = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.goVersion = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.buildDeps.push(Module.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.cosmosSdkVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + gitCommit: isSet(object.gitCommit) ? globalThis.String(object.gitCommit) : "", + buildTags: isSet(object.buildTags) ? globalThis.String(object.buildTags) : "", + goVersion: isSet(object.goVersion) ? globalThis.String(object.goVersion) : "", + buildDeps: globalThis.Array.isArray(object?.buildDeps) + ? object.buildDeps.map((e: any) => Module.fromJSON(e)) + : [], + cosmosSdkVersion: isSet(object.cosmosSdkVersion) ? globalThis.String(object.cosmosSdkVersion) : "", + }; + }, + + toJSON(message: VersionInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.gitCommit !== "") { + obj.gitCommit = message.gitCommit; + } + if (message.buildTags !== "") { + obj.buildTags = message.buildTags; + } + if (message.goVersion !== "") { + obj.goVersion = message.goVersion; + } + if (message.buildDeps?.length) { + obj.buildDeps = message.buildDeps.map((e) => Module.toJSON(e)); + } + if (message.cosmosSdkVersion !== "") { + obj.cosmosSdkVersion = message.cosmosSdkVersion; + } + return obj; + }, + + create, I>>(base?: I): VersionInfo { + return VersionInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionInfo { + const message = createBaseVersionInfo(); + message.name = object.name ?? ""; + message.appName = object.appName ?? ""; + message.version = object.version ?? ""; + message.gitCommit = object.gitCommit ?? ""; + message.buildTags = object.buildTags ?? ""; + message.goVersion = object.goVersion ?? ""; + message.buildDeps = object.buildDeps?.map((e) => Module.fromPartial(e)) || []; + message.cosmosSdkVersion = object.cosmosSdkVersion ?? ""; + return message; + }, +}; + +function createBaseModule(): Module { + return { path: "", version: "", sum: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sum = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + path: isSet(object.path) ? globalThis.String(object.path) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + sum: isSet(object.sum) ? globalThis.String(object.sum) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.sum !== "") { + obj.sum = message.sum; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.path = object.path ?? ""; + message.version = object.version ?? ""; + message.sum = object.sum ?? ""; + return message; + }, +}; + +function createBaseABCIQueryRequest(): ABCIQueryRequest { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const ABCIQueryRequest: MessageFns = { + encode(message: ABCIQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryRequest { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: ABCIQueryRequest): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryRequest { + return ABCIQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryRequest { + const message = createBaseABCIQueryRequest(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseABCIQueryResponse(): ABCIQueryResponse { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ABCIQueryResponse: MessageFns = { + encode(message: ABCIQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryResponse { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ABCIQueryResponse): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryResponse { + return ABCIQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryResponse { + const message = createBaseABCIQueryResponse(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? 0; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseProofOp(): ProofOp { + return { type: "", key: new Uint8Array(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + 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; + /** + * ABCIQuery defines a query handler that supports ABCI queries directly to the + * application, bypassing Tendermint completely. The ABCI query must contain + * a valid and supported path, including app, custom, p2p, and store. + * + * Since: cosmos-sdk 0.46 + */ + ABCIQuery(request: ABCIQueryRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.tendermint.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.ABCIQuery = this.ABCIQuery.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ABCIQuery(request: ABCIQueryRequest): Promise { + const data = ABCIQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ABCIQuery", data); + return promise.then((data) => ABCIQueryResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts new file mode 100644 index 00000000..2d229c81 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts @@ -0,0 +1,530 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { EvidenceList } from "../../../../tendermint/types/evidence"; +import { BlockID, Commit, Data } from "../../../../tendermint/types/types"; +import { Consensus } from "../../../../tendermint/version/types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** + * Block is tendermint type Block, with the Header proposer address + * field converted to bech32 string. + */ +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +/** Header defines the structure of a Tendermint block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** + * proposer_address is the original block proposer address, formatted as a Bech32 string. + * In Tendermint, this type is `bytes`, but in the SDK, we convert it to a Bech32 string + * for better UX. + */ + proposerAddress: string; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: "", + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + writer.uint32(114).string(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? globalThis.String(object.proposerAddress) : "", + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + obj.proposerAddress = message.proposerAddress; + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..72eff8cb --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,335 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ +export interface IntProto { + int: string; +} + +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ +export interface DecProto { + dec: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +export const IntProto: MessageFns = { + encode(message: IntProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IntProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.int = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IntProto { + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + 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 ?? ""; + return message; + }, +}; + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +export const DecProto: MessageFns = { + encode(message: DecProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dec = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecProto { + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + 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 ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/module/v1/module.ts new file mode 100644 index 00000000..733fcc4e --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.circuit.module.v1"; + +/** Module is the config object of the circuit module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/query.ts new file mode 100644 index 00000000..7d1037ab --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/query.ts @@ -0,0 +1,470 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GenesisAccountPermissions, Permissions } from "./types"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + address: string; +} + +/** AccountResponse is the response type for the Query/Account RPC method. */ +export interface AccountResponse { + permission: Permissions | undefined; +} + +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ +export interface QueryAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** AccountsResponse is the response type for the Query/Accounts RPC method. */ +export interface AccountsResponse { + accounts: GenesisAccountPermissions[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryDisableListRequest is the request type for the Query/DisabledList RPC method. */ +export interface QueryDisabledListRequest { +} + +/** DisabledListResponse is the response type for the Query/DisabledList RPC method. */ +export interface DisabledListResponse { + disabledList: string[]; +} + +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { address: "" }; +} + +export const QueryAccountRequest: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseAccountResponse(): AccountResponse { + return { permission: undefined }; +} + +export const AccountResponse: MessageFns = { + encode(message: AccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.permission !== undefined) { + Permissions.encode(message.permission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.permission = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccountResponse { + return { permission: isSet(object.permission) ? Permissions.fromJSON(object.permission) : undefined }; + }, + + toJSON(message: AccountResponse): unknown { + const obj: any = {}; + if (message.permission !== undefined) { + obj.permission = Permissions.toJSON(message.permission); + } + return obj; + }, + + create, I>>(base?: I): AccountResponse { + return AccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccountResponse { + const message = createBaseAccountResponse(); + message.permission = (object.permission !== undefined && object.permission !== null) + ? Permissions.fromPartial(object.permission) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseAccountsResponse(): AccountsResponse { + return { accounts: [], pagination: undefined }; +} + +export const AccountsResponse: MessageFns = { + encode(message: AccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e: any) => GenesisAccountPermissions.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: AccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => GenesisAccountPermissions.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): AccountsResponse { + return AccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccountsResponse { + const message = createBaseAccountsResponse(); + message.accounts = object.accounts?.map((e) => GenesisAccountPermissions.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDisabledListRequest(): QueryDisabledListRequest { + return {}; +} + +export const QueryDisabledListRequest: MessageFns = { + encode(_: QueryDisabledListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDisabledListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDisabledListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryDisabledListRequest { + return {}; + }, + + toJSON(_: QueryDisabledListRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryDisabledListRequest { + return QueryDisabledListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryDisabledListRequest { + const message = createBaseQueryDisabledListRequest(); + return message; + }, +}; + +function createBaseDisabledListResponse(): DisabledListResponse { + return { disabledList: [] }; +} + +export const DisabledListResponse: MessageFns = { + encode(message: DisabledListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.disabledList) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DisabledListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDisabledListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.disabledList.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DisabledListResponse { + return { + disabledList: globalThis.Array.isArray(object?.disabledList) + ? object.disabledList.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: DisabledListResponse): unknown { + const obj: any = {}; + if (message.disabledList?.length) { + obj.disabledList = message.disabledList; + } + return obj; + }, + + create, I>>(base?: I): DisabledListResponse { + return DisabledListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DisabledListResponse { + const message = createBaseDisabledListResponse(); + message.disabledList = object.disabledList?.map((e) => e) || []; + return message; + }, +}; + +/** Query defines the circuit gRPC querier service. */ +export interface Query { + /** Account returns account permissions. */ + Account(request: QueryAccountRequest): Promise; + /** Account returns account permissions. */ + Accounts(request: QueryAccountsRequest): Promise; + /** DisabledList returns a list of disabled message urls */ + DisabledList(request: QueryDisabledListRequest): Promise; +} + +export const QueryServiceName = "cosmos.circuit.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 || QueryServiceName; + this.rpc = rpc; + this.Account = this.Account.bind(this); + this.Accounts = this.Accounts.bind(this); + this.DisabledList = this.DisabledList.bind(this); + } + Account(request: QueryAccountRequest): Promise { + const data = QueryAccountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Account", data); + return promise.then((data) => AccountResponse.decode(new BinaryReader(data))); + } + + Accounts(request: QueryAccountsRequest): Promise { + const data = QueryAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Accounts", data); + return promise.then((data) => AccountsResponse.decode(new BinaryReader(data))); + } + + DisabledList(request: QueryDisabledListRequest): Promise { + const data = QueryDisabledListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DisabledList", data); + return promise.then((data) => DisabledListResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/tx.ts new file mode 100644 index 00000000..1cc16218 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/tx.ts @@ -0,0 +1,566 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Permissions } from "./types"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. */ +export interface MsgAuthorizeCircuitBreaker { + /** + * granter is the granter of the circuit breaker permissions and must have + * LEVEL_SUPER_ADMIN. + */ + granter: string; + /** grantee is the account authorized with the provided permissions. */ + grantee: string; + /** + * permissions are the circuit breaker permissions that the grantee receives. + * These will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can + * be specified to revoke all permissions. + */ + permissions: Permissions | undefined; +} + +/** MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. */ +export interface MsgAuthorizeCircuitBreakerResponse { + success: boolean; +} + +/** MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. */ +export interface MsgTripCircuitBreaker { + /** authority is the account authorized to trip the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of type URLs to immediately stop processing. + * IF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY. + * This value is validated against the authority's permissions and if the + * authority does not have permissions to trip the specified msg type URLs + * (or all URLs), the operation will fail. + */ + msgTypeUrls: string[]; +} + +/** MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. */ +export interface MsgTripCircuitBreakerResponse { + success: boolean; +} + +/** MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. */ +export interface MsgResetCircuitBreaker { + /** authority is the account authorized to trip or reset the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of Msg type URLs to resume processing. If + * it is left empty all Msg processing for type URLs that the account is + * authorized to trip will resume. + */ + msgTypeUrls: string[]; +} + +/** MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. */ +export interface MsgResetCircuitBreakerResponse { + success: boolean; +} + +function createBaseMsgAuthorizeCircuitBreaker(): MsgAuthorizeCircuitBreaker { + return { granter: "", grantee: "", permissions: undefined }; +} + +export const MsgAuthorizeCircuitBreaker: MessageFns = { + encode(message: MsgAuthorizeCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAuthorizeCircuitBreaker { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, + }; + }, + + toJSON(message: MsgAuthorizeCircuitBreaker): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.permissions !== undefined) { + obj.permissions = Permissions.toJSON(message.permissions); + } + return obj; + }, + + create, I>>(base?: I): MsgAuthorizeCircuitBreaker { + return MsgAuthorizeCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgAuthorizeCircuitBreaker { + const message = createBaseMsgAuthorizeCircuitBreaker(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.permissions = (object.permissions !== undefined && object.permissions !== null) + ? Permissions.fromPartial(object.permissions) + : undefined; + return message; + }, +}; + +function createBaseMsgAuthorizeCircuitBreakerResponse(): MsgAuthorizeCircuitBreakerResponse { + return { success: false }; +} + +export const MsgAuthorizeCircuitBreakerResponse: MessageFns = { + encode(message: MsgAuthorizeCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAuthorizeCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgAuthorizeCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgAuthorizeCircuitBreakerResponse { + return MsgAuthorizeCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgAuthorizeCircuitBreakerResponse { + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +function createBaseMsgTripCircuitBreaker(): MsgTripCircuitBreaker { + return { authority: "", msgTypeUrls: [] }; +} + +export const MsgTripCircuitBreaker: MessageFns = { + encode(message: MsgTripCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgTripCircuitBreaker { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgTripCircuitBreaker): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): MsgTripCircuitBreaker { + return MsgTripCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgTripCircuitBreaker { + const message = createBaseMsgTripCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgTripCircuitBreakerResponse(): MsgTripCircuitBreakerResponse { + return { success: false }; +} + +export const MsgTripCircuitBreakerResponse: MessageFns = { + encode(message: MsgTripCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgTripCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgTripCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>(base?: I): MsgTripCircuitBreakerResponse { + return MsgTripCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgTripCircuitBreakerResponse { + const message = createBaseMsgTripCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +function createBaseMsgResetCircuitBreaker(): MsgResetCircuitBreaker { + return { authority: "", msgTypeUrls: [] }; +} + +export const MsgResetCircuitBreaker: MessageFns = { + encode(message: MsgResetCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgResetCircuitBreaker { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgResetCircuitBreaker): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): MsgResetCircuitBreaker { + return MsgResetCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgResetCircuitBreaker { + const message = createBaseMsgResetCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgResetCircuitBreakerResponse(): MsgResetCircuitBreakerResponse { + return { success: false }; +} + +export const MsgResetCircuitBreakerResponse: MessageFns = { + encode(message: MsgResetCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgResetCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgResetCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>(base?: I): MsgResetCircuitBreakerResponse { + return MsgResetCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgResetCircuitBreakerResponse { + const message = createBaseMsgResetCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +/** Msg defines the circuit Msg service. */ +export interface Msg { + /** + * AuthorizeCircuitBreaker allows a super-admin to grant (or revoke) another + * account's circuit breaker permissions. + */ + AuthorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise; + /** TripCircuitBreaker pauses processing of Msg's in the state machine. */ + TripCircuitBreaker(request: MsgTripCircuitBreaker): Promise; + /** + * ResetCircuitBreaker resumes processing of Msg's in the state machine that + * have been been paused using TripCircuitBreaker. + */ + ResetCircuitBreaker(request: MsgResetCircuitBreaker): Promise; +} + +export const MsgServiceName = "cosmos.circuit.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 || MsgServiceName; + this.rpc = rpc; + this.AuthorizeCircuitBreaker = this.AuthorizeCircuitBreaker.bind(this); + this.TripCircuitBreaker = this.TripCircuitBreaker.bind(this); + this.ResetCircuitBreaker = this.ResetCircuitBreaker.bind(this); + } + AuthorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise { + const data = MsgAuthorizeCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizeCircuitBreaker", data); + return promise.then((data) => MsgAuthorizeCircuitBreakerResponse.decode(new BinaryReader(data))); + } + + TripCircuitBreaker(request: MsgTripCircuitBreaker): Promise { + const data = MsgTripCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "TripCircuitBreaker", data); + return promise.then((data) => MsgTripCircuitBreakerResponse.decode(new BinaryReader(data))); + } + + ResetCircuitBreaker(request: MsgResetCircuitBreaker): Promise { + const data = MsgResetCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "ResetCircuitBreaker", data); + return promise.then((data) => MsgResetCircuitBreakerResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/types.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/types.ts new file mode 100644 index 00000000..6810f76c --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/circuit/v1/types.ts @@ -0,0 +1,356 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** + * Permissions are the permissions that an account has to trip + * or reset the circuit breaker. + */ +export interface Permissions { + /** level is the level of permissions granted to this account. */ + level: Permissions_Level; + /** + * limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type + * URLs that the account can trip. It is an error to use limit_type_urls with + * a level other than LEVEL_SOME_MSGS. + */ + limitTypeUrls: string[]; +} + +/** Level is the permission level. */ +export enum Permissions_Level { + /** + * LEVEL_NONE_UNSPECIFIED - LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit + * breaker permissions. + */ + LEVEL_NONE_UNSPECIFIED = 0, + /** + * LEVEL_SOME_MSGS - LEVEL_SOME_MSGS indicates that the account will have permission to + * trip or reset the circuit breaker for some Msg type URLs. If this level + * is chosen, a non-empty list of Msg type URLs must be provided in + * limit_type_urls. + */ + LEVEL_SOME_MSGS = 1, + /** + * LEVEL_ALL_MSGS - LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit + * breaker for Msg's of all type URLs. + */ + LEVEL_ALL_MSGS = 2, + /** + * LEVEL_SUPER_ADMIN - LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker + * actions and can grant permissions to other accounts. + */ + LEVEL_SUPER_ADMIN = 3, + UNRECOGNIZED = -1, +} + +export function permissions_LevelFromJSON(object: any): Permissions_Level { + switch (object) { + case 0: + case "LEVEL_NONE_UNSPECIFIED": + return Permissions_Level.LEVEL_NONE_UNSPECIFIED; + case 1: + case "LEVEL_SOME_MSGS": + return Permissions_Level.LEVEL_SOME_MSGS; + case 2: + case "LEVEL_ALL_MSGS": + return Permissions_Level.LEVEL_ALL_MSGS; + case 3: + case "LEVEL_SUPER_ADMIN": + return Permissions_Level.LEVEL_SUPER_ADMIN; + case -1: + case "UNRECOGNIZED": + default: + return Permissions_Level.UNRECOGNIZED; + } +} + +export function permissions_LevelToJSON(object: Permissions_Level): string { + switch (object) { + case Permissions_Level.LEVEL_NONE_UNSPECIFIED: + return "LEVEL_NONE_UNSPECIFIED"; + case Permissions_Level.LEVEL_SOME_MSGS: + return "LEVEL_SOME_MSGS"; + case Permissions_Level.LEVEL_ALL_MSGS: + return "LEVEL_ALL_MSGS"; + case Permissions_Level.LEVEL_SUPER_ADMIN: + return "LEVEL_SUPER_ADMIN"; + case Permissions_Level.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** GenesisAccountPermissions is the account permissions for the circuit breaker in genesis */ +export interface GenesisAccountPermissions { + address: string; + permissions: Permissions | undefined; +} + +/** GenesisState is the state that must be provided at genesis. */ +export interface GenesisState { + accountPermissions: GenesisAccountPermissions[]; + disabledTypeUrls: string[]; +} + +function createBasePermissions(): Permissions { + return { level: 0, limitTypeUrls: [] }; +} + +export const Permissions: MessageFns = { + encode(message: Permissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.level !== 0) { + writer.uint32(8).int32(message.level); + } + for (const v of message.limitTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Permissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermissions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.level = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.limitTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Permissions { + return { + level: isSet(object.level) ? permissions_LevelFromJSON(object.level) : 0, + limitTypeUrls: globalThis.Array.isArray(object?.limitTypeUrls) + ? object.limitTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Permissions): unknown { + const obj: any = {}; + if (message.level !== 0) { + obj.level = permissions_LevelToJSON(message.level); + } + if (message.limitTypeUrls?.length) { + obj.limitTypeUrls = message.limitTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): Permissions { + return Permissions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Permissions { + const message = createBasePermissions(); + message.level = object.level ?? 0; + message.limitTypeUrls = object.limitTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGenesisAccountPermissions(): GenesisAccountPermissions { + return { address: "", permissions: undefined }; +} + +export const GenesisAccountPermissions: MessageFns = { + encode(message: GenesisAccountPermissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisAccountPermissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisAccountPermissions(); + 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 !== 18) { + break; + } + + message.permissions = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisAccountPermissions { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, + }; + }, + + toJSON(message: GenesisAccountPermissions): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.permissions !== undefined) { + obj.permissions = Permissions.toJSON(message.permissions); + } + return obj; + }, + + create, I>>(base?: I): GenesisAccountPermissions { + return GenesisAccountPermissions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisAccountPermissions { + const message = createBaseGenesisAccountPermissions(); + message.address = object.address ?? ""; + message.permissions = (object.permissions !== undefined && object.permissions !== null) + ? Permissions.fromPartial(object.permissions) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { accountPermissions: [], disabledTypeUrls: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accountPermissions) { + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.disabledTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.accountPermissions.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.disabledTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + accountPermissions: globalThis.Array.isArray(object?.accountPermissions) + ? object.accountPermissions.map((e: any) => GenesisAccountPermissions.fromJSON(e)) + : [], + disabledTypeUrls: globalThis.Array.isArray(object?.disabledTypeUrls) + ? object.disabledTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.accountPermissions?.length) { + obj.accountPermissions = message.accountPermissions.map((e) => GenesisAccountPermissions.toJSON(e)); + } + if (message.disabledTypeUrls?.length) { + obj.disabledTypeUrls = message.disabledTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.accountPermissions = object.accountPermissions?.map((e) => GenesisAccountPermissions.fromPartial(e)) || []; + message.disabledTypeUrls = object.disabledTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/module/v1/module.ts new file mode 100644 index 00000000..97a0d394 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.consensus.module.v1"; + +/** Module is the config object of the consensus module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/v1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/v1/query.ts new file mode 100644 index 00000000..3fe04bb9 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/v1/query.ts @@ -0,0 +1,180 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ConsensusParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponse { + /** + * params are the tendermint consensus params stored in the consensus module. + * Please note that `params.version` is not populated in this response, it is + * tracked separately in the x/upgrade module. + */ + params: ConsensusParams | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + ConsensusParams.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = ConsensusParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? ConsensusParams.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = ConsensusParams.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) + ? ConsensusParams.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/consensus module. */ + Params(request: QueryParamsRequest): Promise; +} + +export const QueryServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/v1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/v1/tx.ts new file mode 100644 index 00000000..c95b67fe --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/consensus/v1/tx.ts @@ -0,0 +1,266 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ABCIParams, BlockParams, EvidenceParams, ValidatorParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/consensus parameters to update. + * VersionsParams is not included in this Msg because it is tracked + * separarately in x/upgrade. + * + * NOTE: All parameters must be supplied. + */ + block: BlockParams | undefined; + evidence: EvidenceParams | undefined; + validator: + | ValidatorParams + | undefined; + /** Since: cosmos-sdk 0.50 */ + abci: ABCIParams | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", block: undefined, evidence: undefined, validator: undefined, abci: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + 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 ?? ""; + 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.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the consensus Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/consensus module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/module/v1/module.ts new file mode 100644 index 00000000..3ae9a625 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/module/v1/module.ts @@ -0,0 +1,117 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crisis.module.v1"; + +/** Module is the config object of the crisis module. */ +export interface Module { + /** fee_collector_name is the name of the FeeCollector ModuleAccount. */ + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts new file mode 100644 index 00000000..4ebe6590 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts @@ -0,0 +1,104 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + */ + constantFee: Coin | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { constantFee: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 26) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/v1beta1/tx.ts new file mode 100644 index 00000000..90d17bf8 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crisis/v1beta1/tx.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.crisis.v1beta1"; + +/** MsgVerifyInvariant represents a message to verify a particular invariance. */ +export interface MsgVerifyInvariant { + /** sender is the account address of private key to send coins to fee collector account. */ + sender: string; + /** name of the invariant module. */ + invariantModuleName: string; + /** invariant_route is the msg's invariant route. */ + invariantRoute: string; +} + +/** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ +export interface MsgVerifyInvariantResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** constant_fee defines the x/crisis parameter. */ + constantFee: Coin | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { + return { sender: "", invariantModuleName: "", invariantRoute: "" }; +} + +export const MsgVerifyInvariant: MessageFns = { + encode(message: MsgVerifyInvariant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.invariantModuleName !== "") { + writer.uint32(18).string(message.invariantModuleName); + } + if (message.invariantRoute !== "") { + writer.uint32(26).string(message.invariantRoute); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.invariantModuleName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.invariantRoute = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVerifyInvariant { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + invariantModuleName: isSet(object.invariantModuleName) ? globalThis.String(object.invariantModuleName) : "", + invariantRoute: isSet(object.invariantRoute) ? globalThis.String(object.invariantRoute) : "", + }; + }, + + toJSON(message: MsgVerifyInvariant): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.invariantModuleName !== "") { + obj.invariantModuleName = message.invariantModuleName; + } + if (message.invariantRoute !== "") { + obj.invariantRoute = message.invariantRoute; + } + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariant { + return MsgVerifyInvariant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVerifyInvariant { + const message = createBaseMsgVerifyInvariant(); + message.sender = object.sender ?? ""; + message.invariantModuleName = object.invariantModuleName ?? ""; + message.invariantRoute = object.invariantRoute ?? ""; + return message; + }, +}; + +function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { + return {}; +} + +export const MsgVerifyInvariantResponse: MessageFns = { + encode(_: MsgVerifyInvariantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVerifyInvariantResponse { + return {}; + }, + + toJSON(_: MsgVerifyInvariantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariantResponse { + return MsgVerifyInvariantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVerifyInvariantResponse { + const message = createBaseMsgVerifyInvariantResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", constantFee: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + 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 ?? ""; + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** VerifyInvariant defines a method to verify a particular invariant. */ + VerifyInvariant(request: MsgVerifyInvariant): Promise; + /** + * UpdateParams defines a governance operation for updating the x/crisis module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.crisis.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 || MsgServiceName; + this.rpc = rpc; + this.VerifyInvariant = this.VerifyInvariant.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/ed25519/keys.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 00000000..59fab7e6 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,193 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/ed25519/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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; +} + +/** + * 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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/hd/v1/hd.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/hd/v1/hd.ts new file mode 100644 index 00000000..55be1b9c --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/hd/v1/hd.ts @@ -0,0 +1,173 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/hd/v1/hd.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crypto.hd.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + coinType: 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 */ + addressIndex: number; +} + +function createBaseBIP44Params(): BIP44Params { + return { purpose: 0, coinType: 0, account: 0, change: false, addressIndex: 0 }; +} + +export const BIP44Params: MessageFns = { + encode(message: BIP44Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.purpose !== 0) { + writer.uint32(8).uint32(message.purpose); + } + if (message.coinType !== 0) { + writer.uint32(16).uint32(message.coinType); + } + if (message.account !== 0) { + writer.uint32(24).uint32(message.account); + } + if (message.change !== false) { + writer.uint32(32).bool(message.change); + } + if (message.addressIndex !== 0) { + writer.uint32(40).uint32(message.addressIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BIP44Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.purpose = reader.uint32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.coinType = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.account = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.change = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.addressIndex = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BIP44Params { + return { + purpose: isSet(object.purpose) ? globalThis.Number(object.purpose) : 0, + coinType: isSet(object.coinType) ? globalThis.Number(object.coinType) : 0, + account: isSet(object.account) ? globalThis.Number(object.account) : 0, + change: isSet(object.change) ? globalThis.Boolean(object.change) : false, + addressIndex: isSet(object.addressIndex) ? globalThis.Number(object.addressIndex) : 0, + }; + }, + + toJSON(message: BIP44Params): unknown { + const obj: any = {}; + if (message.purpose !== 0) { + obj.purpose = Math.round(message.purpose); + } + if (message.coinType !== 0) { + obj.coinType = Math.round(message.coinType); + } + if (message.account !== 0) { + obj.account = Math.round(message.account); + } + if (message.change !== false) { + obj.change = message.change; + } + if (message.addressIndex !== 0) { + obj.addressIndex = Math.round(message.addressIndex); + } + return obj; + }, + + create, I>>(base?: I): BIP44Params { + return BIP44Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BIP44Params { + const message = createBaseBIP44Params(); + message.purpose = object.purpose ?? 0; + message.coinType = object.coinType ?? 0; + message.account = object.account ?? 0; + message.change = object.change ?? false; + message.addressIndex = object.addressIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/keyring/v1/record.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/keyring/v1/record.ts new file mode 100644 index 00000000..d6e83b43 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/keyring/v1/record.ts @@ -0,0 +1,432 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/keyring/v1/record.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { BIP44Params } from "../../hd/v1/hd"; + +export const protobufPackage = "cosmos.crypto.keyring.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + pubKey: + | Any + | undefined; + /** local stores the private key locally. */ + local?: + | Record_Local + | undefined; + /** ledger stores the information about a Ledger key. */ + ledger?: + | Record_Ledger + | undefined; + /** Multi does not store any other information. */ + multi?: + | Record_Multi + | undefined; + /** Offline does not store any other information. */ + offline?: Record_Offline | undefined; +} + +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_Local { + privKey: Any | undefined; +} + +/** Ledger item */ +export interface Record_Ledger { + path: BIP44Params | undefined; +} + +/** Multi item */ +export interface Record_Multi { +} + +/** Offline item */ +export interface Record_Offline { +} + +function createBaseRecord(): Record { + return { name: "", pubKey: undefined, local: undefined, ledger: undefined, multi: undefined, offline: undefined }; +} + +export const Record: MessageFns = { + encode(message: Record, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.local !== undefined) { + Record_Local.encode(message.local, writer.uint32(26).fork()).join(); + } + if (message.ledger !== undefined) { + Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).join(); + } + if (message.multi !== undefined) { + Record_Multi.encode(message.multi, writer.uint32(42).fork()).join(); + } + if (message.offline !== undefined) { + Record_Offline.encode(message.offline, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.local = Record_Local.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.ledger = Record_Ledger.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.multi = Record_Multi.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.offline = Record_Offline.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : 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 = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.local !== undefined) { + obj.local = Record_Local.toJSON(message.local); + } + if (message.ledger !== undefined) { + obj.ledger = Record_Ledger.toJSON(message.ledger); + } + if (message.multi !== undefined) { + obj.multi = Record_Multi.toJSON(message.multi); + } + if (message.offline !== undefined) { + obj.offline = Record_Offline.toJSON(message.offline); + } + return obj; + }, + + create, I>>(base?: I): Record { + return Record.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record { + const message = createBaseRecord(); + message.name = object.name ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : 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 { privKey: undefined }; +} + +export const Record_Local: MessageFns = { + encode(message: Record_Local, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.privKey !== undefined) { + Any.encode(message.privKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Local { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.privKey = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record_Local { + return { privKey: isSet(object.privKey) ? Any.fromJSON(object.privKey) : undefined }; + }, + + toJSON(message: Record_Local): unknown { + const obj: any = {}; + if (message.privKey !== undefined) { + obj.privKey = Any.toJSON(message.privKey); + } + return obj; + }, + + create, I>>(base?: I): Record_Local { + return Record_Local.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record_Local { + const message = createBaseRecord_Local(); + message.privKey = (object.privKey !== undefined && object.privKey !== null) + ? Any.fromPartial(object.privKey) + : undefined; + return message; + }, +}; + +function createBaseRecord_Ledger(): Record_Ledger { + return { path: undefined }; +} + +export const Record_Ledger: MessageFns = { + encode(message: Record_Ledger, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined) { + BIP44Params.encode(message.path, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Ledger { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = BIP44Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.path !== undefined) { + obj.path = BIP44Params.toJSON(message.path); + } + return obj; + }, + + create, I>>(base?: I): Record_Ledger { + return Record_Ledger.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: Record_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Multi { + return {}; + }, + + toJSON(_: Record_Multi): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Multi { + return Record_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, +}; + +function createBaseRecord_Offline(): Record_Offline { + return {}; +} + +export const Record_Offline: MessageFns = { + encode(_: Record_Offline, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Offline { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Offline { + return {}; + }, + + toJSON(_: Record_Offline): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Offline { + return Record_Offline.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/multisig/keys.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/multisig/keys.ts new file mode 100644 index 00000000..3aacbfda --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + publicKeys: Any[]; +} + +function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { + return { threshold: 0, publicKeys: [] }; +} + +export const LegacyAminoPubKey: MessageFns = { + encode(message: LegacyAminoPubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.publicKeys) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LegacyAminoPubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.threshold = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKeys.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyAminoPubKey { + return { + threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0, + publicKeys: globalThis.Array.isArray(object?.publicKeys) + ? object.publicKeys.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LegacyAminoPubKey): unknown { + const obj: any = {}; + if (message.threshold !== 0) { + obj.threshold = Math.round(message.threshold); + } + if (message.publicKeys?.length) { + obj.publicKeys = message.publicKeys.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LegacyAminoPubKey { + return LegacyAminoPubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.publicKeys = object.publicKeys?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 00000000..4f9b99a2 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/v1beta1/multisig.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 { + extraBitsStored: number; + elems: Uint8Array; +} + +function createBaseMultiSignature(): MultiSignature { + return { signatures: [] }; +} + +export const MultiSignature: MessageFns = { + encode(message: MultiSignature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiSignature { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: MultiSignature): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MultiSignature { + return MultiSignature.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCompactBitArray(): CompactBitArray { + return { extraBitsStored: 0, elems: new Uint8Array(0) }; +} + +export const CompactBitArray: MessageFns = { + encode(message: CompactBitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompactBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.extraBitsStored = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.elems = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompactBitArray { + return { + extraBitsStored: isSet(object.extraBitsStored) ? globalThis.Number(object.extraBitsStored) : 0, + elems: isSet(object.elems) ? bytesFromBase64(object.elems) : new Uint8Array(0), + }; + }, + + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + if (message.extraBitsStored !== 0) { + obj.extraBitsStored = Math.round(message.extraBitsStored); + } + if (message.elems.length !== 0) { + obj.elems = base64FromBytes(message.elems); + } + return obj; + }, + + create, I>>(base?: I): CompactBitArray { + return CompactBitArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extraBitsStored = object.extraBitsStored ?? 0; + message.elems = object.elems ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/secp256k1/keys.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 00000000..7f79f331 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256k1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/secp256r1/keys.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 00000000..54922e63 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,191 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256r1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { secret: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.secret = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { secret: isSet(object.secret) ? bytesFromBase64(object.secret) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.secret.length !== 0) { + obj.secret = base64FromBytes(message.secret); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/module/v1/module.ts new file mode 100644 index 00000000..23f8378a --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.distribution.module.v1"; + +/** Module is the config object of the distribution module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..f23cc1d6 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1149 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/distribution.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled !== false) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? globalThis.String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? globalThis.String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? globalThis.String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? globalThis.Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled !== false) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards: MessageFns = { + encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: globalThis.Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? globalThis.Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 0; + return message; + }, +}; + +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { rewards: [], period: 0 }; +} + +export const ValidatorCurrentRewards: MessageFns = { + encode(message: ValidatorCurrentRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommission { + return { + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorAccumulatedCommission): unknown { + const obj: any = {}; + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent: MessageFns = { + encode(message: ValidatorSlashEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? globalThis.Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? globalThis.String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents: MessageFns = { + encode(message: ValidatorSlashEvents, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSlashEvents) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvents(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool: MessageFns = { + encode(message: FeePool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.communityPool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeePool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: globalThis.Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { title: "", description: "", recipient: "", amount: [] }; +} + +export const CommunityPoolSpendProposal: MessageFns = { + encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommunityPoolSpendProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo: MessageFns = { + encode(message: DelegatorStartingInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (message.height !== 0) { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? globalThis.Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? globalThis.String(object.stake) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward: MessageFns = { + encode(message: DelegationDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + reward: globalThis.Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + message.reward = object.reward?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { title: "", description: "", recipient: "", amount: "", deposit: "" }; +} + +export const CommunityPoolSpendProposalWithDeposit: MessageFns = { + encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposalWithDeposit { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + deposit: isSet(object.deposit) ? globalThis.String(object.deposit) : "", + }; + }, + + toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..16d378f9 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1000 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo: MessageFns = { + encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord: MessageFns = { + encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord: MessageFns = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.accumulated !== undefined) { + ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommissionRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord: MessageFns = { + encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + if (message.rewards !== undefined) { + ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord: MessageFns = { + encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.rewards !== undefined) { + ValidatorCurrentRewards.encode(message.rewards, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord: MessageFns = { + encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord: MessageFns = { + encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).join(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.validatorSlashEvents) { + ValidatorSlashEventRecord.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: globalThis.Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? globalThis.String(object.previousProposer) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: globalThis.Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: globalThis.Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: globalThis.Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: globalThis.Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..9d32e8cb --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1674 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest: MessageFns = { + encode(message: QueryValidatorDistributionInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse: MessageFns = { + encode(message: QueryValidatorDistributionInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + selfBondRewards: globalThis.Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { + return { rewards: undefined }; +} + +export const QueryValidatorOutstandingRewardsResponse: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rewards !== undefined) { + ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest: MessageFns = { + encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { + return { commission: undefined }; +} + +export const QueryValidatorCommissionResponse: MessageFns = { + encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commission !== undefined) { + ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest: MessageFns = { + encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? globalThis.Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? globalThis.Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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: MessageFns = { + encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.slashes) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesResponse { + return { + slashes: globalThis.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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest: MessageFns = { + encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { + return { rewards: [] }; +} + +export const QueryDelegationRewardsResponse: MessageFns = { + encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest: MessageFns = { + encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { + return { rewards: [], total: [] }; +} + +export const QueryDelegationTotalRewardsResponse: MessageFns = { + encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.total) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) + ? object.rewards.map((e: any) => DelegationDelegatorReward.fromJSON(e)) + : [], + total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationTotalRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [] }; +} + +export const QueryDelegatorValidatorsResponse: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} + +export const QueryCommunityPoolRequest: MessageFns = { + encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, +}; + +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { pool: [] }; +} + +export const QueryCommunityPoolResponse: MessageFns = { + encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommunityPoolResponse { + return { pool: globalThis.Array.isArray(object?.pool) ? object.pool.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryCommunityPoolResponse): unknown { + const obj: any = {}; + if (message.pool?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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 BinaryReader(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..bf362224 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1161 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress: MessageFns = { + encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} + +export const MsgSetWithdrawAddressResponse: MessageFns = { + encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward: MessageFns = { + encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return { amount: [] }; +} + +export const MsgWithdrawDelegatorRewardResponse: MessageFns = { + encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorRewardResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawDelegatorRewardResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission: MessageFns = { + encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return { amount: [] }; +} + +export const MsgWithdrawValidatorCommissionResponse: MessageFns = { + encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommissionResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MsgFundCommunityPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgFundCommunityPool { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: MsgFundCommunityPool): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend: MessageFns = { + encode(message: MsgCommunityPoolSpend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse: MessageFns = { + encode(_: MsgCommunityPoolSpendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool: MessageFns = { + encode(message: MsgDepositValidatorRewardsPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse: MessageFns = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(new BinaryReader(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/module/v1/module.ts new file mode 100644 index 00000000..f92e0da7 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.evidence.module.v1"; + +/** Module is the config object of the evidence module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts new file mode 100644 index 00000000..16d4bb94 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/evidence.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the equivocation height. */ + height: number; + /** time is the equivocation time. */ + time: + | Date + | undefined; + /** power is the equivocation validator power. */ + power: number; + /** consensus_address is the equivocation validator consensus address. */ + consensusAddress: string; +} + +function createBaseEquivocation(): Equivocation { + return { height: 0, time: undefined, power: 0, consensusAddress: "" }; +} + +export const Equivocation: MessageFns = { + encode(message: Equivocation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(24).int64(message.power); + } + if (message.consensusAddress !== "") { + writer.uint32(34).string(message.consensusAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Equivocation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensusAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Equivocation { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + consensusAddress: isSet(object.consensusAddress) ? globalThis.String(object.consensusAddress) : "", + }; + }, + + toJSON(message: Equivocation): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + if (message.consensusAddress !== "") { + obj.consensusAddress = message.consensusAddress; + } + return obj; + }, + + create, I>>(base?: I): Equivocation { + return Equivocation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Equivocation { + const message = createBaseEquivocation(); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.power = object.power ?? 0; + message.consensusAddress = object.consensusAddress ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts new file mode 100644 index 00000000..5d6dc17a --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts @@ -0,0 +1,97 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.evidence.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/query.ts new file mode 100644 index 00000000..41408c8a --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/query.ts @@ -0,0 +1,408 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + * Deprecated: Use hash, a HEX encoded string, instead. + * + * @deprecated + */ + evidenceHash: Uint8Array; + /** + * hash defines the evidence hash of the requested evidence. + * + * Since: cosmos-sdk 0.47 + */ + hash: string; +} + +/** QueryEvidenceResponse is the response type for the Query/Evidence RPC method. */ +export interface QueryEvidenceResponse { + /** evidence returns the requested evidence. */ + evidence: Any | undefined; +} + +/** + * QueryEvidenceRequest is the request type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { + return { evidenceHash: new Uint8Array(0), hash: "" }; +} + +export const QueryEvidenceRequest: MessageFns = { + encode(message: QueryEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidenceHash.length !== 0) { + writer.uint32(10).bytes(message.evidenceHash); + } + if (message.hash !== "") { + writer.uint32(18).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceRequest { + return { + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + hash: isSet(object.hash) ? globalThis.String(object.hash) : "", + }; + }, + + toJSON(message: QueryEvidenceRequest): unknown { + const obj: any = {}; + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceRequest { + return QueryEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEvidenceRequest { + const message = createBaseQueryEvidenceRequest(); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { + return { evidence: undefined }; +} + +export const QueryEvidenceResponse: MessageFns = { + encode(message: QueryEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceResponse { + return { evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined }; + }, + + toJSON(message: QueryEvidenceResponse): unknown { + const obj: any = {}; + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceResponse { + return QueryEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllEvidenceRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceRequest { + return QueryAllEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidence.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceResponse { + return { + evidence: globalThis.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?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceResponse { + return QueryAllEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.evidence.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/tx.ts new file mode 100644 index 00000000..04c14d2d --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/evidence/v1beta1/tx.ts @@ -0,0 +1,240 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the signer account address of evidence. */ + submitter: string; + /** evidence defines the evidence of misbehavior. */ + evidence: Any | undefined; +} + +/** 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: MessageFns = { + encode(message: MsgSubmitEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.submitter !== "") { + writer.uint32(10).string(message.submitter); + } + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.submitter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidence { + return { + submitter: isSet(object.submitter) ? globalThis.String(object.submitter) : "", + evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined, + }; + }, + + toJSON(message: MsgSubmitEvidence): unknown { + const obj: any = {}; + if (message.submitter !== "") { + obj.submitter = message.submitter; + } + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidence { + return MsgSubmitEvidence.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const MsgSubmitEvidenceResponse: MessageFns = { + encode(message: MsgSubmitEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidenceResponse { + return { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0) }; + }, + + toJSON(message: MsgSubmitEvidenceResponse): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidenceResponse { + return MsgSubmitEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEvidenceResponse { + const message = createBaseMsgSubmitEvidenceResponse(); + message.hash = object.hash ?? new Uint8Array(0); + 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 const MsgServiceName = "cosmos.evidence.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 || MsgServiceName; + 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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/module/v1/module.ts new file mode 100644 index 00000000..386f9d26 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.feegrant.module.v1"; + +/** Module is the config object of the feegrant module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts new file mode 100644 index 00000000..9c002d76 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/feegrant.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 coins + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowance { + /** + * spend_limit specifies the maximum amount of coins that can be spent + * by this allowance and will be updated as coins are spent. If it is + * empty, there is no spend limit and any amount of coins can be spent. + */ + spendLimit: Coin[]; + /** expiration specifies an optional time when this allowance expires */ + expiration: Date | undefined; +} + +/** + * 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 + | undefined; + /** + * period specifies the time duration in which period_spend_limit coins can + * be spent before that allowance is reset + */ + period: + | Duration + | undefined; + /** + * period_spend_limit specifies the maximum number of coins that can be spent + * in the period + */ + periodSpendLimit: Coin[]; + /** period_can_spend is the number of coins left to be spent before the period_reset time */ + periodCanSpend: 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 + */ + periodReset: Date | undefined; +} + +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowance { + /** allowance can be any of basic and periodic fee allowance. */ + allowance: + | Any + | undefined; + /** allowed_messages are the messages for which the grantee has the access. */ + allowedMessages: 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 | undefined; +} + +function createBaseBasicAllowance(): BasicAllowance { + return { spendLimit: [], expiration: undefined }; +} + +export const BasicAllowance: MessageFns = { + encode(message: BasicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BasicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BasicAllowance { + return { + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: BasicAllowance): unknown { + const obj: any = {}; + if (message.spendLimit?.length) { + obj.spendLimit = message.spendLimit.map((e) => Coin.toJSON(e)); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): BasicAllowance { + return BasicAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBasePeriodicAllowance(): PeriodicAllowance { + return { basic: undefined, period: undefined, periodSpendLimit: [], periodCanSpend: [], periodReset: undefined }; +} + +export const PeriodicAllowance: MessageFns = { + encode(message: PeriodicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.basic !== undefined) { + BasicAllowance.encode(message.basic, writer.uint32(10).fork()).join(); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(18).fork()).join(); + } + for (const v of message.periodSpendLimit) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.periodCanSpend) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.periodReset !== undefined) { + Timestamp.encode(toTimestamp(message.periodReset), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.basic = BasicAllowance.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.period = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.periodSpendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.periodCanSpend.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.periodReset = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + periodSpendLimit: globalThis.Array.isArray(object?.periodSpendLimit) + ? object.periodSpendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + periodCanSpend: globalThis.Array.isArray(object?.periodCanSpend) + ? object.periodCanSpend.map((e: any) => Coin.fromJSON(e)) + : [], + periodReset: isSet(object.periodReset) ? fromJsonTimestamp(object.periodReset) : undefined, + }; + }, + + toJSON(message: PeriodicAllowance): unknown { + const obj: any = {}; + if (message.basic !== undefined) { + obj.basic = BasicAllowance.toJSON(message.basic); + } + if (message.period !== undefined) { + obj.period = Duration.toJSON(message.period); + } + if (message.periodSpendLimit?.length) { + obj.periodSpendLimit = message.periodSpendLimit.map((e) => Coin.toJSON(e)); + } + if (message.periodCanSpend?.length) { + obj.periodCanSpend = message.periodCanSpend.map((e) => Coin.toJSON(e)); + } + if (message.periodReset !== undefined) { + obj.periodReset = message.periodReset.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): PeriodicAllowance { + return PeriodicAllowance.fromPartial(base ?? ({} as any)); + }, + 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.periodSpendLimit = object.periodSpendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.periodCanSpend = object.periodCanSpend?.map((e) => Coin.fromPartial(e)) || []; + message.periodReset = object.periodReset ?? undefined; + return message; + }, +}; + +function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { + return { allowance: undefined, allowedMessages: [] }; +} + +export const AllowedMsgAllowance: MessageFns = { + encode(message: AllowedMsgAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(10).fork()).join(); + } + for (const v of message.allowedMessages) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AllowedMsgAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowedMessages.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AllowedMsgAllowance { + return { + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + allowedMessages: globalThis.Array.isArray(object?.allowedMessages) + ? object.allowedMessages.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: AllowedMsgAllowance): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + if (message.allowedMessages?.length) { + obj.allowedMessages = message.allowedMessages; + } + return obj; + }, + + create, I>>(base?: I): AllowedMsgAllowance { + return AllowedMsgAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + message.allowedMessages = object.allowedMessages?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGrant(): Grant { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const Grant: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Grant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts new file mode 100644 index 00000000..14bfd526 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + allowances: globalThis.Array.isArray(object?.allowances) + ? object.allowances.map((e: any) => Grant.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.allowances?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 00000000..3f0c781d --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,586 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterResponse { + /** allowances that have been issued by the granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { + return { granter: "", grantee: "" }; +} + +export const QueryAllowanceRequest: MessageFns = { + encode(message: QueryAllowanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: QueryAllowanceRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceRequest { + return QueryAllowanceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Grant.encode(message.allowance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowance = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceResponse { + return { allowance: isSet(object.allowance) ? Grant.fromJSON(object.allowance) : undefined }; + }, + + toJSON(message: QueryAllowanceResponse): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Grant.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceResponse { + return QueryAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesRequest { + return QueryAllowancesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesResponse { + return { + allowances: globalThis.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?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesResponse { + return QueryAllowancesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesByGranterRequest { + return QueryAllowancesByGranterRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterResponse { + return { + allowances: globalThis.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?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAllowancesByGranterResponse { + return QueryAllowancesByGranterResponse.fromPartial(base ?? ({} as any)); + }, + 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 granted allwance to the grantee by the granter. */ + Allowance(request: QueryAllowanceRequest): Promise; + /** Allowances returns all the grants for the given grantee address. */ + Allowances(request: QueryAllowancesRequest): Promise; + /** + * AllowancesByGranter returns all the grants given by an address + * + * Since: cosmos-sdk 0.46 + */ + AllowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; +} + +export const QueryServiceName = "cosmos.feegrant.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 00000000..052862c2 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,490 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 { +} + +/** + * MsgPruneAllowances prunes expired fee allowances. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowances { + /** pruner is the address of the user pruning expired allowances. */ + pruner: string; +} + +/** + * MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowancesResponse { +} + +function createBaseMsgGrantAllowance(): MsgGrantAllowance { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const MsgGrantAllowance: MessageFns = { + encode(message: MsgGrantAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrantAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: MsgGrantAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowance { + return MsgGrantAllowance.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantAllowanceResponse { + return {}; + }, + + toJSON(_: MsgGrantAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { + return { granter: "", grantee: "" }; +} + +export const MsgRevokeAllowance: MessageFns = { + encode(message: MsgRevokeAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevokeAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: MsgRevokeAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowance { + return MsgRevokeAllowance.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeAllowanceResponse { + return {}; + }, + + toJSON(_: MsgRevokeAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgPruneAllowances(): MsgPruneAllowances { + return { pruner: "" }; +} + +export const MsgPruneAllowances: MessageFns = { + encode(message: MsgPruneAllowances, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pruner !== "") { + writer.uint32(10).string(message.pruner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pruner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgPruneAllowances { + return { pruner: isSet(object.pruner) ? globalThis.String(object.pruner) : "" }; + }, + + toJSON(message: MsgPruneAllowances): unknown { + const obj: any = {}; + if (message.pruner !== "") { + obj.pruner = message.pruner; + } + return obj; + }, + + create, I>>(base?: I): MsgPruneAllowances { + return MsgPruneAllowances.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgPruneAllowances { + const message = createBaseMsgPruneAllowances(); + message.pruner = object.pruner ?? ""; + return message; + }, +}; + +function createBaseMsgPruneAllowancesResponse(): MsgPruneAllowancesResponse { + return {}; +} + +export const MsgPruneAllowancesResponse: MessageFns = { + encode(_: MsgPruneAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgPruneAllowancesResponse { + return {}; + }, + + toJSON(_: MsgPruneAllowancesResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgPruneAllowancesResponse { + return MsgPruneAllowancesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgPruneAllowancesResponse { + const message = createBaseMsgPruneAllowancesResponse(); + 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; + /** + * PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + * + * Since cosmos-sdk 0.50 + */ + PruneAllowances(request: MsgPruneAllowances): Promise; +} + +export const MsgServiceName = "cosmos.feegrant.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 || MsgServiceName; + this.rpc = rpc; + this.GrantAllowance = this.GrantAllowance.bind(this); + this.RevokeAllowance = this.RevokeAllowance.bind(this); + this.PruneAllowances = this.PruneAllowances.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 BinaryReader(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 BinaryReader(data))); + } + + PruneAllowances(request: MsgPruneAllowances): Promise { + const data = MsgPruneAllowances.encode(request).finish(); + const promise = this.rpc.request(this.service, "PruneAllowances", data); + return promise.then((data) => MsgPruneAllowancesResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/genutil/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/genutil/module/v1/module.ts new file mode 100644 index 00000000..a7da77b1 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/genutil/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.module.v1"; + +/** Module is the config object for the genutil module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts new file mode 100644 index 00000000..11bd3193 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.v1beta1"; + +/** GenesisState defines the raw genesis transaction in JSON. */ +export interface GenesisState { + /** gen_txs defines the genesis transactions. */ + genTxs: Uint8Array[]; +} + +function createBaseGenesisState(): GenesisState { + return { genTxs: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.genTxs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.genTxs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + genTxs: globalThis.Array.isArray(object?.genTxs) ? object.genTxs.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.genTxs?.length) { + obj.genTxs = message.genTxs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.genTxs = object.genTxs?.map((e) => e) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/module/v1/module.ts new file mode 100644 index 00000000..d95ae5ed --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/module/v1/module.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.gov.module.v1"; + +/** Module is the config object of the gov module. */ +export interface Module { + /** + * max_metadata_len defines the maximum proposal metadata length. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { maxMetadataLen: 0, authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMetadataLen !== 0) { + writer.uint32(8).uint64(message.maxMetadataLen); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxMetadataLen = object.maxMetadataLen ?? 0; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/genesis.ts new file mode 100644 index 00000000..d6adbe5f --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/genesis.ts @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Deposit, DepositParams, Params, 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. */ + startingProposalId: number; + /** 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[]; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: + | Params + | undefined; + /** + * The constitution allows builders to lay a foundation and define purpose. + * This is an immutable string set in genesis. + * There are no amendments, to go outside of scope, just fork. + * constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. + * + * Since: cosmos-sdk 0.50 + */ + constitution: string; + portId: string; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + params: undefined, + constitution: "", + portId: "", + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(66).fork()).join(); + } + if (message.constitution !== "") { + writer.uint32(74).string(message.constitution); + } + if (message.portId !== "") { + writer.uint32(82).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.constitution = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.constitution = object.constitution ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/gov.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/gov.ts new file mode 100644 index 00000000..8b77a89a --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/gov.ts @@ -0,0 +1,2031 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines an encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + /** + * PROPOSAL_STATUS_TALLY_PERIOD - PROPOSAL_STATUS_TALLY_PERIOD defines a proposal status during the tally + * period. + */ + PROPOSAL_STATUS_TALLY_PERIOD = 6, + 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 6: + case "PROPOSAL_STATUS_TALLY_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_TALLY_PERIOD; + 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.PROPOSAL_STATUS_TALLY_PERIOD: + return "PROPOSAL_STATUS_TALLY_PERIOD"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** id defines the unique id of the proposal. */ + id: number; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: Any[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; + /** + * expedited defines if the proposal is expedited + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; + /** + * failed_reason defines the reason why the proposal failed + * + * Since: cosmos-sdk 0.50 + */ + failedReason: string; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** decryption key is used to decrypt the encrypted votes during the tally phase */ + decryptionKey: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes_count is the number of yes votes on a proposal. */ + yesCount: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstainCount: string; + /** no_count is the number of no votes on a proposal. */ + noCount: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + noWithVetoCount: string; + /** encrypted_count is the number of encrypted votes on a proposal. */ + encryptedCount: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOption[]; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + */ + metadata: string; + encryptedVoteData: string; +} + +/** + * DepositParams defines the params for deposits on governance proposals. + * + * @deprecated + */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** + * VotingParams defines the params for voting on governance proposals. + * + * @deprecated + */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** + * TallyParams defines the params for tallying votes on governance proposals. + * + * @deprecated + */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; +} + +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface Params { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: + | Duration + | undefined; + /** Duration of the voting period. */ + votingPeriod: + | Duration + | undefined; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + minInitialDepositRatio: string; + /** + * The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelRatio: string; + /** + * The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + * If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelDest: string; + /** + * Duration of the voting period of an expedited proposal. + * + * Since: cosmos-sdk 0.50 + */ + expeditedVotingPeriod: + | Duration + | undefined; + /** + * Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. + * + * Since: cosmos-sdk 0.50 + */ + expeditedThreshold: string; + /** Minimum expedited deposit for a proposal to enter voting period. */ + expeditedMinDeposit: Coin[]; + /** burn deposits if a proposal does not meet quorum */ + burnVoteQuorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burnProposalDepositPrevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burnVoteVeto: boolean; + /** + * The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + * Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + * required. + * + * Since: cosmos-sdk 0.50 + */ + minDepositRatio: string; + /** Duration of the voting period. */ + maxTallyPeriod: Duration | undefined; + trustedCounterParties: TrustedCounterParty[]; + channelId: string; + isSourceChain: boolean; +} + +export interface DecryptedVoteOption { + /** option defines the vote option. */ + option: VoteOption; + randomNo: number; +} + +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + messages: [], + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + metadata: "", + title: "", + summary: "", + proposer: "", + expedited: false, + failedReason: "", + hasEncryptedVotes: false, + identity: "", + pubkey: "", + decryptionKey: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(90).string(message.title); + } + if (message.summary !== "") { + writer.uint32(98).string(message.summary); + } + if (message.proposer !== "") { + writer.uint32(106).string(message.proposer); + } + if (message.expedited !== false) { + writer.uint32(112).bool(message.expedited); + } + if (message.failedReason !== "") { + writer.uint32(122).string(message.failedReason); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(128).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(138).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(146).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(154).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.metadata = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.title = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.summary = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.proposer = reader.string(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.expedited = reader.bool(); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.failedReason = reader.string(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.identity = reader.string(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.pubkey = reader.string(); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(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, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + failedReason: isSet(object.failedReason) ? globalThis.String(object.failedReason) : "", + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(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.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + if (message.failedReason !== "") { + obj.failedReason = message.failedReason; + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + 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; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.proposer = object.proposer ?? ""; + message.expedited = object.expedited ?? false; + message.failedReason = object.failedReason ?? ""; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "", encryptedCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + if (message.encryptedCount !== "") { + writer.uint32(42).string(message.encryptedCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + encryptedCount: isSet(object.encryptedCount) ? globalThis.String(object.encryptedCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + if (message.encryptedCount !== "") { + obj.encryptedCount = message.encryptedCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + message.encryptedCount = object.encryptedCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", options: [], metadata: "", encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(42).string(message.metadata); + } + if (message.encryptedVoteData !== "") { + writer.uint32(50).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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) : "", + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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; + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: "", threshold: "", vetoThreshold: "" }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(26).string(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + 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 ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + minDeposit: [], + maxDepositPeriod: undefined, + votingPeriod: undefined, + quorum: "", + threshold: "", + vetoThreshold: "", + minInitialDepositRatio: "", + proposalCancelRatio: "", + proposalCancelDest: "", + expeditedVotingPeriod: undefined, + expeditedThreshold: "", + expeditedMinDeposit: [], + burnVoteQuorum: false, + burnProposalDepositPrevote: false, + burnVoteVeto: false, + minDepositRatio: "", + maxTallyPeriod: undefined, + trustedCounterParties: [], + channelId: "", + isSourceChain: false, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(26).fork()).join(); + } + if (message.quorum !== "") { + writer.uint32(34).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(42).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(50).string(message.vetoThreshold); + } + if (message.minInitialDepositRatio !== "") { + writer.uint32(58).string(message.minInitialDepositRatio); + } + if (message.proposalCancelRatio !== "") { + writer.uint32(66).string(message.proposalCancelRatio); + } + if (message.proposalCancelDest !== "") { + writer.uint32(74).string(message.proposalCancelDest); + } + if (message.expeditedVotingPeriod !== undefined) { + Duration.encode(message.expeditedVotingPeriod, writer.uint32(82).fork()).join(); + } + if (message.expeditedThreshold !== "") { + writer.uint32(90).string(message.expeditedThreshold); + } + for (const v of message.expeditedMinDeposit) { + Coin.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.burnVoteQuorum !== false) { + writer.uint32(104).bool(message.burnVoteQuorum); + } + if (message.burnProposalDepositPrevote !== false) { + writer.uint32(112).bool(message.burnProposalDepositPrevote); + } + if (message.burnVoteVeto !== false) { + writer.uint32(120).bool(message.burnVoteVeto); + } + if (message.minDepositRatio !== "") { + writer.uint32(130).string(message.minDepositRatio); + } + if (message.maxTallyPeriod !== undefined) { + Duration.encode(message.maxTallyPeriod, writer.uint32(138).fork()).join(); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(146).fork()).join(); + } + if (message.channelId !== "") { + writer.uint32(154).string(message.channelId); + } + if (message.isSourceChain !== false) { + writer.uint32(160).bool(message.isSourceChain); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.quorum = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.threshold = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.minInitialDepositRatio = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposalCancelRatio = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.proposalCancelDest = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.expeditedVotingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.expeditedThreshold = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.expeditedMinDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.burnVoteQuorum = reader.bool(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.burnProposalDepositPrevote = reader.bool(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.burnVoteVeto = reader.bool(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.minDepositRatio = reader.string(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.maxTallyPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.channelId = reader.string(); + continue; + case 20: + if (tag !== 160) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + minInitialDepositRatio: isSet(object.minInitialDepositRatio) + ? globalThis.String(object.minInitialDepositRatio) + : "", + proposalCancelRatio: isSet(object.proposalCancelRatio) ? globalThis.String(object.proposalCancelRatio) : "", + proposalCancelDest: isSet(object.proposalCancelDest) ? globalThis.String(object.proposalCancelDest) : "", + expeditedVotingPeriod: isSet(object.expeditedVotingPeriod) + ? Duration.fromJSON(object.expeditedVotingPeriod) + : undefined, + expeditedThreshold: isSet(object.expeditedThreshold) ? globalThis.String(object.expeditedThreshold) : "", + expeditedMinDeposit: globalThis.Array.isArray(object?.expeditedMinDeposit) + ? object.expeditedMinDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + burnVoteQuorum: isSet(object.burnVoteQuorum) ? globalThis.Boolean(object.burnVoteQuorum) : false, + burnProposalDepositPrevote: isSet(object.burnProposalDepositPrevote) + ? globalThis.Boolean(object.burnProposalDepositPrevote) + : false, + burnVoteVeto: isSet(object.burnVoteVeto) ? globalThis.Boolean(object.burnVoteVeto) : false, + minDepositRatio: isSet(object.minDepositRatio) ? globalThis.String(object.minDepositRatio) : "", + maxTallyPeriod: isSet(object.maxTallyPeriod) ? Duration.fromJSON(object.maxTallyPeriod) : undefined, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + if (message.minInitialDepositRatio !== "") { + obj.minInitialDepositRatio = message.minInitialDepositRatio; + } + if (message.proposalCancelRatio !== "") { + obj.proposalCancelRatio = message.proposalCancelRatio; + } + if (message.proposalCancelDest !== "") { + obj.proposalCancelDest = message.proposalCancelDest; + } + if (message.expeditedVotingPeriod !== undefined) { + obj.expeditedVotingPeriod = Duration.toJSON(message.expeditedVotingPeriod); + } + if (message.expeditedThreshold !== "") { + obj.expeditedThreshold = message.expeditedThreshold; + } + if (message.expeditedMinDeposit?.length) { + obj.expeditedMinDeposit = message.expeditedMinDeposit.map((e) => Coin.toJSON(e)); + } + if (message.burnVoteQuorum !== false) { + obj.burnVoteQuorum = message.burnVoteQuorum; + } + if (message.burnProposalDepositPrevote !== false) { + obj.burnProposalDepositPrevote = message.burnProposalDepositPrevote; + } + if (message.burnVoteVeto !== false) { + obj.burnVoteVeto = message.burnVoteVeto; + } + if (message.minDepositRatio !== "") { + obj.minDepositRatio = message.minDepositRatio; + } + if (message.maxTallyPeriod !== undefined) { + obj.maxTallyPeriod = Duration.toJSON(message.maxTallyPeriod); + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + message.minInitialDepositRatio = object.minInitialDepositRatio ?? ""; + message.proposalCancelRatio = object.proposalCancelRatio ?? ""; + message.proposalCancelDest = object.proposalCancelDest ?? ""; + message.expeditedVotingPeriod = + (object.expeditedVotingPeriod !== undefined && object.expeditedVotingPeriod !== null) + ? Duration.fromPartial(object.expeditedVotingPeriod) + : undefined; + message.expeditedThreshold = object.expeditedThreshold ?? ""; + message.expeditedMinDeposit = object.expeditedMinDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.burnVoteQuorum = object.burnVoteQuorum ?? false; + message.burnProposalDepositPrevote = object.burnProposalDepositPrevote ?? false; + message.burnVoteVeto = object.burnVoteVeto ?? false; + message.minDepositRatio = object.minDepositRatio ?? ""; + message.maxTallyPeriod = (object.maxTallyPeriod !== undefined && object.maxTallyPeriod !== null) + ? Duration.fromPartial(object.maxTallyPeriod) + : undefined; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.channelId = object.channelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + return message; + }, +}; + +function createBaseDecryptedVoteOption(): DecryptedVoteOption { + return { option: 0, randomNo: 0 }; +} + +export const DecryptedVoteOption: MessageFns = { + encode(message: DecryptedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.randomNo !== 0) { + writer.uint32(16).int64(message.randomNo); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.randomNo = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + randomNo: isSet(object.randomNo) ? globalThis.Number(object.randomNo) : 0, + }; + }, + + toJSON(message: DecryptedVoteOption): unknown { + const obj: any = {}; + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.randomNo !== 0) { + obj.randomNo = Math.round(message.randomNo); + } + return obj; + }, + + create, I>>(base?: I): DecryptedVoteOption { + return DecryptedVoteOption.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptedVoteOption { + const message = createBaseDecryptedVoteOption(); + message.option = object.option ?? 0; + message.randomNo = object.randomNo ?? 0; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/query.ts new file mode 100644 index 00000000..54a6bef2 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/query.ts @@ -0,0 +1,1575 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + Deposit, + DepositParams, + Params, + Proposal, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyParams, + TallyResult, + Vote, + VotingParams, +} from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryConstitutionRequest is the request type for the Query/Constitution RPC method */ +export interface QueryConstitutionRequest { +} + +/** QueryConstitutionResponse is the response type for the Query/Constitution RPC method */ +export interface QueryConstitutionResponse { + constitution: string; +} + +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + /** proposal is the requested governance proposal. */ + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: Params | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryConstitutionRequest(): QueryConstitutionRequest { + return {}; +} + +export const QueryConstitutionRequest: MessageFns = { + encode(_: QueryConstitutionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConstitutionRequest { + return {}; + }, + + toJSON(_: QueryConstitutionRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConstitutionRequest { + return QueryConstitutionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConstitutionRequest { + const message = createBaseQueryConstitutionRequest(); + return message; + }, +}; + +function createBaseQueryConstitutionResponse(): QueryConstitutionResponse { + return { constitution: "" }; +} + +export const QueryConstitutionResponse: MessageFns = { + encode(message: QueryConstitutionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constitution !== "") { + writer.uint32(10).string(message.constitution); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.constitution = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConstitutionResponse { + return { constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "" }; + }, + + toJSON(message: QueryConstitutionResponse): unknown { + const obj: any = {}; + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + return obj; + }, + + create, I>>(base?: I): QueryConstitutionResponse { + return QueryConstitutionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryConstitutionResponse { + const message = createBaseQueryConstitutionResponse(); + message.constitution = object.constitution ?? ""; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined, params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + 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.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Constitution queries the chain's constitution. */ + Constitution(request: QueryConstitutionRequest): Promise; + /** 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 on 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 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 || QueryServiceName; + this.rpc = rpc; + this.Constitution = this.Constitution.bind(this); + 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); + } + Constitution(request: QueryConstitutionRequest): Promise { + const data = QueryConstitutionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Constitution", data); + return promise.then((data) => QueryConstitutionResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/tx.ts new file mode 100644 index 00000000..9f8156b7 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1/tx.ts @@ -0,0 +1,1531 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params, VoteOption, voteOptionFromJSON, voteOptionToJSON, WeightedVoteOption } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages: Any[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * expedited defines if the proposal is expedited or not + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContent { + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** authority must be the gov module address. */ + authority: string; +} + +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse { +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata: string; +} + +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse { +} + +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCancelProposal is the Msg/CancelProposal request type. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** canceled_time is the time when proposal is canceled. */ + canceledTime: + | Date + | undefined; + /** canceled_height defines the block height at which the proposal is canceled. */ + canceledHeight: number; +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { messages: [], initialDeposit: [], proposer: "", metadata: "", title: "", summary: "", expedited: false }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.summary !== "") { + writer.uint32(50).string(message.summary); + } + if (message.expedited !== false) { + writer.uint32(56).bool(message.expedited); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.title = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.summary = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expedited = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + 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)) || []; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.expedited = object.expedited ?? false; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { content: undefined, authority: "" }; +} + +export const MsgExecLegacyContent: MessageFns = { + encode(message: MsgExecLegacyContent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecLegacyContent { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: MsgExecLegacyContent): unknown { + const obj: any = {}; + 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) + ? Any.fromPartial(object.content) + : undefined; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} + +export const MsgExecLegacyContentResponse: MessageFns = { + encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgExecLegacyContentResponse { + return {}; + }, + + toJSON(_: MsgExecLegacyContentResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "" }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "", metadata: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [], metadata: "" }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCancelProposal(): MsgCancelProposal { + return { proposalId: 0, proposer: "" }; +} + +export const MsgCancelProposal: MessageFns = { + encode(message: MsgCancelProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.proposer !== "") { + writer.uint32(18).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgCancelProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposal { + return MsgCancelProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposal { + const message = createBaseMsgCancelProposal(); + message.proposalId = object.proposalId ?? 0; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgCancelProposalResponse(): MsgCancelProposalResponse { + return { proposalId: 0, canceledTime: undefined, canceledHeight: 0 }; +} + +export const MsgCancelProposalResponse: MessageFns = { + encode(message: MsgCancelProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.canceledTime !== undefined) { + Timestamp.encode(toTimestamp(message.canceledTime), writer.uint32(18).fork()).join(); + } + if (message.canceledHeight !== 0) { + writer.uint32(24).uint64(message.canceledHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.canceledTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.canceledHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposalResponse { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + canceledTime: isSet(object.canceledTime) ? fromJsonTimestamp(object.canceledTime) : undefined, + canceledHeight: isSet(object.canceledHeight) ? globalThis.Number(object.canceledHeight) : 0, + }; + }, + + toJSON(message: MsgCancelProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.canceledTime !== undefined) { + obj.canceledTime = message.canceledTime.toISOString(); + } + if (message.canceledHeight !== 0) { + obj.canceledHeight = Math.round(message.canceledHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposalResponse { + return MsgCancelProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposalResponse { + const message = createBaseMsgCancelProposalResponse(); + message.proposalId = object.proposalId ?? 0; + message.canceledTime = object.canceledTime ?? undefined; + message.canceledHeight = object.canceledHeight ?? 0; + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given the messages. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + */ + ExecLegacyContent(request: MsgExecLegacyContent): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): Promise; + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; + /** + * UpdateParams defines a governance operation for updating the x/gov module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CancelProposal defines a method to cancel governance proposal + * + * Since: cosmos-sdk 0.50 + */ + CancelProposal(request: MsgCancelProposal): 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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.ExecLegacyContent = this.ExecLegacyContent.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.CancelProposal = this.CancelProposal.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelProposal(request: MsgCancelProposal): Promise { + const data = MsgCancelProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelProposal", data); + return promise.then((data) => MsgCancelProposalResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 00000000..f70b4ccf --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,234 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + startingProposalId: number; + /** 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[]; + /** deposit_params defines all the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** voting_params defines all the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** tally_params defines all the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/gov.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 00000000..b58fe54c --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1356 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines a encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** aggregated keyshare is used to decrypt the encrypted votes during the tally phase */ + aggrKeyshare: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + noWithVeto: string; + /** encrypted is the number of encrypted votes on a proposal. */ + encrypted: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + * + * @deprecated + */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOption[]; + encryptedVoteData: string; +} + +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: Uint8Array; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: Uint8Array; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: Uint8Array; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseTextProposal(): TextProposal { + return { title: "", description: "" }; +} + +export const TextProposal: MessageFns = { + encode(message: TextProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TextProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: TextProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): TextProposal { + return TextProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + proposalId: 0, + content: undefined, + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + hasEncryptedVotes: false, + identity: "", + pubkey: "", + aggrKeyshare: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(80).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(90).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(98).string(message.pubkey); + } + if (message.aggrKeyshare !== "") { + writer.uint32(106).string(message.aggrKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.identity = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.pubkey = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.aggrKeyshare = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + aggrKeyshare: isSet(object.aggrKeyshare) ? globalThis.String(object.aggrKeyshare) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.aggrKeyshare !== "") { + obj.aggrKeyshare = message.aggrKeyshare; + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.proposalId = object.proposalId ?? 0; + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.aggrKeyshare = object.aggrKeyshare ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes: "", abstain: "", no: "", noWithVeto: "", encrypted: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yes !== "") { + writer.uint32(10).string(message.yes); + } + if (message.abstain !== "") { + writer.uint32(18).string(message.abstain); + } + if (message.no !== "") { + writer.uint32(26).string(message.no); + } + if (message.noWithVeto !== "") { + writer.uint32(34).string(message.noWithVeto); + } + if (message.encrypted !== "") { + writer.uint32(42).string(message.encrypted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yes = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstain = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.no = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVeto = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encrypted = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes: isSet(object.yes) ? globalThis.String(object.yes) : "", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "", + no: isSet(object.no) ? globalThis.String(object.no) : "", + noWithVeto: isSet(object.noWithVeto) ? globalThis.String(object.noWithVeto) : "", + encrypted: isSet(object.encrypted) ? globalThis.String(object.encrypted) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yes !== "") { + obj.yes = message.yes; + } + if (message.abstain !== "") { + obj.abstain = message.abstain; + } + if (message.no !== "") { + obj.no = message.no; + } + if (message.noWithVeto !== "") { + obj.noWithVeto = message.noWithVeto; + } + if (message.encrypted !== "") { + obj.encrypted = message.encrypted; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.noWithVeto = object.noWithVeto ?? ""; + message.encrypted = object.encrypted ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, options: [], encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.encryptedVoteData !== "") { + writer.uint32(42).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: new Uint8Array(0), threshold: new Uint8Array(0), vetoThreshold: new Uint8Array(0) }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + writer.uint32(26).bytes(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? bytesFromBase64(object.quorum) : new Uint8Array(0), + threshold: isSet(object.threshold) ? bytesFromBase64(object.threshold) : new Uint8Array(0), + vetoThreshold: isSet(object.vetoThreshold) ? bytesFromBase64(object.vetoThreshold) : new Uint8Array(0), + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum.length !== 0) { + obj.quorum = base64FromBytes(message.quorum); + } + if (message.threshold.length !== 0) { + obj.threshold = base64FromBytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + obj.vetoThreshold = base64FromBytes(message.vetoThreshold); + } + 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 ?? new Uint8Array(0); + message.threshold = object.threshold ?? new Uint8Array(0); + message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/query.ts new file mode 100644 index 00000000..1e13f7d3 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1413 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** deposit_params defines the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** tally_params defines the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? 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 on proposalID, depositor address. */ + 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 const QueryServiceName = "cosmos.gov.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 00000000..85994854 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,880 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the proposal's content. */ + content: + | Any + | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + 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 defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { content: undefined, initialDeposit: [], proposer: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [] }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgVoteWeighted { + return MsgVoteWeighted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): 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 const MsgServiceName = "cosmos.gov.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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/group/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/module/v1/module.ts new file mode 100644 index 00000000..fbcfb65d --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/module/v1/module.ts @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../../../google/protobuf/duration"; + +export const protobufPackage = "cosmos.group.module.v1"; + +/** Module is the config object of the group module. */ +export interface Module { + /** + * max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + * to execute the proposal. + */ + maxExecutionPeriod: + | Duration + | undefined; + /** + * max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; +} + +function createBaseModule(): Module { + return { maxExecutionPeriod: undefined, maxMetadataLen: 0 }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxExecutionPeriod !== undefined) { + Duration.encode(message.maxExecutionPeriod, writer.uint32(10).fork()).join(); + } + if (message.maxMetadataLen !== 0) { + writer.uint32(16).uint64(message.maxMetadataLen); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxExecutionPeriod: isSet(object.maxExecutionPeriod) ? Duration.fromJSON(object.maxExecutionPeriod) : undefined, + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxExecutionPeriod !== undefined) { + obj.maxExecutionPeriod = Duration.toJSON(message.maxExecutionPeriod); + } + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxExecutionPeriod = (object.maxExecutionPeriod !== undefined && object.maxExecutionPeriod !== null) + ? Duration.fromPartial(object.maxExecutionPeriod) + : undefined; + message.maxMetadataLen = object.maxMetadataLen ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/events.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/events.ts new file mode 100644 index 00000000..6a221d4e --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/events.ts @@ -0,0 +1,780 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/events.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyResult, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** 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. */ + proposalId: number; +} + +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposal { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVote { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExec { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** result is the proposal execution result. */ + result: ProposalExecutorResult; + /** logs contains error logs in case the execution result is FAILURE. */ + logs: string; +} + +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroup { + /** group_id is the unique ID of the group. */ + groupId: number; + /** address is the account address of the group member. */ + address: string; +} + +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPruned { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). */ + status: ProposalStatus; + /** tally_result is the proposal tally result (when applicable). */ + tallyResult: TallyResult | undefined; +} + +function createBaseEventCreateGroup(): EventCreateGroup { + return { groupId: 0 }; +} + +export const EventCreateGroup: MessageFns = { + encode(message: EventCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventCreateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroup { + return EventCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroup { + const message = createBaseEventCreateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventUpdateGroup(): EventUpdateGroup { + return { groupId: 0 }; +} + +export const EventUpdateGroup: MessageFns = { + encode(message: EventUpdateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventUpdateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroup { + return EventUpdateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { + return { address: "" }; +} + +export const EventCreateGroupPolicy: MessageFns = { + encode(message: EventCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroupPolicy { + return EventCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { + return { address: "" }; +} + +export const EventUpdateGroupPolicy: MessageFns = { + encode(message: EventUpdateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventUpdateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroupPolicy { + return EventUpdateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventSubmitProposal(): EventSubmitProposal { + return { proposalId: 0 }; +} + +export const EventSubmitProposal: MessageFns = { + encode(message: EventSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSubmitProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventSubmitProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventSubmitProposal { + return EventSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventWithdrawProposal(): EventWithdrawProposal { + return { proposalId: 0 }; +} + +export const EventWithdrawProposal: MessageFns = { + encode(message: EventWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventWithdrawProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventWithdrawProposal { + return EventWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventVote(): EventVote { + return { proposalId: 0 }; +} + +export const EventVote: MessageFns = { + encode(message: EventVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventVote { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventVote { + return EventVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventVote { + const message = createBaseEventVote(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventExec(): EventExec { + return { proposalId: 0, result: 0, logs: "" }; +} + +export const EventExec: MessageFns = { + encode(message: EventExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + if (message.logs !== "") { + writer.uint32(26).string(message.logs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.logs = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0, + logs: isSet(object.logs) ? globalThis.String(object.logs) : "", + }; + }, + + toJSON(message: EventExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + if (message.logs !== "") { + obj.logs = message.logs; + } + return obj; + }, + + create, I>>(base?: I): EventExec { + return EventExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventExec { + const message = createBaseEventExec(); + message.proposalId = object.proposalId ?? 0; + message.result = object.result ?? 0; + message.logs = object.logs ?? ""; + return message; + }, +}; + +function createBaseEventLeaveGroup(): EventLeaveGroup { + return { groupId: 0, address: "" }; +} + +export const EventLeaveGroup: MessageFns = { + encode(message: EventLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventLeaveGroup { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: EventLeaveGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventLeaveGroup { + return EventLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + message.groupId = object.groupId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventProposalPruned(): EventProposalPruned { + return { proposalId: 0, status: 0, tallyResult: undefined }; +} + +export const EventProposalPruned: MessageFns = { + encode(message: EventProposalPruned, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.tallyResult !== undefined) { + TallyResult.encode(message.tallyResult, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventProposalPruned { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventProposalPruned(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.status = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventProposalPruned { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + tallyResult: isSet(object.tallyResult) ? TallyResult.fromJSON(object.tallyResult) : undefined, + }; + }, + + toJSON(message: EventProposalPruned): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.tallyResult !== undefined) { + obj.tallyResult = TallyResult.toJSON(message.tallyResult); + } + return obj; + }, + + create, I>>(base?: I): EventProposalPruned { + return EventProposalPruned.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventProposalPruned { + const message = createBaseEventProposalPruned(); + message.proposalId = object.proposalId ?? 0; + message.status = object.status ?? 0; + message.tallyResult = (object.tallyResult !== undefined && object.tallyResult !== null) + ? TallyResult.fromPartial(object.tallyResult) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/genesis.ts new file mode 100644 index 00000000..b2d21dd4 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/genesis.ts @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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. + */ + groupSeq: number; + /** groups is the list of groups info. */ + groups: GroupInfo[]; + /** group_members is the list of groups members. */ + groupMembers: GroupMember[]; + /** + * group_policy_seq is the group policy table orm.Sequence, + * it is used to generate the next group policy account address. + */ + groupPolicySeq: number; + /** group_policies is the list of group policies info. */ + groupPolicies: GroupPolicyInfo[]; + /** + * proposal_seq is the proposal table orm.Sequence, + * it is used to get the next proposal ID. + */ + proposalSeq: number; + /** proposals is the list of proposals. */ + proposals: Proposal[]; + /** votes is the list of votes. */ + votes: Vote[]; +} + +function createBaseGenesisState(): GenesisState { + return { + groupSeq: 0, + groups: [], + groupMembers: [], + groupPolicySeq: 0, + groupPolicies: [], + proposalSeq: 0, + proposals: [], + votes: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupSeq !== 0) { + writer.uint32(8).uint64(message.groupSeq); + } + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.groupMembers) { + GroupMember.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.groupPolicySeq !== 0) { + writer.uint32(32).uint64(message.groupPolicySeq); + } + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.proposalSeq !== 0) { + writer.uint32(48).uint64(message.proposalSeq); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.groupSeq = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMembers.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.groupPolicySeq = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.proposalSeq = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + groupSeq: isSet(object.groupSeq) ? globalThis.Number(object.groupSeq) : 0, + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + groupMembers: globalThis.Array.isArray(object?.groupMembers) + ? object.groupMembers.map((e: any) => GroupMember.fromJSON(e)) + : [], + groupPolicySeq: isSet(object.groupPolicySeq) ? globalThis.Number(object.groupPolicySeq) : 0, + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + proposalSeq: isSet(object.proposalSeq) ? globalThis.Number(object.proposalSeq) : 0, + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.groupSeq !== 0) { + obj.groupSeq = Math.round(message.groupSeq); + } + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.groupMembers?.length) { + obj.groupMembers = message.groupMembers.map((e) => GroupMember.toJSON(e)); + } + if (message.groupPolicySeq !== 0) { + obj.groupPolicySeq = Math.round(message.groupPolicySeq); + } + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.proposalSeq !== 0) { + obj.proposalSeq = Math.round(message.proposalSeq); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.groupSeq = object.groupSeq ?? 0; + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.groupMembers = object.groupMembers?.map((e) => GroupMember.fromPartial(e)) || []; + message.groupPolicySeq = object.groupPolicySeq ?? 0; + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.proposalSeq = object.proposalSeq ?? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/query.ts new file mode 100644 index 00000000..d64f831a --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/query.ts @@ -0,0 +1,2395 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, TallyResult, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequest { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponse { + /** info is the GroupInfo of the group. */ + info: GroupInfo | undefined; +} + +/** 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 of the group policy. */ + info: GroupPolicyInfo | undefined; +} + +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequest { + /** group_id is the unique ID of the group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequest { + /** group_id is the unique ID of the group policy's group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponse { + /** group_policies are the group policies info associated with the provided group. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponse { + /** group_policies are the group policies info with provided admin. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponse { + /** proposal is the proposal info. */ + proposal: Proposal | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequest { + /** proposal_id is the unique id of a proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +/** + * QueryGroupsRequest is the Query/Groups request type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryGroupsResponse is the Query/Groups response type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsResponse { + /** `groups` is all the groups present in state. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { + return { groupId: 0 }; +} + +export const QueryGroupInfoRequest: MessageFns = { + encode(message: QueryGroupInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoRequest { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: QueryGroupInfoRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoRequest { + return QueryGroupInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { + return { info: undefined }; +} + +export const QueryGroupInfoResponse: MessageFns = { + encode(message: QueryGroupInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoResponse { + return { info: isSet(object.info) ? GroupInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoResponse { + return QueryGroupInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupPolicyInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryGroupPolicyInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoRequest { + return QueryGroupPolicyInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { + return { info: undefined }; +} + +export const QueryGroupPolicyInfoResponse: MessageFns = { + encode(message: QueryGroupPolicyInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupPolicyInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoResponse { + return { info: isSet(object.info) ? GroupPolicyInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupPolicyInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupPolicyInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoResponse { + return QueryGroupPolicyInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupMembersRequest: MessageFns = { + encode(message: QueryGroupMembersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupMembersRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersRequest { + return QueryGroupMembersRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + message.groupId = object.groupId ?? 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: MessageFns = { + encode(message: QueryGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.members) { + GroupMember.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.members.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersResponse { + return { + members: globalThis.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?.length) { + obj.members = message.members.map((e) => GroupMember.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersResponse { + return QueryGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminRequest { + return QueryGroupsByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminResponse { + return QueryGroupsByAdminResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupRequest: MessageFns = { + encode(message: QueryGroupPoliciesByGroupRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupRequest { + return QueryGroupPoliciesByGroupRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + message.groupId = object.groupId ?? 0; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { + return { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupResponse: MessageFns = { + encode(message: QueryGroupPoliciesByGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupResponse { + return QueryGroupPoliciesByGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.groupPolicies = object.groupPolicies?.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: MessageFns = { + encode(message: QueryGroupPoliciesByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminRequest { + return QueryGroupPoliciesByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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 { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByAdminResponse: MessageFns = { + encode(message: QueryGroupPoliciesByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminResponse { + return QueryGroupPoliciesByAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { + return { address: "", pagination: undefined }; +} + +export const QueryProposalsByGroupPolicyRequest: MessageFns = { + encode(message: QueryProposalsByGroupPolicyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsByGroupPolicyRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyRequest { + return QueryProposalsByGroupPolicyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryProposalsByGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyResponse { + return { + 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: QueryProposalsByGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyResponse { + return QueryProposalsByGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, voter: "" }; +} + +export const QueryVoteByProposalVoterRequest: MessageFns = { + encode(message: QueryVoteByProposalVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteByProposalVoterRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + return obj; + }, + + create, I>>(base?: I): QueryVoteByProposalVoterRequest { + return QueryVoteByProposalVoterRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { + return { vote: undefined }; +} + +export const QueryVoteByProposalVoterResponse: MessageFns = { + encode(message: QueryVoteByProposalVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteByProposalVoterResponse): unknown { + const obj: any = {}; + if (message.vote !== undefined) { + obj.vote = Vote.toJSON(message.vote); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVoteByProposalVoterResponse { + return QueryVoteByProposalVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesByProposalRequest: MessageFns = { + encode(message: QueryVotesByProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalRequest { + return QueryVotesByProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesByProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalResponse { + return { + 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: QueryVotesByProposalResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalResponse { + return QueryVotesByProposalResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voter !== "") { + writer.uint32(10).string(message.voter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.voter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterRequest { + return { + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByVoterRequest): unknown { + const obj: any = {}; + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterRequest { + return QueryVotesByVoterRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterResponse { + return { + 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: QueryVotesByVoterResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterResponse { + return QueryVotesByVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByMemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberRequest { + return QueryGroupsByMemberRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberResponse { + return QueryGroupsByMemberResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsRequest(): QueryGroupsRequest { + return { pagination: undefined }; +} + +export const QueryGroupsRequest: MessageFns = { + encode(message: QueryGroupsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGroupsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsRequest { + return QueryGroupsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsRequest { + const message = createBaseQueryGroupsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsResponse(): QueryGroupsResponse { + return { groups: [], pagination: undefined }; +} + +export const QueryGroupsResponse: MessageFns = { + encode(message: QueryGroupsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsResponse { + return { + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsResponse): unknown { + const obj: any = {}; + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsResponse { + return QueryGroupsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsResponse { + const message = createBaseQueryGroupsResponse(); + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : 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 by group id. */ + 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; + /** GroupPoliciesByAdmin 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 id. */ + 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 returns the tally result of a proposal. If the proposal is + * still in voting period, then this query computes the current tally state, + * which might not be final. On the other hand, if the proposal is final, + * then it simply returns the `final_tally_result` state stored in the + * proposal itself. + */ + TallyResult(request: QueryTallyResultRequest): Promise; + /** + * Groups queries all groups in state. + * + * Since: cosmos-sdk 0.47.1 + */ + Groups(request: QueryGroupsRequest): Promise; +} + +export const QueryServiceName = "cosmos.group.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 || QueryServiceName; + 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); + this.Groups = this.Groups.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + Groups(request: QueryGroupsRequest): Promise { + const data = QueryGroupsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Groups", data); + return promise.then((data) => QueryGroupsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/tx.ts new file mode 100644 index 00000000..006eb292 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/tx.ts @@ -0,0 +1,2576 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { + MemberRequest, + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + VoteOption, + voteOptionFromJSON, + voteOptionToJSON, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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: MemberRequest[]; + /** 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. */ + groupId: number; +} + +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembers { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + memberUpdates: MemberRequest[]; +} + +/** 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. */ + groupId: number; + /** new_admin is the group new admin account address. */ + newAdmin: 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. */ + groupId: number; + /** 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. */ + groupId: number; + /** metadata is any arbitrary metadata attached to the group policy. */ + metadata: string; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of the group policy. */ + groupPolicyAddress: string; + /** new_admin is the new group policy admin. */ + newAdmin: string; +} + +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponse { +} + +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicy { + /** admin is the account address of the group and group policy admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequest[]; + /** group_metadata is any arbitrary metadata attached to the group. */ + groupMetadata: string; + /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ + groupPolicyMetadata: string; + /** + * group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + * and group policy admin. + */ + groupPolicyAsAdmin: boolean; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponse { + /** group_id is the unique ID of the newly created group with policy. */ + groupId: number; + /** group_policy_address is the account address of the newly created group policy. */ + groupPolicyAddress: string; +} + +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** decision_policy is the updated group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** metadata is the group policy metadata to be updated. */ + metadata: string; +} + +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponse { +} + +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposal { + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * proposers are the account addresses of the proposers. + * Proposers signatures will be counted as yes votes. + */ + proposers: string[]; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * exec defines the mode of execution of the proposal, + * whether it should be executed immediately on creation or not. + * If so, proposers signatures are considered as Yes votes. + */ + exec: Exec; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal is the unique ID of the proposal. */ + proposalId: number; +} + +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposal { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** 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. */ + proposalId: number; + /** voter is the voter account address. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} + +/** 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. */ + proposalId: number; + /** executor is the account address used to execute the proposal. */ + executor: string; +} + +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponse { + /** result is the final result of the proposal execution. */ + result: ProposalExecutorResult; +} + +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroup { + /** address is the account address of the group member. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponse { +} + +function createBaseMsgCreateGroup(): MsgCreateGroup { + return { admin: "", members: [], metadata: "" }; +} + +export const MsgCreateGroup: MessageFns = { + encode(message: MsgCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroup { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgCreateGroup): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroup { + return MsgCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { + return { groupId: 0 }; +} + +export const MsgCreateGroupResponse: MessageFns = { + encode(message: MsgCreateGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupResponse { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: MsgCreateGroupResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupResponse { + return MsgCreateGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { + return { admin: "", groupId: 0, memberUpdates: [] }; +} + +export const MsgUpdateGroupMembers: MessageFns = { + encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + for (const v of message.memberUpdates) { + MemberRequest.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.memberUpdates.push(MemberRequest.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMembers { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + memberUpdates: globalThis.Array.isArray(object?.memberUpdates) + ? object.memberUpdates.map((e: any) => MemberRequest.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgUpdateGroupMembers): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.memberUpdates?.length) { + obj.memberUpdates = message.memberUpdates.map((e) => MemberRequest.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.memberUpdates = object.memberUpdates?.map((e) => MemberRequest.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { + return {}; +} + +export const MsgUpdateGroupMembersResponse: MessageFns = { + encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMembersResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMembersResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { + return { admin: "", groupId: 0, newAdmin: "" }; +} + +export const MsgUpdateGroupAdmin: MessageFns = { + encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { + return {}; +} + +export const MsgUpdateGroupAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { + return { admin: "", groupId: 0, metadata: "" }; +} + +export const MsgUpdateGroupMetadata: MessageFns = { + encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { + return {}; +} + +export const MsgUpdateGroupMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { + return { admin: "", groupId: 0, metadata: "", decisionPolicy: undefined }; +} + +export const MsgCreateGroupPolicy: MessageFns = { + encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { + return { address: "" }; +} + +export const MsgCreateGroupPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicyResponse { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: MsgCreateGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { + return { admin: "", groupPolicyAddress: "", newAdmin: "" }; +} + +export const MsgUpdateGroupPolicyAdmin: MessageFns = { + encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { + return {}; +} + +export const MsgUpdateGroupPolicyAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { + return { + admin: "", + members: [], + groupMetadata: "", + groupPolicyMetadata: "", + groupPolicyAsAdmin: false, + decisionPolicy: undefined, + }; +} + +export const MsgCreateGroupWithPolicy: MessageFns = { + encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.groupMetadata !== "") { + writer.uint32(26).string(message.groupMetadata); + } + if (message.groupPolicyMetadata !== "") { + writer.uint32(34).string(message.groupPolicyMetadata); + } + if (message.groupPolicyAsAdmin !== false) { + writer.uint32(40).bool(message.groupPolicyAsAdmin); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMetadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.groupPolicyMetadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.groupPolicyAsAdmin = reader.bool(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + groupMetadata: isSet(object.groupMetadata) ? globalThis.String(object.groupMetadata) : "", + groupPolicyMetadata: isSet(object.groupPolicyMetadata) ? globalThis.String(object.groupPolicyMetadata) : "", + groupPolicyAsAdmin: isSet(object.groupPolicyAsAdmin) ? globalThis.Boolean(object.groupPolicyAsAdmin) : false, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupWithPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.groupMetadata !== "") { + obj.groupMetadata = message.groupMetadata; + } + if (message.groupPolicyMetadata !== "") { + obj.groupPolicyMetadata = message.groupPolicyMetadata; + } + if (message.groupPolicyAsAdmin !== false) { + obj.groupPolicyAsAdmin = message.groupPolicyAsAdmin; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.groupMetadata = object.groupMetadata ?? ""; + message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; + message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { + return { groupId: 0, groupPolicyAddress: "" }; +} + +export const MsgCreateGroupWithPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicyResponse { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + }; + }, + + toJSON(message: MsgCreateGroupWithPolicyResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + message.groupId = object.groupId ?? 0; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { + return { admin: "", groupPolicyAddress: "", decisionPolicy: undefined }; +} + +export const MsgUpdateGroupPolicyDecisionPolicy: MessageFns = { + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyDecisionPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; +} + +export const MsgUpdateGroupPolicyDecisionPolicyResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { + return { admin: "", groupPolicyAddress: "", metadata: "" }; +} + +export const MsgUpdateGroupPolicyMetadata: MessageFns = { + encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { + return {}; +} + +export const MsgUpdateGroupPolicyMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, +}; + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { groupPolicyAddress: "", proposers: [], metadata: "", messages: [], exec: 0, title: "", summary: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupPolicyAddress !== "") { + writer.uint32(10).string(message.groupPolicyAddress); + } + for (const v of message.proposers) { + writer.uint32(18).string(v!); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + if (message.title !== "") { + writer.uint32(50).string(message.title); + } + if (message.summary !== "") { + writer.uint32(58).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.title = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.metadata = object.metadata ?? ""; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.exec = object.exec ?? 0; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { + return { proposalId: 0, address: "" }; +} + +export const MsgWithdrawProposal: MessageFns = { + encode(message: MsgWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: MsgWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposal { + return MsgWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { + return {}; +} + +export const MsgWithdrawProposalResponse: MessageFns = { + encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgWithdrawProposalResponse { + return {}; + }, + + toJSON(_: MsgWithdrawProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "", exec: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { proposalId: 0, executor: "" }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.executor !== "") { + writer.uint32(18).string(message.executor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.executor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + executor: isSet(object.executor) ? globalThis.String(object.executor) : "", + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.executor !== "") { + obj.executor = message.executor; + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.proposalId = object.proposalId ?? 0; + message.executor = object.executor ?? ""; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { result: 0 }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroup(): MsgLeaveGroup { + return { address: "", groupId: 0 }; +} + +export const MsgLeaveGroup: MessageFns = { + encode(message: MsgLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgLeaveGroup { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + }; + }, + + toJSON(message: MsgLeaveGroup): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroup { + return MsgLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { + return {}; +} + +export const MsgLeaveGroupResponse: MessageFns = { + encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgLeaveGroupResponse { + return {}; + }, + + toJSON(_: MsgLeaveGroupResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.fromPartial(base ?? ({} as any)); + }, + 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 withdraws 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 const MsgServiceName = "cosmos.group.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/types.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/types.ts new file mode 100644 index 00000000..3f7a9e54 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/group/v1/types.ts @@ -0,0 +1,1799 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given proposal. */ +export enum VoteOption { + /** + * VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will + * return an error. + */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} + +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} + +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus defines proposal statuses. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when submitted. */ + PROPOSAL_STATUS_SUBMITTED = 1, + /** + * PROPOSAL_STATUS_ACCEPTED - Final status of a proposal when the final tally is done and the outcome + * passes the group policy's decision policy. + */ + PROPOSAL_STATUS_ACCEPTED = 2, + /** + * PROPOSAL_STATUS_REJECTED - Final status of a proposal when the final tally is done and the outcome + * is rejected by the group policy's decision policy. + */ + PROPOSAL_STATUS_REJECTED = 3, + /** + * PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group policy is modified before the + * final tally. + */ + PROPOSAL_STATUS_ABORTED = 4, + /** + * PROPOSAL_STATUS_WITHDRAWN - A proposal can be withdrawn before the voting start time by the owner. + * When this happens the final status is Withdrawn. + */ + PROPOSAL_STATUS_WITHDRAWN = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_SUBMITTED": + return ProposalStatus.PROPOSAL_STATUS_SUBMITTED; + case 2: + case "PROPOSAL_STATUS_ACCEPTED": + return ProposalStatus.PROPOSAL_STATUS_ACCEPTED; + case 3: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 4: + case "PROPOSAL_STATUS_ABORTED": + return ProposalStatus.PROPOSAL_STATUS_ABORTED; + case 5: + case "PROPOSAL_STATUS_WITHDRAWN": + return ProposalStatus.PROPOSAL_STATUS_WITHDRAWN; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_SUBMITTED: + return "PROPOSAL_STATUS_SUBMITTED"; + case ProposalStatus.PROPOSAL_STATUS_ACCEPTED: + return "PROPOSAL_STATUS_ACCEPTED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return "PROPOSAL_STATUS_ABORTED"; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return "PROPOSAL_STATUS_WITHDRAWN"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalExecutorResult defines types of proposal executor results. */ +export enum ProposalExecutorResult { + /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ + PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0, + /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ + PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1, + /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ + PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2, + /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ + PROPOSAL_EXECUTOR_RESULT_FAILURE = 3, + UNRECOGNIZED = -1, +} + +export function proposalExecutorResultFromJSON(object: any): ProposalExecutorResult { + switch (object) { + case 0: + case "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; + case 1: + case "PROPOSAL_EXECUTOR_RESULT_NOT_RUN": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN; + case 2: + case "PROPOSAL_EXECUTOR_RESULT_SUCCESS": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS; + case 3: + case "PROPOSAL_EXECUTOR_RESULT_FAILURE": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE; + case -1: + case "UNRECOGNIZED": + default: + return ProposalExecutorResult.UNRECOGNIZED; + } +} + +export function proposalExecutorResultToJSON(object: ProposalExecutorResult): string { + switch (object) { + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: + return "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN: + return "PROPOSAL_EXECUTOR_RESULT_NOT_RUN"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS: + return "PROPOSAL_EXECUTOR_RESULT_SUCCESS"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE: + return "PROPOSAL_EXECUTOR_RESULT_FAILURE"; + case ProposalExecutorResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface Member { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + addedAt: Date | undefined; +} + +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequest { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; +} + +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicy { + /** + * threshold is the minimum weighted sum of `YES` votes that must be met or + * exceeded for a proposal to succeed. + */ + threshold: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicy { + /** + * percentage is the minimum percentage of the weighted sum of `YES` votes must + * meet for a proposal to succeed. + */ + percentage: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindows { + /** + * voting_period is the duration from submission of a proposal to the end of voting period + * Within this times votes can be submitted with MsgVote. + */ + votingPeriod: + | Duration + | undefined; + /** + * min_execution_period is the minimum duration after the proposal submission + * where members can start sending MsgExec. This means that the window for + * sending a MsgExec transaction is: + * `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + * where max_execution_period is a app-specific config, defined in the keeper. + * If not set, min_execution_period will default to 0. + * + * Please make sure to set a `min_execution_period` that is smaller than + * `voting_period + max_execution_period`, or else the above execution window + * is empty, meaning that all proposals created with this decision policy + * won't be able to be executed. + */ + minExecutionPeriod: Duration | undefined; +} + +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfo { + /** id is the unique ID of the group. */ + id: number; + /** admin is the account address of the group's admin. */ + admin: string; + /** + * metadata is any arbitrary metadata to attached to the group. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 + */ + metadata: string; + /** + * version is used to track changes to a group's membership structure that + * would break existing proposals. Whenever any members weight is changed, + * or any member is added or removed this version is incremented and will + * cause proposals based on older versions of this group to fail + */ + version: number; + /** total_weight is the sum of the group members' weights. */ + totalWeight: string; + /** created_at is a timestamp specifying when a group was created. */ + createdAt: Date | undefined; +} + +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMember { + /** group_id is the unique ID of the group. */ + groupId: number; + /** member is the member data. */ + member: Member | undefined; +} + +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfo { + /** address is the account address of group policy. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** admin is the account address of the group admin. */ + admin: string; + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ + metadata: string; + /** + * version is used to track changes to a group's GroupPolicyInfo structure that + * would create a different result on a running proposal. + */ + version: number; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: + | Any + | undefined; + /** created_at is a timestamp specifying when a group policy was created. */ + createdAt: Date | undefined; +} + +/** + * 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: number; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ + metadata: string; + /** proposers are the account addresses of the proposers. */ + proposers: string[]; + /** submit_time is a timestamp specifying when a proposal was submitted. */ + submitTime: + | Date + | undefined; + /** + * group_version tracks the version of the group at proposal submission. + * This field is here for informational purposes only. + */ + groupVersion: number; + /** + * group_policy_version tracks the version of the group policy at proposal submission. + * When a decision policy is changed, existing proposals from previous policy + * versions will become invalid with the `ABORTED` status. + * This field is here for informational purposes only. + */ + groupPolicyVersion: number; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option. It is empty at submission, and only + * populated after tallying, at voting period end or at proposal execution, + * whichever happens first. + */ + finalTallyResult: + | TallyResult + | undefined; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successful MsgExec is called before (to execute a proposal whose + * tally is successful before the voting period ends), tallying will be done + * at this point, and the `final_tally_result`and `status` fields will be + * accordingly updated. + */ + votingPeriodEnd: + | Date + | undefined; + /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ + executorResult: ProposalExecutorResult; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResult { + /** yes_count is the weighted sum of yes votes. */ + yesCount: string; + /** abstain_count is the weighted sum of abstainers. */ + abstainCount: string; + /** no_count is the weighted sum of no votes. */ + noCount: string; + /** no_with_veto_count is the weighted sum of veto. */ + noWithVetoCount: string; +} + +/** Vote represents a vote for a proposal.string metadata */ +export interface Vote { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** voter is the account address of the voter. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 + */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submitTime: Date | undefined; +} + +function createBaseMember(): Member { + return { address: "", weight: "", metadata: "", addedAt: undefined }; +} + +export const Member: MessageFns = { + encode(message: Member, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.addedAt !== undefined) { + Timestamp.encode(toTimestamp(message.addedAt), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Member { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.addedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Member { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + addedAt: isSet(object.addedAt) ? fromJsonTimestamp(object.addedAt) : undefined, + }; + }, + + toJSON(message: Member): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.addedAt !== undefined) { + obj.addedAt = message.addedAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Member { + return Member.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Member { + const message = createBaseMember(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + message.addedAt = object.addedAt ?? undefined; + return message; + }, +}; + +function createBaseMemberRequest(): MemberRequest { + return { address: "", weight: "", metadata: "" }; +} + +export const MemberRequest: MessageFns = { + encode(message: MemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MemberRequest { + return MemberRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MemberRequest { + const message = createBaseMemberRequest(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { + return { threshold: "", windows: undefined }; +} + +export const ThresholdDecisionPolicy: MessageFns = { + encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== "") { + writer.uint32(10).string(message.threshold); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseThresholdDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.threshold = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ThresholdDecisionPolicy { + return { + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: ThresholdDecisionPolicy): unknown { + const obj: any = {}; + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: PercentageDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.percentage !== "") { + writer.uint32(10).string(message.percentage); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePercentageDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.percentage = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PercentageDecisionPolicy { + return { + percentage: isSet(object.percentage) ? globalThis.String(object.percentage) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: PercentageDecisionPolicy): unknown { + const obj: any = {}; + if (message.percentage !== "") { + obj.percentage = message.percentage; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): PercentageDecisionPolicy { + return PercentageDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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 { votingPeriod: undefined, minExecutionPeriod: undefined }; +} + +export const DecisionPolicyWindows: MessageFns = { + encode(message: DecisionPolicyWindows, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + if (message.minExecutionPeriod !== undefined) { + Duration.encode(message.minExecutionPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecisionPolicyWindows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecisionPolicyWindows { + return { + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + minExecutionPeriod: isSet(object.minExecutionPeriod) ? Duration.fromJSON(object.minExecutionPeriod) : undefined, + }; + }, + + toJSON(message: DecisionPolicyWindows): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.minExecutionPeriod !== undefined) { + obj.minExecutionPeriod = Duration.toJSON(message.minExecutionPeriod); + } + return obj; + }, + + create, I>>(base?: I): DecisionPolicyWindows { + return DecisionPolicyWindows.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.minExecutionPeriod = (object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null) + ? Duration.fromPartial(object.minExecutionPeriod) + : undefined; + return message; + }, +}; + +function createBaseGroupInfo(): GroupInfo { + return { id: 0, admin: "", metadata: "", version: 0, totalWeight: "", createdAt: undefined }; +} + +export const GroupInfo: MessageFns = { + encode(message: GroupInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.totalWeight !== "") { + writer.uint32(42).string(message.totalWeight); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.admin = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.totalWeight = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupInfo { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + totalWeight: isSet(object.totalWeight) ? globalThis.String(object.totalWeight) : "", + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupInfo): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.totalWeight !== "") { + obj.totalWeight = message.totalWeight; + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupInfo { + return GroupInfo.fromPartial(base ?? ({} as any)); + }, + 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.totalWeight = object.totalWeight ?? ""; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseGroupMember(): GroupMember { + return { groupId: 0, member: undefined }; +} + +export const GroupMember: MessageFns = { + encode(message: GroupMember, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.member !== undefined) { + Member.encode(message.member, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.member = Member.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupMember { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + member: isSet(object.member) ? Member.fromJSON(object.member) : undefined, + }; + }, + + toJSON(message: GroupMember): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.member !== undefined) { + obj.member = Member.toJSON(message.member); + } + return obj; + }, + + create, I>>(base?: I): GroupMember { + return GroupMember.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupMember { + const message = createBaseGroupMember(); + message.groupId = object.groupId ?? 0; + message.member = (object.member !== undefined && object.member !== null) + ? Member.fromPartial(object.member) + : undefined; + return message; + }, +}; + +function createBaseGroupPolicyInfo(): GroupPolicyInfo { + return { + address: "", + groupId: 0, + admin: "", + metadata: "", + version: 0, + decisionPolicy: undefined, + createdAt: undefined, + }; +} + +export const GroupPolicyInfo: MessageFns = { + encode(message: GroupPolicyInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.version !== 0) { + writer.uint32(40).uint64(message.version); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupPolicyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.admin = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupPolicyInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupPolicyInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupPolicyInfo { + return GroupPolicyInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version ?? 0; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + groupPolicyAddress: "", + metadata: "", + proposers: [], + submitTime: undefined, + groupVersion: 0, + groupPolicyVersion: 0, + status: 0, + finalTallyResult: undefined, + votingPeriodEnd: undefined, + executorResult: 0, + messages: [], + title: "", + summary: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.proposers) { + writer.uint32(34).string(v!); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.groupVersion !== 0) { + writer.uint32(48).uint64(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + writer.uint32(56).uint64(message.groupPolicyVersion); + } + if (message.status !== 0) { + writer.uint32(64).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(74).fork()).join(); + } + if (message.votingPeriodEnd !== undefined) { + Timestamp.encode(toTimestamp(message.votingPeriodEnd), writer.uint32(82).fork()).join(); + } + if (message.executorResult !== 0) { + writer.uint32(88).int32(message.executorResult); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.title !== "") { + writer.uint32(106).string(message.title); + } + if (message.summary !== "") { + writer.uint32(114).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.groupVersion = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.groupPolicyVersion = longToNumber(reader.uint64()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.status = reader.int32() as any; + continue; + case 9: + if (tag !== 74) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.votingPeriodEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.executorResult = reader.int32() as any; + continue; + case 12: + if (tag !== 98) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.title = reader.string(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + groupVersion: isSet(object.groupVersion) ? globalThis.Number(object.groupVersion) : 0, + groupPolicyVersion: isSet(object.groupPolicyVersion) ? globalThis.Number(object.groupPolicyVersion) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + votingPeriodEnd: isSet(object.votingPeriodEnd) ? fromJsonTimestamp(object.votingPeriodEnd) : undefined, + executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : 0, + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.groupVersion !== 0) { + obj.groupVersion = Math.round(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + obj.groupPolicyVersion = Math.round(message.groupPolicyVersion); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.votingPeriodEnd !== undefined) { + obj.votingPeriodEnd = message.votingPeriodEnd.toISOString(); + } + if (message.executorResult !== 0) { + obj.executorResult = proposalExecutorResultToJSON(message.executorResult); + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + 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; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.submitTime = object.submitTime ?? undefined; + message.groupVersion = object.groupVersion ?? 0; + message.groupPolicyVersion = object.groupPolicyVersion ?? 0; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; + message.executorResult = object.executorResult ?? 0; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, metadata: "", submitTime: undefined }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.submitTime = object.submitTime ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/module/v1/module.ts new file mode 100644 index 00000000..233c0dd3 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.module.v1"; + +/** Module is the config object of the mint module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 00000000..d5580d2d --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,124 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** params defines all the parameters of the module. */ + params: Params | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { minter: undefined, params: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.minter = Minter.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.minter !== undefined) { + obj.minter = Minter.toJSON(message.minter); + } + 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.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/mint.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 00000000..c9b14ff0 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,285 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/mint.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** Minter represents the minting state. */ +export interface Minter { + /** current annual inflation rate */ + inflation: string; + /** current annual expected provisions */ + annualProvisions: string; +} + +/** Params defines the parameters for the x/mint module. */ +export interface Params { + /** type of coin to mint */ + mintDenom: string; + /** maximum annual change in inflation rate */ + inflationRateChange: string; + /** maximum inflation rate */ + inflationMax: string; + /** minimum inflation rate */ + inflationMin: string; + /** goal of percent bonded atoms */ + goalBonded: string; + /** expected blocks per year */ + blocksPerYear: number; +} + +function createBaseMinter(): Minter { + return { inflation: "", annualProvisions: "" }; +} + +export const Minter: MessageFns = { + encode(message: Minter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation !== "") { + writer.uint32(10).string(message.inflation); + } + if (message.annualProvisions !== "") { + writer.uint32(18).string(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Minter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.annualProvisions = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Minter { + return { + inflation: isSet(object.inflation) ? globalThis.String(object.inflation) : "", + annualProvisions: isSet(object.annualProvisions) ? globalThis.String(object.annualProvisions) : "", + }; + }, + + toJSON(message: Minter): unknown { + const obj: any = {}; + if (message.inflation !== "") { + obj.inflation = message.inflation; + } + if (message.annualProvisions !== "") { + obj.annualProvisions = message.annualProvisions; + } + return obj; + }, + + create, I>>(base?: I): Minter { + return Minter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Minter { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annualProvisions = object.annualProvisions ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + mintDenom: "", + inflationRateChange: "", + inflationMax: "", + inflationMin: "", + goalBonded: "", + blocksPerYear: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mintDenom !== "") { + writer.uint32(10).string(message.mintDenom); + } + if (message.inflationRateChange !== "") { + writer.uint32(18).string(message.inflationRateChange); + } + if (message.inflationMax !== "") { + writer.uint32(26).string(message.inflationMax); + } + if (message.inflationMin !== "") { + writer.uint32(34).string(message.inflationMin); + } + if (message.goalBonded !== "") { + writer.uint32(42).string(message.goalBonded); + } + if (message.blocksPerYear !== 0) { + writer.uint32(48).uint64(message.blocksPerYear); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.mintDenom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.inflationRateChange = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.inflationMax = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.inflationMin = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.goalBonded = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.blocksPerYear = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + mintDenom: isSet(object.mintDenom) ? globalThis.String(object.mintDenom) : "", + inflationRateChange: isSet(object.inflationRateChange) ? globalThis.String(object.inflationRateChange) : "", + inflationMax: isSet(object.inflationMax) ? globalThis.String(object.inflationMax) : "", + inflationMin: isSet(object.inflationMin) ? globalThis.String(object.inflationMin) : "", + goalBonded: isSet(object.goalBonded) ? globalThis.String(object.goalBonded) : "", + blocksPerYear: isSet(object.blocksPerYear) ? globalThis.Number(object.blocksPerYear) : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.mintDenom !== "") { + obj.mintDenom = message.mintDenom; + } + if (message.inflationRateChange !== "") { + obj.inflationRateChange = message.inflationRateChange; + } + if (message.inflationMax !== "") { + obj.inflationMax = message.inflationMax; + } + if (message.inflationMin !== "") { + obj.inflationMin = message.inflationMin; + } + if (message.goalBonded !== "") { + obj.goalBonded = message.goalBonded; + } + if (message.blocksPerYear !== 0) { + obj.blocksPerYear = Math.round(message.blocksPerYear); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.mintDenom = object.mintDenom ?? ""; + message.inflationRateChange = object.inflationRateChange ?? ""; + message.inflationMax = object.inflationMax ?? ""; + message.inflationMin = object.inflationMin ?? ""; + message.goalBonded = object.goalBonded ?? ""; + message.blocksPerYear = object.blocksPerYear ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/query.ts new file mode 100644 index 00000000..c90cf9db --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,450 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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. */ + annualProvisions: Uint8Array; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryInflationRequest(): QueryInflationRequest { + return {}; +} + +export const QueryInflationRequest: MessageFns = { + encode(_: QueryInflationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryInflationRequest { + return {}; + }, + + toJSON(_: QueryInflationRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryInflationRequest { + return QueryInflationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, +}; + +function createBaseQueryInflationResponse(): QueryInflationResponse { + return { inflation: new Uint8Array(0) }; +} + +export const QueryInflationResponse: MessageFns = { + encode(message: QueryInflationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryInflationResponse { + return { inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array(0) }; + }, + + toJSON(message: QueryInflationResponse): unknown { + const obj: any = {}; + if (message.inflation.length !== 0) { + obj.inflation = base64FromBytes(message.inflation); + } + return obj; + }, + + create, I>>(base?: I): QueryInflationResponse { + return QueryInflationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { + return {}; +} + +export const QueryAnnualProvisionsRequest: MessageFns = { + encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAnnualProvisionsRequest { + return {}; + }, + + toJSON(_: QueryAnnualProvisionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { + return { annualProvisions: new Uint8Array(0) }; +} + +export const QueryAnnualProvisionsResponse: MessageFns = { + encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.annualProvisions.length !== 0) { + writer.uint32(10).bytes(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.annualProvisions = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAnnualProvisionsResponse { + return { + annualProvisions: isSet(object.annualProvisions) ? bytesFromBase64(object.annualProvisions) : new Uint8Array(0), + }; + }, + + toJSON(message: QueryAnnualProvisionsResponse): unknown { + const obj: any = {}; + if (message.annualProvisions.length !== 0) { + obj.annualProvisions = base64FromBytes(message.annualProvisions); + } + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annualProvisions = object.annualProvisions ?? new Uint8Array(0); + 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 const QueryServiceName = "cosmos.mint.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/tx.ts new file mode 100644 index 00000000..c3d6285e --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/mint/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./mint"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/mint parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/mint Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/mint module + * parameters. The authority is defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.mint.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/msg/textual/v1/textual.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/msg/textual/v1/textual.ts new file mode 100644 index 00000000..cb8b705c --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/msg/textual/v1/textual.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/textual/v1/textual.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.textual.v1"; diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.nft.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/module/v1/module.ts new file mode 100644 index 00000000..6a444831 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.nft.module.v1"; + +/** Module is the config object of the nft module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/event.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/event.ts index e2fa84bb..81e4fb5e 100644 --- a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/event.ts +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/event.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.nft.v1beta1"; @@ -39,8 +45,8 @@ function createBaseEventSend(): EventSend { return { classId: "", id: "", sender: "", receiver: "" }; } -export const EventSend = { - encode(message: EventSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const EventSend: MessageFns = { + encode(message: EventSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } @@ -56,8 +62,8 @@ export const EventSend = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EventSend { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventSend(); while (reader.pos < end) { @@ -95,17 +101,17 @@ export const EventSend = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EventSend { return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - sender: isSet(object.sender) ? String(object.sender) : "", - receiver: isSet(object.receiver) ? String(object.receiver) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", }; }, @@ -143,8 +149,8 @@ function createBaseEventMint(): EventMint { return { classId: "", id: "", owner: "" }; } -export const EventMint = { - encode(message: EventMint, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const EventMint: MessageFns = { + encode(message: EventMint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } @@ -157,8 +163,8 @@ export const EventMint = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EventMint { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventMint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventMint(); while (reader.pos < end) { @@ -189,16 +195,16 @@ export const EventMint = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EventMint { return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - owner: isSet(object.owner) ? String(object.owner) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", }; }, @@ -232,8 +238,8 @@ function createBaseEventBurn(): EventBurn { return { classId: "", id: "", owner: "" }; } -export const EventBurn = { - encode(message: EventBurn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const EventBurn: MessageFns = { + encode(message: EventBurn, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } @@ -246,8 +252,8 @@ export const EventBurn = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EventBurn { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventBurn { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventBurn(); while (reader.pos < end) { @@ -278,16 +284,16 @@ export const EventBurn = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EventBurn { return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - owner: isSet(object.owner) ? String(object.owner) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", }; }, @@ -320,7 +326,8 @@ export const EventBurn = { type Builtin = 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; @@ -331,3 +338,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/genesis.ts index b3f0d81c..e310a55d 100644 --- a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/genesis.ts +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/genesis.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/genesis.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Class, NFT } from "./nft"; export const protobufPackage = "cosmos.nft.v1beta1"; @@ -24,19 +30,19 @@ function createBaseGenesisState(): GenesisState { return { classes: [], entries: [] }; } -export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.classes) { - Class.encode(v!, writer.uint32(10).fork()).ldelim(); + Class.encode(v!, writer.uint32(10).fork()).join(); } for (const v of message.entries) { - Entry.encode(v!, writer.uint32(18).fork()).ldelim(); + Entry.encode(v!, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisState(); while (reader.pos < end) { @@ -60,15 +66,15 @@ export const GenesisState = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + classes: globalThis.Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => Entry.fromJSON(e)) : [], }; }, @@ -98,19 +104,19 @@ function createBaseEntry(): Entry { return { owner: "", nfts: [] }; } -export const Entry = { - encode(message: Entry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Entry: MessageFns = { + encode(message: Entry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); } for (const v of message.nfts) { - NFT.encode(v!, writer.uint32(18).fork()).ldelim(); + NFT.encode(v!, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Entry { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Entry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEntry(); while (reader.pos < end) { @@ -134,15 +140,15 @@ export const Entry = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + nfts: globalThis.Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], }; }, @@ -171,7 +177,8 @@ export const Entry = { type Builtin = 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; @@ -182,3 +189,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/nft.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/nft.ts index 95f9787c..bbfc88c2 100644 --- a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/nft.ts +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/nft.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/nft.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Any } from "../../../google/protobuf/any"; export const protobufPackage = "cosmos.nft.v1beta1"; @@ -40,8 +46,8 @@ function createBaseClass(): Class { return { id: "", name: "", symbol: "", description: "", uri: "", uriHash: "", data: undefined }; } -export const Class = { - encode(message: Class, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Class: MessageFns = { + encode(message: Class, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); } @@ -61,13 +67,13 @@ export const Class = { writer.uint32(50).string(message.uriHash); } if (message.data !== undefined) { - Any.encode(message.data, writer.uint32(58).fork()).ldelim(); + Any.encode(message.data, writer.uint32(58).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Class { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Class { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClass(); while (reader.pos < end) { @@ -126,19 +132,19 @@ export const Class = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) : "", - uriHash: isSet(object.uriHash) ? String(object.uriHash) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, }; }, @@ -189,8 +195,8 @@ function createBaseNFT(): NFT { return { classId: "", id: "", uri: "", uriHash: "", data: undefined }; } -export const NFT = { - encode(message: NFT, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const NFT: MessageFns = { + encode(message: NFT, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } @@ -204,13 +210,13 @@ export const NFT = { writer.uint32(34).string(message.uriHash); } if (message.data !== undefined) { - Any.encode(message.data, writer.uint32(82).fork()).ldelim(); + Any.encode(message.data, writer.uint32(82).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): NFT { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): NFT { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNFT(); while (reader.pos < end) { @@ -255,17 +261,17 @@ export const NFT = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): NFT { return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - uri: isSet(object.uri) ? String(object.uri) : "", - uriHash: isSet(object.uriHash) ? String(object.uriHash) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, }; }, @@ -307,7 +313,8 @@ export const NFT = { type Builtin = 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; @@ -318,3 +325,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/query.ts index 3c7262d5..869693cd 100644 --- a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/query.ts +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/query.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/query.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; import { Class, NFT } from "./nft"; @@ -108,8 +113,8 @@ function createBaseQueryBalanceRequest(): QueryBalanceRequest { return { classId: "", owner: "" }; } -export const QueryBalanceRequest = { - encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } @@ -119,8 +124,8 @@ export const QueryBalanceRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryBalanceRequest(); while (reader.pos < end) { @@ -144,15 +149,15 @@ export const QueryBalanceRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryBalanceRequest { return { - classId: isSet(object.classId) ? String(object.classId) : "", - owner: isSet(object.owner) ? String(object.owner) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", }; }, @@ -182,16 +187,16 @@ function createBaseQueryBalanceResponse(): QueryBalanceResponse { return { amount: 0 }; } -export const QueryBalanceResponse = { - encode(message: QueryBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryBalanceResponse: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryBalanceResponse(); while (reader.pos < end) { @@ -202,19 +207,19 @@ export const QueryBalanceResponse = { break; } - message.amount = longToNumber(reader.uint64() as Long); + message.amount = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryBalanceResponse { - return { amount: isSet(object.amount) ? Number(object.amount) : 0 }; + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; }, toJSON(message: QueryBalanceResponse): unknown { @@ -239,8 +244,8 @@ function createBaseQueryOwnerRequest(): QueryOwnerRequest { return { classId: "", id: "" }; } -export const QueryOwnerRequest = { - encode(message: QueryOwnerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryOwnerRequest: MessageFns = { + encode(message: QueryOwnerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } @@ -250,8 +255,8 @@ export const QueryOwnerRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryOwnerRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryOwnerRequest(); while (reader.pos < end) { @@ -275,15 +280,15 @@ export const QueryOwnerRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryOwnerRequest { return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", }; }, @@ -313,16 +318,16 @@ function createBaseQueryOwnerResponse(): QueryOwnerResponse { return { owner: "" }; } -export const QueryOwnerResponse = { - encode(message: QueryOwnerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryOwnerResponse: MessageFns = { + encode(message: QueryOwnerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryOwnerResponse(); while (reader.pos < end) { @@ -339,13 +344,13 @@ export const QueryOwnerResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryOwnerResponse { - return { owner: isSet(object.owner) ? String(object.owner) : "" }; + return { owner: isSet(object.owner) ? globalThis.String(object.owner) : "" }; }, toJSON(message: QueryOwnerResponse): unknown { @@ -370,16 +375,16 @@ function createBaseQuerySupplyRequest(): QuerySupplyRequest { return { classId: "" }; } -export const QuerySupplyRequest = { - encode(message: QuerySupplyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QuerySupplyRequest: MessageFns = { + encode(message: QuerySupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySupplyRequest(); while (reader.pos < end) { @@ -396,13 +401,13 @@ export const QuerySupplyRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QuerySupplyRequest { - return { classId: isSet(object.classId) ? String(object.classId) : "" }; + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; }, toJSON(message: QuerySupplyRequest): unknown { @@ -427,16 +432,16 @@ function createBaseQuerySupplyResponse(): QuerySupplyResponse { return { amount: 0 }; } -export const QuerySupplyResponse = { - encode(message: QuerySupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QuerySupplyResponse: MessageFns = { + encode(message: QuerySupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySupplyResponse(); while (reader.pos < end) { @@ -447,19 +452,19 @@ export const QuerySupplyResponse = { break; } - message.amount = longToNumber(reader.uint64() as Long); + message.amount = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QuerySupplyResponse { - return { amount: isSet(object.amount) ? Number(object.amount) : 0 }; + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; }, toJSON(message: QuerySupplyResponse): unknown { @@ -484,8 +489,8 @@ function createBaseQueryNFTsRequest(): QueryNFTsRequest { return { classId: "", owner: "", pagination: undefined }; } -export const QueryNFTsRequest = { - encode(message: QueryNFTsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryNFTsRequest: MessageFns = { + encode(message: QueryNFTsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } @@ -493,13 +498,13 @@ export const QueryNFTsRequest = { writer.uint32(18).string(message.owner); } if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTsRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryNFTsRequest(); while (reader.pos < end) { @@ -530,15 +535,15 @@ export const QueryNFTsRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryNFTsRequest { return { - classId: isSet(object.classId) ? String(object.classId) : "", - owner: isSet(object.owner) ? String(object.owner) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, }; }, @@ -575,19 +580,19 @@ function createBaseQueryNFTsResponse(): QueryNFTsResponse { return { nfts: [], pagination: undefined }; } -export const QueryNFTsResponse = { - encode(message: QueryNFTsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryNFTsResponse: MessageFns = { + encode(message: QueryNFTsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.nfts) { - NFT.encode(v!, writer.uint32(10).fork()).ldelim(); + NFT.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTsResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryNFTsResponse(); while (reader.pos < end) { @@ -611,14 +616,14 @@ export const QueryNFTsResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryNFTsResponse { return { - nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + nfts: globalThis.Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, @@ -651,8 +656,8 @@ function createBaseQueryNFTRequest(): QueryNFTRequest { return { classId: "", id: "" }; } -export const QueryNFTRequest = { - encode(message: QueryNFTRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryNFTRequest: MessageFns = { + encode(message: QueryNFTRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } @@ -662,8 +667,8 @@ export const QueryNFTRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryNFTRequest(); while (reader.pos < end) { @@ -687,15 +692,15 @@ export const QueryNFTRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryNFTRequest { return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", }; }, @@ -725,16 +730,16 @@ function createBaseQueryNFTResponse(): QueryNFTResponse { return { nft: undefined }; } -export const QueryNFTResponse = { - encode(message: QueryNFTResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryNFTResponse: MessageFns = { + encode(message: QueryNFTResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nft !== undefined) { - NFT.encode(message.nft, writer.uint32(10).fork()).ldelim(); + NFT.encode(message.nft, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryNFTResponse(); while (reader.pos < end) { @@ -751,7 +756,7 @@ export const QueryNFTResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -782,16 +787,16 @@ function createBaseQueryClassRequest(): QueryClassRequest { return { classId: "" }; } -export const QueryClassRequest = { - encode(message: QueryClassRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryClassRequest: MessageFns = { + encode(message: QueryClassRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClassRequest(); while (reader.pos < end) { @@ -808,13 +813,13 @@ export const QueryClassRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryClassRequest { - return { classId: isSet(object.classId) ? String(object.classId) : "" }; + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; }, toJSON(message: QueryClassRequest): unknown { @@ -839,16 +844,16 @@ function createBaseQueryClassResponse(): QueryClassResponse { return { class: undefined }; } -export const QueryClassResponse = { - encode(message: QueryClassResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryClassResponse: MessageFns = { + encode(message: QueryClassResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.class !== undefined) { - Class.encode(message.class, writer.uint32(10).fork()).ldelim(); + Class.encode(message.class, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClassResponse(); while (reader.pos < end) { @@ -865,7 +870,7 @@ export const QueryClassResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -896,16 +901,16 @@ function createBaseQueryClassesRequest(): QueryClassesRequest { return { pagination: undefined }; } -export const QueryClassesRequest = { - encode(message: QueryClassesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryClassesRequest: MessageFns = { + encode(message: QueryClassesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassesRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClassesRequest(); while (reader.pos < end) { @@ -922,7 +927,7 @@ export const QueryClassesRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -955,19 +960,19 @@ function createBaseQueryClassesResponse(): QueryClassesResponse { return { classes: [], pagination: undefined }; } -export const QueryClassesResponse = { - encode(message: QueryClassesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryClassesResponse: MessageFns = { + encode(message: QueryClassesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.classes) { - Class.encode(v!, writer.uint32(10).fork()).ldelim(); + Class.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassesResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClassesResponse(); while (reader.pos < end) { @@ -991,14 +996,14 @@ export const QueryClassesResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryClassesResponse { return { - classes: Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + classes: globalThis.Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, @@ -1066,43 +1071,43 @@ export class QueryClientImpl implements Query { 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(_m0.Reader.create(data))); + return promise.then((data) => QueryBalanceResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryOwnerResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QuerySupplyResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryNFTsResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryNFTResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryClassResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryClassesResponse.decode(new BinaryReader(data))); } } @@ -1110,29 +1115,11 @@ interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -1140,18 +1127,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/tx.ts index 3e7af09e..63ad423f 100644 --- a/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/tx.ts +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/tx.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.nft.v1beta1"; @@ -23,8 +29,8 @@ function createBaseMsgSend(): MsgSend { return { classId: "", id: "", sender: "", receiver: "" }; } -export const MsgSend = { - encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } @@ -40,8 +46,8 @@ export const MsgSend = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSend(); while (reader.pos < end) { @@ -79,17 +85,17 @@ export const MsgSend = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgSend { return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - sender: isSet(object.sender) ? String(object.sender) : "", - receiver: isSet(object.receiver) ? String(object.receiver) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", }; }, @@ -127,13 +133,13 @@ function createBaseMsgSendResponse(): MsgSendResponse { return {}; } -export const MsgSendResponse = { - encode(_: MsgSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSendResponse(); while (reader.pos < end) { @@ -143,7 +149,7 @@ export const MsgSendResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -184,7 +190,7 @@ export class MsgClientImpl implements Msg { 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(_m0.Reader.create(data))); + return promise.then((data) => MsgSendResponse.decode(new BinaryReader(data))); } } @@ -195,7 +201,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; @@ -206,3 +213,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts new file mode 100644 index 00000000..053430b5 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts @@ -0,0 +1,82 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/module/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.module.v1alpha1"; + +/** + * Module defines the ORM module which adds providers to the app container for + * ORM ModuleDB's and in the future will automatically register query + * services for modules that use the ORM. + */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts new file mode 100644 index 00000000..da9a277e --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts @@ -0,0 +1,911 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/query/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Duration } from "../../../../google/protobuf/duration"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { PageRequest, PageResponse } from "../../../base/query/v1beta1/pagination"; + +export const protobufPackage = "cosmos.orm.query.v1alpha1"; + +/** GetRequest is the Query/Get request type. */ +export interface GetRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. If it is non-empty, it must + * refer to an unique index. + */ + index: string; + /** + * values are the values of the fields corresponding to the requested index. + * There must be as many values provided as there are fields in the index and + * these values must correspond to the index field types. + */ + values: IndexValue[]; +} + +/** GetResponse is the Query/Get response type. */ +export interface GetResponse { + /** + * result is the result of the get query. If no value is found, the gRPC + * status code NOT_FOUND will be returned. + */ + result: Any | undefined; +} + +/** ListRequest is the Query/List request type. */ +export interface ListRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. + */ + index: string; + /** prefix defines a prefix query. */ + prefix?: + | ListRequest_Prefix + | undefined; + /** range defines a range query. */ + range?: + | ListRequest_Range + | undefined; + /** pagination is the pagination request. */ + pagination: PageRequest | undefined; +} + +/** Prefix specifies the arguments to a prefix query. */ +export interface ListRequest_Prefix { + /** + * values specifies the index values for the prefix query. + * It is valid to special a partial prefix with fewer values than + * the number of fields in the index. + */ + values: IndexValue[]; +} + +/** Range specifies the arguments to a range query. */ +export interface ListRequest_Range { + /** + * start specifies the starting index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + start: IndexValue[]; + /** + * end specifies the inclusive ending index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + end: IndexValue[]; +} + +/** ListResponse is the Query/List response type. */ +export interface ListResponse { + /** results are the results of the query. */ + results: Any[]; + /** pagination is the pagination response. */ + pagination: PageResponse | undefined; +} + +/** IndexValue represents the value of a field in an ORM index expression. */ +export interface IndexValue { + /** + * uint specifies a value for an uint32, fixed32, uint64, or fixed64 + * index field. + */ + uint?: + | number + | undefined; + /** + * int64 specifies a value for an int32, sfixed32, int64, or sfixed64 + * index field. + */ + int?: + | number + | undefined; + /** str specifies a value for a string index field. */ + str?: + | string + | undefined; + /** bytes specifies a value for a bytes index field. */ + bytes?: + | Uint8Array + | undefined; + /** enum specifies a value for an enum index field. */ + enum?: + | string + | undefined; + /** bool specifies a value for a bool index field. */ + bool?: + | boolean + | undefined; + /** timestamp specifies a value for a timestamp index field. */ + timestamp?: + | Date + | undefined; + /** duration specifies a value for a duration index field. */ + duration?: Duration | undefined; +} + +function createBaseGetRequest(): GetRequest { + return { messageName: "", index: "", values: [] }; +} + +export const GetRequest: MessageFns = { + encode(message: GetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: GetRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GetRequest { + return GetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetRequest { + const message = createBaseGetRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetResponse(): GetResponse { + return { result: undefined }; +} + +export const GetResponse: MessageFns = { + encode(message: GetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== undefined) { + Any.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.result = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetResponse { + return { result: isSet(object.result) ? Any.fromJSON(object.result) : undefined }; + }, + + toJSON(message: GetResponse): unknown { + const obj: any = {}; + if (message.result !== undefined) { + obj.result = Any.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): GetResponse { + return GetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetResponse { + const message = createBaseGetResponse(); + message.result = (object.result !== undefined && object.result !== null) + ? Any.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseListRequest(): ListRequest { + return { messageName: "", index: "", prefix: undefined, range: undefined, pagination: undefined }; +} + +export const ListRequest: MessageFns = { + encode(message: ListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + if (message.prefix !== undefined) { + ListRequest_Prefix.encode(message.prefix, writer.uint32(26).fork()).join(); + } + if (message.range !== undefined) { + ListRequest_Range.encode(message.range, writer.uint32(34).fork()).join(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.prefix = ListRequest_Prefix.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.range = ListRequest_Range.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + prefix: isSet(object.prefix) ? ListRequest_Prefix.fromJSON(object.prefix) : undefined, + range: isSet(object.range) ? ListRequest_Range.fromJSON(object.range) : undefined, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.prefix !== undefined) { + obj.prefix = ListRequest_Prefix.toJSON(message.prefix); + } + if (message.range !== undefined) { + obj.range = ListRequest_Range.toJSON(message.range); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListRequest { + return ListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest { + const message = createBaseListRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.prefix = (object.prefix !== undefined && object.prefix !== null) + ? ListRequest_Prefix.fromPartial(object.prefix) + : undefined; + message.range = (object.range !== undefined && object.range !== null) + ? ListRequest_Range.fromPartial(object.range) + : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseListRequest_Prefix(): ListRequest_Prefix { + return { values: [] }; +} + +export const ListRequest_Prefix: MessageFns = { + encode(message: ListRequest_Prefix, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Prefix { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Prefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Prefix { + return { + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Prefix): unknown { + const obj: any = {}; + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Prefix { + return ListRequest_Prefix.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Prefix { + const message = createBaseListRequest_Prefix(); + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListRequest_Range(): ListRequest_Range { + return { start: [], end: [] }; +} + +export const ListRequest_Range: MessageFns = { + encode(message: ListRequest_Range, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.start) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.end) { + IndexValue.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Range { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Range(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.start.push(IndexValue.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.end.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Range { + return { + start: globalThis.Array.isArray(object?.start) ? object.start.map((e: any) => IndexValue.fromJSON(e)) : [], + end: globalThis.Array.isArray(object?.end) ? object.end.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Range): unknown { + const obj: any = {}; + if (message.start?.length) { + obj.start = message.start.map((e) => IndexValue.toJSON(e)); + } + if (message.end?.length) { + obj.end = message.end.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Range { + return ListRequest_Range.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Range { + const message = createBaseListRequest_Range(); + message.start = object.start?.map((e) => IndexValue.fromPartial(e)) || []; + message.end = object.end?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListResponse(): ListResponse { + return { results: [], pagination: undefined }; +} + +export const ListResponse: MessageFns = { + encode(message: ListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListResponse { + return ListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListResponse { + const message = createBaseListResponse(); + message.results = object.results?.map((e) => Any.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseIndexValue(): IndexValue { + return { + uint: undefined, + int: undefined, + str: undefined, + bytes: undefined, + enum: undefined, + bool: undefined, + timestamp: undefined, + duration: undefined, + }; +} + +export const IndexValue: MessageFns = { + encode(message: IndexValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uint !== undefined) { + writer.uint32(8).uint64(message.uint); + } + if (message.int !== undefined) { + writer.uint32(16).int64(message.int); + } + if (message.str !== undefined) { + writer.uint32(26).string(message.str); + } + if (message.bytes !== undefined) { + writer.uint32(34).bytes(message.bytes); + } + if (message.enum !== undefined) { + writer.uint32(42).string(message.enum); + } + if (message.bool !== undefined) { + writer.uint32(48).bool(message.bool); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(58).fork()).join(); + } + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.uint = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.int = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.str = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.enum = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.bool = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.duration = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexValue { + return { + uint: isSet(object.uint) ? globalThis.Number(object.uint) : undefined, + int: isSet(object.int) ? globalThis.Number(object.int) : undefined, + str: isSet(object.str) ? globalThis.String(object.str) : undefined, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : undefined, + enum: isSet(object.enum) ? globalThis.String(object.enum) : undefined, + bool: isSet(object.bool) ? globalThis.Boolean(object.bool) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + }; + }, + + toJSON(message: IndexValue): unknown { + const obj: any = {}; + if (message.uint !== undefined) { + obj.uint = Math.round(message.uint); + } + if (message.int !== undefined) { + obj.int = Math.round(message.int); + } + if (message.str !== undefined) { + obj.str = message.str; + } + if (message.bytes !== undefined) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.enum !== undefined) { + obj.enum = message.enum; + } + if (message.bool !== undefined) { + obj.bool = message.bool; + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.duration !== undefined) { + obj.duration = Duration.toJSON(message.duration); + } + return obj; + }, + + create, I>>(base?: I): IndexValue { + return IndexValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexValue { + const message = createBaseIndexValue(); + message.uint = object.uint ?? undefined; + message.int = object.int ?? undefined; + message.str = object.str ?? undefined; + message.bytes = object.bytes ?? undefined; + message.enum = object.enum ?? undefined; + message.bool = object.bool ?? undefined; + message.timestamp = object.timestamp ?? undefined; + message.duration = (object.duration !== undefined && object.duration !== null) + ? Duration.fromPartial(object.duration) + : undefined; + return message; + }, +}; + +/** Query is a generic gRPC service for querying ORM data. */ +export interface Query { + /** Get queries an ORM table against an unique index. */ + Get(request: GetRequest): Promise; + /** List queries an ORM table against an index. */ + List(request: ListRequest): Promise; +} + +export const QueryServiceName = "cosmos.orm.query.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Get = this.Get.bind(this); + this.List = this.List.bind(this); + } + Get(request: GetRequest): Promise { + const data = GetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Get", data); + return promise.then((data) => GetResponse.decode(new BinaryReader(data))); + } + + List(request: ListRequest): Promise { + const data = ListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "List", data); + return promise.then((data) => ListResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/v1/orm.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/v1/orm.ts new file mode 100644 index 00000000..e13476dc --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/v1/orm.ts @@ -0,0 +1,444 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1/orm.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1"; + +/** TableDescriptor describes an ORM table. */ +export interface TableDescriptor { + /** primary_key defines the primary key for the table. */ + primaryKey: + | PrimaryKeyDescriptor + | undefined; + /** 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 is encoded such that values with only seconds occupy 6 bytes, + * values including nanos occupy 9 bytes, and nil values occupy 1 byte. When iterating, nil + * values will always be ordered last. Seconds and nanos values must conform to the officially + * specified ranges of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z and 0 to 999,999,999 respectively. + * - google.protobuf.Duration is 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. + */ + autoIncrement: 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 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 { primaryKey: undefined, index: [], id: 0 }; +} + +export const TableDescriptor: MessageFns = { + encode(message: TableDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.primaryKey !== undefined) { + PrimaryKeyDescriptor.encode(message.primaryKey, writer.uint32(10).fork()).join(); + } + for (const v of message.index) { + SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.id !== 0) { + writer.uint32(24).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TableDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.primaryKey = PrimaryKeyDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index.push(SecondaryIndexDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TableDescriptor { + return { + primaryKey: isSet(object.primaryKey) ? PrimaryKeyDescriptor.fromJSON(object.primaryKey) : undefined, + index: globalThis.Array.isArray(object?.index) + ? object.index.map((e: any) => SecondaryIndexDescriptor.fromJSON(e)) + : [], + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + }; + }, + + toJSON(message: TableDescriptor): unknown { + const obj: any = {}; + if (message.primaryKey !== undefined) { + obj.primaryKey = PrimaryKeyDescriptor.toJSON(message.primaryKey); + } + if (message.index?.length) { + obj.index = message.index.map((e) => SecondaryIndexDescriptor.toJSON(e)); + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): TableDescriptor { + return TableDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TableDescriptor { + const message = createBaseTableDescriptor(); + message.primaryKey = (object.primaryKey !== undefined && object.primaryKey !== null) + ? PrimaryKeyDescriptor.fromPartial(object.primaryKey) + : undefined; + message.index = object.index?.map((e) => SecondaryIndexDescriptor.fromPartial(e)) || []; + message.id = object.id ?? 0; + return message; + }, +}; + +function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { + return { fields: "", autoIncrement: false }; +} + +export const PrimaryKeyDescriptor: MessageFns = { + encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.autoIncrement !== false) { + writer.uint32(16).bool(message.autoIncrement); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrimaryKeyDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.autoIncrement = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrimaryKeyDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + autoIncrement: isSet(object.autoIncrement) ? globalThis.Boolean(object.autoIncrement) : false, + }; + }, + + toJSON(message: PrimaryKeyDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.autoIncrement !== false) { + obj.autoIncrement = message.autoIncrement; + } + return obj; + }, + + create, I>>(base?: I): PrimaryKeyDescriptor { + return PrimaryKeyDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrimaryKeyDescriptor { + const message = createBasePrimaryKeyDescriptor(); + message.fields = object.fields ?? ""; + message.autoIncrement = object.autoIncrement ?? false; + return message; + }, +}; + +function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { + return { fields: "", id: 0, unique: false }; +} + +export const SecondaryIndexDescriptor: MessageFns = { + encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.id !== 0) { + writer.uint32(16).uint32(message.id); + } + if (message.unique !== false) { + writer.uint32(24).bool(message.unique); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecondaryIndexDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.id = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.unique = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecondaryIndexDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + unique: isSet(object.unique) ? globalThis.Boolean(object.unique) : false, + }; + }, + + toJSON(message: SecondaryIndexDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.unique !== false) { + obj.unique = message.unique; + } + return obj; + }, + + create, I>>(base?: I): SecondaryIndexDescriptor { + return SecondaryIndexDescriptor.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: SingletonDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SingletonDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SingletonDescriptor { + return { id: isSet(object.id) ? globalThis.Number(object.id) : 0 }; + }, + + toJSON(message: SingletonDescriptor): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): SingletonDescriptor { + return SingletonDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/v1alpha1/schema.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/v1alpha1/schema.ts new file mode 100644 index 00000000..e326c1bc --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/orm/v1alpha1/schema.ts @@ -0,0 +1,316 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1alpha1/schema.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1alpha1"; + +/** StorageType */ +export enum StorageType { + /** + * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent storage where all + * data is stored in the regular Merkle-tree backed KV-store. + */ + 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, + 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 -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.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptor { + schemaFile: 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. + */ + protoFileName: 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. + */ + storageType: StorageType; +} + +function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { + return { schemaFile: [], prefix: new Uint8Array(0) }; +} + +export const ModuleSchemaDescriptor: MessageFns = { + encode(message: ModuleSchemaDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.schemaFile) { + ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.schemaFile.push(ModuleSchemaDescriptor_FileEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.prefix = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor { + return { + schemaFile: globalThis.Array.isArray(object?.schemaFile) + ? object.schemaFile.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)) + : [], + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0), + }; + }, + + toJSON(message: ModuleSchemaDescriptor): unknown { + const obj: any = {}; + if (message.schemaFile?.length) { + obj.schemaFile = message.schemaFile.map((e) => ModuleSchemaDescriptor_FileEntry.toJSON(e)); + } + if (message.prefix.length !== 0) { + obj.prefix = base64FromBytes(message.prefix); + } + return obj; + }, + + create, I>>(base?: I): ModuleSchemaDescriptor { + return ModuleSchemaDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schemaFile = object.schemaFile?.map((e) => ModuleSchemaDescriptor_FileEntry.fromPartial(e)) || []; + message.prefix = object.prefix ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { + return { id: 0, protoFileName: "", storageType: 0 }; +} + +export const ModuleSchemaDescriptor_FileEntry: MessageFns = { + encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.protoFileName !== "") { + writer.uint32(18).string(message.protoFileName); + } + if (message.storageType !== 0) { + writer.uint32(24).int32(message.storageType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor_FileEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.protoFileName = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.storageType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor_FileEntry { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + protoFileName: isSet(object.protoFileName) ? globalThis.String(object.protoFileName) : "", + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : 0, + }; + }, + + toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.protoFileName !== "") { + obj.protoFileName = message.protoFileName; + } + if (message.storageType !== 0) { + obj.storageType = storageTypeToJSON(message.storageType); + } + return obj; + }, + + create, I>>( + base?: I, + ): ModuleSchemaDescriptor_FileEntry { + return ModuleSchemaDescriptor_FileEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + message.id = object.id ?? 0; + message.protoFileName = object.protoFileName ?? ""; + message.storageType = object.storageType ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/params/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/params/module/v1/module.ts new file mode 100644 index 00000000..731379ce --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/params/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.params.module.v1"; + +/** Module is the config object of the params module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/params/v1beta1/params.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/params/v1beta1/params.ts new file mode 100644 index 00000000..24070188 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/params/v1beta1/params.ts @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: MessageFns = { + encode(message: ParameterChangeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParameterChangeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changes.push(ParamChange.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParameterChangeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + changes: globalThis.Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [], + }; + }, + + toJSON(message: ParameterChangeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.changes?.length) { + obj.changes = message.changes.map((e) => ParamChange.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ParameterChangeProposal { + return ParameterChangeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ParamChange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ParamChange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParamChange { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: ParamChange): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ParamChange { + return ParamChange.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/params/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/params/v1beta1/query.ts new file mode 100644 index 00000000..d45f57cd --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/params/v1beta1/query.ts @@ -0,0 +1,433 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesRequest { +} + +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesResponse { + subspaces: Subspace[]; +} + +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface Subspace { + subspace: string; + keys: string[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { subspace: "", key: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.param !== undefined) { + ParamChange.encode(message.param, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.param = ParamChange.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.param !== undefined) { + obj.param = ParamChange.toJSON(message.param); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QuerySubspacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QuerySubspacesRequest { + return {}; + }, + + toJSON(_: QuerySubspacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QuerySubspacesRequest { + return QuerySubspacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, +}; + +function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { + return { subspaces: [] }; +} + +export const QuerySubspacesResponse: MessageFns = { + encode(message: QuerySubspacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.subspaces) { + Subspace.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspaces.push(Subspace.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySubspacesResponse { + return { + subspaces: globalThis.Array.isArray(object?.subspaces) + ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QuerySubspacesResponse): unknown { + const obj: any = {}; + if (message.subspaces?.length) { + obj.subspaces = message.subspaces.map((e) => Subspace.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QuerySubspacesResponse { + return QuerySubspacesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Subspace, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + for (const v of message.keys) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Subspace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keys.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Subspace { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: Subspace): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.keys?.length) { + obj.keys = message.keys; + } + return obj; + }, + + create, I>>(base?: I): Subspace { + return Subspace.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + Subspaces(request: QuerySubspacesRequest): Promise; +} + +export const QueryServiceName = "cosmos.params.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/query/v1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/query/v1/query.ts new file mode 100644 index 00000000..bcdfc76d --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/query/v1/query.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/query/v1/query.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.query.v1"; diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/reflection/v1/reflection.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/reflection/v1/reflection.ts new file mode 100644 index 00000000..0962d0d1 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/reflection/v1/reflection.ts @@ -0,0 +1,178 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/reflection/v1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { FileDescriptorProto } from "../../../google/protobuf/descriptor"; + +export const protobufPackage = "cosmos.reflection.v1"; + +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequest { +} + +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponse { + /** files is the file descriptors. */ + files: FileDescriptorProto[]; +} + +function createBaseFileDescriptorsRequest(): FileDescriptorsRequest { + return {}; +} + +export const FileDescriptorsRequest: MessageFns = { + encode(_: FileDescriptorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): FileDescriptorsRequest { + return {}; + }, + + toJSON(_: FileDescriptorsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): FileDescriptorsRequest { + return FileDescriptorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): FileDescriptorsRequest { + const message = createBaseFileDescriptorsRequest(); + return message; + }, +}; + +function createBaseFileDescriptorsResponse(): FileDescriptorsResponse { + return { files: [] }; +} + +export const FileDescriptorsResponse: MessageFns = { + encode(message: FileDescriptorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.files) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.files.push(FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileDescriptorsResponse { + return { + files: globalThis.Array.isArray(object?.files) + ? object.files.map((e: any) => FileDescriptorProto.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileDescriptorsResponse): unknown { + const obj: any = {}; + if (message.files?.length) { + obj.files = message.files.map((e) => FileDescriptorProto.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FileDescriptorsResponse { + return FileDescriptorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileDescriptorsResponse { + const message = createBaseFileDescriptorsResponse(); + message.files = object.files?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +/** + * Package cosmos.reflection.v1 provides support for inspecting protobuf + * file descriptors. + */ +export interface ReflectionService { + /** + * FileDescriptors queries all the file descriptors in the app in order + * to enable easier generation of dynamic clients. + */ + FileDescriptors(request: FileDescriptorsRequest): Promise; +} + +export const ReflectionServiceServiceName = "cosmos.reflection.v1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + this.rpc = rpc; + this.FileDescriptors = this.FileDescriptors.bind(this); + } + FileDescriptors(request: FileDescriptorsRequest): Promise { + const data = FileDescriptorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FileDescriptors", data); + return promise.then((data) => FileDescriptorsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/module/v1/module.ts new file mode 100644 index 00000000..bf27cfd0 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.slashing.module.v1"; + +/** Module is the config object of the slashing module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts new file mode 100644 index 00000000..958b6870 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signingInfos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missedBlocks: 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. */ + validatorSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * 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. */ + missedBlocks: MissedBlock[]; +} + +/** MissedBlock contains height and missed status as boolean. */ +export interface MissedBlock { + /** index is the height at which the block was missed. */ + index: number; + /** missed is the missed status. */ + missed: boolean; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, signingInfos: [], missedBlocks: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.signingInfos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.missedBlocks) { + ValidatorMissedBlocks.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signingInfos.push(SigningInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.missedBlocks.push(ValidatorMissedBlocks.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signingInfos: globalThis.Array.isArray(object?.signingInfos) + ? object.signingInfos.map((e: any) => SigningInfo.fromJSON(e)) + : [], + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.signingInfos?.length) { + obj.signingInfos = message.signingInfos.map((e) => SigningInfo.toJSON(e)); + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => ValidatorMissedBlocks.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) + ? Params.fromPartial(object.params) + : undefined; + message.signingInfos = object.signingInfos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missedBlocks = object.missedBlocks?.map((e) => ValidatorMissedBlocks.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningInfo(): SigningInfo { + return { address: "", validatorSigningInfo: undefined }; +} + +export const SigningInfo: MessageFns = { + encode(message: SigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.validatorSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.validatorSigningInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + validatorSigningInfo: isSet(object.validatorSigningInfo) + ? ValidatorSigningInfo.fromJSON(object.validatorSigningInfo) + : undefined, + }; + }, + + toJSON(message: SigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.validatorSigningInfo !== undefined) { + obj.validatorSigningInfo = ValidatorSigningInfo.toJSON(message.validatorSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): SigningInfo { + return SigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningInfo { + const message = createBaseSigningInfo(); + message.address = object.address ?? ""; + message.validatorSigningInfo = (object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.validatorSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { + return { address: "", missedBlocks: [] }; +} + +export const ValidatorMissedBlocks: MessageFns = { + encode(message: ValidatorMissedBlocks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.missedBlocks) { + MissedBlock.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorMissedBlocks { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.missedBlocks.push(MissedBlock.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlocks { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => MissedBlock.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorMissedBlocks): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => MissedBlock.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorMissedBlocks { + return ValidatorMissedBlocks.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorMissedBlocks { + const message = createBaseValidatorMissedBlocks(); + message.address = object.address ?? ""; + message.missedBlocks = object.missedBlocks?.map((e) => MissedBlock.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMissedBlock(): MissedBlock { + return { index: 0, missed: false }; +} + +export const MissedBlock: MessageFns = { + encode(message: MissedBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).int64(message.index); + } + if (message.missed !== false) { + writer.uint32(16).bool(message.missed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MissedBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.missed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MissedBlock { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + missed: isSet(object.missed) ? globalThis.Boolean(object.missed) : false, + }; + }, + + toJSON(message: MissedBlock): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.missed !== false) { + obj.missed = message.missed; + } + return obj; + }, + + create, I>>(base?: I): MissedBlock { + return MissedBlock.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 00000000..bc78c27e --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,481 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoRequest { + /** cons_address is the address to query signing info of */ + consAddress: 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 */ + valSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosRequest { + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { + return { consAddress: "" }; +} + +export const QuerySigningInfoRequest: MessageFns = { + encode(message: QuerySigningInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consAddress !== "") { + writer.uint32(10).string(message.consAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.consAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoRequest { + return { consAddress: isSet(object.consAddress) ? globalThis.String(object.consAddress) : "" }; + }, + + toJSON(message: QuerySigningInfoRequest): unknown { + const obj: any = {}; + if (message.consAddress !== "") { + obj.consAddress = message.consAddress; + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoRequest { + return QuerySigningInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoRequest { + const message = createBaseQuerySigningInfoRequest(); + message.consAddress = object.consAddress ?? ""; + return message; + }, +}; + +function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { + return { valSigningInfo: undefined }; +} + +export const QuerySigningInfoResponse: MessageFns = { + encode(message: QuerySigningInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.valSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.valSigningInfo, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.valSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoResponse { + return { + valSigningInfo: isSet(object.valSigningInfo) ? ValidatorSigningInfo.fromJSON(object.valSigningInfo) : undefined, + }; + }, + + toJSON(message: QuerySigningInfoResponse): unknown { + const obj: any = {}; + if (message.valSigningInfo !== undefined) { + obj.valSigningInfo = ValidatorSigningInfo.toJSON(message.valSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoResponse { + return QuerySigningInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoResponse { + const message = createBaseQuerySigningInfoResponse(); + message.valSigningInfo = (object.valSigningInfo !== undefined && object.valSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.valSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { + return { pagination: undefined }; +} + +export const QuerySigningInfosRequest: MessageFns = { + encode(message: QuerySigningInfosRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QuerySigningInfosRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosRequest { + return QuerySigningInfosRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySigningInfosResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.info) { + ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info.push(ValidatorSigningInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosResponse { + return { + info: globalThis.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?.length) { + obj.info = message.info.map((e) => ValidatorSigningInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosResponse { + return QuerySigningInfosResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.slashing.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts new file mode 100644 index 00000000..06f87d05 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts @@ -0,0 +1,411 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/slashing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 un-jailed */ + startHeight: number; + /** + * Index which is incremented every time a validator is bonded in a block and + * _may_ have signed a pre-commit or not. This in conjunction with the + * signed_blocks_window param determines the index in the missed block bitmap. + */ + indexOffset: number; + /** Timestamp until which the validator is jailed due to liveness downtime. */ + jailedUntil: + | Date + | undefined; + /** + * 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 misbehavior. + */ + tombstoned: boolean; + /** + * A counter of missed (unsigned) blocks. It is used to avoid unnecessary + * reads in the missed block bitmap. + */ + missedBlocksCounter: number; +} + +/** Params represents the parameters used for by the slashing module. */ +export interface Params { + signedBlocksWindow: number; + minSignedPerWindow: Uint8Array; + downtimeJailDuration: Duration | undefined; + slashFractionDoubleSign: Uint8Array; + slashFractionDowntime: Uint8Array; +} + +function createBaseValidatorSigningInfo(): ValidatorSigningInfo { + return { + address: "", + startHeight: 0, + indexOffset: 0, + jailedUntil: undefined, + tombstoned: false, + missedBlocksCounter: 0, + }; +} + +export const ValidatorSigningInfo: MessageFns = { + encode(message: ValidatorSigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.startHeight !== 0) { + writer.uint32(16).int64(message.startHeight); + } + if (message.indexOffset !== 0) { + writer.uint32(24).int64(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + Timestamp.encode(toTimestamp(message.jailedUntil), writer.uint32(34).fork()).join(); + } + if (message.tombstoned !== false) { + writer.uint32(40).bool(message.tombstoned); + } + if (message.missedBlocksCounter !== 0) { + writer.uint32(48).int64(message.missedBlocksCounter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.indexOffset = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.jailedUntil = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.tombstoned = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.missedBlocksCounter = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + startHeight: isSet(object.startHeight) ? globalThis.Number(object.startHeight) : 0, + indexOffset: isSet(object.indexOffset) ? globalThis.Number(object.indexOffset) : 0, + jailedUntil: isSet(object.jailedUntil) ? fromJsonTimestamp(object.jailedUntil) : undefined, + tombstoned: isSet(object.tombstoned) ? globalThis.Boolean(object.tombstoned) : false, + missedBlocksCounter: isSet(object.missedBlocksCounter) ? globalThis.Number(object.missedBlocksCounter) : 0, + }; + }, + + toJSON(message: ValidatorSigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.startHeight !== 0) { + obj.startHeight = Math.round(message.startHeight); + } + if (message.indexOffset !== 0) { + obj.indexOffset = Math.round(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + obj.jailedUntil = message.jailedUntil.toISOString(); + } + if (message.tombstoned !== false) { + obj.tombstoned = message.tombstoned; + } + if (message.missedBlocksCounter !== 0) { + obj.missedBlocksCounter = Math.round(message.missedBlocksCounter); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSigningInfo { + return ValidatorSigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSigningInfo { + const message = createBaseValidatorSigningInfo(); + message.address = object.address ?? ""; + message.startHeight = object.startHeight ?? 0; + message.indexOffset = object.indexOffset ?? 0; + message.jailedUntil = object.jailedUntil ?? undefined; + message.tombstoned = object.tombstoned ?? false; + message.missedBlocksCounter = object.missedBlocksCounter ?? 0; + return message; + }, +}; + +function createBaseParams(): Params { + return { + signedBlocksWindow: 0, + minSignedPerWindow: new Uint8Array(0), + downtimeJailDuration: undefined, + slashFractionDoubleSign: new Uint8Array(0), + slashFractionDowntime: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedBlocksWindow !== 0) { + writer.uint32(8).int64(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + writer.uint32(18).bytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + Duration.encode(message.downtimeJailDuration, writer.uint32(26).fork()).join(); + } + if (message.slashFractionDoubleSign.length !== 0) { + writer.uint32(34).bytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + writer.uint32(42).bytes(message.slashFractionDowntime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.signedBlocksWindow = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minSignedPerWindow = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.downtimeJailDuration = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.slashFractionDoubleSign = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionDowntime = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + signedBlocksWindow: isSet(object.signedBlocksWindow) ? globalThis.Number(object.signedBlocksWindow) : 0, + minSignedPerWindow: isSet(object.minSignedPerWindow) + ? bytesFromBase64(object.minSignedPerWindow) + : new Uint8Array(0), + downtimeJailDuration: isSet(object.downtimeJailDuration) + ? Duration.fromJSON(object.downtimeJailDuration) + : undefined, + slashFractionDoubleSign: isSet(object.slashFractionDoubleSign) + ? bytesFromBase64(object.slashFractionDoubleSign) + : new Uint8Array(0), + slashFractionDowntime: isSet(object.slashFractionDowntime) + ? bytesFromBase64(object.slashFractionDowntime) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.signedBlocksWindow !== 0) { + obj.signedBlocksWindow = Math.round(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + obj.minSignedPerWindow = base64FromBytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + obj.downtimeJailDuration = Duration.toJSON(message.downtimeJailDuration); + } + if (message.slashFractionDoubleSign.length !== 0) { + obj.slashFractionDoubleSign = base64FromBytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + obj.slashFractionDowntime = base64FromBytes(message.slashFractionDowntime); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.signedBlocksWindow = object.signedBlocksWindow ?? 0; + message.minSignedPerWindow = object.minSignedPerWindow ?? new Uint8Array(0); + message.downtimeJailDuration = (object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null) + ? Duration.fromPartial(object.downtimeJailDuration) + : undefined; + message.slashFractionDoubleSign = object.slashFractionDoubleSign ?? new Uint8Array(0); + message.slashFractionDowntime = object.slashFractionDowntime ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/tx.ts new file mode 100644 index 00000000..54377079 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/slashing/v1beta1/tx.ts @@ -0,0 +1,333 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./slashing"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** MsgUnjail defines the Msg/Unjail request type */ +export interface MsgUnjail { + validatorAddr: string; +} + +/** MsgUnjailResponse defines the Msg/Unjail response type */ +export interface MsgUnjailResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/slashing parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUnjail(): MsgUnjail { + return { validatorAddr: "" }; +} + +export const MsgUnjail: MessageFns = { + encode(message: MsgUnjail, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjail { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnjail { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: MsgUnjail): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): MsgUnjail { + return MsgUnjail.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnjail { + const message = createBaseMsgUnjail(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseMsgUnjailResponse(): MsgUnjailResponse { + return {}; +} + +export const MsgUnjailResponse: MessageFns = { + encode(_: MsgUnjailResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjailResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjailResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnjailResponse { + return {}; + }, + + toJSON(_: MsgUnjailResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnjailResponse { + return MsgUnjailResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnjailResponse { + const message = createBaseMsgUnjailResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/slashing module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.slashing.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 || MsgServiceName; + this.rpc = rpc; + this.Unjail = this.Unjail.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/module/v1/module.ts new file mode 100644 index 00000000..7f8fe4b9 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/module/v1/module.ts @@ -0,0 +1,157 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.staking.module.v1"; + +/** Module is the config object of the staking module. */ +export interface Module { + /** + * hooks_order specifies the order of staking hooks and should be a list + * of module names which provide a staking hooks instance. If no order is + * provided, then hooks will be applied in alphabetical order of module names. + */ + hooksOrder: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** bech32_prefix_validator is the bech32 validator prefix for the app. */ + bech32PrefixValidator: string; + /** bech32_prefix_consensus is the bech32 consensus node prefix for the app. */ + bech32PrefixConsensus: string; +} + +function createBaseModule(): Module { + return { hooksOrder: [], authority: "", bech32PrefixValidator: "", bech32PrefixConsensus: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.hooksOrder) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + if (message.bech32PrefixValidator !== "") { + writer.uint32(26).string(message.bech32PrefixValidator); + } + if (message.bech32PrefixConsensus !== "") { + writer.uint32(34).string(message.bech32PrefixConsensus); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.hooksOrder.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bech32PrefixValidator = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bech32PrefixConsensus = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + hooksOrder: globalThis.Array.isArray(object?.hooksOrder) + ? object.hooksOrder.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + bech32PrefixValidator: isSet(object.bech32PrefixValidator) ? globalThis.String(object.bech32PrefixValidator) : "", + bech32PrefixConsensus: isSet(object.bech32PrefixConsensus) ? globalThis.String(object.bech32PrefixConsensus) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.hooksOrder?.length) { + obj.hooksOrder = message.hooksOrder; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.bech32PrefixValidator !== "") { + obj.bech32PrefixValidator = message.bech32PrefixValidator; + } + if (message.bech32PrefixConsensus !== "") { + obj.bech32PrefixConsensus = message.bech32PrefixConsensus; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.hooksOrder = object.hooksOrder?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.bech32PrefixValidator = object.bech32PrefixValidator ?? ""; + message.bech32PrefixConsensus = object.bech32PrefixConsensus ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/authz.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 00000000..b989d692 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,301 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION - AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION defines an authorization type for Msg/MsgCancelUnbondingDelegation */ + AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION = 4, + 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 4: + case "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION": + return AuthorizationType.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION; + 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.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION: + return "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION"; + 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. + */ + maxTokens: + | Coin + | undefined; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allowList?: + | StakeAuthorization_Validators + | undefined; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + denyList?: + | StakeAuthorization_Validators + | undefined; + /** authorization_type defines one of AuthorizationType. */ + authorizationType: AuthorizationType; +} + +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_Validators { + address: string[]; +} + +function createBaseStakeAuthorization(): StakeAuthorization { + return { maxTokens: undefined, allowList: undefined, denyList: undefined, authorizationType: 0 }; +} + +export const StakeAuthorization: MessageFns = { + encode(message: StakeAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTokens !== undefined) { + Coin.encode(message.maxTokens, writer.uint32(10).fork()).join(); + } + if (message.allowList !== undefined) { + StakeAuthorization_Validators.encode(message.allowList, writer.uint32(18).fork()).join(); + } + if (message.denyList !== undefined) { + StakeAuthorization_Validators.encode(message.denyList, writer.uint32(26).fork()).join(); + } + if (message.authorizationType !== 0) { + writer.uint32(32).int32(message.authorizationType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxTokens = Coin.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.denyList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.authorizationType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization { + return { + maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, + allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, + denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, + authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : 0, + }; + }, + + toJSON(message: StakeAuthorization): unknown { + const obj: any = {}; + if (message.maxTokens !== undefined) { + obj.maxTokens = Coin.toJSON(message.maxTokens); + } + if (message.allowList !== undefined) { + obj.allowList = StakeAuthorization_Validators.toJSON(message.allowList); + } + if (message.denyList !== undefined) { + obj.denyList = StakeAuthorization_Validators.toJSON(message.denyList); + } + if (message.authorizationType !== 0) { + obj.authorizationType = authorizationTypeToJSON(message.authorizationType); + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization { + return StakeAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeAuthorization { + const message = createBaseStakeAuthorization(); + message.maxTokens = (object.maxTokens !== undefined && object.maxTokens !== null) + ? Coin.fromPartial(object.maxTokens) + : undefined; + message.allowList = (object.allowList !== undefined && object.allowList !== null) + ? StakeAuthorization_Validators.fromPartial(object.allowList) + : undefined; + message.denyList = (object.denyList !== undefined && object.denyList !== null) + ? StakeAuthorization_Validators.fromPartial(object.denyList) + : undefined; + message.authorizationType = object.authorizationType ?? 0; + return message; + }, +}; + +function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { + return { address: [] }; +} + +export const StakeAuthorization_Validators: MessageFns = { + encode(message: StakeAuthorization_Validators, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.address) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization_Validators { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization_Validators { + return { + address: globalThis.Array.isArray(object?.address) ? object.address.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: StakeAuthorization_Validators): unknown { + const obj: any = {}; + if (message.address?.length) { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization_Validators { + return StakeAuthorization_Validators.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/genesis.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 00000000..8c967ba2 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,367 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of related to deposit. */ + params: + | Params + | undefined; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + lastTotalPower: Uint8Array; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + lastValidatorPowers: LastValidatorPower[]; + /** validators 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. */ + unbondingDelegations: UnbondingDelegation[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: Redelegation[]; + /** exported defines a bool to identify whether the chain dealing with exported or initialized genesis. */ + 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: number; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + lastTotalPower: new Uint8Array(0), + lastValidatorPowers: [], + validators: [], + delegations: [], + unbondingDelegations: [], + redelegations: [], + exported: false, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.lastTotalPower.length !== 0) { + writer.uint32(18).bytes(message.lastTotalPower); + } + for (const v of message.lastValidatorPowers) { + LastValidatorPower.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.delegations) { + Delegation.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.unbondingDelegations) { + UnbondingDelegation.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.redelegations) { + Redelegation.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.exported !== false) { + writer.uint32(64).bool(message.exported); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lastTotalPower = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.lastValidatorPowers.push(LastValidatorPower.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delegations.push(Delegation.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.unbondingDelegations.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.redelegations.push(Redelegation.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.exported = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + lastTotalPower: isSet(object.lastTotalPower) ? bytesFromBase64(object.lastTotalPower) : new Uint8Array(0), + lastValidatorPowers: globalThis.Array.isArray(object?.lastValidatorPowers) + ? object.lastValidatorPowers.map((e: any) => LastValidatorPower.fromJSON(e)) + : [], + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + delegations: globalThis.Array.isArray(object?.delegations) + ? object.delegations.map((e: any) => Delegation.fromJSON(e)) + : [], + unbondingDelegations: globalThis.Array.isArray(object?.unbondingDelegations) + ? object.unbondingDelegations.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + redelegations: globalThis.Array.isArray(object?.redelegations) + ? object.redelegations.map((e: any) => Redelegation.fromJSON(e)) + : [], + exported: isSet(object.exported) ? globalThis.Boolean(object.exported) : false, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.lastTotalPower.length !== 0) { + obj.lastTotalPower = base64FromBytes(message.lastTotalPower); + } + if (message.lastValidatorPowers?.length) { + obj.lastValidatorPowers = message.lastValidatorPowers.map((e) => LastValidatorPower.toJSON(e)); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.delegations?.length) { + obj.delegations = message.delegations.map((e) => Delegation.toJSON(e)); + } + if (message.unbondingDelegations?.length) { + obj.unbondingDelegations = message.unbondingDelegations.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.redelegations?.length) { + obj.redelegations = message.redelegations.map((e) => Redelegation.toJSON(e)); + } + if (message.exported !== false) { + obj.exported = message.exported; + } + 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) + ? Params.fromPartial(object.params) + : undefined; + message.lastTotalPower = object.lastTotalPower ?? new Uint8Array(0); + message.lastValidatorPowers = object.lastValidatorPowers?.map((e) => LastValidatorPower.fromPartial(e)) || []; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.delegations = object.delegations?.map((e) => Delegation.fromPartial(e)) || []; + message.unbondingDelegations = object.unbondingDelegations?.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: MessageFns = { + encode(message: LastValidatorPower, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LastValidatorPower { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LastValidatorPower { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: LastValidatorPower): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): LastValidatorPower { + return LastValidatorPower.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LastValidatorPower { + const message = createBaseLastValidatorPower(); + message.address = object.address ?? ""; + message.power = object.power ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/query.ts new file mode 100644 index 00000000..ef8f2dc7 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,2495 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponse { + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegationResponse: DelegationResponse | undefined; +} + +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond: UnbondingDelegation | undefined; +} + +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** src_validator_addr defines the validator address to redelegate from. */ + srcValidatorAddr: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dstValidatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponse { + redelegationResponses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: number; +} + +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist: HistoricalInfo | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { status: "", pagination: undefined }; +} + +export const QueryValidatorsRequest: MessageFns = { + encode(message: QueryValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.status = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsRequest { + return { + status: isSet(object.status) ? globalThis.String(object.status) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsRequest): unknown { + const obj: any = {}; + if (message.status !== "") { + obj.status = message.status; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsRequest { + return QueryValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsResponse { + return QueryValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "" }; +} + +export const QueryValidatorRequest: MessageFns = { + encode(message: QueryValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorRequest { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: QueryValidatorRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorRequest { + return QueryValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { validator: undefined }; +} + +export const QueryValidatorResponse: MessageFns = { + encode(message: QueryValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorResponse { + return QueryValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorDelegationsRequest: MessageFns = { + encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryValidatorDelegationsResponse: MessageFns = { + encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegationRequest: MessageFns = { + encode(message: QueryDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRequest { + return QueryDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { delegationResponse: undefined }; +} + +export const QueryDelegationResponse: MessageFns = { + encode(message: QueryDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegationResponse !== undefined) { + DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponse = DelegationResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationResponse { + return { + delegationResponse: isSet(object.delegationResponse) + ? DelegationResponse.fromJSON(object.delegationResponse) + : undefined, + }; + }, + + toJSON(message: QueryDelegationResponse): unknown { + const obj: any = {}; + if (message.delegationResponse !== undefined) { + obj.delegationResponse = DelegationResponse.toJSON(message.delegationResponse); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationResponse { + return QueryDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegationResponse = (object.delegationResponse !== undefined && object.delegationResponse !== null) + ? DelegationResponse.fromPartial(object.delegationResponse) + : undefined; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryUnbondingDelegationRequest: MessageFns = { + encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryUnbondingDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { unbond: undefined }; +} + +export const QueryUnbondingDelegationResponse: MessageFns = { + encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbond = UnbondingDelegation.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationResponse { + return { unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined }; + }, + + toJSON(message: QueryUnbondingDelegationResponse): unknown { + const obj: any = {}; + if (message.unbond !== undefined) { + obj.unbond = UnbondingDelegation.toJSON(message.unbond); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryDelegatorDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { delegatorAddr: "", srcValidatorAddr: "", dstValidatorAddr: "", pagination: undefined }; +} + +export const QueryRedelegationsRequest: MessageFns = { + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.srcValidatorAddr !== "") { + writer.uint32(18).string(message.srcValidatorAddr); + } + if (message.dstValidatorAddr !== "") { + writer.uint32(26).string(message.dstValidatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.srcValidatorAddr = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.dstValidatorAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + srcValidatorAddr: isSet(object.srcValidatorAddr) ? globalThis.String(object.srcValidatorAddr) : "", + dstValidatorAddr: isSet(object.dstValidatorAddr) ? globalThis.String(object.dstValidatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.srcValidatorAddr !== "") { + obj.srcValidatorAddr = message.srcValidatorAddr; + } + if (message.dstValidatorAddr !== "") { + obj.dstValidatorAddr = message.dstValidatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsRequest { + return QueryRedelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.srcValidatorAddr = object.srcValidatorAddr ?? ""; + message.dstValidatorAddr = object.dstValidatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { redelegationResponses: [], pagination: undefined }; +} + +export const QueryRedelegationsResponse: MessageFns = { + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.redelegationResponses) { + RedelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationResponses.push(RedelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsResponse { + return { + redelegationResponses: globalThis.Array.isArray(object?.redelegationResponses) + ? object.redelegationResponses.map((e: any) => RedelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsResponse): unknown { + const obj: any = {}; + if (message.redelegationResponses?.length) { + obj.redelegationResponses = message.redelegationResponses.map((e) => RedelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsResponse { + return QueryRedelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegationResponses?.map((e) => RedelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + 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: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegatorValidatorRequest: MessageFns = { + encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegatorValidatorRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { validator: undefined }; +} + +export const QueryDelegatorValidatorResponse: MessageFns = { + encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryDelegatorValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryHistoricalInfoRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { hist: undefined }; +} + +export const QueryHistoricalInfoResponse: MessageFns = { + encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hist = HistoricalInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoResponse { + return { hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined }; + }, + + toJSON(message: QueryHistoricalInfoResponse): unknown { + const obj: any = {}; + if (message.hist !== undefined) { + obj.hist = HistoricalInfo.toJSON(message.hist); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPoolRequest { + return {}; + }, + + toJSON(_: QueryPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPoolRequest { + return QueryPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, +}; + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +export const QueryPoolResponse: MessageFns = { + encode(message: QueryPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pool = Pool.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + if (message.pool !== undefined) { + obj.pool = Pool.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) ? Pool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Validators(request: QueryValidatorsRequest): Promise; + /** Validator queries validator info for given validator address. */ + Validator(request: QueryValidatorRequest): Promise; + /** + * ValidatorDelegations queries delegate info for given validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + ValidatorDelegations(request: QueryValidatorDelegationsRequest): Promise; + /** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; + /** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorUnbondingDelegations( + request: QueryDelegatorUnbondingDelegationsRequest, + ): Promise; + /** + * Redelegations queries redelegations of given address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Redelegations(request: QueryRedelegationsRequest): Promise; + /** + * DelegatorValidators queries all validators info for given delegator + * address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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 const QueryServiceName = "cosmos.staking.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/staking.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 00000000..7ea20d02 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,2506 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/staking.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { ValidatorUpdate } from "../../../tendermint/abci/types"; +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"; + } +} + +/** Infraction indicates the infraction a validator commited. */ +export enum Infraction { + /** INFRACTION_UNSPECIFIED - UNSPECIFIED defines an empty infraction. */ + INFRACTION_UNSPECIFIED = 0, + /** INFRACTION_DOUBLE_SIGN - DOUBLE_SIGN defines a validator that double-signs a block. */ + INFRACTION_DOUBLE_SIGN = 1, + /** INFRACTION_DOWNTIME - DOWNTIME defines a validator that missed signing too many blocks. */ + INFRACTION_DOWNTIME = 2, + UNRECOGNIZED = -1, +} + +export function infractionFromJSON(object: any): Infraction { + switch (object) { + case 0: + case "INFRACTION_UNSPECIFIED": + return Infraction.INFRACTION_UNSPECIFIED; + case 1: + case "INFRACTION_DOUBLE_SIGN": + return Infraction.INFRACTION_DOUBLE_SIGN; + case 2: + case "INFRACTION_DOWNTIME": + return Infraction.INFRACTION_DOWNTIME; + case -1: + case "UNRECOGNIZED": + default: + return Infraction.UNRECOGNIZED; + } +} + +export function infractionToJSON(object: Infraction): string { + switch (object) { + case Infraction.INFRACTION_UNSPECIFIED: + return "INFRACTION_UNSPECIFIED"; + case Infraction.INFRACTION_DOUBLE_SIGN: + return "INFRACTION_DOUBLE_SIGN"; + case Infraction.INFRACTION_DOWNTIME: + return "INFRACTION_DOWNTIME"; + case Infraction.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfo { + header: Header | undefined; + 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. */ + maxRate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + maxChangeRate: 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. */ + commissionRates: + | CommissionRates + | undefined; + /** update_time is the last time the commission rate was changed. */ + updateTime: Date | undefined; +} + +/** Description defines a validator description. */ +export interface Description { + /** moniker defines a human-readable name for the validator. */ + moniker: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity: string; + /** website defines an optional website link. */ + website: string; + /** security_contact defines an optional email for security contact. */ + securityContact: string; + /** details define other optional details. */ + details: string; +} + +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface Validator { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operatorAddress: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensusPubkey: + | Any + | undefined; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegatorShares: string; + /** description defines the description terms for the validator. */ + description: + | Description + | undefined; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbondingHeight: number; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbondingTime: + | Date + | undefined; + /** commission defines the commission parameters. */ + commission: + | Commission + | undefined; + /** + * min_self_delegation is the validator's self declared minimum self delegation. + * + * Since: cosmos-sdk 0.46 + */ + minSelfDelegation: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbondingIds: number[]; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: 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 encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** shares define the delegation shares received. */ + shares: string; +} + +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegation { + /** delegator_address is the encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} + +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; + /** completion_time is the unix time for unbonding completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initialBalance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creationHeight: number; + /** completion_time defines the unix time for redelegation completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the initial balance when redelegation started. */ + initialBalance: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + sharesDst: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface Redelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegatorAddress: string; + /** validator_src_address is the validator redelegation source operator address. */ + validatorSrcAddress: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validatorDstAddress: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntry[]; +} + +/** Params defines the parameters for the x/staking module. */ +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbondingTime: + | Duration + | undefined; + /** max_validators is the maximum number of validators. */ + maxValidators: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + maxEntries: number; + /** historical_entries is the number of historical entries to persist. */ + historicalEntries: number; + /** bond_denom defines the bondable coin denomination. */ + bondDenom: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + minCommissionRate: string; +} + +/** + * 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 | undefined; + balance: Coin | undefined; +} + +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponse { + redelegationEntry: RedelegationEntry | undefined; + 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 | undefined; + entries: RedelegationEntryResponse[]; +} + +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface Pool { + notBondedTokens: string; + bondedTokens: string; +} + +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdates { + updates: ValidatorUpdate[]; +} + +function createBaseHistoricalInfo(): HistoricalInfo { + return { header: undefined, valset: [] }; +} + +export const HistoricalInfo: MessageFns = { + encode(message: HistoricalInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + for (const v of message.valset) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoricalInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.valset.push(Validator.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HistoricalInfo { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + valset: globalThis.Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [], + }; + }, + + toJSON(message: HistoricalInfo): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.valset?.length) { + obj.valset = message.valset.map((e) => Validator.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HistoricalInfo { + return HistoricalInfo.fromPartial(base ?? ({} as any)); + }, + 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: "", maxRate: "", maxChangeRate: "" }; +} + +export const CommissionRates: MessageFns = { + encode(message: CommissionRates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.maxRate !== "") { + writer.uint32(18).string(message.maxRate); + } + if (message.maxChangeRate !== "") { + writer.uint32(26).string(message.maxChangeRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rate = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxRate = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.maxChangeRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommissionRates { + return { + rate: isSet(object.rate) ? globalThis.String(object.rate) : "", + maxRate: isSet(object.maxRate) ? globalThis.String(object.maxRate) : "", + maxChangeRate: isSet(object.maxChangeRate) ? globalThis.String(object.maxChangeRate) : "", + }; + }, + + toJSON(message: CommissionRates): unknown { + const obj: any = {}; + if (message.rate !== "") { + obj.rate = message.rate; + } + if (message.maxRate !== "") { + obj.maxRate = message.maxRate; + } + if (message.maxChangeRate !== "") { + obj.maxChangeRate = message.maxChangeRate; + } + return obj; + }, + + create, I>>(base?: I): CommissionRates { + return CommissionRates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.maxRate = object.maxRate ?? ""; + message.maxChangeRate = object.maxChangeRate ?? ""; + return message; + }, +}; + +function createBaseCommission(): Commission { + return { commissionRates: undefined, updateTime: undefined }; +} + +export const Commission: MessageFns = { + encode(message: Commission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commissionRates !== undefined) { + CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).join(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commissionRates = CommissionRates.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commission { + return { + commissionRates: isSet(object.commissionRates) ? CommissionRates.fromJSON(object.commissionRates) : undefined, + updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, + }; + }, + + toJSON(message: Commission): unknown { + const obj: any = {}; + if (message.commissionRates !== undefined) { + obj.commissionRates = CommissionRates.toJSON(message.commissionRates); + } + if (message.updateTime !== undefined) { + obj.updateTime = message.updateTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Commission { + return Commission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commission { + const message = createBaseCommission(); + message.commissionRates = (object.commissionRates !== undefined && object.commissionRates !== null) + ? CommissionRates.fromPartial(object.commissionRates) + : undefined; + message.updateTime = object.updateTime ?? undefined; + return message; + }, +}; + +function createBaseDescription(): Description { + return { moniker: "", identity: "", website: "", securityContact: "", details: "" }; +} + +export const Description: MessageFns = { + encode(message: Description, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.securityContact !== "") { + writer.uint32(34).string(message.securityContact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Description { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moniker = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.website = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.securityContact = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.details = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Description { + return { + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + securityContact: isSet(object.securityContact) ? globalThis.String(object.securityContact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", + }; + }, + + toJSON(message: Description): unknown { + const obj: any = {}; + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.securityContact !== "") { + obj.securityContact = message.securityContact; + } + if (message.details !== "") { + obj.details = message.details; + } + return obj; + }, + + create, I>>(base?: I): Description { + return Description.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.securityContact = object.securityContact ?? ""; + message.details = object.details ?? ""; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { + operatorAddress: "", + consensusPubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegatorShares: "", + description: undefined, + unbondingHeight: 0, + unbondingTime: undefined, + commission: undefined, + minSelfDelegation: "", + unbondingOnHoldRefCount: 0, + unbondingIds: [], + }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + if (message.consensusPubkey !== undefined) { + Any.encode(message.consensusPubkey, writer.uint32(18).fork()).join(); + } + if (message.jailed !== false) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegatorShares !== "") { + writer.uint32(50).string(message.delegatorShares); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).join(); + } + if (message.unbondingHeight !== 0) { + writer.uint32(64).int64(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + Timestamp.encode(toTimestamp(message.unbondingTime), writer.uint32(74).fork()).join(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(90).string(message.minSelfDelegation); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(96).int64(message.unbondingOnHoldRefCount); + } + writer.uint32(106).fork(); + for (const v of message.unbondingIds) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.consensusPubkey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.jailed = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.status = reader.int32() as any; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.tokens = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.delegatorShares = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.unbondingHeight = longToNumber(reader.int64()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.unbondingTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.commission = Commission.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + case 13: + if (tag === 104) { + message.unbondingIds.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 106) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.unbondingIds.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, + jailed: isSet(object.jailed) ? globalThis.Boolean(object.jailed) : false, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + tokens: isSet(object.tokens) ? globalThis.String(object.tokens) : "", + delegatorShares: isSet(object.delegatorShares) ? globalThis.String(object.delegatorShares) : "", + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + unbondingHeight: isSet(object.unbondingHeight) ? globalThis.Number(object.unbondingHeight) : 0, + unbondingTime: isSet(object.unbondingTime) ? fromJsonTimestamp(object.unbondingTime) : undefined, + commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + unbondingIds: globalThis.Array.isArray(object?.unbondingIds) + ? object.unbondingIds.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.consensusPubkey !== undefined) { + obj.consensusPubkey = Any.toJSON(message.consensusPubkey); + } + if (message.jailed !== false) { + obj.jailed = message.jailed; + } + if (message.status !== 0) { + obj.status = bondStatusToJSON(message.status); + } + if (message.tokens !== "") { + obj.tokens = message.tokens; + } + if (message.delegatorShares !== "") { + obj.delegatorShares = message.delegatorShares; + } + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.unbondingHeight !== 0) { + obj.unbondingHeight = Math.round(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + obj.unbondingTime = message.unbondingTime.toISOString(); + } + if (message.commission !== undefined) { + obj.commission = Commission.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + if (message.unbondingIds?.length) { + obj.unbondingIds = message.unbondingIds.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.operatorAddress = object.operatorAddress ?? ""; + message.consensusPubkey = (object.consensusPubkey !== undefined && object.consensusPubkey !== null) + ? Any.fromPartial(object.consensusPubkey) + : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegatorShares = object.delegatorShares ?? ""; + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.unbondingHeight = object.unbondingHeight ?? 0; + message.unbondingTime = object.unbondingTime ?? undefined; + message.commission = (object.commission !== undefined && object.commission !== null) + ? Commission.fromPartial(object.commission) + : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + message.unbondingIds = object.unbondingIds?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValAddresses(): ValAddresses { + return { addresses: [] }; +} + +export const ValAddresses: MessageFns = { + encode(message: ValAddresses, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addresses.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValAddresses { + return { + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValAddresses): unknown { + const obj: any = {}; + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + return obj; + }, + + create, I>>(base?: I): ValAddresses { + return ValAddresses.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDVPair(): DVPair { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const DVPair: MessageFns = { + encode(message: DVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPair { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: DVPair): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): DVPair { + return DVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPair { + const message = createBaseDVPair(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseDVPairs(): DVPairs { + return { pairs: [] }; +} + +export const DVPairs: MessageFns = { + encode(message: DVPairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pairs.push(DVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] }; + }, + + toJSON(message: DVPairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => DVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVPairs { + return DVPairs.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map((e) => DVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDVVTriplet(): DVVTriplet { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" }; +} + +export const DVVTriplet: MessageFns = { + encode(message: DVVTriplet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplet { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + }; + }, + + toJSON(message: DVVTriplet): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + return obj; + }, + + create, I>>(base?: I): DVVTriplet { + return DVVTriplet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + return message; + }, +}; + +function createBaseDVVTriplets(): DVVTriplets { + return { triplets: [] }; +} + +export const DVVTriplets: MessageFns = { + encode(message: DVVTriplets, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.triplets.push(DVVTriplet.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplets { + return { + triplets: globalThis.Array.isArray(object?.triplets) + ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DVVTriplets): unknown { + const obj: any = {}; + if (message.triplets?.length) { + obj.triplets = message.triplets.map((e) => DVVTriplet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVVTriplets { + return DVVTriplets.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map((e) => DVVTriplet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDelegation(): Delegation { + return { delegatorAddress: "", validatorAddress: "", shares: "" }; +} + +export const Delegation: MessageFns = { + encode(message: Delegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Delegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.shares = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Delegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + shares: isSet(object.shares) ? globalThis.String(object.shares) : "", + }; + }, + + toJSON(message: Delegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.shares !== "") { + obj.shares = message.shares; + } + return obj; + }, + + create, I>>(base?: I): Delegation { + return Delegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Delegation { + const message = createBaseDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.shares = object.shares ?? ""; + return message; + }, +}; + +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", entries: [] }; +} + +export const UnbondingDelegation: MessageFns = { + encode(message: UnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: UnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => UnbondingDelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegation { + return UnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + balance: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const UnbondingDelegationEntry: MessageFns = { + encode(message: UnbondingDelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: UnbondingDelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.balance !== "") { + obj.balance = message.balance; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegationEntry { + return UnbondingDelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.balance = object.balance ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegationEntry(): RedelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + sharesDst: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const RedelegationEntry: MessageFns = { + encode(message: RedelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.sharesDst !== "") { + writer.uint32(34).string(message.sharesDst); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sharesDst = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + sharesDst: isSet(object.sharesDst) ? globalThis.String(object.sharesDst) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.sharesDst !== "") { + obj.sharesDst = message.sharesDst; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntry { + return RedelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.sharesDst = object.sharesDst ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegation(): Redelegation { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", entries: [] }; +} + +export const Redelegation: MessageFns = { + encode(message: Redelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Redelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Redelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Redelegation { + return Redelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Redelegation { + const message = createBaseRedelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.entries = object.entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + unbondingTime: undefined, + maxValidators: 0, + maxEntries: 0, + historicalEntries: 0, + bondDenom: "", + minCommissionRate: "", + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbondingTime !== undefined) { + Duration.encode(message.unbondingTime, writer.uint32(10).fork()).join(); + } + if (message.maxValidators !== 0) { + writer.uint32(16).uint32(message.maxValidators); + } + if (message.maxEntries !== 0) { + writer.uint32(24).uint32(message.maxEntries); + } + if (message.historicalEntries !== 0) { + writer.uint32(32).uint32(message.historicalEntries); + } + if (message.bondDenom !== "") { + writer.uint32(42).string(message.bondDenom); + } + if (message.minCommissionRate !== "") { + writer.uint32(50).string(message.minCommissionRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingTime = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxValidators = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxEntries = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.historicalEntries = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bondDenom = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.minCommissionRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbondingTime: isSet(object.unbondingTime) ? Duration.fromJSON(object.unbondingTime) : undefined, + maxValidators: isSet(object.maxValidators) ? globalThis.Number(object.maxValidators) : 0, + maxEntries: isSet(object.maxEntries) ? globalThis.Number(object.maxEntries) : 0, + historicalEntries: isSet(object.historicalEntries) ? globalThis.Number(object.historicalEntries) : 0, + bondDenom: isSet(object.bondDenom) ? globalThis.String(object.bondDenom) : "", + minCommissionRate: isSet(object.minCommissionRate) ? globalThis.String(object.minCommissionRate) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.unbondingTime !== undefined) { + obj.unbondingTime = Duration.toJSON(message.unbondingTime); + } + if (message.maxValidators !== 0) { + obj.maxValidators = Math.round(message.maxValidators); + } + if (message.maxEntries !== 0) { + obj.maxEntries = Math.round(message.maxEntries); + } + if (message.historicalEntries !== 0) { + obj.historicalEntries = Math.round(message.historicalEntries); + } + if (message.bondDenom !== "") { + obj.bondDenom = message.bondDenom; + } + if (message.minCommissionRate !== "") { + obj.minCommissionRate = message.minCommissionRate; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbondingTime = (object.unbondingTime !== undefined && object.unbondingTime !== null) + ? Duration.fromPartial(object.unbondingTime) + : undefined; + message.maxValidators = object.maxValidators ?? 0; + message.maxEntries = object.maxEntries ?? 0; + message.historicalEntries = object.historicalEntries ?? 0; + message.bondDenom = object.bondDenom ?? ""; + message.minCommissionRate = object.minCommissionRate ?? ""; + return message; + }, +}; + +function createBaseDelegationResponse(): DelegationResponse { + return { delegation: undefined, balance: undefined }; +} + +export const DelegationResponse: MessageFns = { + encode(message: DelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegation !== undefined) { + Delegation.encode(message.delegation, writer.uint32(10).fork()).join(); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegation = Delegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.delegation !== undefined) { + obj.delegation = Delegation.toJSON(message.delegation); + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DelegationResponse { + return DelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { redelegationEntry: undefined, balance: "" }; +} + +export const RedelegationEntryResponse: MessageFns = { + encode(message: RedelegationEntryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegationEntry !== undefined) { + RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).join(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationEntry = RedelegationEntry.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntryResponse { + return { + redelegationEntry: isSet(object.redelegationEntry) + ? RedelegationEntry.fromJSON(object.redelegationEntry) + : undefined, + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + }; + }, + + toJSON(message: RedelegationEntryResponse): unknown { + const obj: any = {}; + if (message.redelegationEntry !== undefined) { + obj.redelegationEntry = RedelegationEntry.toJSON(message.redelegationEntry); + } + if (message.balance !== "") { + obj.balance = message.balance; + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntryResponse { + return RedelegationEntryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegationEntry = (object.redelegationEntry !== undefined && object.redelegationEntry !== null) + ? RedelegationEntry.fromPartial(object.redelegationEntry) + : undefined; + message.balance = object.balance ?? ""; + return message; + }, +}; + +function createBaseRedelegationResponse(): RedelegationResponse { + return { redelegation: undefined, entries: [] }; +} + +export const RedelegationResponse: MessageFns = { + encode(message: RedelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegation !== undefined) { + Redelegation.encode(message.redelegation, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + RedelegationEntryResponse.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegation = Redelegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(RedelegationEntryResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationResponse { + return { + redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RedelegationResponse): unknown { + const obj: any = {}; + if (message.redelegation !== undefined) { + obj.redelegation = Redelegation.toJSON(message.redelegation); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntryResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RedelegationResponse { + return RedelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { notBondedTokens: "", bondedTokens: "" }; +} + +export const Pool: MessageFns = { + encode(message: Pool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.notBondedTokens !== "") { + writer.uint32(10).string(message.notBondedTokens); + } + if (message.bondedTokens !== "") { + writer.uint32(18).string(message.bondedTokens); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.notBondedTokens = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bondedTokens = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pool { + return { + notBondedTokens: isSet(object.notBondedTokens) ? globalThis.String(object.notBondedTokens) : "", + bondedTokens: isSet(object.bondedTokens) ? globalThis.String(object.bondedTokens) : "", + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + if (message.notBondedTokens !== "") { + obj.notBondedTokens = message.notBondedTokens; + } + if (message.bondedTokens !== "") { + obj.bondedTokens = message.bondedTokens; + } + return obj; + }, + + create, I>>(base?: I): Pool { + return Pool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.notBondedTokens = object.notBondedTokens ?? ""; + message.bondedTokens = object.bondedTokens ?? ""; + return message; + }, +}; + +function createBaseValidatorUpdates(): ValidatorUpdates { + return { updates: [] }; +} + +export const ValidatorUpdates: MessageFns = { + encode(message: ValidatorUpdates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdates { + return { + updates: globalThis.Array.isArray(object?.updates) + ? object.updates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorUpdates): unknown { + const obj: any = {}; + if (message.updates?.length) { + obj.updates = message.updates.map((e) => ValidatorUpdate.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdates { + return ValidatorUpdates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 00000000..06be4ca4 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,1403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { CommissionRates, Description, Params } from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidator { + description: Description | undefined; + commission: CommissionRates | undefined; + minSelfDelegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + * + * @deprecated + */ + delegatorAddress: string; + validatorAddress: string; + pubkey: Any | undefined; + value: Coin | undefined; +} + +/** 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 | undefined; + validatorAddress: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commissionRate: string; + minSelfDelegation: string; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; + amount: Coin | undefined; +} + +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponse { + completionTime: Date | undefined; +} + +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponse { + completionTime: + | Date + | undefined; + /** + * amount returns the amount of undelegated coins + * + * Since: cosmos-sdk 0.50 + */ + amount: Coin | undefined; +} + +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegation { + delegatorAddress: string; + validatorAddress: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: + | Coin + | undefined; + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; +} + +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: undefined, + commission: undefined, + minSelfDelegation: "", + delegatorAddress: "", + validatorAddress: "", + pubkey: undefined, + value: undefined, + }; +} + +export const MsgCreateValidator: MessageFns = { + encode(message: MsgCreateValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.commission !== undefined) { + CommissionRates.encode(message.commission, writer.uint32(18).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(26).string(message.minSelfDelegation); + } + if (message.delegatorAddress !== "") { + writer.uint32(34).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(42).string(message.validatorAddress); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(50).fork()).join(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commission = CommissionRates.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.pubkey = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + 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 = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.commission !== undefined) { + obj.commission = CommissionRates.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.pubkey !== undefined) { + obj.pubkey = Any.toJSON(message.pubkey); + } + if (message.value !== undefined) { + obj.value = Coin.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateValidator { + return MsgCreateValidator.fromPartial(base ?? ({} as any)); + }, + 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.minSelfDelegation = object.minSelfDelegation ?? ""; + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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: MessageFns = { + encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateValidatorResponse { + return {}; + }, + + toJSON(_: MsgCreateValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, +}; + +function createBaseMsgEditValidator(): MsgEditValidator { + return { description: undefined, validatorAddress: "", commissionRate: "", minSelfDelegation: "" }; +} + +export const MsgEditValidator: MessageFns = { + encode(message: MsgEditValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.commissionRate !== "") { + writer.uint32(26).string(message.commissionRate); + } + if (message.minSelfDelegation !== "") { + writer.uint32(34).string(message.minSelfDelegation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commissionRate = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + commissionRate: isSet(object.commissionRate) ? globalThis.String(object.commissionRate) : "", + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + }; + }, + + toJSON(message: MsgEditValidator): unknown { + const obj: any = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.commissionRate !== "") { + obj.commissionRate = message.commissionRate; + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + return obj; + }, + + create, I>>(base?: I): MsgEditValidator { + return MsgEditValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.validatorAddress = object.validatorAddress ?? ""; + message.commissionRate = object.commissionRate ?? ""; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, +}; + +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} + +export const MsgEditValidatorResponse: MessageFns = { + encode(_: MsgEditValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgEditValidatorResponse { + return {}; + }, + + toJSON(_: MsgEditValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgEditValidatorResponse { + return MsgEditValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, +}; + +function createBaseMsgDelegate(): MsgDelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgDelegate: MessageFns = { + encode(message: MsgDelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgDelegate { + return MsgDelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +export const MsgDelegateResponse: MessageFns = { + encode(_: MsgDelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDelegateResponse { + return MsgDelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", amount: undefined }; +} + +export const MsgBeginRedelegate: MessageFns = { + encode(message: MsgBeginRedelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgBeginRedelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegate { + return MsgBeginRedelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { completionTime: undefined }; +} + +export const MsgBeginRedelegateResponse: MessageFns = { + encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegateResponse { + return { completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined }; + }, + + toJSON(message: MsgBeginRedelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + return message; + }, +}; + +function createBaseMsgUndelegate(): MsgUndelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgUndelegate: MessageFns = { + encode(message: MsgUndelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegate { + return MsgUndelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { completionTime: undefined, amount: undefined }; +} + +export const MsgUndelegateResponse: MessageFns = { + encode(message: MsgUndelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegateResponse { + return { + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegateResponse { + return MsgUndelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegation(): MsgCancelUnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", amount: undefined, creationHeight: 0 }; +} + +export const MsgCancelUnbondingDelegation: MessageFns = { + encode(message: MsgCancelUnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + if (message.creationHeight !== 0) { + writer.uint32(32).int64(message.creationHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelUnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + }; + }, + + toJSON(message: MsgCancelUnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelUnbondingDelegation { + return MsgCancelUnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelUnbondingDelegation { + const message = createBaseMsgCancelUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + message.creationHeight = object.creationHeight ?? 0; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegationResponse(): MsgCancelUnbondingDelegationResponse { + return {}; +} + +export const MsgCancelUnbondingDelegationResponse: MessageFns = { + encode(_: MsgCancelUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelUnbondingDelegationResponse { + return {}; + }, + + toJSON(_: MsgCancelUnbondingDelegationResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCancelUnbondingDelegationResponse { + return MsgCancelUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCancelUnbondingDelegationResponse { + const message = createBaseMsgCancelUnbondingDelegationResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + * and delegate back to previous validator. + * + * Since: cosmos-sdk 0.46 + */ + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise; + /** + * UpdateParams defines an operation for updating the x/staking module + * parameters. + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.staking.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 || MsgServiceName; + 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); + this.CancelUnbondingDelegation = this.CancelUnbondingDelegation.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise { + const data = MsgCancelUnbondingDelegation.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelUnbondingDelegation", data); + return promise.then((data) => MsgCancelUnbondingDelegationResponse.decode(new BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts new file mode 100644 index 00000000..15cd0546 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts @@ -0,0 +1,202 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/internal/kv/v1beta1/kv.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.internal.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: MessageFns = { + encode(message: Pairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + Pair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pairs.push(Pair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => Pair.fromJSON(e)) : [] }; + }, + + toJSON(message: Pairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => Pair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Pairs { + return Pairs.fromPartial(base ?? ({} as any)); + }, + 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(0), value: new Uint8Array(0) }; +} + +export const Pair: MessageFns = { + encode(message: Pair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pair { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Pair): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Pair { + return Pair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pair { + const message = createBasePair(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts new file mode 100644 index 00000000..6763ba8c --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts @@ -0,0 +1,728 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/snapshots/v1/snapshot.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.snapshots.v1"; + +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface Snapshot { + height: number; + format: number; + chunks: number; + hash: Uint8Array; + metadata: Metadata | undefined; +} + +/** Metadata contains SDK-specific snapshot metadata. */ +export interface Metadata { + /** SHA-256 chunk hashes */ + chunkHashes: Uint8Array[]; +} + +/** + * SnapshotItem is an item contained in a rootmulti.Store snapshot. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotItem { + store?: SnapshotStoreItem | undefined; + iavl?: SnapshotIAVLItem | undefined; + extension?: SnapshotExtensionMeta | undefined; + extensionPayload?: SnapshotExtensionPayload | undefined; +} + +/** + * SnapshotStoreItem contains metadata about a snapshotted store. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotStoreItem { + name: string; +} + +/** + * SnapshotIAVLItem is an exported IAVL node. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotIAVLItem { + key: Uint8Array; + value: Uint8Array; + /** version is block height */ + version: number; + /** height is depth of the tree. */ + height: number; +} + +/** + * SnapshotExtensionMeta contains metadata about an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionMeta { + name: string; + format: number; +} + +/** + * SnapshotExtensionPayload contains payloads of an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionPayload { + payload: Uint8Array; +} + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: undefined }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { chunkHashes: [] }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.chunkHashes) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunkHashes.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + chunkHashes: globalThis.Array.isArray(object?.chunkHashes) + ? object.chunkHashes.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.chunkHashes?.length) { + obj.chunkHashes = message.chunkHashes.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.chunkHashes = object.chunkHashes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSnapshotItem(): SnapshotItem { + return { store: undefined, iavl: undefined, extension: undefined, extensionPayload: undefined }; +} + +export const SnapshotItem: MessageFns = { + encode(message: SnapshotItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.store !== undefined) { + SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).join(); + } + if (message.iavl !== undefined) { + SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).join(); + } + if (message.extension !== undefined) { + SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).join(); + } + if (message.extensionPayload !== undefined) { + SnapshotExtensionPayload.encode(message.extensionPayload, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.store = SnapshotStoreItem.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionPayload = SnapshotExtensionPayload.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + extensionPayload: isSet(object.extensionPayload) + ? SnapshotExtensionPayload.fromJSON(object.extensionPayload) + : undefined, + }; + }, + + toJSON(message: SnapshotItem): unknown { + const obj: any = {}; + if (message.store !== undefined) { + obj.store = SnapshotStoreItem.toJSON(message.store); + } + if (message.iavl !== undefined) { + obj.iavl = SnapshotIAVLItem.toJSON(message.iavl); + } + if (message.extension !== undefined) { + obj.extension = SnapshotExtensionMeta.toJSON(message.extension); + } + if (message.extensionPayload !== undefined) { + obj.extensionPayload = SnapshotExtensionPayload.toJSON(message.extensionPayload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotItem { + return SnapshotItem.fromPartial(base ?? ({} as any)); + }, + 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.extensionPayload = (object.extensionPayload !== undefined && object.extensionPayload !== null) + ? SnapshotExtensionPayload.fromPartial(object.extensionPayload) + : undefined; + return message; + }, +}; + +function createBaseSnapshotStoreItem(): SnapshotStoreItem { + return { name: "" }; +} + +export const SnapshotStoreItem: MessageFns = { + encode(message: SnapshotStoreItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotStoreItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotStoreItem { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: SnapshotStoreItem): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): SnapshotStoreItem { + return SnapshotStoreItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { + return { key: new Uint8Array(0), value: new Uint8Array(0), version: 0, height: 0 }; +} + +export const SnapshotIAVLItem: MessageFns = { + encode(message: SnapshotIAVLItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.version !== 0) { + writer.uint32(24).int64(message.version); + } + if (message.height !== 0) { + writer.uint32(32).int32(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotIAVLItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.height = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotIAVLItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: SnapshotIAVLItem): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): SnapshotIAVLItem { + return SnapshotIAVLItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.version = object.version ?? 0; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { + return { name: "", format: 0 }; +} + +export const SnapshotExtensionMeta: MessageFns = { + encode(message: SnapshotExtensionMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionMeta { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + }; + }, + + toJSON(message: SnapshotExtensionMeta): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionMeta { + return SnapshotExtensionMeta.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SnapshotExtensionPayload: MessageFns = { + encode(message: SnapshotExtensionPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.payload = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionPayload { + return { payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(0) }; + }, + + toJSON(message: SnapshotExtensionPayload): unknown { + const obj: any = {}; + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionPayload { + return SnapshotExtensionPayload.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + message.payload = object.payload ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/store/streaming/abci/grpc.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/streaming/abci/grpc.ts new file mode 100644 index 00000000..4e0a2d5d --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/streaming/abci/grpc.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/streaming/abci/grpc.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../../tendermint/abci/types"; +import { StoreKVPair } from "../../v1beta1/listening"; + +export const protobufPackage = "cosmos.store.streaming.abci"; + +/** ListenEndBlockRequest is the request type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockRequest { + req: RequestFinalizeBlock | undefined; + res: ResponseFinalizeBlock | undefined; +} + +/** ListenEndBlockResponse is the response type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockResponse { +} + +/** ListenCommitRequest is the request type for the ListenCommit RPC method */ +export interface ListenCommitRequest { + /** explicitly pass in block height as ResponseCommit does not contain this info */ + blockHeight: number; + res: ResponseCommit | undefined; + changeSet: StoreKVPair[]; +} + +/** ListenCommitResponse is the response type for the ListenCommit RPC method */ +export interface ListenCommitResponse { +} + +function createBaseListenFinalizeBlockRequest(): ListenFinalizeBlockRequest { + return { req: undefined, res: undefined }; +} + +export const ListenFinalizeBlockRequest: MessageFns = { + encode(message: ListenFinalizeBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.req !== undefined) { + RequestFinalizeBlock.encode(message.req, writer.uint32(10).fork()).join(); + } + if (message.res !== undefined) { + ResponseFinalizeBlock.encode(message.res, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.req = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenFinalizeBlockRequest { + return { + req: isSet(object.req) ? RequestFinalizeBlock.fromJSON(object.req) : undefined, + res: isSet(object.res) ? ResponseFinalizeBlock.fromJSON(object.res) : undefined, + }; + }, + + toJSON(message: ListenFinalizeBlockRequest): unknown { + const obj: any = {}; + if (message.req !== undefined) { + obj.req = RequestFinalizeBlock.toJSON(message.req); + } + if (message.res !== undefined) { + obj.res = ResponseFinalizeBlock.toJSON(message.res); + } + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockRequest { + return ListenFinalizeBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenFinalizeBlockRequest { + const message = createBaseListenFinalizeBlockRequest(); + message.req = (object.req !== undefined && object.req !== null) + ? RequestFinalizeBlock.fromPartial(object.req) + : undefined; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseFinalizeBlock.fromPartial(object.res) + : undefined; + return message; + }, +}; + +function createBaseListenFinalizeBlockResponse(): ListenFinalizeBlockResponse { + return {}; +} + +export const ListenFinalizeBlockResponse: MessageFns = { + encode(_: ListenFinalizeBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenFinalizeBlockResponse { + return {}; + }, + + toJSON(_: ListenFinalizeBlockResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockResponse { + return ListenFinalizeBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenFinalizeBlockResponse { + const message = createBaseListenFinalizeBlockResponse(); + return message; + }, +}; + +function createBaseListenCommitRequest(): ListenCommitRequest { + return { blockHeight: 0, res: undefined, changeSet: [] }; +} + +export const ListenCommitRequest: MessageFns = { + encode(message: ListenCommitRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + if (message.res !== undefined) { + ResponseCommit.encode(message.res, writer.uint32(18).fork()).join(); + } + for (const v of message.changeSet) { + StoreKVPair.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changeSet.push(StoreKVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenCommitRequest { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + res: isSet(object.res) ? ResponseCommit.fromJSON(object.res) : undefined, + changeSet: globalThis.Array.isArray(object?.changeSet) + ? object.changeSet.map((e: any) => StoreKVPair.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListenCommitRequest): unknown { + const obj: any = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.res !== undefined) { + obj.res = ResponseCommit.toJSON(message.res); + } + if (message.changeSet?.length) { + obj.changeSet = message.changeSet.map((e) => StoreKVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListenCommitRequest { + return ListenCommitRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenCommitRequest { + const message = createBaseListenCommitRequest(); + message.blockHeight = object.blockHeight ?? 0; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseCommit.fromPartial(object.res) + : undefined; + message.changeSet = object.changeSet?.map((e) => StoreKVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListenCommitResponse(): ListenCommitResponse { + return {}; +} + +export const ListenCommitResponse: MessageFns = { + encode(_: ListenCommitResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenCommitResponse { + return {}; + }, + + toJSON(_: ListenCommitResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenCommitResponse { + return ListenCommitResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenCommitResponse { + const message = createBaseListenCommitResponse(); + return message; + }, +}; + +/** ABCIListenerService is the service for the BaseApp ABCIListener interface */ +export interface ABCIListenerService { + /** ListenFinalizeBlock is the corresponding endpoint for ABCIListener.ListenEndBlock */ + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise; + /** ListenCommit is the corresponding endpoint for ABCIListener.ListenCommit */ + ListenCommit(request: ListenCommitRequest): Promise; +} + +export const ABCIListenerServiceServiceName = "cosmos.store.streaming.abci.ABCIListenerService"; +export class ABCIListenerServiceClientImpl implements ABCIListenerService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIListenerServiceServiceName; + this.rpc = rpc; + this.ListenFinalizeBlock = this.ListenFinalizeBlock.bind(this); + this.ListenCommit = this.ListenCommit.bind(this); + } + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise { + const data = ListenFinalizeBlockRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenFinalizeBlock", data); + return promise.then((data) => ListenFinalizeBlockResponse.decode(new BinaryReader(data))); + } + + ListenCommit(request: ListenCommitRequest): Promise { + const data = ListenCommitRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenCommit", data); + return promise.then((data) => ListenCommitResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/store/v1beta1/commit_info.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/v1beta1/commit_info.ts new file mode 100644 index 00000000..17c74706 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/v1beta1/commit_info.ts @@ -0,0 +1,363 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/commit_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.store.v1beta1"; + +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfo { + version: number; + storeInfos: StoreInfo[]; + timestamp: Date | undefined; +} + +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfo { + name: string; + commitId: CommitID | undefined; +} + +/** + * CommitID defines the commitment information when a specific store is + * committed. + */ +export interface CommitID { + version: number; + hash: Uint8Array; +} + +function createBaseCommitInfo(): CommitInfo { + return { version: 0, storeInfos: [], timestamp: undefined }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== 0) { + writer.uint32(8).int64(message.version); + } + for (const v of message.storeInfos) { + StoreInfo.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.storeInfos.push(StoreInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + storeInfos: globalThis.Array.isArray(object?.storeInfos) + ? object.storeInfos.map((e: any) => StoreInfo.fromJSON(e)) + : [], + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.storeInfos?.length) { + obj.storeInfos = message.storeInfos.map((e) => StoreInfo.toJSON(e)); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.version = object.version ?? 0; + message.storeInfos = object.storeInfos?.map((e) => StoreInfo.fromPartial(e)) || []; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseStoreInfo(): StoreInfo { + return { name: "", commitId: undefined }; +} + +export const StoreInfo: MessageFns = { + encode(message: StoreInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.commitId !== undefined) { + CommitID.encode(message.commitId, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commitId = CommitID.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + commitId: isSet(object.commitId) ? CommitID.fromJSON(object.commitId) : undefined, + }; + }, + + toJSON(message: StoreInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.commitId !== undefined) { + obj.commitId = CommitID.toJSON(message.commitId); + } + return obj; + }, + + create, I>>(base?: I): StoreInfo { + return StoreInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreInfo { + const message = createBaseStoreInfo(); + message.name = object.name ?? ""; + message.commitId = (object.commitId !== undefined && object.commitId !== null) + ? CommitID.fromPartial(object.commitId) + : undefined; + return message; + }, +}; + +function createBaseCommitID(): CommitID { + return { version: 0, hash: new Uint8Array(0) }; +} + +export const CommitID: MessageFns = { + encode(message: CommitID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): CommitID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitID { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitID): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): CommitID { + return CommitID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitID { + const message = createBaseCommitID(); + message.version = object.version ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/store/v1beta1/listening.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/v1beta1/listening.ts new file mode 100644 index 00000000..73eb4288 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/store/v1beta1/listening.ts @@ -0,0 +1,294 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/listening.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../tendermint/abci/types"; + +export const protobufPackage = "cosmos.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 */ + storeKey: string; + /** true indicates a delete operation, false indicates a set operation */ + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} + +/** + * BlockMetadata contains all the abci event data of a block + * the file streamer dump them into files together with the state changes. + */ +export interface BlockMetadata { + responseCommit: ResponseCommit | undefined; + requestFinalizeBlock: + | RequestFinalizeBlock + | undefined; + /** TODO: should we renumber this? */ + responseFinalizeBlock: ResponseFinalizeBlock | undefined; +} + +function createBaseStoreKVPair(): StoreKVPair { + return { storeKey: "", delete: false, key: new Uint8Array(0), value: new Uint8Array(0) }; +} + +export const StoreKVPair: MessageFns = { + encode(message: StoreKVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.storeKey !== "") { + writer.uint32(10).string(message.storeKey); + } + if (message.delete !== false) { + 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: BinaryReader | Uint8Array, length?: number): StoreKVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.storeKey = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.delete = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.key = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKVPair { + return { + storeKey: isSet(object.storeKey) ? globalThis.String(object.storeKey) : "", + delete: isSet(object.delete) ? globalThis.Boolean(object.delete) : false, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: StoreKVPair): unknown { + const obj: any = {}; + if (message.storeKey !== "") { + obj.storeKey = message.storeKey; + } + if (message.delete !== false) { + obj.delete = message.delete; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): StoreKVPair { + return StoreKVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKVPair { + const message = createBaseStoreKVPair(); + message.storeKey = object.storeKey ?? ""; + message.delete = object.delete ?? false; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseBlockMetadata(): BlockMetadata { + return { responseCommit: undefined, requestFinalizeBlock: undefined, responseFinalizeBlock: undefined }; +} + +export const BlockMetadata: MessageFns = { + encode(message: BlockMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.responseCommit !== undefined) { + ResponseCommit.encode(message.responseCommit, writer.uint32(50).fork()).join(); + } + if (message.requestFinalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.requestFinalizeBlock, writer.uint32(58).fork()).join(); + } + if (message.responseFinalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.responseFinalizeBlock, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + if (tag !== 50) { + break; + } + + message.responseCommit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestFinalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.responseFinalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMetadata { + return { + responseCommit: isSet(object.responseCommit) ? ResponseCommit.fromJSON(object.responseCommit) : undefined, + requestFinalizeBlock: isSet(object.requestFinalizeBlock) + ? RequestFinalizeBlock.fromJSON(object.requestFinalizeBlock) + : undefined, + responseFinalizeBlock: isSet(object.responseFinalizeBlock) + ? ResponseFinalizeBlock.fromJSON(object.responseFinalizeBlock) + : undefined, + }; + }, + + toJSON(message: BlockMetadata): unknown { + const obj: any = {}; + if (message.responseCommit !== undefined) { + obj.responseCommit = ResponseCommit.toJSON(message.responseCommit); + } + if (message.requestFinalizeBlock !== undefined) { + obj.requestFinalizeBlock = RequestFinalizeBlock.toJSON(message.requestFinalizeBlock); + } + if (message.responseFinalizeBlock !== undefined) { + obj.responseFinalizeBlock = ResponseFinalizeBlock.toJSON(message.responseFinalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): BlockMetadata { + return BlockMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMetadata { + const message = createBaseBlockMetadata(); + message.responseCommit = (object.responseCommit !== undefined && object.responseCommit !== null) + ? ResponseCommit.fromPartial(object.responseCommit) + : undefined; + message.requestFinalizeBlock = (object.requestFinalizeBlock !== undefined && object.requestFinalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.requestFinalizeBlock) + : undefined; + message.responseFinalizeBlock = + (object.responseFinalizeBlock !== undefined && object.responseFinalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.responseFinalizeBlock) + : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/config/v1/config.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/config/v1/config.ts new file mode 100644 index 00000000..aa780391 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/config/v1/config.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/config/v1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.tx.config.v1"; + +/** Config is the config object of the x/auth/tx package. */ +export interface Config { + /** + * skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipAnteHandler: boolean; + /** + * skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipPostHandler: boolean; +} + +function createBaseConfig(): Config { + return { skipAnteHandler: false, skipPostHandler: false }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.skipAnteHandler !== false) { + writer.uint32(8).bool(message.skipAnteHandler); + } + if (message.skipPostHandler !== false) { + writer.uint32(16).bool(message.skipPostHandler); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.skipAnteHandler = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.skipPostHandler = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + skipAnteHandler: isSet(object.skipAnteHandler) ? globalThis.Boolean(object.skipAnteHandler) : false, + skipPostHandler: isSet(object.skipPostHandler) ? globalThis.Boolean(object.skipPostHandler) : false, + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.skipAnteHandler !== false) { + obj.skipAnteHandler = message.skipAnteHandler; + } + if (message.skipPostHandler !== false) { + obj.skipPostHandler = message.skipPostHandler; + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.skipAnteHandler = object.skipAnteHandler ?? false; + message.skipPostHandler = object.skipPostHandler ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 00000000..35f6e628 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,620 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/signing/v1beta1/signing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + * + * Since: cosmos-sdk 0.50 + */ + SIGN_MODE_TEXTUAL = 2, + /** + * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses + * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not + * require signers signing over other signers' `signer_info`. + * + * Since: cosmos-sdk 0.46 + */ + SIGN_MODE_DIRECT_AUX = 3, + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future. + */ + SIGN_MODE_LEGACY_AMINO_JSON = 127, + /** + * SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + * SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + * + * Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + * but is not implemented on the SDK by default. To enable EIP-191, you need + * to pass a custom `TxConfig` that has an implementation of + * `SignModeHandler` for EIP-191. The SDK may decide to fully support + * EIP-191 in the future. + * + * Since: cosmos-sdk 0.45.2 + */ + SIGN_MODE_EIP_191 = 191, + UNRECOGNIZED = -1, +} + +export function signModeFromJSON(object: any): SignMode { + switch (object) { + case 0: + case "SIGN_MODE_UNSPECIFIED": + return SignMode.SIGN_MODE_UNSPECIFIED; + case 1: + case "SIGN_MODE_DIRECT": + return SignMode.SIGN_MODE_DIRECT; + case 2: + case "SIGN_MODE_TEXTUAL": + return SignMode.SIGN_MODE_TEXTUAL; + case 3: + case "SIGN_MODE_DIRECT_AUX": + return SignMode.SIGN_MODE_DIRECT_AUX; + case 127: + case "SIGN_MODE_LEGACY_AMINO_JSON": + return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + case 191: + case "SIGN_MODE_EIP_191": + return SignMode.SIGN_MODE_EIP_191; + case -1: + case "UNRECOGNIZED": + default: + return SignMode.UNRECOGNIZED; + } +} + +export function signModeToJSON(object: SignMode): string { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return "SIGN_MODE_UNSPECIFIED"; + case SignMode.SIGN_MODE_DIRECT: + return "SIGN_MODE_DIRECT"; + case SignMode.SIGN_MODE_TEXTUAL: + return "SIGN_MODE_TEXTUAL"; + case SignMode.SIGN_MODE_DIRECT_AUX: + return "SIGN_MODE_DIRECT_AUX"; + case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: + return "SIGN_MODE_LEGACY_AMINO_JSON"; + case SignMode.SIGN_MODE_EIP_191: + return "SIGN_MODE_EIP_191"; + case SignMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} + +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + publicKey: Any | undefined; + data: + | SignatureDescriptor_Data + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_Data[]; +} + +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { signatures: [] }; +} + +export const SignatureDescriptors: MessageFns = { + encode(message: SignatureDescriptors, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptors(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptors { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptors): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptors { + return SignatureDescriptors.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map((e) => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { publicKey: undefined, data: undefined, sequence: 0 }; +} + +export const SignatureDescriptor: MessageFns = { + encode(message: SignatureDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + data: isSet(object.data) ? SignatureDescriptor_Data.fromJSON(object.data) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.data !== undefined) { + obj.data = SignatureDescriptor_Data.toJSON(message.data); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor { + return SignatureDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.data = (object.data !== undefined && object.data !== null) + ? SignatureDescriptor_Data.fromPartial(object.data) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { + return { single: undefined, multi: undefined }; +} + +export const SignatureDescriptor_Data: MessageFns = { + encode(message: SignatureDescriptor_Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = SignatureDescriptor_Data_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = SignatureDescriptor_Data_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data { + return SignatureDescriptor_Data.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SignatureDescriptor_Data_Single: MessageFns = { + encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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(0), + }; + }, + + toJSON(message: SignatureDescriptor_Data_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { + return { bitarray: undefined, signatures: [] }; +} + +export const SignatureDescriptor_Data_Multi: MessageFns = { + encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.signatures) { + SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor_Data_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptor_Data_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor_Data.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/v1beta1/service.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/v1beta1/service.ts new file mode 100644 index 00000000..411f1dc2 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,1855 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 - DEPRECATED: use BROADCAST_MODE_SYNC instead, + * BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + * + * @deprecated + */ + 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. + * Deprecated post v0.47.x: use query instead, which should contain a valid + * events query. + * + * @deprecated + */ + events: string[]; + /** + * pagination defines a pagination for the request. + * Deprecated post v0.46.x: use page and limit instead. + * + * @deprecated + */ + pagination: PageRequest | undefined; + orderBy: OrderBy; + /** + * page is the page number to query, starts at 1. If not provided, will + * default to first page. + */ + page: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * query defines the transaction event query that is proxied to Tendermint's + * TxSearch RPC method. The query must be valid. + * + * Since cosmos-sdk 0.50 + */ + query: string; +} + +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponse { + /** txs is the list of queried transactions. */ + txs: Tx[]; + /** tx_responses is the list of queried TxResponses. */ + txResponses: TxResponse[]; + /** + * pagination defines a pagination for the response. + * Deprecated post v0.46.x: use total instead. + * + * @deprecated + */ + pagination: + | PageResponse + | undefined; + /** total is total number of results available */ + total: number; +} + +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; + mode: BroadcastMode; +} + +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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 + | undefined; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + txBytes: 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. */ + gasInfo: + | GasInfo + | undefined; + /** result is the result of the simulation. */ + result: Result | undefined; +} + +/** + * 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 + | undefined; + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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: number; + /** pagination defines a pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponse { + /** txs are the transactions in the block. */ + txs: Tx[]; + blockId: BlockID | undefined; + block: + | Block + | undefined; + /** pagination defines a pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; +} + +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponse { + /** tx is the decoded transaction. */ + tx: Tx | undefined; +} + +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequest { + /** tx is the transaction to encode. */ + tx: Tx | undefined; +} + +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponse { + /** tx_bytes is the encoded transaction bytes. */ + txBytes: Uint8Array; +} + +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequest { + aminoJson: string; +} + +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponse { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequest { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponse { + aminoJson: string; +} + +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { events: [], pagination: undefined, orderBy: 0, page: 0, limit: 0, query: "" }; +} + +export const GetTxsEventRequest: MessageFns = { + encode(message: GetTxsEventRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.orderBy !== 0) { + writer.uint32(24).int32(message.orderBy); + } + if (message.page !== 0) { + writer.uint32(32).uint64(message.page); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + if (message.query !== "") { + writer.uint32(50).string(message.query); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.orderBy = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.page = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventRequest { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0, + page: isSet(object.page) ? globalThis.Number(object.page) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + query: isSet(object.query) ? globalThis.String(object.query) : "", + }; + }, + + toJSON(message: GetTxsEventRequest): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.orderBy !== 0) { + obj.orderBy = orderByToJSON(message.orderBy); + } + if (message.page !== 0) { + obj.page = Math.round(message.page); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.query !== "") { + obj.query = message.query; + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventRequest { + return GetTxsEventRequest.fromPartial(base ?? ({} as any)); + }, + 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.orderBy = object.orderBy ?? 0; + message.page = object.page ?? 0; + message.limit = object.limit ?? 0; + message.query = object.query ?? ""; + return message; + }, +}; + +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { txs: [], txResponses: [], pagination: undefined, total: 0 }; +} + +export const GetTxsEventResponse: MessageFns = { + encode(message: GetTxsEventResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResponses) { + TxResponse.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + if (message.total !== 0) { + writer.uint32(32).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponses.push(TxResponse.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + txResponses: globalThis.Array.isArray(object?.txResponses) + ? object.txResponses.map((e: any) => TxResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: GetTxsEventResponse): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.txResponses?.length) { + obj.txResponses = message.txResponses.map((e) => TxResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventResponse { + return GetTxsEventResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.txResponses = object.txResponses?.map((e) => TxResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.total = object.total ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { txBytes: new Uint8Array(0), mode: 0 }; +} + +export const BroadcastTxRequest: MessageFns = { + encode(message: BroadcastTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxRequest { + return { + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0, + }; + }, + + toJSON(message: BroadcastTxRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + if (message.mode !== 0) { + obj.mode = broadcastModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxRequest { + return BroadcastTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + message.mode = object.mode ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { txResponse: undefined }; +} + +export const BroadcastTxResponse: MessageFns = { + encode(message: BroadcastTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxResponse { + return { txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined }; + }, + + toJSON(message: BroadcastTxResponse): unknown { + const obj: any = {}; + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxResponse { + return BroadcastTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseSimulateRequest(): SimulateRequest { + return { tx: undefined, txBytes: new Uint8Array(0) }; +} + +export const SimulateRequest: MessageFns = { + encode(message: SimulateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txBytes.length !== 0) { + writer.uint32(18).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateRequest { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + }; + }, + + toJSON(message: SimulateRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): SimulateRequest { + return SimulateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSimulateResponse(): SimulateResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulateResponse: MessageFns = { + encode(message: SimulateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulateResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulateResponse { + return SimulateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateResponse { + const message = createBaseSimulateResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseGetTxRequest(): GetTxRequest { + return { hash: "" }; +} + +export const GetTxRequest: MessageFns = { + encode(message: GetTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxRequest { + return { hash: isSet(object.hash) ? globalThis.String(object.hash) : "" }; + }, + + toJSON(message: GetTxRequest): unknown { + const obj: any = {}; + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): GetTxRequest { + return GetTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseGetTxResponse(): GetTxResponse { + return { tx: undefined, txResponse: undefined }; +} + +export const GetTxResponse: MessageFns = { + encode(message: GetTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxResponse { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined, + }; + }, + + toJSON(message: GetTxResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): GetTxResponse { + return GetTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { height: 0, pagination: undefined }; +} + +export const GetBlockWithTxsRequest: MessageFns = { + encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.fromPartial(base ?? ({} as any)); + }, + 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: [], blockId: undefined, block: undefined, pagination: undefined }; +} + +export const GetBlockWithTxsResponse: MessageFns = { + encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(18).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(26).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : 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?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseTxDecodeRequest(): TxDecodeRequest { + return { txBytes: new Uint8Array(0) }; +} + +export const TxDecodeRequest: MessageFns = { + encode(message: TxDecodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeRequest { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeRequest { + return TxDecodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeResponse(): TxDecodeResponse { + return { tx: undefined }; +} + +export const TxDecodeResponse: MessageFns = { + encode(message: TxDecodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeResponse { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxDecodeResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeResponse { + return TxDecodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeRequest(): TxEncodeRequest { + return { tx: undefined }; +} + +export const TxEncodeRequest: MessageFns = { + encode(message: TxEncodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeRequest { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxEncodeRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeRequest { + return TxEncodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeResponse(): TxEncodeResponse { + return { txBytes: new Uint8Array(0) }; +} + +export const TxEncodeResponse: MessageFns = { + encode(message: TxEncodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeResponse { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeResponse): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeResponse { + return TxEncodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxEncodeAminoRequest(): TxEncodeAminoRequest { + return { aminoJson: "" }; +} + +export const TxEncodeAminoRequest: MessageFns = { + encode(message: TxEncodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoRequest { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxEncodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoRequest { + return TxEncodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, +}; + +function createBaseTxEncodeAminoResponse(): TxEncodeAminoResponse { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxEncodeAminoResponse: MessageFns = { + encode(message: TxEncodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoResponse { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoResponse { + return TxEncodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoRequest(): TxDecodeAminoRequest { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxDecodeAminoRequest: MessageFns = { + encode(message: TxDecodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoRequest { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoRequest { + return TxDecodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoResponse(): TxDecodeAminoResponse { + return { aminoJson: "" }; +} + +export const TxDecodeAminoResponse: MessageFns = { + encode(message: TxDecodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoResponse { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxDecodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoResponse { + return TxDecodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + message.aminoJson = object.aminoJson ?? ""; + 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; + /** + * TxDecode decodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxDecode(request: TxDecodeRequest): Promise; + /** + * TxEncode encodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxEncode(request: TxEncodeRequest): Promise; + /** + * TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. + * + * Since: cosmos-sdk 0.47 + */ + TxEncodeAmino(request: TxEncodeAminoRequest): Promise; + /** + * TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. + * + * Since: cosmos-sdk 0.47 + */ + TxDecodeAmino(request: TxDecodeAminoRequest): Promise; +} + +export const ServiceServiceName = "cosmos.tx.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.TxDecode = this.TxDecode.bind(this); + this.TxEncode = this.TxEncode.bind(this); + this.TxEncodeAmino = this.TxEncodeAmino.bind(this); + this.TxDecodeAmino = this.TxDecodeAmino.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + TxDecode(request: TxDecodeRequest): Promise { + const data = TxDecodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecode", data); + return promise.then((data) => TxDecodeResponse.decode(new BinaryReader(data))); + } + + TxEncode(request: TxEncodeRequest): Promise { + const data = TxEncodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncode", data); + return promise.then((data) => TxEncodeResponse.decode(new BinaryReader(data))); + } + + TxEncodeAmino(request: TxEncodeAminoRequest): Promise { + const data = TxEncodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncodeAmino", data); + return promise.then((data) => TxEncodeAminoResponse.decode(new BinaryReader(data))); + } + + TxDecodeAmino(request: TxDecodeAminoRequest): Promise { + const data = TxDecodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecodeAmino", data); + return promise.then((data) => TxDecodeAminoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 00000000..f2c427d1 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,1615 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + authInfo: + | AuthInfo + | undefined; + /** + * 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. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + authInfoBytes: Uint8Array; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} + +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDoc { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + authInfoBytes: Uint8Array; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chainId: string; + /** account_number is the account number of the account in state */ + accountNumber: number; +} + +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAux { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** public_key is the public key of the signing account. */ + publicKey: + | Any + | undefined; + /** + * chain_id is the identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker. + */ + chainId: string; + /** account_number is the account number of the account in state. */ + accountNumber: number; + /** sequence is the sequence number of the signing account. */ + sequence: number; + /** + * tips have been depreacted and should not be used + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBody { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages: Any[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeoutHeight: number; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extensionOptions: Any[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + nonCriticalExtensionOptions: Any[]; +} + +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfo { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signerInfos: SignerInfo[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee: + | Fee + | undefined; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + * + * Since: cosmos-sdk 0.46 + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfo { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + publicKey: + | Any + | undefined; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + modeInfo: + | ModeInfo + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + modeInfos: 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 + */ + gasLimit: number; + /** + * 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 + * + * @deprecated + */ +export interface Tip { + /** amount is the amount of the tip */ + amount: Coin[]; + /** tipper is the address of the account paying for the tip */ + tipper: string; +} + +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerData { + /** + * address is the bech32-encoded address of the auxiliary signer. If using + * AuxSignerData across different chains, the bech32 prefix of the target + * chain (where the final transaction is broadcasted) should be used. + */ + address: string; + /** + * sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + * signs. Note: we use the same sign doc even if we're signing with + * LEGACY_AMINO_JSON. + */ + signDoc: + | SignDocDirectAux + | undefined; + /** 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, authInfo: undefined, signatures: [] }; +} + +export const Tx: MessageFns = { + encode(message: Tx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).join(); + } + if (message.authInfo !== undefined) { + AuthInfo.encode(message.authInfo, writer.uint32(18).fork()).join(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.body = TxBody.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfo = AuthInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tx { + return { + body: isSet(object.body) ? TxBody.fromJSON(object.body) : undefined, + authInfo: isSet(object.authInfo) ? AuthInfo.fromJSON(object.authInfo) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Tx): unknown { + const obj: any = {}; + if (message.body !== undefined) { + obj.body = TxBody.toJSON(message.body); + } + if (message.authInfo !== undefined) { + obj.authInfo = AuthInfo.toJSON(message.authInfo); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Tx { + return Tx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Tx { + const message = createBaseTx(); + message.body = (object.body !== undefined && object.body !== null) ? TxBody.fromPartial(object.body) : undefined; + message.authInfo = (object.authInfo !== undefined && object.authInfo !== null) + ? AuthInfo.fromPartial(object.authInfo) + : undefined; + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTxRaw(): TxRaw { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), signatures: [] }; +} + +export const TxRaw: MessageFns = { + encode(message: TxRaw, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRaw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxRaw { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: TxRaw): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): TxRaw { + return TxRaw.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxRaw { + const message = createBaseTxRaw(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSignDoc(): SignDoc { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), chainId: "", accountNumber: 0 }; +} + +export const SignDoc: MessageFns = { + encode(message: SignDoc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDoc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDoc { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + }; + }, + + toJSON(message: SignDoc): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + return obj; + }, + + create, I>>(base?: I): SignDoc { + return SignDoc.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDoc { + const message = createBaseSignDoc(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 0; + return message; + }, +}; + +function createBaseSignDocDirectAux(): SignDocDirectAux { + return { + bodyBytes: new Uint8Array(0), + publicKey: undefined, + chainId: "", + accountNumber: 0, + sequence: 0, + tip: undefined, + }; +} + +export const SignDocDirectAux: MessageFns = { + encode(message: SignDocDirectAux, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(18).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(40).uint64(message.sequence); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDocDirectAux(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDocDirectAux { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined, + }; + }, + + toJSON(message: SignDocDirectAux): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): SignDocDirectAux { + return SignDocDirectAux.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 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: "", timeoutHeight: 0, extensionOptions: [], nonCriticalExtensionOptions: [] }; +} + +export const TxBody: MessageFns = { + encode(message: TxBody, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (message.timeoutHeight !== 0) { + writer.uint32(24).uint64(message.timeoutHeight); + } + for (const v of message.extensionOptions) { + Any.encode(v!, writer.uint32(8186).fork()).join(); + } + for (const v of message.nonCriticalExtensionOptions) { + Any.encode(v!, writer.uint32(16378).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.memo = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.timeoutHeight = longToNumber(reader.uint64()); + continue; + case 1023: + if (tag !== 8186) { + break; + } + + message.extensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + case 2047: + if (tag !== 16378) { + break; + } + + message.nonCriticalExtensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxBody { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + memo: isSet(object.memo) ? globalThis.String(object.memo) : "", + timeoutHeight: isSet(object.timeoutHeight) ? globalThis.Number(object.timeoutHeight) : 0, + extensionOptions: globalThis.Array.isArray(object?.extensionOptions) + ? object.extensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + nonCriticalExtensionOptions: globalThis.Array.isArray(object?.nonCriticalExtensionOptions) + ? object.nonCriticalExtensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.memo !== "") { + obj.memo = message.memo; + } + if (message.timeoutHeight !== 0) { + obj.timeoutHeight = Math.round(message.timeoutHeight); + } + if (message.extensionOptions?.length) { + obj.extensionOptions = message.extensionOptions.map((e) => Any.toJSON(e)); + } + if (message.nonCriticalExtensionOptions?.length) { + obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxBody { + return TxBody.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeoutHeight = object.timeoutHeight ?? 0; + message.extensionOptions = object.extensionOptions?.map((e) => Any.fromPartial(e)) || []; + message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAuthInfo(): AuthInfo { + return { signerInfos: [], fee: undefined, tip: undefined }; +} + +export const AuthInfo: MessageFns = { + encode(message: AuthInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signerInfos) { + SignerInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fee !== undefined) { + Fee.encode(message.fee, writer.uint32(18).fork()).join(); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signerInfos.push(SignerInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fee = Fee.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthInfo { + return { + signerInfos: globalThis.Array.isArray(object?.signerInfos) + ? object.signerInfos.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.signerInfos?.length) { + obj.signerInfos = message.signerInfos.map((e) => SignerInfo.toJSON(e)); + } + if (message.fee !== undefined) { + obj.fee = Fee.toJSON(message.fee); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): AuthInfo { + return AuthInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signerInfos?.map((e) => SignerInfo.fromPartial(e)) || []; + message.fee = (object.fee !== undefined && object.fee !== null) ? Fee.fromPartial(object.fee) : undefined; + message.tip = (object.tip !== undefined && object.tip !== null) ? Tip.fromPartial(object.tip) : undefined; + return message; + }, +}; + +function createBaseSignerInfo(): SignerInfo { + return { publicKey: undefined, modeInfo: undefined, sequence: 0 }; +} + +export const SignerInfo: MessageFns = { + encode(message: SignerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.modeInfo !== undefined) { + ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfo = ModeInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignerInfo { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + modeInfo: isSet(object.modeInfo) ? ModeInfo.fromJSON(object.modeInfo) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.modeInfo !== undefined) { + obj.modeInfo = ModeInfo.toJSON(message.modeInfo); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignerInfo { + return SignerInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignerInfo { + const message = createBaseSignerInfo(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.modeInfo = (object.modeInfo !== undefined && object.modeInfo !== null) + ? ModeInfo.fromPartial(object.modeInfo) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModeInfo(): ModeInfo { + return { single: undefined, multi: undefined }; +} + +export const ModeInfo: MessageFns = { + encode(message: ModeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + ModeInfo_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = ModeInfo_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = ModeInfo_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = ModeInfo_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = ModeInfo_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo { + return ModeInfo.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ModeInfo_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Single { + return { mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; + }, + + toJSON(message: ModeInfo_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Single { + return ModeInfo_Single.fromPartial(base ?? ({} as any)); + }, + 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, modeInfos: [] }; +} + +export const ModeInfo_Multi: MessageFns = { + encode(message: ModeInfo_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.modeInfos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfos.push(ModeInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + modeInfos: globalThis.Array.isArray(object?.modeInfos) + ? object.modeInfos.map((e: any) => ModeInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModeInfo_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.modeInfos?.length) { + obj.modeInfos = message.modeInfos.map((e) => ModeInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Multi { + return ModeInfo_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + message.bitarray = (object.bitarray !== undefined && object.bitarray !== null) + ? CompactBitArray.fromPartial(object.bitarray) + : undefined; + message.modeInfos = object.modeInfos?.map((e) => ModeInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFee(): Fee { + return { amount: [], gasLimit: 0, payer: "", granter: "" }; +} + +export const Fee: MessageFns = { + encode(message: Fee, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.gasLimit !== 0) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.payer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.granter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Fee { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + gasLimit: isSet(object.gasLimit) ? globalThis.Number(object.gasLimit) : 0, + payer: isSet(object.payer) ? globalThis.String(object.payer) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + }; + }, + + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.gasLimit !== 0) { + obj.gasLimit = Math.round(message.gasLimit); + } + if (message.payer !== "") { + obj.payer = message.payer; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + return obj; + }, + + create, I>>(base?: I): Fee { + return Fee.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.gasLimit = object.gasLimit ?? 0; + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, +}; + +function createBaseTip(): Tip { + return { amount: [], tipper: "" }; +} + +export const Tip: MessageFns = { + encode(message: Tip, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.tipper !== "") { + writer.uint32(18).string(message.tipper); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tip { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTip(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tipper = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tip { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + tipper: isSet(object.tipper) ? globalThis.String(object.tipper) : "", + }; + }, + + toJSON(message: Tip): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.tipper !== "") { + obj.tipper = message.tipper; + } + return obj; + }, + + create, I>>(base?: I): Tip { + return Tip.fromPartial(base ?? ({} as any)); + }, + 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: "", signDoc: undefined, mode: 0, sig: new Uint8Array(0) }; +} + +export const AuxSignerData: MessageFns = { + encode(message: AuxSignerData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.signDoc !== undefined) { + SignDocDirectAux.encode(message.signDoc, writer.uint32(18).fork()).join(); + } + if (message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + if (message.sig.length !== 0) { + writer.uint32(34).bytes(message.sig); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuxSignerData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signDoc = SignDocDirectAux.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sig = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuxSignerData { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array(0), + }; + }, + + toJSON(message: AuxSignerData): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.signDoc !== undefined) { + obj.signDoc = SignDocDirectAux.toJSON(message.signDoc); + } + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.sig.length !== 0) { + obj.sig = base64FromBytes(message.sig); + } + return obj; + }, + + create, I>>(base?: I): AuxSignerData { + return AuxSignerData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuxSignerData { + const message = createBaseAuxSignerData(); + message.address = object.address ?? ""; + message.signDoc = (object.signDoc !== undefined && object.signDoc !== null) + ? SignDocDirectAux.fromPartial(object.signDoc) + : undefined; + message.mode = object.mode ?? 0; + message.sig = object.sig ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/module/v1/module.ts new file mode 100644 index 00000000..2bec3886 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.upgrade.module.v1"; + +/** Module is the config object of the upgrade module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/query.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 00000000..39cddba7 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,811 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * 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: number; +} + +/** + * 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 + */ + lastHeight: number; +} + +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + * + * @deprecated + */ +export interface QueryUpgradedConsensusStateResponse { + /** Since: cosmos-sdk 0.43 */ + upgradedConsensusState: 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 + */ + moduleName: 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. */ + moduleVersions: 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: MessageFns = { + encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCurrentPlanRequest { + return {}; + }, + + toJSON(_: QueryCurrentPlanRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, +}; + +function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { + return { plan: undefined }; +} + +export const QueryCurrentPlanResponse: MessageFns = { + encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCurrentPlanResponse { + return { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; + }, + + toJSON(message: QueryCurrentPlanResponse): unknown { + const obj: any = {}; + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryAppliedPlanRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { + return { height: 0 }; +} + +export const QueryAppliedPlanResponse: MessageFns = { + encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryAppliedPlanResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return { lastHeight: 0 }; +} + +export const QueryUpgradedConsensusStateRequest: MessageFns = { + encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.lastHeight !== 0) { + writer.uint32(8).int64(message.lastHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.lastHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateRequest { + return { lastHeight: isSet(object.lastHeight) ? globalThis.Number(object.lastHeight) : 0 }; + }, + + toJSON(message: QueryUpgradedConsensusStateRequest): unknown { + const obj: any = {}; + if (message.lastHeight !== 0) { + obj.lastHeight = Math.round(message.lastHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + message.lastHeight = object.lastHeight ?? 0; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { upgradedConsensusState: new Uint8Array(0) }; +} + +export const QueryUpgradedConsensusStateResponse: MessageFns = { + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.upgradedConsensusState.length !== 0) { + writer.uint32(18).bytes(message.upgradedConsensusState); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.upgradedConsensusState = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: isSet(object.upgradedConsensusState) + ? bytesFromBase64(object.upgradedConsensusState) + : new Uint8Array(0), + }; + }, + + toJSON(message: QueryUpgradedConsensusStateResponse): unknown { + const obj: any = {}; + if (message.upgradedConsensusState.length !== 0) { + obj.upgradedConsensusState = base64FromBytes(message.upgradedConsensusState); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgradedConsensusState = object.upgradedConsensusState ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { + return { moduleName: "" }; +} + +export const QueryModuleVersionsRequest: MessageFns = { + encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsRequest { + return { moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "" }; + }, + + toJSON(message: QueryModuleVersionsRequest): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + message.moduleName = object.moduleName ?? ""; + return message; + }, +}; + +function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { + return { moduleVersions: [] }; +} + +export const QueryModuleVersionsResponse: MessageFns = { + encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.moduleVersions) { + ModuleVersion.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.moduleVersions.push(ModuleVersion.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsResponse { + return { + moduleVersions: globalThis.Array.isArray(object?.moduleVersions) + ? object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryModuleVersionsResponse): unknown { + const obj: any = {}; + if (message.moduleVersions?.length) { + obj.moduleVersions = message.moduleVersions.map((e) => ModuleVersion.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.moduleVersions = object.moduleVersions?.map((e) => ModuleVersion.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { + return {}; +} + +export const QueryAuthorityRequest: MessageFns = { + encode(_: QueryAuthorityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAuthorityRequest { + return {}; + }, + + toJSON(_: QueryAuthorityRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAuthorityRequest { + return QueryAuthorityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAuthorityRequest { + const message = createBaseQueryAuthorityRequest(); + return message; + }, +}; + +function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { + return { address: "" }; +} + +export const QueryAuthorityResponse: MessageFns = { + encode(message: QueryAuthorityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorityResponse { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAuthorityResponse): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorityResponse { + return QueryAuthorityResponse.fromPartial(base ?? ({} as any)); + }, + 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 + * + * Since: cosmos-sdk 0.46 + */ + Authority(request: QueryAuthorityRequest): Promise; +} + +export const QueryServiceName = "cosmos.upgrade.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts new file mode 100644 index 00000000..48e7cf58 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts @@ -0,0 +1,337 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Plan } from "./upgrade"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgrade { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** plan is the upgrade plan. */ + plan: Plan | undefined; +} + +/** + * 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 that controls the module (defaults to x/gov unless overwritten). */ + 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: MessageFns = { + encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSoftwareUpgrade { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: MsgSoftwareUpgrade): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgSoftwareUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSoftwareUpgradeResponse { + return {}; + }, + + toJSON(_: MsgSoftwareUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSoftwareUpgradeResponse { + const message = createBaseMsgSoftwareUpgradeResponse(); + return message; + }, +}; + +function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { + return { authority: "" }; +} + +export const MsgCancelUpgrade: MessageFns = { + encode(message: MsgCancelUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelUpgrade { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: MsgCancelUpgrade): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): MsgCancelUpgrade { + return MsgCancelUpgrade.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelUpgrade { + const message = createBaseMsgCancelUpgrade(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { + return {}; +} + +export const MsgCancelUpgradeResponse: MessageFns = { + encode(_: MsgCancelUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelUpgradeResponse { + return {}; + }, + + toJSON(_: MsgCancelUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.fromPartial(base ?? ({} as any)); + }, + 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 + * approved software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + CancelUpgrade(request: MsgCancelUpgrade): Promise; +} + +export const MsgServiceName = "cosmos.upgrade.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 00000000..30096c1f --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,513 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/upgrade.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** The height at which the upgrade must be performed. */ + height: number; + /** + * Any application specific upgrade info to be included on-chain + * such as a git commit that validators could automatically upgrade to + */ + info: string; + /** + * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + * moved to the IBC module in the sub module 02-client. + * If this field is not empty, an error will be thrown. + * + * @deprecated + */ + upgradedClientState: Any | undefined; +} + +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + * + * @deprecated + */ +export interface SoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; + /** plan of the proposal */ + plan: Plan | undefined; +} + +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + * + * @deprecated + */ +export interface CancelSoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; +} + +/** + * 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: number; +} + +function createBasePlan(): Plan { + return { name: "", time: undefined, height: 0, info: "", upgradedClientState: undefined }; +} + +export const Plan: MessageFns = { + encode(message: Plan, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Plan { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.upgradedClientState = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Plan { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + info: isSet(object.info) ? globalThis.String(object.info) : "", + upgradedClientState: isSet(object.upgradedClientState) ? Any.fromJSON(object.upgradedClientState) : undefined, + }; + }, + + toJSON(message: Plan): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.upgradedClientState !== undefined) { + obj.upgradedClientState = Any.toJSON(message.upgradedClientState); + } + return obj; + }, + + create, I>>(base?: I): Plan { + return Plan.fromPartial(base ?? ({} as any)); + }, + 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.upgradedClientState = (object.upgradedClientState !== undefined && object.upgradedClientState !== null) + ? Any.fromPartial(object.upgradedClientState) + : undefined; + return message; + }, +}; + +function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { + return { title: "", description: "", plan: undefined }; +} + +export const SoftwareUpgradeProposal: MessageFns = { + encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: SoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CancelSoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: CancelSoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ModuleVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.version !== 0) { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleVersion { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: ModuleVersion): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): ModuleVersion { + return ModuleVersion.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/module/v1/module.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/module/v1/module.ts new file mode 100644 index 00000000..99609e8c --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.vesting.module.v1"; + +/** Module is the config object of the vesting module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/v1beta1/tx.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 00000000..034b0314 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,628 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + fromAddress: string; + toAddress: string; + amount: Coin[]; + /** end of vesting as unix time (in seconds). */ + endTime: number; + delayed: boolean; +} + +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponse { +} + +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; +} + +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponse { +} + +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccount { + fromAddress: string; + toAddress: string; + /** start of vesting as unix time (in seconds). */ + startTime: number; + vestingPeriods: Period[]; +} + +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponse { +} + +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { fromAddress: "", toAddress: "", amount: [], endTime: 0, delayed: false }; +} + +export const MsgCreateVestingAccount: MessageFns = { + encode(message: MsgCreateVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(32).int64(message.endTime); + } + if (message.delayed !== false) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.delayed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + delayed: isSet(object.delayed) ? globalThis.Boolean(object.delayed) : false, + }; + }, + + toJSON(message: MsgCreateVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + if (message.delayed !== false) { + obj.delayed = message.delayed; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccount { + return MsgCreateVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + message.delayed = object.delayed ?? false; + return message; + }, +}; + +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} + +export const MsgCreateVestingAccountResponse: MessageFns = { + encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreateVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgCreatePermanentLockedAccount: MessageFns = { + encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePermanentLockedAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCreatePermanentLockedAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { + return {}; +} + +export const MsgCreatePermanentLockedAccountResponse: MessageFns = { + encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePermanentLockedAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { + return { fromAddress: "", toAddress: "", startTime: 0, vestingPeriods: [] }; +} + +export const MsgCreatePeriodicVestingAccount: MessageFns = { + encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + if (message.startTime !== 0) { + writer.uint32(24).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePeriodicVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreatePeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { + return {}; +} + +export const MsgCreatePeriodicVestingAccountResponse: MessageFns = { + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePeriodicVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + CreatePermanentLockedAccount( + request: MsgCreatePermanentLockedAccount, + ): Promise; + /** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * + * Since: cosmos-sdk 0.46 + */ + CreatePeriodicVestingAccount( + request: MsgCreatePeriodicVestingAccount, + ): Promise; +} + +export const MsgServiceName = "cosmos.vesting.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 00000000..0fe13459 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,610 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/vesting.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + baseAccount: BaseAccount | undefined; + originalVesting: Coin[]; + delegatedFree: Coin[]; + delegatedVesting: Coin[]; + /** Vesting end time, as unix timestamp (in seconds). */ + endTime: number; +} + +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccount { + baseVestingAccount: + | BaseVestingAccount + | undefined; + /** Vesting start time, as unix timestamp (in seconds). */ + startTime: number; +} + +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; +} + +/** Period defines a length of time and amount of coins that will vest. */ +export interface Period { + /** Period duration in seconds. */ + length: number; + amount: Coin[]; +} + +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; + startTime: number; + vestingPeriods: 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 { + baseVestingAccount: BaseVestingAccount | undefined; +} + +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { baseAccount: undefined, originalVesting: [], delegatedFree: [], delegatedVesting: [], endTime: 0 }; +} + +export const BaseVestingAccount: MessageFns = { + encode(message: BaseVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + for (const v of message.originalVesting) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatedFree) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.delegatedVesting) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(40).int64(message.endTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.originalVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatedFree.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatedVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseVestingAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + originalVesting: globalThis.Array.isArray(object?.originalVesting) + ? object.originalVesting.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedFree: globalThis.Array.isArray(object?.delegatedFree) + ? object.delegatedFree.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedVesting: globalThis.Array.isArray(object?.delegatedVesting) + ? object.delegatedVesting.map((e: any) => Coin.fromJSON(e)) + : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + }; + }, + + toJSON(message: BaseVestingAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.originalVesting?.length) { + obj.originalVesting = message.originalVesting.map((e) => Coin.toJSON(e)); + } + if (message.delegatedFree?.length) { + obj.delegatedFree = message.delegatedFree.map((e) => Coin.toJSON(e)); + } + if (message.delegatedVesting?.length) { + obj.delegatedVesting = message.delegatedVesting.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + return obj; + }, + + create, I>>(base?: I): BaseVestingAccount { + return BaseVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.originalVesting = object.originalVesting?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedFree = object.delegatedFree?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedVesting = object.delegatedVesting?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + return message; + }, +}; + +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { baseVestingAccount: undefined, startTime: 0 }; +} + +export const ContinuousVestingAccount: MessageFns = { + encode(message: ContinuousVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContinuousVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + }; + }, + + toJSON(message: ContinuousVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + return obj; + }, + + create, I>>(base?: I): ContinuousVestingAccount { + return ContinuousVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + return message; + }, +}; + +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { baseVestingAccount: undefined }; +} + +export const DelayedVestingAccount: MessageFns = { + encode(message: DelayedVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelayedVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: DelayedVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): DelayedVestingAccount { + return DelayedVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +function createBasePeriod(): Period { + return { length: 0, amount: [] }; +} + +export const Period: MessageFns = { + encode(message: Period, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.length !== 0) { + writer.uint32(8).int64(message.length); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Period { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.length = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Period { + return { + length: isSet(object.length) ? globalThis.Number(object.length) : 0, + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Period): unknown { + const obj: any = {}; + if (message.length !== 0) { + obj.length = Math.round(message.length); + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Period { + return Period.fromPartial(base ?? ({} as any)); + }, + 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 { baseVestingAccount: undefined, startTime: 0, vestingPeriods: [] }; +} + +export const PeriodicVestingAccount: MessageFns = { + encode(message: PeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeriodicVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PeriodicVestingAccount { + return PeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { baseVestingAccount: undefined }; +} + +export const PermanentLockedAccount: MessageFns = { + encode(message: PermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PermanentLockedAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: PermanentLockedAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): PermanentLockedAccount { + return PermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.nft.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.nft.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.nft.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.nft.v1beta1/types/gogoproto/gogo.ts new file mode 100644 index 00000000..c9ab057a --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/gogoproto/gogo.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + +/* eslint-disable */ + +export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.nft.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.nft.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.nft.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.nft.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.nft.v1beta1/types/google/api/http.ts b/ts-client/cosmos.nft.v1beta1/types/google/api/http.ts index 9010600b..d3390802 100644 --- a/ts-client/cosmos.nft.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.nft.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,94 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} + * This enables an HTTP REST to gRPC mapping as below: * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: - * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` - * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` - * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. - * - * For HTTP method kinds which allow a request body, the `body` field + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +134,10 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +147,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +159,14 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +188,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC + * HTTP | gRPC * -----|----- * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` - * - * # Rules for HTTP mapping - * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: - * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. - * - * The syntax of the path template is as follows: + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +224,115 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +346,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +383,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +419,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +438,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +470,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +491,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +500,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +586,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +668,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +679,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +704,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +741,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; @@ -673,3 +753,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/google/protobuf/any.ts b/ts-client/cosmos.nft.v1beta1/types/google/protobuf/any.ts index f4abfdf9..24b86540 100644 --- a/ts-client/cosmos.nft.v1beta1/types/google/protobuf/any.ts +++ b/ts-client/cosmos.nft.v1beta1/types/google/protobuf/any.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/any.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -28,6 +34,10 @@ 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. * @@ -111,7 +121,8 @@ export interface Any { * * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. * * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. @@ -125,8 +136,8 @@ function createBaseAny(): Any { return { typeUrl: "", value: new Uint8Array(0) }; } -export const Any = { - encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Any: MessageFns = { + encode(message: Any, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.typeUrl !== "") { writer.uint32(10).string(message.typeUrl); } @@ -136,8 +147,8 @@ export const Any = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Any { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAny(); while (reader.pos < end) { @@ -161,14 +172,14 @@ export const Any = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Any { return { - typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), }; }, @@ -195,30 +206,11 @@ export const Any = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -228,21 +220,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -253,3 +246,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.nft.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..b7d4af33 100644 --- a/ts-client/cosmos.nft.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.nft.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,106 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +112,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +133,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +142,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +178,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +193,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,33 +312,40 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** @@ -163,7 +371,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +398,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +529,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +544,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +561,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +573,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +607,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +657,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +667,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,13 +678,17 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** * 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 @@ -469,8 +697,10 @@ export interface FileOptions { * However, an extension field still accepts non-UTF-8 byte sequences. * This option has no effect on when used with the lite runtime. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +708,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +723,83 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: boolean | undefined; + phpGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,21 +871,31 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** + * 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. + * * Whether the message is an automatically generated map entry type for the * maps field. * @@ -647,12 +913,31 @@ export interface MessageOptions { * 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. + */ + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. * - * 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. + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated */ - mapEntry: boolean; + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -661,18 +946,26 @@ 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release -- sorry, we'll try to include + * other types in a future version! */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +979,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -715,17 +1010,46 @@ export interface FieldOptions { * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. + * + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1057,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1144,150 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1297,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1337,39 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1381,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1453,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,51 +1474,341 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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. +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + NONE = 1, + VERIFY = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 1: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: Edition | undefined; + features?: FeatureSet | undefined; +} + +/** + * 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. @@ -1010,8 +1822,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition occurs. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1879,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1900,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1925,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2020,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2063,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2082,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2226,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) + : [], + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2309,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2339,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2359,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2394,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2475,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2571,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2617,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2664,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2700,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2737,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2771,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2821,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,6 +2839,134 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; + return message; + }, +}; + +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; +} + +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; return message; }, }; @@ -1915,46 +2987,46 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { }; } -export const FieldDescriptorProto = { - encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(24).int32(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { writer.uint32(32).int32(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { writer.uint32(40).int32(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { writer.uint32(50).string(message.typeName); } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { writer.uint32(18).string(message.extendee); } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { writer.uint32(58).string(message.defaultValue); } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { writer.uint32(72).int32(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3113,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3198,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3234,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3274,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3294,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3340,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3402,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3438,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3480,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3526,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3571,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3617,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3671,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3747,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2736,7 +3817,7 @@ function createBaseFileOptions(): FileOptions { pyGenericServices: false, phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3825,84 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { writer.uint32(336).bool(message.phpGenericServices); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2963,6 +4048,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4066,37 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + phpGenericServices: isSet(object.phpGenericServices) ? globalThis.Boolean(object.phpGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4104,69 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { obj.phpGenericServices = message.phpGenericServices; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3094,7 +4190,7 @@ export const FileOptions = { message.pyGenericServices = object.pyGenericServices ?? false; message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4198,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4212,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4281,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4306,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4333,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4368,81 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4476,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4497,51 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4553,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4561,22 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4584,42 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,32 +4635,124 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; +} + +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptions_EditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: FieldOptions_EditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; + return message; + }, +}; + function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; + return { features: undefined, uninterpretedOption: [] }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3417,14 +4764,15 @@ export const OneofOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3432,6 +4780,9 @@ export const OneofOptions = { toJSON(message: OneofOptions): unknown { const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3443,31 +4794,48 @@ export const OneofOptions = { }, fromPartial, I>>(object: I): OneofOptions { const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { writer.uint32(16).bool(message.allowAlias); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumOptions(); while (reader.pos < end) { @@ -3487,6 +4855,20 @@ export const EnumOptions = { message.deprecated = reader.bool(); continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3498,16 +4880,20 @@ export const EnumOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumOptions { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3515,12 +4901,20 @@ export const EnumOptions = { toJSON(message: EnumOptions): unknown { const obj: any = {}; - if (message.allowAlias === true) { + if (message.allowAlias !== undefined && message.allowAlias !== false) { obj.allowAlias = message.allowAlias; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3534,28 +4928,38 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { deprecated: false, features: undefined, debugRedact: false, uninterpretedOption: [] }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +4972,20 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +4997,17 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5015,15 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5036,47 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5095,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5112,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5129,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5139,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5180,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5198,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5218,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5240,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5260,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5312,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5346,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5370,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5411,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5447,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5464,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5481,337 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, features: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +5828,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +5863,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +5887,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +5953,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +5978,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6008,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6034,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6066,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6136,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6167,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6191,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6210,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6233,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.nft.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/google/protobuf/timestamp.ts b/ts-client/cosmos.nft.v1beta1/types/google/protobuf/timestamp.ts new file mode 100644 index 00000000..c7ff7f50 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/google/protobuf/timestamp.ts @@ -0,0 +1,227 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/timestamp.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: 0, nanos: 0 }; +} + +export const Timestamp: MessageFns = { + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/route-name.eta b/ts-client/cosmos.nft.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/abci/types.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/abci/types.ts new file mode 100644 index 00000000..c4e0902e --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/abci/types.ts @@ -0,0 +1,5925 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/abci/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { ConsensusParams } from "../types/params"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON } from "../types/validator"; + +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 MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1, +} + +export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} + +export function misbehaviorTypeToJSON(object: MisbehaviorType): string { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Request { + echo?: RequestEcho | undefined; + flush?: RequestFlush | undefined; + info?: RequestInfo | undefined; + initChain?: RequestInitChain | undefined; + query?: RequestQuery | undefined; + checkTx?: RequestCheckTx | undefined; + commit?: RequestCommit | undefined; + listSnapshots?: RequestListSnapshots | undefined; + offerSnapshot?: RequestOfferSnapshot | undefined; + loadSnapshotChunk?: RequestLoadSnapshotChunk | undefined; + applySnapshotChunk?: RequestApplySnapshotChunk | undefined; + prepareProposal?: RequestPrepareProposal | undefined; + processProposal?: RequestProcessProposal | undefined; + extendVote?: RequestExtendVote | undefined; + verifyVoteExtension?: RequestVerifyVoteExtension | undefined; + finalizeBlock?: RequestFinalizeBlock | undefined; +} + +export interface RequestEcho { + message: string; +} + +export interface RequestFlush { +} + +export interface RequestInfo { + version: string; + blockVersion: number; + p2pVersion: number; + abciVersion: string; +} + +export interface RequestInitChain { + time: Date | undefined; + chainId: string; + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appStateBytes: Uint8Array; + initialHeight: number; +} + +export interface RequestQuery { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} + +export interface RequestCommit { +} + +/** lists available snapshots */ +export interface RequestListSnapshots { +} + +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot: + | Snapshot + | undefined; + /** light client-verified app hash for snapshot height */ + appHash: Uint8Array; +} + +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: number; + format: number; + chunk: number; +} + +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} + +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: number; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit: ExtendedCommitInfo | undefined; + misbehavior: Misbehavior[]; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} + +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Extends a vote with application-injected data */ +export interface RequestExtendVote { + /** the hash of the block that this vote may be referring to */ + hash: Uint8Array; + /** the height of the extended vote */ + height: number; + /** info of the block that this vote may be referring to */ + time: Date | undefined; + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Verify the vote extension */ +export interface RequestVerifyVoteExtension { + /** the hash of the block that this received vote corresponds to */ + hash: Uint8Array; + /** the validator that signed the vote extension */ + validatorAddress: Uint8Array; + height: number; + voteExtension: Uint8Array; +} + +export interface RequestFinalizeBlock { + txs: Uint8Array[]; + decidedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the decided block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +export interface Response { + exception?: ResponseException | undefined; + echo?: ResponseEcho | undefined; + flush?: ResponseFlush | undefined; + info?: ResponseInfo | undefined; + initChain?: ResponseInitChain | undefined; + query?: ResponseQuery | undefined; + checkTx?: ResponseCheckTx | undefined; + commit?: ResponseCommit | undefined; + listSnapshots?: ResponseListSnapshots | undefined; + offerSnapshot?: ResponseOfferSnapshot | undefined; + loadSnapshotChunk?: ResponseLoadSnapshotChunk | undefined; + applySnapshotChunk?: ResponseApplySnapshotChunk | undefined; + prepareProposal?: ResponsePrepareProposal | undefined; + processProposal?: ResponseProcessProposal | undefined; + extendVote?: ResponseExtendVote | undefined; + verifyVoteExtension?: ResponseVerifyVoteExtension | undefined; + finalizeBlock?: ResponseFinalizeBlock | undefined; +} + +/** nondeterministic */ +export interface ResponseException { + error: string; +} + +export interface ResponseEcho { + message: string; +} + +export interface ResponseFlush { +} + +export interface ResponseInfo { + data: string; + version: string; + appVersion: number; + lastBlockHeight: number; + lastBlockAppHash: Uint8Array; +} + +export interface ResponseInitChain { + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appHash: Uint8Array; +} + +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + events: Event[]; + codespace: string; +} + +export interface ResponseCommit { + retainHeight: number; +} + +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 */ + refetchChunks: number[]; + /** Chunk senders to reject and ban */ + rejectSenders: 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"; + } +} + +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} + +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} + +export enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} + +export function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseExtendVote { + voteExtension: Uint8Array; +} + +export interface ResponseVerifyVoteExtension { + status: ResponseVerifyVoteExtension_VerifyStatus; +} + +export enum ResponseVerifyVoteExtension_VerifyStatus { + UNKNOWN = 0, + ACCEPT = 1, + /** + * REJECT - Rejecting the vote extension will reject the entire precommit by the sender. + * Incorrectly implementing this thus has liveness implications as it may affect + * CometBFT's ability to receive 2/3+ valid votes to finalize the block. + * Honest nodes should never be rejected. + */ + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseVerifyVoteExtension_VerifyStatusFromJSON( + object: any, +): ResponseVerifyVoteExtension_VerifyStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseVerifyVoteExtension_VerifyStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseVerifyVoteExtension_VerifyStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED; + } +} + +export function responseVerifyVoteExtension_VerifyStatusToJSON( + object: ResponseVerifyVoteExtension_VerifyStatus, +): string { + switch (object) { + case ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseVerifyVoteExtension_VerifyStatus.ACCEPT: + return "ACCEPT"; + case ResponseVerifyVoteExtension_VerifyStatus.REJECT: + return "REJECT"; + case ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseFinalizeBlock { + /** set of block events emmitted as part of executing the block */ + events: Event[]; + /** + * the result of executing each transaction including the events + * the particular transction emitted. This should match the order + * of the transactions delivered in the block itself + */ + txResults: ExecTxResult[]; + /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ + validatorUpdates: ValidatorUpdate[]; + /** updates to the consensus params, if any. */ + consensusParamUpdates: + | ConsensusParams + | undefined; + /** + * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + * deterministic. It is up to the application to decide which algorithm to use. + */ + appHash: Uint8Array; +} + +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} + +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} + +/** + * Event allows application developers to attach additional information to + * ResponseFinalizeBlock and ResponseCheckTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} + +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} + +/** + * ExecTxResult contains results of executing one individual transaction. + * + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted + */ +export interface ExecTxResult { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + /** nondeterministic */ + events: Event[]; + codespace: string; +} + +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: number; + index: number; + tx: Uint8Array; + result: ExecTxResult | undefined; +} + +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: number; +} + +export interface ValidatorUpdate { + pubKey: PublicKey | undefined; + power: number; +} + +export interface VoteInfo { + validator: Validator | undefined; + blockIdFlag: BlockIDFlag; +} + +export interface ExtendedVoteInfo { + /** The validator that sent the vote. */ + validator: + | Validator + | undefined; + /** Non-deterministic extension provided by the sending validator's application. */ + voteExtension: Uint8Array; + /** Vote extension signature created by CometBFT */ + extensionSignature: Uint8Array; + /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ + blockIdFlag: BlockIDFlag; +} + +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator: + | Validator + | undefined; + /** The height when the offense occurred */ + height: number; + /** The corresponding time where the offense occurred */ + time: + | Date + | undefined; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + totalVotingPower: number; +} + +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: number; + /** 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, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Request: MessageFns = { + encode(message: Request, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.echo !== undefined) { + RequestEcho.encode(message.echo, writer.uint32(10).fork()).join(); + } + if (message.flush !== undefined) { + RequestFlush.encode(message.flush, writer.uint32(18).fork()).join(); + } + if (message.info !== undefined) { + RequestInfo.encode(message.info, writer.uint32(26).fork()).join(); + } + if (message.initChain !== undefined) { + RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).join(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).join(); + } + if (message.checkTx !== undefined) { + RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).join(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).join(); + } + if (message.listSnapshots !== undefined) { + RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.prepareProposal !== undefined) { + RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).join(); + } + if (message.processProposal !== undefined) { + RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).join(); + } + if (message.extendVote !== undefined) { + RequestExtendVote.encode(message.extendVote, writer.uint32(146).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + RequestVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(154).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.finalizeBlock, writer.uint32(162).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Request { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.echo = RequestEcho.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.flush = RequestFlush.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.info = RequestInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.initChain = RequestInitChain.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = RequestQuery.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.commit = RequestCommit.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.extendVote = RequestExtendVote.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.verifyVoteExtension = RequestVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.finalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? RequestInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? RequestCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? RequestListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? RequestOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? RequestPrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? RequestProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? RequestExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? RequestVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? RequestFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Request): unknown { + const obj: any = {}; + if (message.echo !== undefined) { + obj.echo = RequestEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = RequestFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = RequestInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = RequestInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = RequestQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = RequestCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = RequestCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = RequestListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = RequestOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = RequestPrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = RequestProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = RequestExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = RequestVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = RequestFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Request { + return Request.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? RequestInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? RequestQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? RequestCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? RequestCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? RequestListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? RequestPrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? RequestProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? RequestExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? RequestVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseRequestEcho(): RequestEcho { + return { message: "" }; +} + +export const RequestEcho: MessageFns = { + encode(message: RequestEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: RequestEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): RequestEcho { + return RequestEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseRequestFlush(): RequestFlush { + return {}; +} + +export const RequestFlush: MessageFns = { + encode(_: RequestFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestFlush { + return {}; + }, + + toJSON(_: RequestFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestFlush { + return RequestFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, +}; + +function createBaseRequestInfo(): RequestInfo { + return { version: "", blockVersion: 0, p2pVersion: 0, abciVersion: "" }; +} + +export const RequestInfo: MessageFns = { + encode(message: RequestInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.blockVersion !== 0) { + writer.uint32(16).uint64(message.blockVersion); + } + if (message.p2pVersion !== 0) { + writer.uint32(24).uint64(message.p2pVersion); + } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockVersion = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.p2pVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.abciVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo { + return { + version: isSet(object.version) ? globalThis.String(object.version) : "", + blockVersion: isSet(object.blockVersion) ? globalThis.Number(object.blockVersion) : 0, + p2pVersion: isSet(object.p2pVersion) ? globalThis.Number(object.p2pVersion) : 0, + abciVersion: isSet(object.abciVersion) ? globalThis.String(object.abciVersion) : "", + }; + }, + + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + if (message.version !== "") { + obj.version = message.version; + } + if (message.blockVersion !== 0) { + obj.blockVersion = Math.round(message.blockVersion); + } + if (message.p2pVersion !== 0) { + obj.p2pVersion = Math.round(message.p2pVersion); + } + if (message.abciVersion !== "") { + obj.abciVersion = message.abciVersion; + } + return obj; + }, + + create, I>>(base?: I): RequestInfo { + return RequestInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = object.blockVersion ?? 0; + message.p2pVersion = object.p2pVersion ?? 0; + message.abciVersion = object.abciVersion ?? ""; + return message; + }, +}; + +function createBaseRequestInitChain(): RequestInitChain { + return { + time: undefined, + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(0), + initialHeight: 0, + }; +} + +export const RequestInitChain: MessageFns = { + encode(message: RequestInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appStateBytes = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.initialHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInitChain { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appStateBytes: isSet(object.appStateBytes) ? bytesFromBase64(object.appStateBytes) : new Uint8Array(0), + initialHeight: isSet(object.initialHeight) ? globalThis.Number(object.initialHeight) : 0, + }; + }, + + toJSON(message: RequestInitChain): unknown { + const obj: any = {}; + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appStateBytes.length !== 0) { + obj.appStateBytes = base64FromBytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + obj.initialHeight = Math.round(message.initialHeight); + } + return obj; + }, + + create, I>>(base?: I): RequestInitChain { + return RequestInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(0); + message.initialHeight = object.initialHeight ?? 0; + return message; + }, +}; + +function createBaseRequestQuery(): RequestQuery { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const RequestQuery: MessageFns = { + encode(message: RequestQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestQuery { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: RequestQuery): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): RequestQuery { + return RequestQuery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseRequestCheckTx(): RequestCheckTx { + return { tx: new Uint8Array(0), type: 0 }; +} + +export const RequestCheckTx: MessageFns = { + encode(message: RequestCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestCheckTx { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + + toJSON(message: RequestCheckTx): unknown { + const obj: any = {}; + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.type !== 0) { + obj.type = checkTxTypeToJSON(message.type); + } + return obj; + }, + + create, I>>(base?: I): RequestCheckTx { + return RequestCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(0); + message.type = object.type ?? 0; + return message; + }, +}; + +function createBaseRequestCommit(): RequestCommit { + return {}; +} + +export const RequestCommit: MessageFns = { + encode(_: RequestCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestCommit { + return {}; + }, + + toJSON(_: RequestCommit): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestCommit { + return RequestCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, +}; + +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} + +export const RequestListSnapshots: MessageFns = { + encode(_: RequestListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestListSnapshots { + return {}; + }, + + toJSON(_: RequestListSnapshots): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestListSnapshots { + return RequestListSnapshots.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; + +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { snapshot: undefined, appHash: new Uint8Array(0) }; +} + +export const RequestOfferSnapshot: MessageFns = { + encode(message: RequestOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshot = Snapshot.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestOfferSnapshot { + return { + snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestOfferSnapshot): unknown { + const obj: any = {}; + if (message.snapshot !== undefined) { + obj.snapshot = Snapshot.toJSON(message.snapshot); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): RequestOfferSnapshot { + return RequestOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) + ? Snapshot.fromPartial(object.snapshot) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { height: 0, format: 0, chunk: 0 }; +} + +export const RequestLoadSnapshotChunk: MessageFns = { + encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunk = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestLoadSnapshotChunk { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunk: isSet(object.chunk) ? globalThis.Number(object.chunk) : 0, + }; + }, + + toJSON(message: RequestLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunk !== 0) { + obj.chunk = Math.round(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + 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(0), sender: "" }; +} + +export const RequestApplySnapshotChunk: MessageFns = { + encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chunk = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestApplySnapshotChunk { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0), + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + }; + }, + + toJSON(message: RequestApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + if (message.sender !== "") { + obj.sender = message.sender; + } + return obj; + }, + + create, I>>(base?: I): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(0); + message.sender = object.sender ?? ""; + return message; + }, +}; + +function createBaseRequestPrepareProposal(): RequestPrepareProposal { + return { + maxTxBytes: 0, + txs: [], + localLastCommit: undefined, + misbehavior: [], + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestPrepareProposal: MessageFns = { + encode(message: RequestPrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTxBytes !== 0) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v!); + } + if (message.localLastCommit !== undefined) { + ExtendedCommitInfo.encode(message.localLastCommit, writer.uint32(26).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxTxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.localLastCommit = ExtendedCommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrepareProposal { + return { + maxTxBytes: isSet(object.maxTxBytes) ? globalThis.Number(object.maxTxBytes) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + localLastCommit: isSet(object.localLastCommit) ? ExtendedCommitInfo.fromJSON(object.localLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestPrepareProposal): unknown { + const obj: any = {}; + if (message.maxTxBytes !== 0) { + obj.maxTxBytes = Math.round(message.maxTxBytes); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.localLastCommit !== undefined) { + obj.localLastCommit = ExtendedCommitInfo.toJSON(message.localLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestPrepareProposal { + return RequestPrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = object.maxTxBytes ?? 0; + message.txs = object.txs?.map((e) => e) || []; + message.localLastCommit = (object.localLastCommit !== undefined && object.localLastCommit !== null) + ? ExtendedCommitInfo.fromPartial(object.localLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestProcessProposal(): RequestProcessProposal { + return { + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestProcessProposal: MessageFns = { + encode(message: RequestProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestProcessProposal { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestProcessProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestProcessProposal { + return RequestProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestExtendVote(): RequestExtendVote { + return { + hash: new Uint8Array(0), + height: 0, + time: undefined, + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestExtendVote: MessageFns = { + encode(message: RequestExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(26).fork()).join(); + } + for (const v of message.txs) { + writer.uint32(34).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(42).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestExtendVote { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestExtendVote): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestExtendVote { + return RequestExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestExtendVote { + const message = createBaseRequestExtendVote(); + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestVerifyVoteExtension(): RequestVerifyVoteExtension { + return { hash: new Uint8Array(0), validatorAddress: new Uint8Array(0), height: 0, voteExtension: new Uint8Array(0) }; +} + +export const RequestVerifyVoteExtension: MessageFns = { + encode(message: RequestVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.voteExtension.length !== 0) { + writer.uint32(34).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestVerifyVoteExtension { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + message.hash = object.hash ?? new Uint8Array(0); + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestFinalizeBlock(): RequestFinalizeBlock { + return { + txs: [], + decidedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestFinalizeBlock: MessageFns = { + encode(message: RequestFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.decidedLastCommit !== undefined) { + CommitInfo.encode(message.decidedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decidedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestFinalizeBlock { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + decidedLastCommit: isSet(object.decidedLastCommit) ? CommitInfo.fromJSON(object.decidedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestFinalizeBlock): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.decidedLastCommit !== undefined) { + obj.decidedLastCommit = CommitInfo.toJSON(message.decidedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestFinalizeBlock { + return RequestFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map((e) => e) || []; + message.decidedLastCommit = (object.decidedLastCommit !== undefined && object.decidedLastCommit !== null) + ? CommitInfo.fromPartial(object.decidedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Response: MessageFns = { + encode(message: Response, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).join(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).join(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).join(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + if (message.initChain !== undefined) { + ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).join(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).join(); + } + if (message.checkTx !== undefined) { + ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).join(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).join(); + } + if (message.listSnapshots !== undefined) { + ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).join(); + } + if (message.prepareProposal !== undefined) { + ResponsePrepareProposal.encode(message.prepareProposal, writer.uint32(138).fork()).join(); + } + if (message.processProposal !== undefined) { + ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).join(); + } + if (message.extendVote !== undefined) { + ResponseExtendVote.encode(message.extendVote, writer.uint32(154).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + ResponseVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(162).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.finalizeBlock, writer.uint32(170).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exception = ResponseException.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.echo = ResponseEcho.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.flush = ResponseFlush.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = ResponseInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.initChain = ResponseInitChain.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.query = ResponseQuery.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.commit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.listSnapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.offerSnapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.applySnapshotChunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.prepareProposal = ResponsePrepareProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.processProposal = ResponseProcessProposal.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.extendVote = ResponseExtendVote.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.verifyVoteExtension = ResponseVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.finalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? ResponseInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? ResponseQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? ResponseCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? ResponseCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? ResponseListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? ResponseOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? ResponsePrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? ResponseProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? ResponseExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? ResponseVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? ResponseFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + if (message.exception !== undefined) { + obj.exception = ResponseException.toJSON(message.exception); + } + if (message.echo !== undefined) { + obj.echo = ResponseEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = ResponseFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = ResponseInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = ResponseInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = ResponseQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = ResponseCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = ResponseCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = ResponseListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = ResponseOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = ResponsePrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = ResponseProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = ResponseExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = ResponseVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = ResponseFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Response { + return Response.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? ResponseInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ResponseQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? ResponseCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? ResponseCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? ResponseListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? ResponsePrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? ResponseProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? ResponseExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? ResponseVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseResponseException(): ResponseException { + return { error: "" }; +} + +export const ResponseException: MessageFns = { + encode(message: ResponseException, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.error = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseException { + return { error: isSet(object.error) ? globalThis.String(object.error) : "" }; + }, + + toJSON(message: ResponseException): unknown { + const obj: any = {}; + if (message.error !== "") { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): ResponseException { + return ResponseException.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; + +function createBaseResponseEcho(): ResponseEcho { + return { message: "" }; +} + +export const ResponseEcho: MessageFns = { + encode(message: ResponseEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: ResponseEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ResponseEcho { + return ResponseEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseResponseFlush(): ResponseFlush { + return {}; +} + +export const ResponseFlush: MessageFns = { + encode(_: ResponseFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ResponseFlush { + return {}; + }, + + toJSON(_: ResponseFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ResponseFlush { + return ResponseFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, +}; + +function createBaseResponseInfo(): ResponseInfo { + return { data: "", version: "", appVersion: 0, lastBlockHeight: 0, lastBlockAppHash: new Uint8Array(0) }; +} + +export const ResponseInfo: MessageFns = { + encode(message: ResponseInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.appVersion !== 0) { + writer.uint32(24).uint64(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.appVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.lastBlockHeight = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockAppHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInfo { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + appVersion: isSet(object.appVersion) ? globalThis.Number(object.appVersion) : 0, + lastBlockHeight: isSet(object.lastBlockHeight) ? globalThis.Number(object.lastBlockHeight) : 0, + lastBlockAppHash: isSet(object.lastBlockAppHash) ? bytesFromBase64(object.lastBlockAppHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInfo): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.appVersion !== 0) { + obj.appVersion = Math.round(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + obj.lastBlockHeight = Math.round(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + obj.lastBlockAppHash = base64FromBytes(message.lastBlockAppHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInfo { + return ResponseInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = object.appVersion ?? 0; + message.lastBlockHeight = object.lastBlockHeight ?? 0; + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseInitChain(): ResponseInitChain { + return { consensusParams: undefined, validators: [], appHash: new Uint8Array(0) }; +} + +export const ResponseInitChain: MessageFns = { + encode(message: ResponseInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInitChain { + return { + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInitChain): unknown { + const obj: any = {}; + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInitChain { + return ResponseInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ResponseQuery: MessageFns = { + encode(message: ResponseQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseQuery { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseQuery): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseQuery { + return ResponseQuery.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCheckTx(): ResponseCheckTx { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ResponseCheckTx: MessageFns = { + encode(message: ResponseCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCheckTx { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseCheckTx): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseCheckTx { + return ResponseCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCommit(): ResponseCommit { + return { retainHeight: 0 }; +} + +export const ResponseCommit: MessageFns = { + encode(message: ResponseCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.retainHeight !== 0) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.retainHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCommit { + return { retainHeight: isSet(object.retainHeight) ? globalThis.Number(object.retainHeight) : 0 }; + }, + + toJSON(message: ResponseCommit): unknown { + const obj: any = {}; + if (message.retainHeight !== 0) { + obj.retainHeight = Math.round(message.retainHeight); + } + return obj; + }, + + create, I>>(base?: I): ResponseCommit { + return ResponseCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCommit { + const message = createBaseResponseCommit(); + message.retainHeight = object.retainHeight ?? 0; + return message; + }, +}; + +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { snapshots: [] }; +} + +export const ResponseListSnapshots: MessageFns = { + encode(message: ResponseListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshots.push(Snapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseListSnapshots { + return { + snapshots: globalThis.Array.isArray(object?.snapshots) + ? object.snapshots.map((e: any) => Snapshot.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ResponseListSnapshots): unknown { + const obj: any = {}; + if (message.snapshots?.length) { + obj.snapshots = message.snapshots.map((e) => Snapshot.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponseListSnapshots { + return ResponseListSnapshots.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ResponseOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseOfferSnapshot { + return { result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: ResponseOfferSnapshot): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseOfferSnapshot_ResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { chunk: new Uint8Array(0) }; +} + +export const ResponseLoadSnapshotChunk: MessageFns = { + encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunk = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseLoadSnapshotChunk { + return { chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { result: 0, refetchChunks: [], rejectSenders: [] }; +} + +export const ResponseApplySnapshotChunk: MessageFns = { + encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.join(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + case 2: + if (tag === 16) { + message.refetchChunks.push(reader.uint32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + + continue; + } + + break; + case 3: + if (tag !== 26) { + break; + } + + message.rejectSenders.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseApplySnapshotChunk { + return { + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + refetchChunks: globalThis.Array.isArray(object?.refetchChunks) + ? object.refetchChunks.map((e: any) => globalThis.Number(e)) + : [], + rejectSenders: globalThis.Array.isArray(object?.rejectSenders) + ? object.rejectSenders.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ResponseApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + } + if (message.refetchChunks?.length) { + obj.refetchChunks = message.refetchChunks.map((e) => Math.round(e)); + } + if (message.rejectSenders?.length) { + obj.rejectSenders = message.rejectSenders; + } + return obj; + }, + + create, I>>(base?: I): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map((e) => e) || []; + message.rejectSenders = object.rejectSenders?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponsePrepareProposal(): ResponsePrepareProposal { + return { txs: [] }; +} + +export const ResponsePrepareProposal: MessageFns = { + encode(message: ResponsePrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponsePrepareProposal { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: ResponsePrepareProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponsePrepareProposal { + return ResponsePrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { status: 0 }; +} + +export const ResponseProcessProposal: MessageFns = { + encode(message: ResponseProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseProcessProposal { + return { status: isSet(object.status) ? responseProcessProposal_ProposalStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseProcessProposal): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseProcessProposal_ProposalStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseProcessProposal { + return ResponseProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseExtendVote(): ResponseExtendVote { + return { voteExtension: new Uint8Array(0) }; +} + +export const ResponseExtendVote: MessageFns = { + encode(message: ResponseExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtension.length !== 0) { + writer.uint32(10).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseExtendVote { + return { voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseExtendVote): unknown { + const obj: any = {}; + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): ResponseExtendVote { + return ResponseExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseVerifyVoteExtension(): ResponseVerifyVoteExtension { + return { status: 0 }; +} + +export const ResponseVerifyVoteExtension: MessageFns = { + encode(message: ResponseVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseVerifyVoteExtension { + return { status: isSet(object.status) ? responseVerifyVoteExtension_VerifyStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseVerifyVoteExtension_VerifyStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseFinalizeBlock(): ResponseFinalizeBlock { + return { + events: [], + txResults: [], + validatorUpdates: [], + consensusParamUpdates: undefined, + appHash: new Uint8Array(0), + }; +} + +export const ResponseFinalizeBlock: MessageFns = { + encode(message: ResponseFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResults) { + ExecTxResult.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.validatorUpdates) { + ValidatorUpdate.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.consensusParamUpdates !== undefined) { + ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(34).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(42).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResults.push(ExecTxResult.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseFinalizeBlock { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + txResults: globalThis.Array.isArray(object?.txResults) + ? object.txResults.map((e: any) => ExecTxResult.fromJSON(e)) + : [], + validatorUpdates: globalThis.Array.isArray(object?.validatorUpdates) + ? object.validatorUpdates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + consensusParamUpdates: isSet(object.consensusParamUpdates) + ? ConsensusParams.fromJSON(object.consensusParamUpdates) + : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseFinalizeBlock): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.txResults?.length) { + obj.txResults = message.txResults.map((e) => ExecTxResult.toJSON(e)); + } + if (message.validatorUpdates?.length) { + obj.validatorUpdates = message.validatorUpdates.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.consensusParamUpdates !== undefined) { + obj.consensusParamUpdates = ConsensusParams.toJSON(message.consensusParamUpdates); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseFinalizeBlock { + return ResponseFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.txResults = object.txResults?.map((e) => ExecTxResult.fromPartial(e)) || []; + message.validatorUpdates = object.validatorUpdates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = + (object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null) + ? ConsensusParams.fromPartial(object.consensusParamUpdates) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommitInfo(): CommitInfo { + return { round: 0, votes: [] }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + VoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(VoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => VoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitInfo(): ExtendedCommitInfo { + return { round: 0, votes: [] }; +} + +export const ExtendedCommitInfo: MessageFns = { + encode(message: ExtendedCommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + ExtendedVoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => ExtendedVoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ExtendedCommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => ExtendedVoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitInfo { + return ExtendedCommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEvent(): Event { + return { type: "", attributes: [] }; +} + +export const Event: MessageFns = { + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + EventAttribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(EventAttribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Event { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => EventAttribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => EventAttribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + 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: "", value: "", index: false }; +} + +export const EventAttribute: MessageFns = { + encode(message: EventAttribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index !== false) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.index = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventAttribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + index: isSet(object.index) ? globalThis.Boolean(object.index) : false, + }; + }, + + toJSON(message: EventAttribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.index !== false) { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): EventAttribute { + return EventAttribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, +}; + +function createBaseExecTxResult(): ExecTxResult { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ExecTxResult: MessageFns = { + encode(message: ExecTxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecTxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecTxResult { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ExecTxResult): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ExecTxResult { + return ExecTxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecTxResult { + const message = createBaseExecTxResult(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseTxResult(): TxResult { + return { height: 0, index: 0, tx: new Uint8Array(0), result: undefined }; +} + +export const TxResult: MessageFns = { + encode(message: TxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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) { + ExecTxResult.encode(message.result, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tx = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.result = ExecTxResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + result: isSet(object.result) ? ExecTxResult.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.result !== undefined) { + obj.result = ExecTxResult.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): TxResult { + return TxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.height = object.height ?? 0; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(0); + message.result = (object.result !== undefined && object.result !== null) + ? ExecTxResult.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), power: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseValidatorUpdate(): ValidatorUpdate { + return { pubKey: undefined, power: 0 }; +} + +export const ValidatorUpdate: MessageFns = { + encode(message: ValidatorUpdate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdate { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: ValidatorUpdate): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdate { + return ValidatorUpdate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseVoteInfo(): VoteInfo { + return { validator: undefined, blockIdFlag: 0 }; +} + +export const VoteInfo: MessageFns = { + encode(message: VoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.blockIdFlag !== 0) { + writer.uint32(24).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: VoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): VoteInfo { + return VoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseExtendedVoteInfo(): ExtendedVoteInfo { + return { + validator: undefined, + voteExtension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + blockIdFlag: 0, + }; +} + +export const ExtendedVoteInfo: MessageFns = { + encode(message: ExtendedVoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(34).bytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + writer.uint32(40).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedVoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedVoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: ExtendedVoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): ExtendedVoteInfo { + return ExtendedVoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseMisbehavior(): Misbehavior { + return { type: 0, validator: undefined, height: 0, time: undefined, totalVotingPower: 0 }; +} + +export const Misbehavior: MessageFns = { + encode(message: Misbehavior, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Misbehavior { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Misbehavior { + return { + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: Misbehavior): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = misbehaviorTypeToJSON(message.type); + } + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): Misbehavior { + return Misbehavior.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Misbehavior { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: new Uint8Array(0) }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? bytesFromBase64(object.metadata) : new Uint8Array(0), + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata.length !== 0) { + obj.metadata = base64FromBytes(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = object.metadata ?? new Uint8Array(0); + return message; + }, +}; + +export interface ABCI { + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; + PrepareProposal(request: RequestPrepareProposal): Promise; + ProcessProposal(request: RequestProcessProposal): Promise; + ExtendVote(request: RequestExtendVote): Promise; + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise; + FinalizeBlock(request: RequestFinalizeBlock): Promise; +} + +export const ABCIServiceName = "tendermint.abci.ABCI"; +export class ABCIClientImpl implements ABCI { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIServiceName; + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.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.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + this.PrepareProposal = this.PrepareProposal.bind(this); + this.ProcessProposal = this.ProcessProposal.bind(this); + this.ExtendVote = this.ExtendVote.bind(this); + this.VerifyVoteExtension = this.VerifyVoteExtension.bind(this); + this.FinalizeBlock = this.FinalizeBlock.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + PrepareProposal(request: RequestPrepareProposal): Promise { + const data = RequestPrepareProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrepareProposal", data); + return promise.then((data) => ResponsePrepareProposal.decode(new BinaryReader(data))); + } + + ProcessProposal(request: RequestProcessProposal): Promise { + const data = RequestProcessProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "ProcessProposal", data); + return promise.then((data) => ResponseProcessProposal.decode(new BinaryReader(data))); + } + + ExtendVote(request: RequestExtendVote): Promise { + const data = RequestExtendVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExtendVote", data); + return promise.then((data) => ResponseExtendVote.decode(new BinaryReader(data))); + } + + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise { + const data = RequestVerifyVoteExtension.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifyVoteExtension", data); + return promise.then((data) => ResponseVerifyVoteExtension.decode(new BinaryReader(data))); + } + + FinalizeBlock(request: RequestFinalizeBlock): Promise { + const data = RequestFinalizeBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizeBlock", data); + return promise.then((data) => ResponseFinalizeBlock.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/crypto/keys.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/crypto/keys.ts new file mode 100644 index 00000000..f30b6751 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/crypto/keys.ts @@ -0,0 +1,140 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKey { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; +} + +function createBasePublicKey(): PublicKey { + return { ed25519: undefined, secp256k1: undefined }; +} + +export const PublicKey: MessageFns = { + encode(message: PublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ed25519 = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.secp256k1 = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.ed25519 !== undefined) { + obj.ed25519 = base64FromBytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + obj.secp256k1 = base64FromBytes(message.secp256k1); + } + return obj; + }, + + create, I>>(base?: I): PublicKey { + return PublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/crypto/proof.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/crypto/proof.ts new file mode 100644 index 00000000..2b470701 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/crypto/proof.ts @@ -0,0 +1,520 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/proof.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +export interface Proof { + total: number; + index: number; + leafHash: Uint8Array; + aunts: Uint8Array[]; +} + +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof: Proof | undefined; +} + +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, leafHash: new Uint8Array(0), aunts: [] }; +} + +export const Proof: MessageFns = { + encode(message: Proof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).int64(message.total); + } + if (message.index !== 0) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.leafHash = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aunts.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proof { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + leafHash: isSet(object.leafHash) ? bytesFromBase64(object.leafHash) : new Uint8Array(0), + aunts: globalThis.Array.isArray(object?.aunts) ? object.aunts.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Proof): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.leafHash.length !== 0) { + obj.leafHash = base64FromBytes(message.leafHash); + } + if (message.aunts?.length) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Proof { + return Proof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proof { + const message = createBaseProof(); + message.total = object.total ?? 0; + message.index = object.index ?? 0; + message.leafHash = object.leafHash ?? new Uint8Array(0); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValueOp(): ValueOp { + return { key: new Uint8Array(0), proof: undefined }; +} + +export const ValueOp: MessageFns = { + encode(message: ValueOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValueOp { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: ValueOp): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): ValueOp { + return ValueOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValueOp { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(0); + 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: MessageFns = { + encode(message: DominoOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.input = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.output = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DominoOp { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + input: isSet(object.input) ? globalThis.String(object.input) : "", + output: isSet(object.output) ? globalThis.String(object.output) : "", + }; + }, + + toJSON(message: DominoOp): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.input !== "") { + obj.input = message.input; + } + if (message.output !== "") { + obj.output = message.output; + } + return obj; + }, + + create, I>>(base?: I): DominoOp { + return DominoOp.fromPartial(base ?? ({} as any)); + }, + 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(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/libs/bits/types.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/libs/bits/types.ts new file mode 100644 index 00000000..e8ec9685 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/libs/bits/types.ts @@ -0,0 +1,137 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/libs/bits/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.libs.bits"; + +export interface BitArray { + bits: number; + elems: number[]; +} + +function createBaseBitArray(): BitArray { + return { bits: 0, elems: [] }; +} + +export const BitArray: MessageFns = { + encode(message: BitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bits !== 0) { + writer.uint32(8).int64(message.bits); + } + writer.uint32(18).fork(); + for (const v of message.elems) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.bits = longToNumber(reader.int64()); + continue; + case 2: + if (tag === 16) { + message.elems.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.elems.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BitArray { + return { + bits: isSet(object.bits) ? globalThis.Number(object.bits) : 0, + elems: globalThis.Array.isArray(object?.elems) ? object.elems.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: BitArray): unknown { + const obj: any = {}; + if (message.bits !== 0) { + obj.bits = Math.round(message.bits); + } + if (message.elems?.length) { + obj.elems = message.elems.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): BitArray { + return BitArray.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/p2p/types.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/p2p/types.ts new file mode 100644 index 00000000..4ea8187a --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/p2p/types.ts @@ -0,0 +1,528 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/p2p/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.p2p"; + +export interface NetAddress { + id: string; + ip: string; + port: number; +} + +export interface ProtocolVersion { + p2p: number; + block: number; + app: number; +} + +export interface DefaultNodeInfo { + protocolVersion: ProtocolVersion | undefined; + defaultNodeId: string; + listenAddr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other: DefaultNodeInfoOther | undefined; +} + +export interface DefaultNodeInfoOther { + txIndex: string; + rpcAddress: string; +} + +function createBaseNetAddress(): NetAddress { + return { id: "", ip: "", port: 0 }; +} + +export const NetAddress: MessageFns = { + encode(message: NetAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.ip !== "") { + writer.uint32(18).string(message.ip); + } + if (message.port !== 0) { + writer.uint32(24).uint32(message.port); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.ip = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.port = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NetAddress { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + ip: isSet(object.ip) ? globalThis.String(object.ip) : "", + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + }; + }, + + toJSON(message: NetAddress): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.ip !== "") { + obj.ip = message.ip; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + + create, I>>(base?: I): NetAddress { + return NetAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetAddress { + const message = createBaseNetAddress(); + message.id = object.id ?? ""; + message.ip = object.ip ?? ""; + message.port = object.port ?? 0; + return message; + }, +}; + +function createBaseProtocolVersion(): ProtocolVersion { + return { p2p: 0, block: 0, app: 0 }; +} + +export const ProtocolVersion: MessageFns = { + encode(message: ProtocolVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ProtocolVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.p2p = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProtocolVersion { + return { + p2p: isSet(object.p2p) ? globalThis.Number(object.p2p) : 0, + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: ProtocolVersion): unknown { + const obj: any = {}; + if (message.p2p !== 0) { + obj.p2p = Math.round(message.p2p); + } + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): ProtocolVersion { + return ProtocolVersion.fromPartial(base ?? ({} as any)); + }, + 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 createBaseDefaultNodeInfo(): DefaultNodeInfo { + return { + protocolVersion: undefined, + defaultNodeId: "", + listenAddr: "", + network: "", + version: "", + channels: new Uint8Array(0), + moniker: "", + other: undefined, + }; +} + +export const DefaultNodeInfo: MessageFns = { + encode(message: DefaultNodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocolVersion !== undefined) { + ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).join(); + } + if (message.defaultNodeId !== "") { + writer.uint32(18).string(message.defaultNodeId); + } + if (message.listenAddr !== "") { + writer.uint32(26).string(message.listenAddr); + } + 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) { + DefaultNodeInfoOther.encode(message.other, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protocolVersion = ProtocolVersion.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.defaultNodeId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.listenAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.network = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.version = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.channels = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.moniker = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.other = DefaultNodeInfoOther.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfo { + return { + protocolVersion: isSet(object.protocolVersion) ? ProtocolVersion.fromJSON(object.protocolVersion) : undefined, + defaultNodeId: isSet(object.defaultNodeId) ? globalThis.String(object.defaultNodeId) : "", + listenAddr: isSet(object.listenAddr) ? globalThis.String(object.listenAddr) : "", + network: isSet(object.network) ? globalThis.String(object.network) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + channels: isSet(object.channels) ? bytesFromBase64(object.channels) : new Uint8Array(0), + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + other: isSet(object.other) ? DefaultNodeInfoOther.fromJSON(object.other) : undefined, + }; + }, + + toJSON(message: DefaultNodeInfo): unknown { + const obj: any = {}; + if (message.protocolVersion !== undefined) { + obj.protocolVersion = ProtocolVersion.toJSON(message.protocolVersion); + } + if (message.defaultNodeId !== "") { + obj.defaultNodeId = message.defaultNodeId; + } + if (message.listenAddr !== "") { + obj.listenAddr = message.listenAddr; + } + if (message.network !== "") { + obj.network = message.network; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.channels.length !== 0) { + obj.channels = base64FromBytes(message.channels); + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.other !== undefined) { + obj.other = DefaultNodeInfoOther.toJSON(message.other); + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfo { + return DefaultNodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfo { + const message = createBaseDefaultNodeInfo(); + message.protocolVersion = (object.protocolVersion !== undefined && object.protocolVersion !== null) + ? ProtocolVersion.fromPartial(object.protocolVersion) + : undefined; + message.defaultNodeId = object.defaultNodeId ?? ""; + message.listenAddr = object.listenAddr ?? ""; + message.network = object.network ?? ""; + message.version = object.version ?? ""; + message.channels = object.channels ?? new Uint8Array(0); + message.moniker = object.moniker ?? ""; + message.other = (object.other !== undefined && object.other !== null) + ? DefaultNodeInfoOther.fromPartial(object.other) + : undefined; + return message; + }, +}; + +function createBaseDefaultNodeInfoOther(): DefaultNodeInfoOther { + return { txIndex: "", rpcAddress: "" }; +} + +export const DefaultNodeInfoOther: MessageFns = { + encode(message: DefaultNodeInfoOther, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txIndex !== "") { + writer.uint32(10).string(message.txIndex); + } + if (message.rpcAddress !== "") { + writer.uint32(18).string(message.rpcAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfoOther { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfoOther(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txIndex = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfoOther { + return { + txIndex: isSet(object.txIndex) ? globalThis.String(object.txIndex) : "", + rpcAddress: isSet(object.rpcAddress) ? globalThis.String(object.rpcAddress) : "", + }; + }, + + toJSON(message: DefaultNodeInfoOther): unknown { + const obj: any = {}; + if (message.txIndex !== "") { + obj.txIndex = message.txIndex; + } + if (message.rpcAddress !== "") { + obj.rpcAddress = message.rpcAddress; + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfoOther { + return DefaultNodeInfoOther.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfoOther { + const message = createBaseDefaultNodeInfoOther(); + message.txIndex = object.txIndex ?? ""; + message.rpcAddress = object.rpcAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/types/block.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/block.ts new file mode 100644 index 00000000..4fbb3c13 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/block.ts @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/block.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { EvidenceList } from "./evidence"; +import { Commit, Data, Header } from "./types"; + +export const protobufPackage = "tendermint.types"; + +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/types/evidence.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/evidence.ts new file mode 100644 index 00000000..9a2fc48b --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/evidence.ts @@ -0,0 +1,489 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/evidence.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { LightBlock, Vote } from "./types"; +import { Validator } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +export interface Evidence { + duplicateVoteEvidence?: DuplicateVoteEvidence | undefined; + lightClientAttackEvidence?: LightClientAttackEvidence | undefined; +} + +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidence { + voteA: Vote | undefined; + voteB: Vote | undefined; + totalVotingPower: number; + validatorPower: number; + timestamp: Date | undefined; +} + +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidence { + conflictingBlock: LightBlock | undefined; + commonHeight: number; + byzantineValidators: Validator[]; + totalVotingPower: number; + timestamp: Date | undefined; +} + +export interface EvidenceList { + evidence: Evidence[]; +} + +function createBaseEvidence(): Evidence { + return { duplicateVoteEvidence: undefined, lightClientAttackEvidence: undefined }; +} + +export const Evidence: MessageFns = { + encode(message: Evidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.duplicateVoteEvidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).join(); + } + if (message.lightClientAttackEvidence !== undefined) { + LightClientAttackEvidence.encode(message.lightClientAttackEvidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.duplicateVoteEvidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lightClientAttackEvidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + duplicateVoteEvidence: isSet(object.duplicateVoteEvidence) + ? DuplicateVoteEvidence.fromJSON(object.duplicateVoteEvidence) + : undefined, + lightClientAttackEvidence: isSet(object.lightClientAttackEvidence) + ? LightClientAttackEvidence.fromJSON(object.lightClientAttackEvidence) + : undefined, + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + if (message.duplicateVoteEvidence !== undefined) { + obj.duplicateVoteEvidence = DuplicateVoteEvidence.toJSON(message.duplicateVoteEvidence); + } + if (message.lightClientAttackEvidence !== undefined) { + obj.lightClientAttackEvidence = LightClientAttackEvidence.toJSON(message.lightClientAttackEvidence); + } + return obj; + }, + + create, I>>(base?: I): Evidence { + return Evidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.duplicateVoteEvidence = + (object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null) + ? DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) + : undefined; + message.lightClientAttackEvidence = + (object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null) + ? LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) + : undefined; + return message; + }, +}; + +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { voteA: undefined, voteB: undefined, totalVotingPower: 0, validatorPower: 0, timestamp: undefined }; +} + +export const DuplicateVoteEvidence: MessageFns = { + encode(message: DuplicateVoteEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteA !== undefined) { + Vote.encode(message.voteA, writer.uint32(10).fork()).join(); + } + if (message.voteB !== undefined) { + Vote.encode(message.voteB, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + writer.uint32(32).int64(message.validatorPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuplicateVoteEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteA = Vote.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voteB = Vote.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.validatorPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DuplicateVoteEvidence { + return { + voteA: isSet(object.voteA) ? Vote.fromJSON(object.voteA) : undefined, + voteB: isSet(object.voteB) ? Vote.fromJSON(object.voteB) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + validatorPower: isSet(object.validatorPower) ? globalThis.Number(object.validatorPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: DuplicateVoteEvidence): unknown { + const obj: any = {}; + if (message.voteA !== undefined) { + obj.voteA = Vote.toJSON(message.voteA); + } + if (message.voteB !== undefined) { + obj.voteB = Vote.toJSON(message.voteB); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + obj.validatorPower = Math.round(message.validatorPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.voteA = (object.voteA !== undefined && object.voteA !== null) ? Vote.fromPartial(object.voteA) : undefined; + message.voteB = (object.voteB !== undefined && object.voteB !== null) ? Vote.fromPartial(object.voteB) : undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.validatorPower = object.validatorPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflictingBlock: undefined, + commonHeight: 0, + byzantineValidators: [], + totalVotingPower: 0, + timestamp: undefined, + }; +} + +export const LightClientAttackEvidence: MessageFns = { + encode(message: LightClientAttackEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.conflictingBlock !== undefined) { + LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).join(); + } + if (message.commonHeight !== 0) { + writer.uint32(16).int64(message.commonHeight); + } + for (const v of message.byzantineValidators) { + Validator.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(32).int64(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightClientAttackEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.conflictingBlock = LightBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.commonHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.byzantineValidators.push(Validator.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightClientAttackEvidence { + return { + conflictingBlock: isSet(object.conflictingBlock) ? LightBlock.fromJSON(object.conflictingBlock) : undefined, + commonHeight: isSet(object.commonHeight) ? globalThis.Number(object.commonHeight) : 0, + byzantineValidators: globalThis.Array.isArray(object?.byzantineValidators) + ? object.byzantineValidators.map((e: any) => Validator.fromJSON(e)) + : [], + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: LightClientAttackEvidence): unknown { + const obj: any = {}; + if (message.conflictingBlock !== undefined) { + obj.conflictingBlock = LightBlock.toJSON(message.conflictingBlock); + } + if (message.commonHeight !== 0) { + obj.commonHeight = Math.round(message.commonHeight); + } + if (message.byzantineValidators?.length) { + obj.byzantineValidators = message.byzantineValidators.map((e) => Validator.toJSON(e)); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): LightClientAttackEvidence { + return LightClientAttackEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflictingBlock = (object.conflictingBlock !== undefined && object.conflictingBlock !== null) + ? LightBlock.fromPartial(object.conflictingBlock) + : undefined; + message.commonHeight = object.commonHeight ?? 0; + message.byzantineValidators = object.byzantineValidators?.map((e) => Validator.fromPartial(e)) || []; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseEvidenceList(): EvidenceList { + return { evidence: [] }; +} + +export const EvidenceList: MessageFns = { + encode(message: EvidenceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence.push(Evidence.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceList { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Evidence.fromJSON(e)) : [], + }; + }, + + toJSON(message: EvidenceList): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Evidence.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EvidenceList { + return EvidenceList.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/types/params.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/params.ts new file mode 100644 index 00000000..d4cc2b8a --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/params.ts @@ -0,0 +1,686 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; + evidence: EvidenceParams | undefined; + validator: ValidatorParams | undefined; + version: VersionParams | undefined; + abci: ABCIParams | undefined; +} + +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + maxBytes: number; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + maxGas: number; +} + +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + maxAgeNumBlocks: number; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + maxAgeDuration: + | Duration + | undefined; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + maxBytes: number; +} + +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pubKeyTypes: string[]; +} + +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app: number; +} + +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + blockMaxBytes: number; + blockMaxGas: number; +} + +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParams { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + voteExtensionsEnableHeight: number; +} + +function createBaseConsensusParams(): ConsensusParams { + return { block: undefined, evidence: undefined, validator: undefined, version: undefined, abci: undefined }; +} + +export const ConsensusParams: MessageFns = { + encode(message: ConsensusParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(10).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(26).fork()).join(); + } + if (message.version !== undefined) { + VersionParams.encode(message.version, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.version = VersionParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.version !== undefined) { + obj.version = VersionParams.toJSON(message.version); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + return obj; + }, + + create, I>>(base?: I): ConsensusParams { + return ConsensusParams.fromPartial(base ?? ({} as any)); + }, + 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; + message.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseBlockParams(): BlockParams { + return { maxBytes: 0, maxGas: 0 }; +} + +export const BlockParams: MessageFns = { + encode(message: BlockParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxBytes !== 0) { + writer.uint32(8).int64(message.maxBytes); + } + if (message.maxGas !== 0) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + maxGas: isSet(object.maxGas) ? globalThis.Number(object.maxGas) : 0, + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxGas !== 0) { + obj.maxGas = Math.round(message.maxGas); + } + return obj; + }, + + create, I>>(base?: I): BlockParams { + return BlockParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes ?? 0; + message.maxGas = object.maxGas ?? 0; + return message; + }, +}; + +function createBaseEvidenceParams(): EvidenceParams { + return { maxAgeNumBlocks: 0, maxAgeDuration: undefined, maxBytes: 0 }; +} + +export const EvidenceParams: MessageFns = { + encode(message: EvidenceParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxAgeNumBlocks !== 0) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).join(); + } + if (message.maxBytes !== 0) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxAgeNumBlocks = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxAgeDuration = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceParams { + return { + maxAgeNumBlocks: isSet(object.maxAgeNumBlocks) ? globalThis.Number(object.maxAgeNumBlocks) : 0, + maxAgeDuration: isSet(object.maxAgeDuration) ? Duration.fromJSON(object.maxAgeDuration) : undefined, + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + }; + }, + + toJSON(message: EvidenceParams): unknown { + const obj: any = {}; + if (message.maxAgeNumBlocks !== 0) { + obj.maxAgeNumBlocks = Math.round(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + obj.maxAgeDuration = Duration.toJSON(message.maxAgeDuration); + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + return obj; + }, + + create, I>>(base?: I): EvidenceParams { + return EvidenceParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EvidenceParams { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = object.maxAgeNumBlocks ?? 0; + message.maxAgeDuration = (object.maxAgeDuration !== undefined && object.maxAgeDuration !== null) + ? Duration.fromPartial(object.maxAgeDuration) + : undefined; + message.maxBytes = object.maxBytes ?? 0; + return message; + }, +}; + +function createBaseValidatorParams(): ValidatorParams { + return { pubKeyTypes: [] }; +} + +export const ValidatorParams: MessageFns = { + encode(message: ValidatorParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKeyTypes.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorParams { + return { + pubKeyTypes: globalThis.Array.isArray(object?.pubKeyTypes) + ? object.pubKeyTypes.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValidatorParams): unknown { + const obj: any = {}; + if (message.pubKeyTypes?.length) { + obj.pubKeyTypes = message.pubKeyTypes; + } + return obj; + }, + + create, I>>(base?: I): ValidatorParams { + return ValidatorParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVersionParams(): VersionParams { + return { app: 0 }; +} + +export const VersionParams: MessageFns = { + encode(message: VersionParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.app !== 0) { + writer.uint32(8).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionParams { + return { app: isSet(object.app) ? globalThis.Number(object.app) : 0 }; + }, + + toJSON(message: VersionParams): unknown { + const obj: any = {}; + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): VersionParams { + return VersionParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionParams { + const message = createBaseVersionParams(); + message.app = object.app ?? 0; + return message; + }, +}; + +function createBaseHashedParams(): HashedParams { + return { blockMaxBytes: 0, blockMaxGas: 0 }; +} + +export const HashedParams: MessageFns = { + encode(message: HashedParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockMaxBytes !== 0) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockMaxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockMaxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashedParams { + return { + blockMaxBytes: isSet(object.blockMaxBytes) ? globalThis.Number(object.blockMaxBytes) : 0, + blockMaxGas: isSet(object.blockMaxGas) ? globalThis.Number(object.blockMaxGas) : 0, + }; + }, + + toJSON(message: HashedParams): unknown { + const obj: any = {}; + if (message.blockMaxBytes !== 0) { + obj.blockMaxBytes = Math.round(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + obj.blockMaxGas = Math.round(message.blockMaxGas); + } + return obj; + }, + + create, I>>(base?: I): HashedParams { + return HashedParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HashedParams { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes ?? 0; + message.blockMaxGas = object.blockMaxGas ?? 0; + return message; + }, +}; + +function createBaseABCIParams(): ABCIParams { + return { voteExtensionsEnableHeight: 0 }; +} + +export const ABCIParams: MessageFns = { + encode(message: ABCIParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtensionsEnableHeight !== 0) { + writer.uint32(8).int64(message.voteExtensionsEnableHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.voteExtensionsEnableHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIParams { + return { + voteExtensionsEnableHeight: isSet(object.voteExtensionsEnableHeight) + ? globalThis.Number(object.voteExtensionsEnableHeight) + : 0, + }; + }, + + toJSON(message: ABCIParams): unknown { + const obj: any = {}; + if (message.voteExtensionsEnableHeight !== 0) { + obj.voteExtensionsEnableHeight = Math.round(message.voteExtensionsEnableHeight); + } + return obj; + }, + + create, I>>(base?: I): ABCIParams { + return ABCIParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIParams { + const message = createBaseABCIParams(); + message.voteExtensionsEnableHeight = object.voteExtensionsEnableHeight ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/types/types.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/types.ts new file mode 100644 index 00000000..85454a42 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/types.ts @@ -0,0 +1,2065 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON, ValidatorSet } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +/** 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 | undefined; +} + +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + partSetHeader: PartSetHeader | undefined; +} + +/** Header defines the structure of a block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** original proposer of the block */ + proposerAddress: Uint8Array; +} + +/** 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 or precommit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: number; + round: number; + /** zero if vote is nil. */ + blockId: BlockID | undefined; + timestamp: Date | undefined; + validatorAddress: Uint8Array; + validatorIndex: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ + signature: Uint8Array; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension: Uint8Array; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. + * Only valid for precommit messages. + */ + extensionSignature: Uint8Array; +} + +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: number; + round: number; + blockId: BlockID | undefined; + signatures: CommitSig[]; +} + +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface ExtendedCommit { + height: number; + round: number; + blockId: BlockID | undefined; + extendedSignatures: ExtendedCommitSig[]; +} + +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; + /** Vote extension data */ + extension: Uint8Array; + /** Vote extension signature */ + extensionSignature: Uint8Array; +} + +export interface Proposal { + type: SignedMsgType; + height: number; + round: number; + polRound: number; + blockId: BlockID | undefined; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface SignedHeader { + header: Header | undefined; + commit: Commit | undefined; +} + +export interface LightBlock { + signedHeader: SignedHeader | undefined; + validatorSet: ValidatorSet | undefined; +} + +export interface BlockMeta { + blockId: BlockID | undefined; + blockSize: number; + header: Header | undefined; + numTxs: number; +} + +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + rootHash: Uint8Array; + data: Uint8Array; + proof: Proof | undefined; +} + +function createBasePartSetHeader(): PartSetHeader { + return { total: 0, hash: new Uint8Array(0) }; +} + +export const PartSetHeader: MessageFns = { + encode(message: PartSetHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PartSetHeader { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: PartSetHeader): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): PartSetHeader { + return PartSetHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePart(): Part { + return { index: 0, bytes: new Uint8Array(0), proof: undefined }; +} + +export const Part: MessageFns = { + encode(message: Part, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Part { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Part { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: Part): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.bytes.length !== 0) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): Part { + return Part.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Part { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function createBaseBlockID(): BlockID { + return { hash: new Uint8Array(0), partSetHeader: undefined }; +} + +export const BlockID: MessageFns = { + encode(message: BlockID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.partSetHeader = PartSetHeader.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockID { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + partSetHeader: isSet(object.partSetHeader) ? PartSetHeader.fromJSON(object.partSetHeader) : undefined, + }; + }, + + toJSON(message: BlockID): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.partSetHeader !== undefined) { + obj.partSetHeader = PartSetHeader.toJSON(message.partSetHeader); + } + return obj; + }, + + create, I>>(base?: I): BlockID { + return BlockID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(0); + message.partSetHeader = (object.partSetHeader !== undefined && object.partSetHeader !== null) + ? PartSetHeader.fromPartial(object.partSetHeader) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseData(): Data { + return { txs: [] }; +} + +export const Data: MessageFns = { + encode(message: Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Data { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: Data): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Data { + return Data.fromPartial(base ?? ({} as any)); + }, + 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, + blockId: undefined, + timestamp: undefined, + validatorAddress: new Uint8Array(0), + validatorIndex: 0, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(74).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(82).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.validatorIndex = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.signature = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.extension = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + validatorIndex: isSet(object.validatorIndex) ? globalThis.Number(object.validatorIndex) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + obj.validatorIndex = Math.round(message.validatorIndex); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommit(): Commit { + return { height: 0, round: 0, blockId: undefined, signatures: [] }; +} + +export const Commit: MessageFns = { + encode(message: Commit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signatures.push(CommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => CommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Commit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => CommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Commit { + return Commit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commit { + const message = createBaseCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.signatures = object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommitSig(): CommitSig { + return { blockIdFlag: 0, validatorAddress: new Uint8Array(0), timestamp: undefined, signature: new Uint8Array(0) }; +} + +export const CommitSig: MessageFns = { + encode(message: CommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): CommitSig { + return CommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitSig { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseExtendedCommit(): ExtendedCommit { + return { height: 0, round: 0, blockId: undefined, extendedSignatures: [] }; +} + +export const ExtendedCommit: MessageFns = { + encode(message: ExtendedCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.extendedSignatures) { + ExtendedCommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extendedSignatures.push(ExtendedCommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + extendedSignatures: globalThis.Array.isArray(object?.extendedSignatures) + ? object.extendedSignatures.map((e: any) => ExtendedCommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ExtendedCommit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.extendedSignatures?.length) { + obj.extendedSignatures = message.extendedSignatures.map((e) => ExtendedCommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommit { + return ExtendedCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommit { + const message = createBaseExtendedCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.extendedSignatures = object.extendedSignatures?.map((e) => ExtendedCommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitSig(): ExtendedCommitSig { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(0), + timestamp: undefined, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const ExtendedCommitSig: MessageFns = { + encode(message: ExtendedCommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(42).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(50).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.extension = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: ExtendedCommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitSig { + return ExtendedCommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + type: 0, + height: 0, + round: 0, + polRound: 0, + blockId: undefined, + timestamp: undefined, + signature: new Uint8Array(0), + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(42).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.polRound = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + polRound: isSet(object.polRound) ? globalThis.Number(object.polRound) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.polRound !== 0) { + obj.polRound = Math.round(message.polRound); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignedHeader(): SignedHeader { + return { header: undefined, commit: undefined }; +} + +export const SignedHeader: MessageFns = { + encode(message: SignedHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.commit !== undefined) { + Commit.encode(message.commit, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.commit !== undefined) { + obj.commit = Commit.toJSON(message.commit); + } + return obj; + }, + + create, I>>(base?: I): SignedHeader { + return SignedHeader.fromPartial(base ?? ({} as any)); + }, + 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 { signedHeader: undefined, validatorSet: undefined }; +} + +export const LightBlock: MessageFns = { + encode(message: LightBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedHeader !== undefined) { + SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).join(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightBlock { + return { + signedHeader: isSet(object.signedHeader) ? SignedHeader.fromJSON(object.signedHeader) : undefined, + validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined, + }; + }, + + toJSON(message: LightBlock): unknown { + const obj: any = {}; + if (message.signedHeader !== undefined) { + obj.signedHeader = SignedHeader.toJSON(message.signedHeader); + } + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): LightBlock { + return LightBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightBlock { + const message = createBaseLightBlock(); + message.signedHeader = (object.signedHeader !== undefined && object.signedHeader !== null) + ? SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseBlockMeta(): BlockMeta { + return { blockId: undefined, blockSize: 0, header: undefined, numTxs: 0 }; +} + +export const BlockMeta: MessageFns = { + encode(message: BlockMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.blockSize !== 0) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).join(); + } + if (message.numTxs !== 0) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockSize = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numTxs = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMeta { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + blockSize: isSet(object.blockSize) ? globalThis.Number(object.blockSize) : 0, + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + numTxs: isSet(object.numTxs) ? globalThis.Number(object.numTxs) : 0, + }; + }, + + toJSON(message: BlockMeta): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.blockSize !== 0) { + obj.blockSize = Math.round(message.blockSize); + } + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.numTxs !== 0) { + obj.numTxs = Math.round(message.numTxs); + } + return obj; + }, + + create, I>>(base?: I): BlockMeta { + return BlockMeta.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMeta { + const message = createBaseBlockMeta(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.blockSize = object.blockSize ?? 0; + message.header = (object.header !== undefined && object.header !== null) + ? Header.fromPartial(object.header) + : undefined; + message.numTxs = object.numTxs ?? 0; + return message; + }, +}; + +function createBaseTxProof(): TxProof { + return { rootHash: new Uint8Array(0), data: new Uint8Array(0), proof: undefined }; +} + +export const TxProof: MessageFns = { + encode(message: TxProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rootHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxProof { + return { + rootHash: isSet(object.rootHash) ? bytesFromBase64(object.rootHash) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: TxProof): unknown { + const obj: any = {}; + if (message.rootHash.length !== 0) { + obj.rootHash = base64FromBytes(message.rootHash); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): TxProof { + return TxProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxProof { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/types/validator.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/validator.ts new file mode 100644 index 00000000..623b14d8 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/types/validator.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/validator.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PublicKey } from "../crypto/keys"; + +export const protobufPackage = "tendermint.types"; + +/** BlockIdFlag indicates which BlockID the signature is for */ +export enum BlockIDFlag { + /** BLOCK_ID_FLAG_UNKNOWN - indicates an error condition */ + BLOCK_ID_FLAG_UNKNOWN = 0, + /** BLOCK_ID_FLAG_ABSENT - the vote was not received */ + BLOCK_ID_FLAG_ABSENT = 1, + /** BLOCK_ID_FLAG_COMMIT - voted for the block that received the majority */ + BLOCK_ID_FLAG_COMMIT = 2, + /** BLOCK_ID_FLAG_NIL - voted for nil */ + 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"; + } +} + +export interface ValidatorSet { + validators: Validator[]; + proposer: Validator | undefined; + totalVotingPower: number; +} + +export interface Validator { + address: Uint8Array; + pubKey: PublicKey | undefined; + votingPower: number; + proposerPriority: number; +} + +export interface SimpleValidator { + pubKey: PublicKey | undefined; + votingPower: number; +} + +function createBaseValidatorSet(): ValidatorSet { + return { validators: [], proposer: undefined, totalVotingPower: 0 }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.proposer !== undefined) { + Validator.encode(message.proposer, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.proposer !== undefined) { + obj.proposer = Validator.toJSON(message.proposer); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + 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.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseSimpleValidator(): SimpleValidator { + return { pubKey: undefined, votingPower: 0 }; +} + +export const SimpleValidator: MessageFns = { + encode(message: SimpleValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimpleValidator { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + }; + }, + + toJSON(message: SimpleValidator): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + return obj; + }, + + create, I>>(base?: I): SimpleValidator { + return SimpleValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.nft.v1beta1/types/tendermint/version/types.ts b/ts-client/cosmos.nft.v1beta1/types/tendermint/version/types.ts new file mode 100644 index 00000000..7a4b2fa4 --- /dev/null +++ b/ts-client/cosmos.nft.v1beta1/types/tendermint/version/types.ts @@ -0,0 +1,214 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/version/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: number; + 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: number; + app: number; +} + +function createBaseApp(): App { + return { protocol: 0, software: "" }; +} + +export const App: MessageFns = { + encode(message: App, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocol !== 0) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): App { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.protocol = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.software = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): App { + return { + protocol: isSet(object.protocol) ? globalThis.Number(object.protocol) : 0, + software: isSet(object.software) ? globalThis.String(object.software) : "", + }; + }, + + toJSON(message: App): unknown { + const obj: any = {}; + if (message.protocol !== 0) { + obj.protocol = Math.round(message.protocol); + } + if (message.software !== "") { + obj.software = message.software; + } + return obj; + }, + + create, I>>(base?: I): App { + return App.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Consensus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== 0) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== 0) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Consensus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Consensus { + return { + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: Consensus): unknown { + const obj: any = {}; + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): Consensus { + return Consensus.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/module.ts b/ts-client/cosmos.params.v1beta1/module.ts index 85466862..9f4bd27a 100755 --- a/ts-client/cosmos.params.v1beta1/module.ts +++ b/ts-client/cosmos.params.v1beta1/module.ts @@ -6,25 +6,25 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { QueryParamsRequest } from "./types/cosmos/params/v1beta1/query"; -import { QueryParamsResponse } from "./types/cosmos/params/v1beta1/query"; -import { Subspace } from "./types/cosmos/params/v1beta1/query"; -import { ParameterChangeProposal } from "./types/cosmos/params/v1beta1/params"; -import { ParamChange } from "./types/cosmos/params/v1beta1/params"; -import { QuerySubspacesRequest } from "./types/cosmos/params/v1beta1/query"; -import { QuerySubspacesResponse } from "./types/cosmos/params/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; +import { QuerySubspacesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; +import { Subspace } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; +import { QuerySubspacesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; +import { ParameterChangeProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/params"; +import { ParamChange } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/params"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; -export { QueryParamsRequest, QueryParamsResponse, Subspace, ParameterChangeProposal, ParamChange, QuerySubspacesRequest, QuerySubspacesResponse }; +export { QueryParamsResponse, QuerySubspacesResponse, Subspace, QuerySubspacesRequest, ParameterChangeProposal, ParamChange, QueryParamsRequest }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendQuerySubspacesResponseParams = { + value: QuerySubspacesResponse, fee?: StdFee, memo?: string }; @@ -35,43 +35,47 @@ type sendSubspaceParams = { memo?: string }; -type sendParameterChangeProposalParams = { - value: ParameterChangeProposal, +type sendQuerySubspacesRequestParams = { + value: QuerySubspacesRequest, fee?: StdFee, memo?: string }; -type sendParamChangeParams = { - value: ParamChange, +type sendParameterChangeProposalParams = { + value: ParameterChangeProposal, fee?: StdFee, memo?: string }; -type sendQuerySubspacesRequestParams = { - value: QuerySubspacesRequest, +type sendParamChangeParams = { + value: ParamChange, fee?: StdFee, memo?: string }; -type sendQuerySubspacesResponseParams = { - value: QuerySubspacesResponse, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type queryParamsRequestParams = { - value: QueryParamsRequest, -}; - type queryParamsResponseParams = { value: QueryParamsResponse, }; +type querySubspacesResponseParams = { + value: QuerySubspacesResponse, +}; + type subspaceParams = { value: Subspace, }; +type querySubspacesRequestParams = { + value: QuerySubspacesRequest, +}; + type parameterChangeProposalParams = { value: ParameterChangeProposal, }; @@ -80,12 +84,8 @@ type paramChangeParams = { value: ParamChange, }; -type querySubspacesRequestParams = { - value: QuerySubspacesRequest, -}; - -type querySubspacesResponseParams = { - value: QuerySubspacesResponse, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; @@ -118,31 +118,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendQuerySubspacesResponse({ value, fee, memo }: sendQuerySubspacesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySubspacesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.querySubspacesResponse({ value: QuerySubspacesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySubspacesResponse: Could not broadcast Tx: '+ e.message) } }, @@ -160,76 +160,76 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendParameterChangeProposal({ value, fee, memo }: sendParameterChangeProposalParams): Promise { + async sendQuerySubspacesRequest({ value, fee, memo }: sendQuerySubspacesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendParameterChangeProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySubspacesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.parameterChangeProposal({ value: ParameterChangeProposal.fromPartial(value) }) + let msg = this.querySubspacesRequest({ value: QuerySubspacesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParameterChangeProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySubspacesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendParamChange({ value, fee, memo }: sendParamChangeParams): Promise { + async sendParameterChangeProposal({ value, fee, memo }: sendParameterChangeProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendParamChange: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParameterChangeProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.paramChange({ value: ParamChange.fromPartial(value) }) + let msg = this.parameterChangeProposal({ value: ParameterChangeProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParamChange: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParameterChangeProposal: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySubspacesRequest({ value, fee, memo }: sendQuerySubspacesRequestParams): Promise { + async sendParamChange({ value, fee, memo }: sendParamChangeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySubspacesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParamChange: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySubspacesRequest({ value: QuerySubspacesRequest.fromPartial(value) }) + let msg = this.paramChange({ value: ParamChange.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySubspacesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParamChange: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySubspacesResponse({ value, fee, memo }: sendQuerySubspacesResponseParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySubspacesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySubspacesResponse({ value: QuerySubspacesResponse.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySubspacesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + querySubspacesResponse({ value }: querySubspacesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", value: QuerySubspacesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySubspacesResponse: Could not create message: ' + e.message) } }, @@ -241,6 +241,14 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, + querySubspacesRequest({ value }: querySubspacesRequestParams): EncodeObject { + try { + return { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", value: QuerySubspacesRequest.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QuerySubspacesRequest: Could not create message: ' + e.message) + } + }, + parameterChangeProposal({ value }: parameterChangeProposalParams): EncodeObject { try { return { typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", value: ParameterChangeProposal.fromPartial( value ) } @@ -257,19 +265,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - querySubspacesRequest({ value }: querySubspacesRequestParams): EncodeObject { - try { - return { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", value: QuerySubspacesRequest.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:QuerySubspacesRequest: Could not create message: ' + e.message) - } - }, - - querySubspacesResponse({ value }: querySubspacesResponseParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", value: QuerySubspacesResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySubspacesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.params.v1beta1/registry.ts b/ts-client/cosmos.params.v1beta1/registry.ts index 9d3983bb..4d2e7d84 100755 --- a/ts-client/cosmos.params.v1beta1/registry.ts +++ b/ts-client/cosmos.params.v1beta1/registry.ts @@ -1,20 +1,20 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { QueryParamsRequest } from "./types/cosmos/params/v1beta1/query"; -import { QueryParamsResponse } from "./types/cosmos/params/v1beta1/query"; -import { Subspace } from "./types/cosmos/params/v1beta1/query"; -import { ParameterChangeProposal } from "./types/cosmos/params/v1beta1/params"; -import { ParamChange } from "./types/cosmos/params/v1beta1/params"; -import { QuerySubspacesRequest } from "./types/cosmos/params/v1beta1/query"; -import { QuerySubspacesResponse } from "./types/cosmos/params/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; +import { QuerySubspacesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; +import { Subspace } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; +import { QuerySubspacesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; +import { ParameterChangeProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/params"; +import { ParamChange } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/params"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/params/v1beta1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.params.v1beta1.QueryParamsRequest", QueryParamsRequest], ["/cosmos.params.v1beta1.QueryParamsResponse", QueryParamsResponse], + ["/cosmos.params.v1beta1.QuerySubspacesResponse", QuerySubspacesResponse], ["/cosmos.params.v1beta1.Subspace", Subspace], + ["/cosmos.params.v1beta1.QuerySubspacesRequest", QuerySubspacesRequest], ["/cosmos.params.v1beta1.ParameterChangeProposal", ParameterChangeProposal], ["/cosmos.params.v1beta1.ParamChange", ParamChange], - ["/cosmos.params.v1beta1.QuerySubspacesRequest", QuerySubspacesRequest], - ["/cosmos.params.v1beta1.QuerySubspacesResponse", QuerySubspacesResponse], + ["/cosmos.params.v1beta1.QueryParamsRequest", QueryParamsRequest], ]; diff --git a/ts-client/cosmos.params.v1beta1/types/amino/amino.ts b/ts-client/cosmos.params.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.params.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.params.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.params.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.params.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.params.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..effd5449 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} + +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + 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(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: 0 }; +} + +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.params.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.params.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.params.v1beta1/types/cosmos/msg/v1/msg.ts new file mode 100644 index 00000000..7a993ec3 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/cosmos/msg/v1/msg.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.params.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.params.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.params.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.params.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.params.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.params.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.params.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.params.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.params.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.params.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.params.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.params.v1beta1/types/google/api/http.ts b/ts-client/cosmos.params.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.params.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.params.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.params.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.params.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.params.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.params.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.params.v1beta1/types/route-name.eta b/ts-client/cosmos.params.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.params.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.slashing.v1beta1/module.ts b/ts-client/cosmos.slashing.v1beta1/module.ts index 8ed42c6d..4d649a19 100755 --- a/ts-client/cosmos.slashing.v1beta1/module.ts +++ b/ts-client/cosmos.slashing.v1beta1/module.ts @@ -6,46 +6,46 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgUnjail } from "./types/cosmos/slashing/v1beta1/tx"; -import { SigningInfo } from "./types/cosmos/slashing/v1beta1/genesis"; -import { ValidatorMissedBlocks } from "./types/cosmos/slashing/v1beta1/genesis"; -import { QueryParamsRequest } from "./types/cosmos/slashing/v1beta1/query"; -import { QuerySigningInfosResponse } from "./types/cosmos/slashing/v1beta1/query"; -import { MsgUpdateParamsResponse } from "./types/cosmos/slashing/v1beta1/tx"; -import { ValidatorSigningInfo } from "./types/cosmos/slashing/v1beta1/slashing"; -import { GenesisState } from "./types/cosmos/slashing/v1beta1/genesis"; -import { MissedBlock } from "./types/cosmos/slashing/v1beta1/genesis"; -import { QuerySigningInfoResponse } from "./types/cosmos/slashing/v1beta1/query"; -import { MsgUpdateParams } from "./types/cosmos/slashing/v1beta1/tx"; -import { QueryParamsResponse } from "./types/cosmos/slashing/v1beta1/query"; -import { QuerySigningInfoRequest } from "./types/cosmos/slashing/v1beta1/query"; -import { QuerySigningInfosRequest } from "./types/cosmos/slashing/v1beta1/query"; -import { MsgUnjailResponse } from "./types/cosmos/slashing/v1beta1/tx"; -import { Params } from "./types/cosmos/slashing/v1beta1/slashing"; - - -export { MsgUnjail, SigningInfo, ValidatorMissedBlocks, QueryParamsRequest, QuerySigningInfosResponse, MsgUpdateParamsResponse, ValidatorSigningInfo, GenesisState, MissedBlock, QuerySigningInfoResponse, MsgUpdateParams, QueryParamsResponse, QuerySigningInfoRequest, QuerySigningInfosRequest, MsgUnjailResponse, Params }; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { QuerySigningInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/tx"; +import { ValidatorSigningInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/slashing"; +import { QuerySigningInfosResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { ValidatorMissedBlocks } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/genesis"; +import { MissedBlock } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/genesis"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { QuerySigningInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { QuerySigningInfosRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { MsgUnjail } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/tx"; +import { MsgUnjailResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/genesis"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/slashing"; +import { SigningInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/genesis"; + + +export { QueryParamsResponse, QuerySigningInfoResponse, MsgUpdateParamsResponse, ValidatorSigningInfo, QuerySigningInfosResponse, ValidatorMissedBlocks, MissedBlock, QueryParamsRequest, QuerySigningInfoRequest, QuerySigningInfosRequest, MsgUnjail, MsgUnjailResponse, GenesisState, MsgUpdateParams, Params, SigningInfo }; -type sendMsgUnjailParams = { - value: MsgUnjail, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendSigningInfoParams = { - value: SigningInfo, +type sendQuerySigningInfoResponseParams = { + value: QuerySigningInfoResponse, fee?: StdFee, memo?: string }; -type sendValidatorMissedBlocksParams = { - value: ValidatorMissedBlocks, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendValidatorSigningInfoParams = { + value: ValidatorSigningInfo, fee?: StdFee, memo?: string }; @@ -56,62 +56,56 @@ type sendQuerySigningInfosResponseParams = { memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, - fee?: StdFee, - memo?: string -}; - -type sendValidatorSigningInfoParams = { - value: ValidatorSigningInfo, +type sendValidatorMissedBlocksParams = { + value: ValidatorMissedBlocks, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendMissedBlockParams = { + value: MissedBlock, fee?: StdFee, memo?: string }; -type sendMissedBlockParams = { - value: MissedBlock, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendQuerySigningInfoResponseParams = { - value: QuerySigningInfoResponse, +type sendQuerySigningInfoRequestParams = { + value: QuerySigningInfoRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendQuerySigningInfosRequestParams = { + value: QuerySigningInfosRequest, fee?: StdFee, memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendMsgUnjailParams = { + value: MsgUnjail, fee?: StdFee, memo?: string }; -type sendQuerySigningInfoRequestParams = { - value: QuerySigningInfoRequest, +type sendMsgUnjailResponseParams = { + value: MsgUnjailResponse, fee?: StdFee, memo?: string }; -type sendQuerySigningInfosRequestParams = { - value: QuerySigningInfosRequest, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendMsgUnjailResponseParams = { - value: MsgUnjailResponse, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; @@ -122,25 +116,19 @@ type sendParamsParams = { memo?: string }; - -type msgUnjailParams = { - value: MsgUnjail, -}; - -type signingInfoParams = { +type sendSigningInfoParams = { value: SigningInfo, + fee?: StdFee, + memo?: string }; -type validatorMissedBlocksParams = { - value: ValidatorMissedBlocks, -}; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type queryParamsResponseParams = { + value: QueryParamsResponse, }; -type querySigningInfosResponseParams = { - value: QuerySigningInfosResponse, +type querySigningInfoResponseParams = { + value: QuerySigningInfoResponse, }; type msgUpdateParamsResponseParams = { @@ -151,24 +139,20 @@ type validatorSigningInfoParams = { value: ValidatorSigningInfo, }; -type genesisStateParams = { - value: GenesisState, -}; - -type missedBlockParams = { - value: MissedBlock, +type querySigningInfosResponseParams = { + value: QuerySigningInfosResponse, }; -type querySigningInfoResponseParams = { - value: QuerySigningInfoResponse, +type validatorMissedBlocksParams = { + value: ValidatorMissedBlocks, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type missedBlockParams = { + value: MissedBlock, }; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; type querySigningInfoRequestParams = { @@ -179,14 +163,30 @@ type querySigningInfosRequestParams = { value: QuerySigningInfosRequest, }; +type msgUnjailParams = { + value: MsgUnjail, +}; + type msgUnjailResponseParams = { value: MsgUnjailResponse, }; +type genesisStateParams = { + value: GenesisState, +}; + +type msgUpdateParamsParams = { + value: MsgUpdateParams, +}; + type paramsParams = { value: Params, }; +type signingInfoParams = { + value: SigningInfo, +}; + export const registry = new Registry(msgTypes); @@ -217,59 +217,59 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgUnjail({ value, fee, memo }: sendMsgUnjailParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUnjail: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUnjail({ value: MsgUnjail.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUnjail: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendSigningInfo({ value, fee, memo }: sendSigningInfoParams): Promise { + async sendQuerySigningInfoResponse({ value, fee, memo }: sendQuerySigningInfoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendSigningInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySigningInfoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.signingInfo({ value: SigningInfo.fromPartial(value) }) + let msg = this.querySigningInfoResponse({ value: QuerySigningInfoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSigningInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySigningInfoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorMissedBlocks({ value, fee, memo }: sendValidatorMissedBlocksParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorMissedBlocks: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorMissedBlocks({ value: ValidatorMissedBlocks.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorMissedBlocks: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendValidatorSigningInfo({ value, fee, memo }: sendValidatorSigningInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorSigningInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.validatorSigningInfo({ value: ValidatorSigningInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorSigningInfo: Could not broadcast Tx: '+ e.message) } }, @@ -287,190 +287,190 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendValidatorMissedBlocks({ value, fee, memo }: sendValidatorMissedBlocksParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorMissedBlocks: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.validatorMissedBlocks({ value: ValidatorMissedBlocks.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorMissedBlocks: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorSigningInfo({ value, fee, memo }: sendValidatorSigningInfoParams): Promise { + async sendMissedBlock({ value, fee, memo }: sendMissedBlockParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorSigningInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMissedBlock: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorSigningInfo({ value: ValidatorSigningInfo.fromPartial(value) }) + let msg = this.missedBlock({ value: MissedBlock.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorSigningInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMissedBlock: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMissedBlock({ value, fee, memo }: sendMissedBlockParams): Promise { + async sendQuerySigningInfoRequest({ value, fee, memo }: sendQuerySigningInfoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMissedBlock: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySigningInfoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.missedBlock({ value: MissedBlock.fromPartial(value) }) + let msg = this.querySigningInfoRequest({ value: QuerySigningInfoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMissedBlock: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySigningInfoRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySigningInfoResponse({ value, fee, memo }: sendQuerySigningInfoResponseParams): Promise { + async sendQuerySigningInfosRequest({ value, fee, memo }: sendQuerySigningInfosRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySigningInfoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySigningInfosRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySigningInfoResponse({ value: QuerySigningInfoResponse.fromPartial(value) }) + let msg = this.querySigningInfosRequest({ value: QuerySigningInfosRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySigningInfoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySigningInfosRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendMsgUnjail({ value, fee, memo }: sendMsgUnjailParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUnjail: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.msgUnjail({ value: MsgUnjail.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUnjail: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendMsgUnjailResponse({ value, fee, memo }: sendMsgUnjailResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUnjailResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.msgUnjailResponse({ value: MsgUnjailResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUnjailResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySigningInfoRequest({ value, fee, memo }: sendQuerySigningInfoRequestParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySigningInfoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySigningInfoRequest({ value: QuerySigningInfoRequest.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySigningInfoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySigningInfosRequest({ value, fee, memo }: sendQuerySigningInfosRequestParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySigningInfosRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySigningInfosRequest({ value: QuerySigningInfosRequest.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySigningInfosRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUnjailResponse({ value, fee, memo }: sendMsgUnjailResponseParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUnjailResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUnjailResponse({ value: MsgUnjailResponse.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUnjailResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendSigningInfo({ value, fee, memo }: sendSigningInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSigningInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.signingInfo({ value: SigningInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSigningInfo: Could not broadcast Tx: '+ e.message) } }, - msgUnjail({ value }: msgUnjailParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", value: MsgUnjail.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUnjail: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - signingInfo({ value }: signingInfoParams): EncodeObject { + querySigningInfoResponse({ value }: querySigningInfoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", value: SigningInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse", value: QuerySigningInfoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SigningInfo: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySigningInfoResponse: Could not create message: ' + e.message) } }, - validatorMissedBlocks({ value }: validatorMissedBlocksParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", value: ValidatorMissedBlocks.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorMissedBlocks: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + validatorSigningInfo({ value }: validatorSigningInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", value: ValidatorSigningInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorSigningInfo: Could not create message: ' + e.message) } }, @@ -482,91 +482,91 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + validatorMissedBlocks({ value }: validatorMissedBlocksParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", value: ValidatorMissedBlocks.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorMissedBlocks: Could not create message: ' + e.message) } }, - validatorSigningInfo({ value }: validatorSigningInfoParams): EncodeObject { + missedBlock({ value }: missedBlockParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", value: ValidatorSigningInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", value: MissedBlock.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorSigningInfo: Could not create message: ' + e.message) + throw new Error('TxClient:MissedBlock: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - missedBlock({ value }: missedBlockParams): EncodeObject { + querySigningInfoRequest({ value }: querySigningInfoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", value: MissedBlock.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", value: QuerySigningInfoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MissedBlock: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySigningInfoRequest: Could not create message: ' + e.message) } }, - querySigningInfoResponse({ value }: querySigningInfoResponseParams): EncodeObject { + querySigningInfosRequest({ value }: querySigningInfosRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse", value: QuerySigningInfoResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest", value: QuerySigningInfosRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySigningInfoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySigningInfosRequest: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + msgUnjail({ value }: msgUnjailParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", value: MsgUnjail.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUnjail: Could not create message: ' + e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + msgUnjailResponse({ value }: msgUnjailResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse", value: MsgUnjailResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUnjailResponse: Could not create message: ' + e.message) } }, - querySigningInfoRequest({ value }: querySigningInfoRequestParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", value: QuerySigningInfoRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySigningInfoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - querySigningInfosRequest({ value }: querySigningInfosRequestParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest", value: QuerySigningInfosRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySigningInfosRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - msgUnjailResponse({ value }: msgUnjailResponseParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse", value: MsgUnjailResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUnjailResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + signingInfo({ value }: signingInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.slashing.v1beta1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", value: SigningInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:SigningInfo: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.slashing.v1beta1/registry.ts b/ts-client/cosmos.slashing.v1beta1/registry.ts index 593172ae..33e3757e 100755 --- a/ts-client/cosmos.slashing.v1beta1/registry.ts +++ b/ts-client/cosmos.slashing.v1beta1/registry.ts @@ -1,38 +1,38 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgUnjail } from "./types/cosmos/slashing/v1beta1/tx"; -import { SigningInfo } from "./types/cosmos/slashing/v1beta1/genesis"; -import { ValidatorMissedBlocks } from "./types/cosmos/slashing/v1beta1/genesis"; -import { QueryParamsRequest } from "./types/cosmos/slashing/v1beta1/query"; -import { QuerySigningInfosResponse } from "./types/cosmos/slashing/v1beta1/query"; -import { MsgUpdateParamsResponse } from "./types/cosmos/slashing/v1beta1/tx"; -import { ValidatorSigningInfo } from "./types/cosmos/slashing/v1beta1/slashing"; -import { GenesisState } from "./types/cosmos/slashing/v1beta1/genesis"; -import { MissedBlock } from "./types/cosmos/slashing/v1beta1/genesis"; -import { QuerySigningInfoResponse } from "./types/cosmos/slashing/v1beta1/query"; -import { MsgUpdateParams } from "./types/cosmos/slashing/v1beta1/tx"; -import { QueryParamsResponse } from "./types/cosmos/slashing/v1beta1/query"; -import { QuerySigningInfoRequest } from "./types/cosmos/slashing/v1beta1/query"; -import { QuerySigningInfosRequest } from "./types/cosmos/slashing/v1beta1/query"; -import { MsgUnjailResponse } from "./types/cosmos/slashing/v1beta1/tx"; -import { Params } from "./types/cosmos/slashing/v1beta1/slashing"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { QuerySigningInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/tx"; +import { ValidatorSigningInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/slashing"; +import { QuerySigningInfosResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { ValidatorMissedBlocks } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/genesis"; +import { MissedBlock } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/genesis"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { QuerySigningInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { QuerySigningInfosRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/query"; +import { MsgUnjail } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/tx"; +import { MsgUnjailResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/genesis"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/slashing"; +import { SigningInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/slashing/v1beta1/genesis"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail], - ["/cosmos.slashing.v1beta1.SigningInfo", SigningInfo], - ["/cosmos.slashing.v1beta1.ValidatorMissedBlocks", ValidatorMissedBlocks], - ["/cosmos.slashing.v1beta1.QueryParamsRequest", QueryParamsRequest], - ["/cosmos.slashing.v1beta1.QuerySigningInfosResponse", QuerySigningInfosResponse], + ["/cosmos.slashing.v1beta1.QueryParamsResponse", QueryParamsResponse], + ["/cosmos.slashing.v1beta1.QuerySigningInfoResponse", QuerySigningInfoResponse], ["/cosmos.slashing.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], ["/cosmos.slashing.v1beta1.ValidatorSigningInfo", ValidatorSigningInfo], - ["/cosmos.slashing.v1beta1.GenesisState", GenesisState], + ["/cosmos.slashing.v1beta1.QuerySigningInfosResponse", QuerySigningInfosResponse], + ["/cosmos.slashing.v1beta1.ValidatorMissedBlocks", ValidatorMissedBlocks], ["/cosmos.slashing.v1beta1.MissedBlock", MissedBlock], - ["/cosmos.slashing.v1beta1.QuerySigningInfoResponse", QuerySigningInfoResponse], - ["/cosmos.slashing.v1beta1.MsgUpdateParams", MsgUpdateParams], - ["/cosmos.slashing.v1beta1.QueryParamsResponse", QueryParamsResponse], + ["/cosmos.slashing.v1beta1.QueryParamsRequest", QueryParamsRequest], ["/cosmos.slashing.v1beta1.QuerySigningInfoRequest", QuerySigningInfoRequest], ["/cosmos.slashing.v1beta1.QuerySigningInfosRequest", QuerySigningInfosRequest], + ["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail], ["/cosmos.slashing.v1beta1.MsgUnjailResponse", MsgUnjailResponse], + ["/cosmos.slashing.v1beta1.GenesisState", GenesisState], + ["/cosmos.slashing.v1beta1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.slashing.v1beta1.Params", Params], + ["/cosmos.slashing.v1beta1.SigningInfo", SigningInfo], ]; diff --git a/ts-client/cosmos.slashing.v1beta1/types/amino/amino.ts b/ts-client/cosmos.slashing.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.slashing.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.slashing.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.slashing.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.slashing.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.slashing.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.slashing.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.slashing.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.slashing.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.slashing.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.slashing.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.slashing.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.slashing.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.slashing.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.slashing.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.slashing.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.slashing.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.slashing.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.slashing.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.slashing.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.slashing.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.slashing.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.slashing.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.slashing.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.slashing.v1beta1/types/google/api/http.ts b/ts-client/cosmos.slashing.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.slashing.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.slashing.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.slashing.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.slashing.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.slashing.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.slashing.v1beta1/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/cosmos.slashing.v1beta1/types/google/protobuf/duration.ts +++ b/ts-client/cosmos.slashing.v1beta1/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.slashing.v1beta1/types/route-name.eta b/ts-client/cosmos.slashing.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.slashing.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.staking.v1beta1/module.ts b/ts-client/cosmos.staking.v1beta1/module.ts index 1883840e..e0e18354 100755 --- a/ts-client/cosmos.staking.v1beta1/module.ts +++ b/ts-client/cosmos.staking.v1beta1/module.ts @@ -6,403 +6,403 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgDelegateResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { GenesisState } from "./types/cosmos/staking/v1beta1/genesis"; -import { LastValidatorPower } from "./types/cosmos/staking/v1beta1/genesis"; -import { Params } from "./types/cosmos/staking/v1beta1/staking"; -import { ValidatorUpdates } from "./types/cosmos/staking/v1beta1/staking"; -import { DelegationResponse } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryRedelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryHistoricalInfoRequest } from "./types/cosmos/staking/v1beta1/query"; -import { MsgCancelUnbondingDelegation } from "./types/cosmos/staking/v1beta1/tx"; -import { QueryDelegationRequest } from "./types/cosmos/staking/v1beta1/query"; -import { MsgEditValidatorResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { Description } from "./types/cosmos/staking/v1beta1/staking"; -import { Commission } from "./types/cosmos/staking/v1beta1/staking"; -import { ValAddresses } from "./types/cosmos/staking/v1beta1/staking"; -import { DVVTriplets } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryDelegatorUnbondingDelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryRedelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryPoolRequest } from "./types/cosmos/staking/v1beta1/query"; -import { MsgCancelUnbondingDelegationResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { Pool } from "./types/cosmos/staking/v1beta1/staking"; -import { UnbondingDelegationEntry } from "./types/cosmos/staking/v1beta1/staking"; -import { MsgBeginRedelegateResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUndelegateResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { DVPair } from "./types/cosmos/staking/v1beta1/staking"; -import { Delegation } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryValidatorDelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorDelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorUnbondingDelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorDelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorValidatorRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryHistoricalInfoResponse } from "./types/cosmos/staking/v1beta1/query"; -import { Redelegation } from "./types/cosmos/staking/v1beta1/staking"; -import { RedelegationResponse } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryDelegatorDelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { DVVTriplet } from "./types/cosmos/staking/v1beta1/staking"; -import { MsgBeginRedelegate } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUpdateParams } from "./types/cosmos/staking/v1beta1/tx"; -import { QueryParamsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryUnbondingDelegationRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorUnbondingDelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorValidatorsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { MsgCreateValidator } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUndelegate } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUpdateParamsResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { UnbondingDelegation } from "./types/cosmos/staking/v1beta1/staking"; -import { StakeAuthorization_Validators } from "./types/cosmos/staking/v1beta1/authz"; -import { QueryPoolResponse } from "./types/cosmos/staking/v1beta1/query"; -import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx"; -import { Validator } from "./types/cosmos/staking/v1beta1/staking"; -import { CommissionRates } from "./types/cosmos/staking/v1beta1/staking"; -import { DVPairs } from "./types/cosmos/staking/v1beta1/staking"; -import { StakeAuthorization } from "./types/cosmos/staking/v1beta1/authz"; -import { QueryUnbondingDelegationResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorValidatorsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { RedelegationEntryResponse } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryDelegatorValidatorResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryParamsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { MsgCreateValidatorResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgDelegate } from "./types/cosmos/staking/v1beta1/tx"; -import { RedelegationEntry } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryValidatorsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorUnbondingDelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegationResponse } from "./types/cosmos/staking/v1beta1/query"; -import { HistoricalInfo } from "./types/cosmos/staking/v1beta1/staking"; - - -export { MsgDelegateResponse, GenesisState, LastValidatorPower, Params, ValidatorUpdates, DelegationResponse, QueryRedelegationsRequest, QueryHistoricalInfoRequest, MsgCancelUnbondingDelegation, QueryDelegationRequest, MsgEditValidatorResponse, Description, Commission, ValAddresses, DVVTriplets, QueryDelegatorUnbondingDelegationsRequest, QueryRedelegationsResponse, QueryPoolRequest, MsgCancelUnbondingDelegationResponse, Pool, UnbondingDelegationEntry, MsgBeginRedelegateResponse, MsgUndelegateResponse, DVPair, Delegation, QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponse, QueryValidatorUnbondingDelegationsResponse, QueryDelegatorDelegationsRequest, QueryDelegatorValidatorRequest, QueryHistoricalInfoResponse, Redelegation, RedelegationResponse, QueryDelegatorDelegationsResponse, DVVTriplet, MsgBeginRedelegate, MsgUpdateParams, QueryParamsResponse, QueryValidatorResponse, QueryUnbondingDelegationRequest, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorValidatorsResponse, MsgCreateValidator, MsgUndelegate, MsgUpdateParamsResponse, UnbondingDelegation, StakeAuthorization_Validators, QueryPoolResponse, MsgEditValidator, Validator, CommissionRates, DVPairs, StakeAuthorization, QueryUnbondingDelegationResponse, QueryDelegatorValidatorsRequest, RedelegationEntryResponse, QueryDelegatorValidatorResponse, QueryParamsRequest, MsgCreateValidatorResponse, MsgDelegate, RedelegationEntry, QueryValidatorsResponse, QueryValidatorsRequest, QueryValidatorRequest, QueryValidatorUnbondingDelegationsRequest, QueryDelegationResponse, HistoricalInfo }; +import { MsgEditValidatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { QueryDelegationRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryValidatorsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { CommissionRates } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { RedelegationEntry } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { MsgEditValidator } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgUndelegate } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { DVPair } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { ValidatorUpdates } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryValidatorRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryValidatorDelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorUnbondingDelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryRedelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryValidatorsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { MsgUndelegateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgDelegate } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { QueryDelegatorValidatorsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { RedelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { DVVTriplet } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { StakeAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/authz"; +import { StakeAuthorization_Validators } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/authz"; +import { MsgBeginRedelegate } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { LastValidatorPower } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/genesis"; +import { QueryValidatorUnbondingDelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { HistoricalInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { ValAddresses } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { Pool } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryUnbondingDelegationRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { MsgCreateValidatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/genesis"; +import { QueryDelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorValidatorRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryHistoricalInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryHistoricalInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { UnbondingDelegationEntry } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { MsgCancelUnbondingDelegation } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { QueryDelegatorUnbondingDelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { Delegation } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { DVVTriplets } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryDelegatorValidatorsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryValidatorUnbondingDelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorValidatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { Commission } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { DelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { Description } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryValidatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorDelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryRedelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryUnbondingDelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { Redelegation } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { MsgCreateValidator } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { RedelegationEntryResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryPoolResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { MsgDelegateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { Validator } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorDelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryPoolRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { MsgBeginRedelegateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgCancelUnbondingDelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { QueryValidatorDelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { UnbondingDelegation } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { DVPairs } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; + + +export { MsgEditValidatorResponse, MsgUpdateParams, QueryDelegationRequest, QueryValidatorsResponse, CommissionRates, RedelegationEntry, MsgEditValidator, MsgUndelegate, DVPair, Params, ValidatorUpdates, QueryValidatorRequest, QueryValidatorDelegationsRequest, QueryDelegatorUnbondingDelegationsResponse, QueryRedelegationsRequest, QueryValidatorsRequest, MsgUndelegateResponse, MsgDelegate, QueryDelegatorValidatorsRequest, RedelegationResponse, DVVTriplet, StakeAuthorization, StakeAuthorization_Validators, MsgBeginRedelegate, LastValidatorPower, QueryValidatorUnbondingDelegationsRequest, HistoricalInfo, ValAddresses, Pool, QueryUnbondingDelegationRequest, MsgCreateValidatorResponse, MsgUpdateParamsResponse, GenesisState, QueryDelegationResponse, QueryDelegatorValidatorRequest, QueryHistoricalInfoRequest, QueryHistoricalInfoResponse, UnbondingDelegationEntry, MsgCancelUnbondingDelegation, QueryDelegatorUnbondingDelegationsRequest, Delegation, DVVTriplets, QueryDelegatorValidatorsResponse, QueryValidatorUnbondingDelegationsResponse, QueryDelegatorValidatorResponse, Commission, DelegationResponse, Description, QueryValidatorResponse, QueryDelegatorDelegationsResponse, QueryRedelegationsResponse, QueryUnbondingDelegationResponse, QueryParamsResponse, Redelegation, MsgCreateValidator, RedelegationEntryResponse, QueryPoolResponse, MsgDelegateResponse, Validator, QueryParamsRequest, QueryDelegatorDelegationsRequest, QueryPoolRequest, MsgBeginRedelegateResponse, MsgCancelUnbondingDelegationResponse, QueryValidatorDelegationsResponse, UnbondingDelegation, DVPairs }; -type sendMsgDelegateResponseParams = { - value: MsgDelegateResponse, +type sendMsgEditValidatorResponseParams = { + value: MsgEditValidatorResponse, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendLastValidatorPowerParams = { - value: LastValidatorPower, +type sendQueryDelegationRequestParams = { + value: QueryDelegationRequest, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendQueryValidatorsResponseParams = { + value: QueryValidatorsResponse, fee?: StdFee, memo?: string }; -type sendValidatorUpdatesParams = { - value: ValidatorUpdates, +type sendCommissionRatesParams = { + value: CommissionRates, fee?: StdFee, memo?: string }; -type sendDelegationResponseParams = { - value: DelegationResponse, +type sendRedelegationEntryParams = { + value: RedelegationEntry, fee?: StdFee, memo?: string }; -type sendQueryRedelegationsRequestParams = { - value: QueryRedelegationsRequest, +type sendMsgEditValidatorParams = { + value: MsgEditValidator, fee?: StdFee, memo?: string }; -type sendQueryHistoricalInfoRequestParams = { - value: QueryHistoricalInfoRequest, +type sendMsgUndelegateParams = { + value: MsgUndelegate, fee?: StdFee, memo?: string }; -type sendMsgCancelUnbondingDelegationParams = { - value: MsgCancelUnbondingDelegation, +type sendDVPairParams = { + value: DVPair, fee?: StdFee, memo?: string }; -type sendQueryDelegationRequestParams = { - value: QueryDelegationRequest, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendMsgEditValidatorResponseParams = { - value: MsgEditValidatorResponse, +type sendValidatorUpdatesParams = { + value: ValidatorUpdates, fee?: StdFee, memo?: string }; -type sendDescriptionParams = { - value: Description, +type sendQueryValidatorRequestParams = { + value: QueryValidatorRequest, fee?: StdFee, memo?: string }; -type sendCommissionParams = { - value: Commission, +type sendQueryValidatorDelegationsRequestParams = { + value: QueryValidatorDelegationsRequest, fee?: StdFee, memo?: string }; -type sendValAddressesParams = { - value: ValAddresses, +type sendQueryDelegatorUnbondingDelegationsResponseParams = { + value: QueryDelegatorUnbondingDelegationsResponse, fee?: StdFee, memo?: string }; -type sendDVVTripletsParams = { - value: DVVTriplets, +type sendQueryRedelegationsRequestParams = { + value: QueryRedelegationsRequest, fee?: StdFee, memo?: string }; -type sendQueryDelegatorUnbondingDelegationsRequestParams = { - value: QueryDelegatorUnbondingDelegationsRequest, +type sendQueryValidatorsRequestParams = { + value: QueryValidatorsRequest, fee?: StdFee, memo?: string }; -type sendQueryRedelegationsResponseParams = { - value: QueryRedelegationsResponse, +type sendMsgUndelegateResponseParams = { + value: MsgUndelegateResponse, fee?: StdFee, memo?: string }; -type sendQueryPoolRequestParams = { - value: QueryPoolRequest, +type sendMsgDelegateParams = { + value: MsgDelegate, fee?: StdFee, memo?: string }; -type sendMsgCancelUnbondingDelegationResponseParams = { - value: MsgCancelUnbondingDelegationResponse, +type sendQueryDelegatorValidatorsRequestParams = { + value: QueryDelegatorValidatorsRequest, fee?: StdFee, memo?: string }; -type sendPoolParams = { - value: Pool, +type sendRedelegationResponseParams = { + value: RedelegationResponse, fee?: StdFee, memo?: string }; -type sendUnbondingDelegationEntryParams = { - value: UnbondingDelegationEntry, +type sendDVVTripletParams = { + value: DVVTriplet, fee?: StdFee, memo?: string }; -type sendMsgBeginRedelegateResponseParams = { - value: MsgBeginRedelegateResponse, +type sendStakeAuthorizationParams = { + value: StakeAuthorization, fee?: StdFee, memo?: string }; -type sendMsgUndelegateResponseParams = { - value: MsgUndelegateResponse, +type sendStakeAuthorization_ValidatorsParams = { + value: StakeAuthorization_Validators, fee?: StdFee, memo?: string }; -type sendDVPairParams = { - value: DVPair, +type sendMsgBeginRedelegateParams = { + value: MsgBeginRedelegate, fee?: StdFee, memo?: string }; -type sendDelegationParams = { - value: Delegation, +type sendLastValidatorPowerParams = { + value: LastValidatorPower, fee?: StdFee, memo?: string }; -type sendQueryValidatorDelegationsRequestParams = { - value: QueryValidatorDelegationsRequest, +type sendQueryValidatorUnbondingDelegationsRequestParams = { + value: QueryValidatorUnbondingDelegationsRequest, fee?: StdFee, memo?: string }; -type sendQueryValidatorDelegationsResponseParams = { - value: QueryValidatorDelegationsResponse, +type sendHistoricalInfoParams = { + value: HistoricalInfo, fee?: StdFee, memo?: string }; -type sendQueryValidatorUnbondingDelegationsResponseParams = { - value: QueryValidatorUnbondingDelegationsResponse, +type sendValAddressesParams = { + value: ValAddresses, fee?: StdFee, memo?: string }; -type sendQueryDelegatorDelegationsRequestParams = { - value: QueryDelegatorDelegationsRequest, +type sendPoolParams = { + value: Pool, fee?: StdFee, memo?: string }; -type sendQueryDelegatorValidatorRequestParams = { - value: QueryDelegatorValidatorRequest, +type sendQueryUnbondingDelegationRequestParams = { + value: QueryUnbondingDelegationRequest, fee?: StdFee, memo?: string }; -type sendQueryHistoricalInfoResponseParams = { - value: QueryHistoricalInfoResponse, +type sendMsgCreateValidatorResponseParams = { + value: MsgCreateValidatorResponse, fee?: StdFee, memo?: string }; -type sendRedelegationParams = { - value: Redelegation, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendRedelegationResponseParams = { - value: RedelegationResponse, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendQueryDelegatorDelegationsResponseParams = { - value: QueryDelegatorDelegationsResponse, +type sendQueryDelegationResponseParams = { + value: QueryDelegationResponse, fee?: StdFee, memo?: string }; -type sendDVVTripletParams = { - value: DVVTriplet, +type sendQueryDelegatorValidatorRequestParams = { + value: QueryDelegatorValidatorRequest, fee?: StdFee, memo?: string }; -type sendMsgBeginRedelegateParams = { - value: MsgBeginRedelegate, +type sendQueryHistoricalInfoRequestParams = { + value: QueryHistoricalInfoRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendQueryHistoricalInfoResponseParams = { + value: QueryHistoricalInfoResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendUnbondingDelegationEntryParams = { + value: UnbondingDelegationEntry, fee?: StdFee, memo?: string }; -type sendQueryValidatorResponseParams = { - value: QueryValidatorResponse, +type sendMsgCancelUnbondingDelegationParams = { + value: MsgCancelUnbondingDelegation, fee?: StdFee, memo?: string }; -type sendQueryUnbondingDelegationRequestParams = { - value: QueryUnbondingDelegationRequest, +type sendQueryDelegatorUnbondingDelegationsRequestParams = { + value: QueryDelegatorUnbondingDelegationsRequest, fee?: StdFee, memo?: string }; -type sendQueryDelegatorUnbondingDelegationsResponseParams = { - value: QueryDelegatorUnbondingDelegationsResponse, +type sendDelegationParams = { + value: Delegation, fee?: StdFee, memo?: string }; -type sendQueryDelegatorValidatorsResponseParams = { - value: QueryDelegatorValidatorsResponse, +type sendDVVTripletsParams = { + value: DVVTriplets, fee?: StdFee, memo?: string }; -type sendMsgCreateValidatorParams = { - value: MsgCreateValidator, +type sendQueryDelegatorValidatorsResponseParams = { + value: QueryDelegatorValidatorsResponse, fee?: StdFee, memo?: string }; -type sendMsgUndelegateParams = { - value: MsgUndelegate, +type sendQueryValidatorUnbondingDelegationsResponseParams = { + value: QueryValidatorUnbondingDelegationsResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendQueryDelegatorValidatorResponseParams = { + value: QueryDelegatorValidatorResponse, fee?: StdFee, memo?: string }; -type sendUnbondingDelegationParams = { - value: UnbondingDelegation, +type sendCommissionParams = { + value: Commission, fee?: StdFee, memo?: string }; -type sendStakeAuthorization_ValidatorsParams = { - value: StakeAuthorization_Validators, +type sendDelegationResponseParams = { + value: DelegationResponse, fee?: StdFee, memo?: string }; -type sendQueryPoolResponseParams = { - value: QueryPoolResponse, +type sendDescriptionParams = { + value: Description, fee?: StdFee, memo?: string }; -type sendMsgEditValidatorParams = { - value: MsgEditValidator, +type sendQueryValidatorResponseParams = { + value: QueryValidatorResponse, fee?: StdFee, memo?: string }; -type sendValidatorParams = { - value: Validator, +type sendQueryDelegatorDelegationsResponseParams = { + value: QueryDelegatorDelegationsResponse, fee?: StdFee, memo?: string }; -type sendCommissionRatesParams = { - value: CommissionRates, +type sendQueryRedelegationsResponseParams = { + value: QueryRedelegationsResponse, fee?: StdFee, memo?: string }; -type sendDVPairsParams = { - value: DVPairs, +type sendQueryUnbondingDelegationResponseParams = { + value: QueryUnbondingDelegationResponse, fee?: StdFee, memo?: string }; -type sendStakeAuthorizationParams = { - value: StakeAuthorization, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryUnbondingDelegationResponseParams = { - value: QueryUnbondingDelegationResponse, +type sendRedelegationParams = { + value: Redelegation, fee?: StdFee, memo?: string }; -type sendQueryDelegatorValidatorsRequestParams = { - value: QueryDelegatorValidatorsRequest, +type sendMsgCreateValidatorParams = { + value: MsgCreateValidator, fee?: StdFee, memo?: string }; @@ -413,339 +413,339 @@ type sendRedelegationEntryResponseParams = { memo?: string }; -type sendQueryDelegatorValidatorResponseParams = { - value: QueryDelegatorValidatorResponse, +type sendQueryPoolResponseParams = { + value: QueryPoolResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendMsgDelegateResponseParams = { + value: MsgDelegateResponse, fee?: StdFee, memo?: string }; -type sendMsgCreateValidatorResponseParams = { - value: MsgCreateValidatorResponse, +type sendValidatorParams = { + value: Validator, fee?: StdFee, memo?: string }; -type sendMsgDelegateParams = { - value: MsgDelegate, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendRedelegationEntryParams = { - value: RedelegationEntry, +type sendQueryDelegatorDelegationsRequestParams = { + value: QueryDelegatorDelegationsRequest, fee?: StdFee, memo?: string }; -type sendQueryValidatorsResponseParams = { - value: QueryValidatorsResponse, +type sendQueryPoolRequestParams = { + value: QueryPoolRequest, fee?: StdFee, memo?: string }; -type sendQueryValidatorsRequestParams = { - value: QueryValidatorsRequest, +type sendMsgBeginRedelegateResponseParams = { + value: MsgBeginRedelegateResponse, fee?: StdFee, memo?: string }; -type sendQueryValidatorRequestParams = { - value: QueryValidatorRequest, +type sendMsgCancelUnbondingDelegationResponseParams = { + value: MsgCancelUnbondingDelegationResponse, fee?: StdFee, memo?: string }; -type sendQueryValidatorUnbondingDelegationsRequestParams = { - value: QueryValidatorUnbondingDelegationsRequest, +type sendQueryValidatorDelegationsResponseParams = { + value: QueryValidatorDelegationsResponse, fee?: StdFee, memo?: string }; -type sendQueryDelegationResponseParams = { - value: QueryDelegationResponse, +type sendUnbondingDelegationParams = { + value: UnbondingDelegation, fee?: StdFee, memo?: string }; -type sendHistoricalInfoParams = { - value: HistoricalInfo, +type sendDVPairsParams = { + value: DVPairs, fee?: StdFee, memo?: string }; -type msgDelegateResponseParams = { - value: MsgDelegateResponse, +type msgEditValidatorResponseParams = { + value: MsgEditValidatorResponse, }; -type genesisStateParams = { - value: GenesisState, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type lastValidatorPowerParams = { - value: LastValidatorPower, +type queryDelegationRequestParams = { + value: QueryDelegationRequest, }; -type paramsParams = { - value: Params, +type queryValidatorsResponseParams = { + value: QueryValidatorsResponse, }; -type validatorUpdatesParams = { - value: ValidatorUpdates, +type commissionRatesParams = { + value: CommissionRates, }; -type delegationResponseParams = { - value: DelegationResponse, +type redelegationEntryParams = { + value: RedelegationEntry, }; -type queryRedelegationsRequestParams = { - value: QueryRedelegationsRequest, +type msgEditValidatorParams = { + value: MsgEditValidator, }; -type queryHistoricalInfoRequestParams = { - value: QueryHistoricalInfoRequest, +type msgUndelegateParams = { + value: MsgUndelegate, }; -type msgCancelUnbondingDelegationParams = { - value: MsgCancelUnbondingDelegation, +type dvpairParams = { + value: DVPair, }; -type queryDelegationRequestParams = { - value: QueryDelegationRequest, +type paramsParams = { + value: Params, }; -type msgEditValidatorResponseParams = { - value: MsgEditValidatorResponse, +type validatorUpdatesParams = { + value: ValidatorUpdates, }; -type descriptionParams = { - value: Description, +type queryValidatorRequestParams = { + value: QueryValidatorRequest, }; -type commissionParams = { - value: Commission, +type queryValidatorDelegationsRequestParams = { + value: QueryValidatorDelegationsRequest, }; -type valAddressesParams = { - value: ValAddresses, +type queryDelegatorUnbondingDelegationsResponseParams = { + value: QueryDelegatorUnbondingDelegationsResponse, }; -type dvvtripletsParams = { - value: DVVTriplets, +type queryRedelegationsRequestParams = { + value: QueryRedelegationsRequest, }; -type queryDelegatorUnbondingDelegationsRequestParams = { - value: QueryDelegatorUnbondingDelegationsRequest, +type queryValidatorsRequestParams = { + value: QueryValidatorsRequest, }; -type queryRedelegationsResponseParams = { - value: QueryRedelegationsResponse, +type msgUndelegateResponseParams = { + value: MsgUndelegateResponse, }; -type queryPoolRequestParams = { - value: QueryPoolRequest, +type msgDelegateParams = { + value: MsgDelegate, }; -type msgCancelUnbondingDelegationResponseParams = { - value: MsgCancelUnbondingDelegationResponse, +type queryDelegatorValidatorsRequestParams = { + value: QueryDelegatorValidatorsRequest, }; -type poolParams = { - value: Pool, +type redelegationResponseParams = { + value: RedelegationResponse, }; -type unbondingDelegationEntryParams = { - value: UnbondingDelegationEntry, +type dvvtripletParams = { + value: DVVTriplet, }; -type msgBeginRedelegateResponseParams = { - value: MsgBeginRedelegateResponse, +type stakeAuthorizationParams = { + value: StakeAuthorization, }; -type msgUndelegateResponseParams = { - value: MsgUndelegateResponse, +type stakeAuthorizationValidatorsParams = { + value: StakeAuthorization_Validators, }; -type dvpairParams = { - value: DVPair, +type msgBeginRedelegateParams = { + value: MsgBeginRedelegate, }; -type delegationParams = { - value: Delegation, +type lastValidatorPowerParams = { + value: LastValidatorPower, }; -type queryValidatorDelegationsRequestParams = { - value: QueryValidatorDelegationsRequest, +type queryValidatorUnbondingDelegationsRequestParams = { + value: QueryValidatorUnbondingDelegationsRequest, }; -type queryValidatorDelegationsResponseParams = { - value: QueryValidatorDelegationsResponse, +type historicalInfoParams = { + value: HistoricalInfo, }; -type queryValidatorUnbondingDelegationsResponseParams = { - value: QueryValidatorUnbondingDelegationsResponse, +type valAddressesParams = { + value: ValAddresses, }; -type queryDelegatorDelegationsRequestParams = { - value: QueryDelegatorDelegationsRequest, +type poolParams = { + value: Pool, }; -type queryDelegatorValidatorRequestParams = { - value: QueryDelegatorValidatorRequest, +type queryUnbondingDelegationRequestParams = { + value: QueryUnbondingDelegationRequest, }; -type queryHistoricalInfoResponseParams = { - value: QueryHistoricalInfoResponse, +type msgCreateValidatorResponseParams = { + value: MsgCreateValidatorResponse, }; -type redelegationParams = { - value: Redelegation, +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; -type redelegationResponseParams = { - value: RedelegationResponse, +type genesisStateParams = { + value: GenesisState, }; -type queryDelegatorDelegationsResponseParams = { - value: QueryDelegatorDelegationsResponse, +type queryDelegationResponseParams = { + value: QueryDelegationResponse, }; -type dvvtripletParams = { - value: DVVTriplet, +type queryDelegatorValidatorRequestParams = { + value: QueryDelegatorValidatorRequest, }; -type msgBeginRedelegateParams = { - value: MsgBeginRedelegate, +type queryHistoricalInfoRequestParams = { + value: QueryHistoricalInfoRequest, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type queryHistoricalInfoResponseParams = { + value: QueryHistoricalInfoResponse, }; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type unbondingDelegationEntryParams = { + value: UnbondingDelegationEntry, }; -type queryValidatorResponseParams = { - value: QueryValidatorResponse, +type msgCancelUnbondingDelegationParams = { + value: MsgCancelUnbondingDelegation, }; -type queryUnbondingDelegationRequestParams = { - value: QueryUnbondingDelegationRequest, +type queryDelegatorUnbondingDelegationsRequestParams = { + value: QueryDelegatorUnbondingDelegationsRequest, }; -type queryDelegatorUnbondingDelegationsResponseParams = { - value: QueryDelegatorUnbondingDelegationsResponse, +type delegationParams = { + value: Delegation, }; -type queryDelegatorValidatorsResponseParams = { - value: QueryDelegatorValidatorsResponse, +type dvvtripletsParams = { + value: DVVTriplets, }; -type msgCreateValidatorParams = { - value: MsgCreateValidator, +type queryDelegatorValidatorsResponseParams = { + value: QueryDelegatorValidatorsResponse, }; -type msgUndelegateParams = { - value: MsgUndelegate, +type queryValidatorUnbondingDelegationsResponseParams = { + value: QueryValidatorUnbondingDelegationsResponse, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type queryDelegatorValidatorResponseParams = { + value: QueryDelegatorValidatorResponse, }; -type unbondingDelegationParams = { - value: UnbondingDelegation, +type commissionParams = { + value: Commission, }; -type stakeAuthorizationValidatorsParams = { - value: StakeAuthorization_Validators, +type delegationResponseParams = { + value: DelegationResponse, }; -type queryPoolResponseParams = { - value: QueryPoolResponse, +type descriptionParams = { + value: Description, }; -type msgEditValidatorParams = { - value: MsgEditValidator, +type queryValidatorResponseParams = { + value: QueryValidatorResponse, }; -type validatorParams = { - value: Validator, +type queryDelegatorDelegationsResponseParams = { + value: QueryDelegatorDelegationsResponse, }; -type commissionRatesParams = { - value: CommissionRates, +type queryRedelegationsResponseParams = { + value: QueryRedelegationsResponse, }; -type dvpairsParams = { - value: DVPairs, +type queryUnbondingDelegationResponseParams = { + value: QueryUnbondingDelegationResponse, }; -type stakeAuthorizationParams = { - value: StakeAuthorization, +type queryParamsResponseParams = { + value: QueryParamsResponse, }; -type queryUnbondingDelegationResponseParams = { - value: QueryUnbondingDelegationResponse, +type redelegationParams = { + value: Redelegation, }; -type queryDelegatorValidatorsRequestParams = { - value: QueryDelegatorValidatorsRequest, +type msgCreateValidatorParams = { + value: MsgCreateValidator, }; type redelegationEntryResponseParams = { value: RedelegationEntryResponse, }; -type queryDelegatorValidatorResponseParams = { - value: QueryDelegatorValidatorResponse, +type queryPoolResponseParams = { + value: QueryPoolResponse, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type msgDelegateResponseParams = { + value: MsgDelegateResponse, }; -type msgCreateValidatorResponseParams = { - value: MsgCreateValidatorResponse, +type validatorParams = { + value: Validator, }; -type msgDelegateParams = { - value: MsgDelegate, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; -type redelegationEntryParams = { - value: RedelegationEntry, +type queryDelegatorDelegationsRequestParams = { + value: QueryDelegatorDelegationsRequest, }; -type queryValidatorsResponseParams = { - value: QueryValidatorsResponse, +type queryPoolRequestParams = { + value: QueryPoolRequest, }; -type queryValidatorsRequestParams = { - value: QueryValidatorsRequest, +type msgBeginRedelegateResponseParams = { + value: MsgBeginRedelegateResponse, }; -type queryValidatorRequestParams = { - value: QueryValidatorRequest, +type msgCancelUnbondingDelegationResponseParams = { + value: MsgCancelUnbondingDelegationResponse, }; -type queryValidatorUnbondingDelegationsRequestParams = { - value: QueryValidatorUnbondingDelegationsRequest, +type queryValidatorDelegationsResponseParams = { + value: QueryValidatorDelegationsResponse, }; -type queryDelegationResponseParams = { - value: QueryDelegationResponse, +type unbondingDelegationParams = { + value: UnbondingDelegation, }; -type historicalInfoParams = { - value: HistoricalInfo, +type dvpairsParams = { + value: DVPairs, }; @@ -778,773 +778,773 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgDelegateResponse({ value, fee, memo }: sendMsgDelegateResponseParams): Promise { + async sendMsgEditValidatorResponse({ value, fee, memo }: sendMsgEditValidatorResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDelegateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgEditValidatorResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDelegateResponse({ value: MsgDelegateResponse.fromPartial(value) }) + let msg = this.msgEditValidatorResponse({ value: MsgEditValidatorResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDelegateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgEditValidatorResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendLastValidatorPower({ value, fee, memo }: sendLastValidatorPowerParams): Promise { + async sendQueryDelegationRequest({ value, fee, memo }: sendQueryDelegationRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendLastValidatorPower: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegationRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.lastValidatorPower({ value: LastValidatorPower.fromPartial(value) }) + let msg = this.queryDelegationRequest({ value: QueryDelegationRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendLastValidatorPower: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegationRequest: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendQueryValidatorsResponse({ value, fee, memo }: sendQueryValidatorsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.queryValidatorsResponse({ value: QueryValidatorsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorUpdates({ value, fee, memo }: sendValidatorUpdatesParams): Promise { + async sendCommissionRates({ value, fee, memo }: sendCommissionRatesParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorUpdates: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCommissionRates: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorUpdates({ value: ValidatorUpdates.fromPartial(value) }) + let msg = this.commissionRates({ value: CommissionRates.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorUpdates: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCommissionRates: Could not broadcast Tx: '+ e.message) } }, - async sendDelegationResponse({ value, fee, memo }: sendDelegationResponseParams): Promise { + async sendRedelegationEntry({ value, fee, memo }: sendRedelegationEntryParams): Promise { if (!signer) { - throw new Error('TxClient:sendDelegationResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRedelegationEntry: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.delegationResponse({ value: DelegationResponse.fromPartial(value) }) + let msg = this.redelegationEntry({ value: RedelegationEntry.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDelegationResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRedelegationEntry: Could not broadcast Tx: '+ e.message) } }, - async sendQueryRedelegationsRequest({ value, fee, memo }: sendQueryRedelegationsRequestParams): Promise { + async sendMsgEditValidator({ value, fee, memo }: sendMsgEditValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryRedelegationsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgEditValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryRedelegationsRequest({ value: QueryRedelegationsRequest.fromPartial(value) }) + let msg = this.msgEditValidator({ value: MsgEditValidator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryRedelegationsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgEditValidator: Could not broadcast Tx: '+ e.message) } }, - async sendQueryHistoricalInfoRequest({ value, fee, memo }: sendQueryHistoricalInfoRequestParams): Promise { + async sendMsgUndelegate({ value, fee, memo }: sendMsgUndelegateParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryHistoricalInfoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUndelegate: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryHistoricalInfoRequest({ value: QueryHistoricalInfoRequest.fromPartial(value) }) + let msg = this.msgUndelegate({ value: MsgUndelegate.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryHistoricalInfoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUndelegate: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCancelUnbondingDelegation({ value, fee, memo }: sendMsgCancelUnbondingDelegationParams): Promise { + async sendDVPair({ value, fee, memo }: sendDVPairParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCancelUnbondingDelegation: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDVPair: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCancelUnbondingDelegation({ value: MsgCancelUnbondingDelegation.fromPartial(value) }) + let msg = this.dvpair({ value: DVPair.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCancelUnbondingDelegation: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDVPair: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegationRequest({ value, fee, memo }: sendQueryDelegationRequestParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegationRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegationRequest({ value: QueryDelegationRequest.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegationRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgEditValidatorResponse({ value, fee, memo }: sendMsgEditValidatorResponseParams): Promise { + async sendValidatorUpdates({ value, fee, memo }: sendValidatorUpdatesParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgEditValidatorResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorUpdates: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgEditValidatorResponse({ value: MsgEditValidatorResponse.fromPartial(value) }) + let msg = this.validatorUpdates({ value: ValidatorUpdates.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgEditValidatorResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorUpdates: Could not broadcast Tx: '+ e.message) } }, - async sendDescription({ value, fee, memo }: sendDescriptionParams): Promise { + async sendQueryValidatorRequest({ value, fee, memo }: sendQueryValidatorRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendDescription: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.description({ value: Description.fromPartial(value) }) + let msg = this.queryValidatorRequest({ value: QueryValidatorRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDescription: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorRequest: Could not broadcast Tx: '+ e.message) } }, - async sendCommission({ value, fee, memo }: sendCommissionParams): Promise { + async sendQueryValidatorDelegationsRequest({ value, fee, memo }: sendQueryValidatorDelegationsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendCommission: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorDelegationsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.commission({ value: Commission.fromPartial(value) }) + let msg = this.queryValidatorDelegationsRequest({ value: QueryValidatorDelegationsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCommission: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorDelegationsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendValAddresses({ value, fee, memo }: sendValAddressesParams): Promise { + async sendQueryDelegatorUnbondingDelegationsResponse({ value, fee, memo }: sendQueryDelegatorUnbondingDelegationsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendValAddresses: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorUnbondingDelegationsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.valAddresses({ value: ValAddresses.fromPartial(value) }) + let msg = this.queryDelegatorUnbondingDelegationsResponse({ value: QueryDelegatorUnbondingDelegationsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValAddresses: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorUnbondingDelegationsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendDVVTriplets({ value, fee, memo }: sendDVVTripletsParams): Promise { + async sendQueryRedelegationsRequest({ value, fee, memo }: sendQueryRedelegationsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendDVVTriplets: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryRedelegationsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.dvvtriplets({ value: DVVTriplets.fromPartial(value) }) + let msg = this.queryRedelegationsRequest({ value: QueryRedelegationsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDVVTriplets: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryRedelegationsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorUnbondingDelegationsRequest({ value, fee, memo }: sendQueryDelegatorUnbondingDelegationsRequestParams): Promise { + async sendQueryValidatorsRequest({ value, fee, memo }: sendQueryValidatorsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorUnbondingDelegationsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorUnbondingDelegationsRequest({ value: QueryDelegatorUnbondingDelegationsRequest.fromPartial(value) }) + let msg = this.queryValidatorsRequest({ value: QueryValidatorsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorUnbondingDelegationsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryRedelegationsResponse({ value, fee, memo }: sendQueryRedelegationsResponseParams): Promise { + async sendMsgUndelegateResponse({ value, fee, memo }: sendMsgUndelegateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryRedelegationsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUndelegateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryRedelegationsResponse({ value: QueryRedelegationsResponse.fromPartial(value) }) + let msg = this.msgUndelegateResponse({ value: MsgUndelegateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryRedelegationsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUndelegateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPoolRequest({ value, fee, memo }: sendQueryPoolRequestParams): Promise { + async sendMsgDelegate({ value, fee, memo }: sendMsgDelegateParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPoolRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDelegate: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPoolRequest({ value: QueryPoolRequest.fromPartial(value) }) + let msg = this.msgDelegate({ value: MsgDelegate.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPoolRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDelegate: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCancelUnbondingDelegationResponse({ value, fee, memo }: sendMsgCancelUnbondingDelegationResponseParams): Promise { + async sendQueryDelegatorValidatorsRequest({ value, fee, memo }: sendQueryDelegatorValidatorsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCancelUnbondingDelegationResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorValidatorsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCancelUnbondingDelegationResponse({ value: MsgCancelUnbondingDelegationResponse.fromPartial(value) }) + let msg = this.queryDelegatorValidatorsRequest({ value: QueryDelegatorValidatorsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCancelUnbondingDelegationResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorValidatorsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendPool({ value, fee, memo }: sendPoolParams): Promise { + async sendRedelegationResponse({ value, fee, memo }: sendRedelegationResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendPool: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRedelegationResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.pool({ value: Pool.fromPartial(value) }) + let msg = this.redelegationResponse({ value: RedelegationResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPool: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRedelegationResponse: Could not broadcast Tx: '+ e.message) } }, - async sendUnbondingDelegationEntry({ value, fee, memo }: sendUnbondingDelegationEntryParams): Promise { + async sendDVVTriplet({ value, fee, memo }: sendDVVTripletParams): Promise { if (!signer) { - throw new Error('TxClient:sendUnbondingDelegationEntry: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDVVTriplet: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.unbondingDelegationEntry({ value: UnbondingDelegationEntry.fromPartial(value) }) + let msg = this.dvvtriplet({ value: DVVTriplet.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendUnbondingDelegationEntry: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDVVTriplet: Could not broadcast Tx: '+ e.message) } }, - async sendMsgBeginRedelegateResponse({ value, fee, memo }: sendMsgBeginRedelegateResponseParams): Promise { + async sendStakeAuthorization({ value, fee, memo }: sendStakeAuthorizationParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgBeginRedelegateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendStakeAuthorization: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgBeginRedelegateResponse({ value: MsgBeginRedelegateResponse.fromPartial(value) }) + let msg = this.stakeAuthorization({ value: StakeAuthorization.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgBeginRedelegateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendStakeAuthorization: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUndelegateResponse({ value, fee, memo }: sendMsgUndelegateResponseParams): Promise { + async sendStakeAuthorization_Validators({ value, fee, memo }: sendStakeAuthorization_ValidatorsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUndelegateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendStakeAuthorization_Validators: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUndelegateResponse({ value: MsgUndelegateResponse.fromPartial(value) }) + let msg = this.stakeAuthorizationValidators({ value: StakeAuthorization_Validators.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUndelegateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendStakeAuthorization_Validators: Could not broadcast Tx: '+ e.message) } }, - async sendDVPair({ value, fee, memo }: sendDVPairParams): Promise { + async sendMsgBeginRedelegate({ value, fee, memo }: sendMsgBeginRedelegateParams): Promise { if (!signer) { - throw new Error('TxClient:sendDVPair: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgBeginRedelegate: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.dvpair({ value: DVPair.fromPartial(value) }) + let msg = this.msgBeginRedelegate({ value: MsgBeginRedelegate.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDVPair: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgBeginRedelegate: Could not broadcast Tx: '+ e.message) } }, - async sendDelegation({ value, fee, memo }: sendDelegationParams): Promise { + async sendLastValidatorPower({ value, fee, memo }: sendLastValidatorPowerParams): Promise { if (!signer) { - throw new Error('TxClient:sendDelegation: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendLastValidatorPower: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.delegation({ value: Delegation.fromPartial(value) }) + let msg = this.lastValidatorPower({ value: LastValidatorPower.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDelegation: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendLastValidatorPower: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorDelegationsRequest({ value, fee, memo }: sendQueryValidatorDelegationsRequestParams): Promise { + async sendQueryValidatorUnbondingDelegationsRequest({ value, fee, memo }: sendQueryValidatorUnbondingDelegationsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorDelegationsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorUnbondingDelegationsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorDelegationsRequest({ value: QueryValidatorDelegationsRequest.fromPartial(value) }) + let msg = this.queryValidatorUnbondingDelegationsRequest({ value: QueryValidatorUnbondingDelegationsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorDelegationsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorUnbondingDelegationsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorDelegationsResponse({ value, fee, memo }: sendQueryValidatorDelegationsResponseParams): Promise { + async sendHistoricalInfo({ value, fee, memo }: sendHistoricalInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorDelegationsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendHistoricalInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorDelegationsResponse({ value: QueryValidatorDelegationsResponse.fromPartial(value) }) + let msg = this.historicalInfo({ value: HistoricalInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorDelegationsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendHistoricalInfo: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorUnbondingDelegationsResponse({ value, fee, memo }: sendQueryValidatorUnbondingDelegationsResponseParams): Promise { + async sendValAddresses({ value, fee, memo }: sendValAddressesParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorUnbondingDelegationsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValAddresses: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorUnbondingDelegationsResponse({ value: QueryValidatorUnbondingDelegationsResponse.fromPartial(value) }) + let msg = this.valAddresses({ value: ValAddresses.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorUnbondingDelegationsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValAddresses: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorDelegationsRequest({ value, fee, memo }: sendQueryDelegatorDelegationsRequestParams): Promise { + async sendPool({ value, fee, memo }: sendPoolParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorDelegationsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPool: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorDelegationsRequest({ value: QueryDelegatorDelegationsRequest.fromPartial(value) }) + let msg = this.pool({ value: Pool.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorDelegationsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPool: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorValidatorRequest({ value, fee, memo }: sendQueryDelegatorValidatorRequestParams): Promise { + async sendQueryUnbondingDelegationRequest({ value, fee, memo }: sendQueryUnbondingDelegationRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorValidatorRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUnbondingDelegationRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorValidatorRequest({ value: QueryDelegatorValidatorRequest.fromPartial(value) }) + let msg = this.queryUnbondingDelegationRequest({ value: QueryUnbondingDelegationRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorValidatorRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUnbondingDelegationRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryHistoricalInfoResponse({ value, fee, memo }: sendQueryHistoricalInfoResponseParams): Promise { + async sendMsgCreateValidatorResponse({ value, fee, memo }: sendMsgCreateValidatorResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryHistoricalInfoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateValidatorResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryHistoricalInfoResponse({ value: QueryHistoricalInfoResponse.fromPartial(value) }) + let msg = this.msgCreateValidatorResponse({ value: MsgCreateValidatorResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryHistoricalInfoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateValidatorResponse: Could not broadcast Tx: '+ e.message) } }, - async sendRedelegation({ value, fee, memo }: sendRedelegationParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendRedelegation: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.redelegation({ value: Redelegation.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendRedelegation: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendRedelegationResponse({ value, fee, memo }: sendRedelegationResponseParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendRedelegationResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.redelegationResponse({ value: RedelegationResponse.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendRedelegationResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorDelegationsResponse({ value, fee, memo }: sendQueryDelegatorDelegationsResponseParams): Promise { + async sendQueryDelegationResponse({ value, fee, memo }: sendQueryDelegationResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorDelegationsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegationResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorDelegationsResponse({ value: QueryDelegatorDelegationsResponse.fromPartial(value) }) + let msg = this.queryDelegationResponse({ value: QueryDelegationResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorDelegationsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegationResponse: Could not broadcast Tx: '+ e.message) } }, - async sendDVVTriplet({ value, fee, memo }: sendDVVTripletParams): Promise { + async sendQueryDelegatorValidatorRequest({ value, fee, memo }: sendQueryDelegatorValidatorRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendDVVTriplet: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorValidatorRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.dvvtriplet({ value: DVVTriplet.fromPartial(value) }) + let msg = this.queryDelegatorValidatorRequest({ value: QueryDelegatorValidatorRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDVVTriplet: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorValidatorRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgBeginRedelegate({ value, fee, memo }: sendMsgBeginRedelegateParams): Promise { + async sendQueryHistoricalInfoRequest({ value, fee, memo }: sendQueryHistoricalInfoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgBeginRedelegate: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryHistoricalInfoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgBeginRedelegate({ value: MsgBeginRedelegate.fromPartial(value) }) + let msg = this.queryHistoricalInfoRequest({ value: QueryHistoricalInfoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgBeginRedelegate: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryHistoricalInfoRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendQueryHistoricalInfoResponse({ value, fee, memo }: sendQueryHistoricalInfoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryHistoricalInfoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.queryHistoricalInfoResponse({ value: QueryHistoricalInfoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryHistoricalInfoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendUnbondingDelegationEntry({ value, fee, memo }: sendUnbondingDelegationEntryParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendUnbondingDelegationEntry: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.unbondingDelegationEntry({ value: UnbondingDelegationEntry.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendUnbondingDelegationEntry: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorResponse({ value, fee, memo }: sendQueryValidatorResponseParams): Promise { + async sendMsgCancelUnbondingDelegation({ value, fee, memo }: sendMsgCancelUnbondingDelegationParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCancelUnbondingDelegation: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorResponse({ value: QueryValidatorResponse.fromPartial(value) }) + let msg = this.msgCancelUnbondingDelegation({ value: MsgCancelUnbondingDelegation.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCancelUnbondingDelegation: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUnbondingDelegationRequest({ value, fee, memo }: sendQueryUnbondingDelegationRequestParams): Promise { + async sendQueryDelegatorUnbondingDelegationsRequest({ value, fee, memo }: sendQueryDelegatorUnbondingDelegationsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUnbondingDelegationRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorUnbondingDelegationsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUnbondingDelegationRequest({ value: QueryUnbondingDelegationRequest.fromPartial(value) }) + let msg = this.queryDelegatorUnbondingDelegationsRequest({ value: QueryDelegatorUnbondingDelegationsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUnbondingDelegationRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorUnbondingDelegationsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorUnbondingDelegationsResponse({ value, fee, memo }: sendQueryDelegatorUnbondingDelegationsResponseParams): Promise { + async sendDelegation({ value, fee, memo }: sendDelegationParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorUnbondingDelegationsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDelegation: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorUnbondingDelegationsResponse({ value: QueryDelegatorUnbondingDelegationsResponse.fromPartial(value) }) + let msg = this.delegation({ value: Delegation.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorUnbondingDelegationsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDelegation: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorValidatorsResponse({ value, fee, memo }: sendQueryDelegatorValidatorsResponseParams): Promise { + async sendDVVTriplets({ value, fee, memo }: sendDVVTripletsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorValidatorsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDVVTriplets: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorValidatorsResponse({ value: QueryDelegatorValidatorsResponse.fromPartial(value) }) + let msg = this.dvvtriplets({ value: DVVTriplets.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorValidatorsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDVVTriplets: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateValidator({ value, fee, memo }: sendMsgCreateValidatorParams): Promise { + async sendQueryDelegatorValidatorsResponse({ value, fee, memo }: sendQueryDelegatorValidatorsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateValidator: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorValidatorsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateValidator({ value: MsgCreateValidator.fromPartial(value) }) + let msg = this.queryDelegatorValidatorsResponse({ value: QueryDelegatorValidatorsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateValidator: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorValidatorsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUndelegate({ value, fee, memo }: sendMsgUndelegateParams): Promise { + async sendQueryValidatorUnbondingDelegationsResponse({ value, fee, memo }: sendQueryValidatorUnbondingDelegationsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUndelegate: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorUnbondingDelegationsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUndelegate({ value: MsgUndelegate.fromPartial(value) }) + let msg = this.queryValidatorUnbondingDelegationsResponse({ value: QueryValidatorUnbondingDelegationsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUndelegate: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorUnbondingDelegationsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendQueryDelegatorValidatorResponse({ value, fee, memo }: sendQueryDelegatorValidatorResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorValidatorResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.queryDelegatorValidatorResponse({ value: QueryDelegatorValidatorResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorValidatorResponse: Could not broadcast Tx: '+ e.message) } }, - async sendUnbondingDelegation({ value, fee, memo }: sendUnbondingDelegationParams): Promise { + async sendCommission({ value, fee, memo }: sendCommissionParams): Promise { if (!signer) { - throw new Error('TxClient:sendUnbondingDelegation: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCommission: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.unbondingDelegation({ value: UnbondingDelegation.fromPartial(value) }) + let msg = this.commission({ value: Commission.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendUnbondingDelegation: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCommission: Could not broadcast Tx: '+ e.message) } }, - async sendStakeAuthorization_Validators({ value, fee, memo }: sendStakeAuthorization_ValidatorsParams): Promise { + async sendDelegationResponse({ value, fee, memo }: sendDelegationResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendStakeAuthorization_Validators: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDelegationResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.stakeAuthorizationValidators({ value: StakeAuthorization_Validators.fromPartial(value) }) + let msg = this.delegationResponse({ value: DelegationResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendStakeAuthorization_Validators: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDelegationResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPoolResponse({ value, fee, memo }: sendQueryPoolResponseParams): Promise { + async sendDescription({ value, fee, memo }: sendDescriptionParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPoolResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDescription: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPoolResponse({ value: QueryPoolResponse.fromPartial(value) }) + let msg = this.description({ value: Description.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPoolResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDescription: Could not broadcast Tx: '+ e.message) } }, - async sendMsgEditValidator({ value, fee, memo }: sendMsgEditValidatorParams): Promise { + async sendQueryValidatorResponse({ value, fee, memo }: sendQueryValidatorResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgEditValidator: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgEditValidator({ value: MsgEditValidator.fromPartial(value) }) + let msg = this.queryValidatorResponse({ value: QueryValidatorResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgEditValidator: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorResponse: Could not broadcast Tx: '+ e.message) } }, - async sendValidator({ value, fee, memo }: sendValidatorParams): Promise { + async sendQueryDelegatorDelegationsResponse({ value, fee, memo }: sendQueryDelegatorDelegationsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidator: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorDelegationsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validator({ value: Validator.fromPartial(value) }) + let msg = this.queryDelegatorDelegationsResponse({ value: QueryDelegatorDelegationsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidator: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorDelegationsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendCommissionRates({ value, fee, memo }: sendCommissionRatesParams): Promise { + async sendQueryRedelegationsResponse({ value, fee, memo }: sendQueryRedelegationsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendCommissionRates: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryRedelegationsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.commissionRates({ value: CommissionRates.fromPartial(value) }) + let msg = this.queryRedelegationsResponse({ value: QueryRedelegationsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCommissionRates: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryRedelegationsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendDVPairs({ value, fee, memo }: sendDVPairsParams): Promise { + async sendQueryUnbondingDelegationResponse({ value, fee, memo }: sendQueryUnbondingDelegationResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendDVPairs: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUnbondingDelegationResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.dvpairs({ value: DVPairs.fromPartial(value) }) + let msg = this.queryUnbondingDelegationResponse({ value: QueryUnbondingDelegationResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDVPairs: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUnbondingDelegationResponse: Could not broadcast Tx: '+ e.message) } }, - async sendStakeAuthorization({ value, fee, memo }: sendStakeAuthorizationParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendStakeAuthorization: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.stakeAuthorization({ value: StakeAuthorization.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendStakeAuthorization: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUnbondingDelegationResponse({ value, fee, memo }: sendQueryUnbondingDelegationResponseParams): Promise { + async sendRedelegation({ value, fee, memo }: sendRedelegationParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUnbondingDelegationResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRedelegation: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUnbondingDelegationResponse({ value: QueryUnbondingDelegationResponse.fromPartial(value) }) + let msg = this.redelegation({ value: Redelegation.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUnbondingDelegationResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRedelegation: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegatorValidatorsRequest({ value, fee, memo }: sendQueryDelegatorValidatorsRequestParams): Promise { + async sendMsgCreateValidator({ value, fee, memo }: sendMsgCreateValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorValidatorsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorValidatorsRequest({ value: QueryDelegatorValidatorsRequest.fromPartial(value) }) + let msg = this.msgCreateValidator({ value: MsgCreateValidator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorValidatorsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateValidator: Could not broadcast Tx: '+ e.message) } }, @@ -1562,486 +1562,494 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryDelegatorValidatorResponse({ value, fee, memo }: sendQueryDelegatorValidatorResponseParams): Promise { + async sendQueryPoolResponse({ value, fee, memo }: sendQueryPoolResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegatorValidatorResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPoolResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegatorValidatorResponse({ value: QueryDelegatorValidatorResponse.fromPartial(value) }) + let msg = this.queryPoolResponse({ value: QueryPoolResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegatorValidatorResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPoolResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendMsgDelegateResponse({ value, fee, memo }: sendMsgDelegateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDelegateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.msgDelegateResponse({ value: MsgDelegateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDelegateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateValidatorResponse({ value, fee, memo }: sendMsgCreateValidatorResponseParams): Promise { + async sendValidator({ value, fee, memo }: sendValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateValidatorResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateValidatorResponse({ value: MsgCreateValidatorResponse.fromPartial(value) }) + let msg = this.validator({ value: Validator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateValidatorResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidator: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDelegate({ value, fee, memo }: sendMsgDelegateParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDelegate: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDelegate({ value: MsgDelegate.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDelegate: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendRedelegationEntry({ value, fee, memo }: sendRedelegationEntryParams): Promise { + async sendQueryDelegatorDelegationsRequest({ value, fee, memo }: sendQueryDelegatorDelegationsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendRedelegationEntry: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDelegatorDelegationsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.redelegationEntry({ value: RedelegationEntry.fromPartial(value) }) + let msg = this.queryDelegatorDelegationsRequest({ value: QueryDelegatorDelegationsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendRedelegationEntry: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDelegatorDelegationsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorsResponse({ value, fee, memo }: sendQueryValidatorsResponseParams): Promise { + async sendQueryPoolRequest({ value, fee, memo }: sendQueryPoolRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPoolRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorsResponse({ value: QueryValidatorsResponse.fromPartial(value) }) + let msg = this.queryPoolRequest({ value: QueryPoolRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPoolRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorsRequest({ value, fee, memo }: sendQueryValidatorsRequestParams): Promise { + async sendMsgBeginRedelegateResponse({ value, fee, memo }: sendMsgBeginRedelegateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgBeginRedelegateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorsRequest({ value: QueryValidatorsRequest.fromPartial(value) }) + let msg = this.msgBeginRedelegateResponse({ value: MsgBeginRedelegateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgBeginRedelegateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorRequest({ value, fee, memo }: sendQueryValidatorRequestParams): Promise { + async sendMsgCancelUnbondingDelegationResponse({ value, fee, memo }: sendMsgCancelUnbondingDelegationResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCancelUnbondingDelegationResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorRequest({ value: QueryValidatorRequest.fromPartial(value) }) + let msg = this.msgCancelUnbondingDelegationResponse({ value: MsgCancelUnbondingDelegationResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCancelUnbondingDelegationResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryValidatorUnbondingDelegationsRequest({ value, fee, memo }: sendQueryValidatorUnbondingDelegationsRequestParams): Promise { + async sendQueryValidatorDelegationsResponse({ value, fee, memo }: sendQueryValidatorDelegationsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryValidatorUnbondingDelegationsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorDelegationsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryValidatorUnbondingDelegationsRequest({ value: QueryValidatorUnbondingDelegationsRequest.fromPartial(value) }) + let msg = this.queryValidatorDelegationsResponse({ value: QueryValidatorDelegationsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryValidatorUnbondingDelegationsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorDelegationsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDelegationResponse({ value, fee, memo }: sendQueryDelegationResponseParams): Promise { + async sendUnbondingDelegation({ value, fee, memo }: sendUnbondingDelegationParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDelegationResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendUnbondingDelegation: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDelegationResponse({ value: QueryDelegationResponse.fromPartial(value) }) + let msg = this.unbondingDelegation({ value: UnbondingDelegation.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDelegationResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendUnbondingDelegation: Could not broadcast Tx: '+ e.message) } }, - async sendHistoricalInfo({ value, fee, memo }: sendHistoricalInfoParams): Promise { + async sendDVPairs({ value, fee, memo }: sendDVPairsParams): Promise { if (!signer) { - throw new Error('TxClient:sendHistoricalInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDVPairs: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.historicalInfo({ value: HistoricalInfo.fromPartial(value) }) + let msg = this.dvpairs({ value: DVPairs.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendHistoricalInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDVPairs: Could not broadcast Tx: '+ e.message) } }, - msgDelegateResponse({ value }: msgDelegateResponseParams): EncodeObject { + msgEditValidatorResponse({ value }: msgEditValidatorResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", value: MsgDelegateResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", value: MsgEditValidatorResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDelegateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgEditValidatorResponse: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - lastValidatorPower({ value }: lastValidatorPowerParams): EncodeObject { + queryDelegationRequest({ value }: queryDelegationRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", value: LastValidatorPower.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", value: QueryDelegationRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:LastValidatorPower: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegationRequest: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + queryValidatorsResponse({ value }: queryValidatorsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", value: QueryValidatorsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorsResponse: Could not create message: ' + e.message) } }, - validatorUpdates({ value }: validatorUpdatesParams): EncodeObject { + commissionRates({ value }: commissionRatesParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates", value: ValidatorUpdates.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.CommissionRates", value: CommissionRates.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorUpdates: Could not create message: ' + e.message) + throw new Error('TxClient:CommissionRates: Could not create message: ' + e.message) } }, - delegationResponse({ value }: delegationResponseParams): EncodeObject { + redelegationEntry({ value }: redelegationEntryParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", value: DelegationResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", value: RedelegationEntry.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DelegationResponse: Could not create message: ' + e.message) + throw new Error('TxClient:RedelegationEntry: Could not create message: ' + e.message) } }, - queryRedelegationsRequest({ value }: queryRedelegationsRequestParams): EncodeObject { + msgEditValidator({ value }: msgEditValidatorParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", value: QueryRedelegationsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: MsgEditValidator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryRedelegationsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgEditValidator: Could not create message: ' + e.message) } }, - queryHistoricalInfoRequest({ value }: queryHistoricalInfoRequestParams): EncodeObject { + msgUndelegate({ value }: msgUndelegateParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", value: QueryHistoricalInfoRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: MsgUndelegate.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryHistoricalInfoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUndelegate: Could not create message: ' + e.message) } }, - msgCancelUnbondingDelegation({ value }: msgCancelUnbondingDelegationParams): EncodeObject { + dvpair({ value }: dvpairParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", value: MsgCancelUnbondingDelegation.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.DVPair", value: DVPair.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCancelUnbondingDelegation: Could not create message: ' + e.message) + throw new Error('TxClient:DVPair: Could not create message: ' + e.message) } }, - queryDelegationRequest({ value }: queryDelegationRequestParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", value: QueryDelegationRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegationRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - msgEditValidatorResponse({ value }: msgEditValidatorResponseParams): EncodeObject { + validatorUpdates({ value }: validatorUpdatesParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", value: MsgEditValidatorResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates", value: ValidatorUpdates.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgEditValidatorResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorUpdates: Could not create message: ' + e.message) } }, - description({ value }: descriptionParams): EncodeObject { + queryValidatorRequest({ value }: queryValidatorRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.Description", value: Description.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", value: QueryValidatorRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Description: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorRequest: Could not create message: ' + e.message) } }, - commission({ value }: commissionParams): EncodeObject { + queryValidatorDelegationsRequest({ value }: queryValidatorDelegationsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.Commission", value: Commission.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", value: QueryValidatorDelegationsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Commission: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorDelegationsRequest: Could not create message: ' + e.message) } }, - valAddresses({ value }: valAddressesParams): EncodeObject { + queryDelegatorUnbondingDelegationsResponse({ value }: queryDelegatorUnbondingDelegationsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.ValAddresses", value: ValAddresses.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", value: QueryDelegatorUnbondingDelegationsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValAddresses: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorUnbondingDelegationsResponse: Could not create message: ' + e.message) } }, - dvvtriplets({ value }: dvvtripletsParams): EncodeObject { + queryRedelegationsRequest({ value }: queryRedelegationsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", value: DVVTriplets.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", value: QueryRedelegationsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DVVTriplets: Could not create message: ' + e.message) + throw new Error('TxClient:QueryRedelegationsRequest: Could not create message: ' + e.message) } }, - queryDelegatorUnbondingDelegationsRequest({ value }: queryDelegatorUnbondingDelegationsRequestParams): EncodeObject { + queryValidatorsRequest({ value }: queryValidatorsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", value: QueryDelegatorUnbondingDelegationsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", value: QueryValidatorsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorUnbondingDelegationsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorsRequest: Could not create message: ' + e.message) } }, - queryRedelegationsResponse({ value }: queryRedelegationsResponseParams): EncodeObject { + msgUndelegateResponse({ value }: msgUndelegateResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", value: QueryRedelegationsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", value: MsgUndelegateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryRedelegationsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUndelegateResponse: Could not create message: ' + e.message) } }, - queryPoolRequest({ value }: queryPoolRequestParams): EncodeObject { + msgDelegate({ value }: msgDelegateParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", value: QueryPoolRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPoolRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDelegate: Could not create message: ' + e.message) } }, - msgCancelUnbondingDelegationResponse({ value }: msgCancelUnbondingDelegationResponseParams): EncodeObject { + queryDelegatorValidatorsRequest({ value }: queryDelegatorValidatorsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", value: MsgCancelUnbondingDelegationResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", value: QueryDelegatorValidatorsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCancelUnbondingDelegationResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorValidatorsRequest: Could not create message: ' + e.message) } }, - pool({ value }: poolParams): EncodeObject { + redelegationResponse({ value }: redelegationResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.Pool", value: Pool.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", value: RedelegationResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Pool: Could not create message: ' + e.message) + throw new Error('TxClient:RedelegationResponse: Could not create message: ' + e.message) } }, - unbondingDelegationEntry({ value }: unbondingDelegationEntryParams): EncodeObject { + dvvtriplet({ value }: dvvtripletParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", value: UnbondingDelegationEntry.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", value: DVVTriplet.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:UnbondingDelegationEntry: Could not create message: ' + e.message) + throw new Error('TxClient:DVVTriplet: Could not create message: ' + e.message) } }, - msgBeginRedelegateResponse({ value }: msgBeginRedelegateResponseParams): EncodeObject { + stakeAuthorization({ value }: stakeAuthorizationParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", value: MsgBeginRedelegateResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", value: StakeAuthorization.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgBeginRedelegateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:StakeAuthorization: Could not create message: ' + e.message) } }, - msgUndelegateResponse({ value }: msgUndelegateResponseParams): EncodeObject { + stakeAuthorizationValidators({ value }: stakeAuthorizationValidatorsParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", value: MsgUndelegateResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization_Validators", value: StakeAuthorization_Validators.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:StakeAuthorization_Validators: Could not create message: ' + e.message) + } + }, + + msgBeginRedelegate({ value }: msgBeginRedelegateParams): EncodeObject { + try { + return { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: MsgBeginRedelegate.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUndelegateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgBeginRedelegate: Could not create message: ' + e.message) } }, - dvpair({ value }: dvpairParams): EncodeObject { + lastValidatorPower({ value }: lastValidatorPowerParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.DVPair", value: DVPair.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", value: LastValidatorPower.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DVPair: Could not create message: ' + e.message) + throw new Error('TxClient:LastValidatorPower: Could not create message: ' + e.message) } }, - delegation({ value }: delegationParams): EncodeObject { + queryValidatorUnbondingDelegationsRequest({ value }: queryValidatorUnbondingDelegationsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.Delegation", value: Delegation.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", value: QueryValidatorUnbondingDelegationsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Delegation: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorUnbondingDelegationsRequest: Could not create message: ' + e.message) } }, - queryValidatorDelegationsRequest({ value }: queryValidatorDelegationsRequestParams): EncodeObject { + historicalInfo({ value }: historicalInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", value: QueryValidatorDelegationsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", value: HistoricalInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorDelegationsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:HistoricalInfo: Could not create message: ' + e.message) } }, - queryValidatorDelegationsResponse({ value }: queryValidatorDelegationsResponseParams): EncodeObject { + valAddresses({ value }: valAddressesParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", value: QueryValidatorDelegationsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.ValAddresses", value: ValAddresses.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorDelegationsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ValAddresses: Could not create message: ' + e.message) } }, - queryValidatorUnbondingDelegationsResponse({ value }: queryValidatorUnbondingDelegationsResponseParams): EncodeObject { + pool({ value }: poolParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", value: QueryValidatorUnbondingDelegationsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.Pool", value: Pool.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorUnbondingDelegationsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Pool: Could not create message: ' + e.message) } }, - queryDelegatorDelegationsRequest({ value }: queryDelegatorDelegationsRequestParams): EncodeObject { + queryUnbondingDelegationRequest({ value }: queryUnbondingDelegationRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", value: QueryDelegatorDelegationsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", value: QueryUnbondingDelegationRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorDelegationsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUnbondingDelegationRequest: Could not create message: ' + e.message) } }, - queryDelegatorValidatorRequest({ value }: queryDelegatorValidatorRequestParams): EncodeObject { + msgCreateValidatorResponse({ value }: msgCreateValidatorResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", value: QueryDelegatorValidatorRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", value: MsgCreateValidatorResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorValidatorRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateValidatorResponse: Could not create message: ' + e.message) } }, - queryHistoricalInfoResponse({ value }: queryHistoricalInfoResponseParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", value: QueryHistoricalInfoResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryHistoricalInfoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - redelegation({ value }: redelegationParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.Redelegation", value: Redelegation.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Redelegation: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - redelegationResponse({ value }: redelegationResponseParams): EncodeObject { + queryDelegationResponse({ value }: queryDelegationResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", value: RedelegationResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", value: QueryDelegationResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:RedelegationResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegationResponse: Could not create message: ' + e.message) } }, - queryDelegatorDelegationsResponse({ value }: queryDelegatorDelegationsResponseParams): EncodeObject { + queryDelegatorValidatorRequest({ value }: queryDelegatorValidatorRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", value: QueryDelegatorDelegationsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", value: QueryDelegatorValidatorRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorDelegationsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorValidatorRequest: Could not create message: ' + e.message) } }, - dvvtriplet({ value }: dvvtripletParams): EncodeObject { + queryHistoricalInfoRequest({ value }: queryHistoricalInfoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", value: DVVTriplet.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", value: QueryHistoricalInfoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DVVTriplet: Could not create message: ' + e.message) + throw new Error('TxClient:QueryHistoricalInfoRequest: Could not create message: ' + e.message) } }, - msgBeginRedelegate({ value }: msgBeginRedelegateParams): EncodeObject { + queryHistoricalInfoResponse({ value }: queryHistoricalInfoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: MsgBeginRedelegate.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", value: QueryHistoricalInfoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgBeginRedelegate: Could not create message: ' + e.message) + throw new Error('TxClient:QueryHistoricalInfoResponse: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + unbondingDelegationEntry({ value }: unbondingDelegationEntryParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", value: UnbondingDelegationEntry.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:UnbondingDelegationEntry: Could not create message: ' + e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + msgCancelUnbondingDelegation({ value }: msgCancelUnbondingDelegationParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", value: MsgCancelUnbondingDelegation.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCancelUnbondingDelegation: Could not create message: ' + e.message) } }, - queryValidatorResponse({ value }: queryValidatorResponseParams): EncodeObject { + queryDelegatorUnbondingDelegationsRequest({ value }: queryDelegatorUnbondingDelegationsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", value: QueryValidatorResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", value: QueryDelegatorUnbondingDelegationsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorUnbondingDelegationsRequest: Could not create message: ' + e.message) } }, - queryUnbondingDelegationRequest({ value }: queryUnbondingDelegationRequestParams): EncodeObject { + delegation({ value }: delegationParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", value: QueryUnbondingDelegationRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.Delegation", value: Delegation.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUnbondingDelegationRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Delegation: Could not create message: ' + e.message) } }, - queryDelegatorUnbondingDelegationsResponse({ value }: queryDelegatorUnbondingDelegationsResponseParams): EncodeObject { + dvvtriplets({ value }: dvvtripletsParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", value: QueryDelegatorUnbondingDelegationsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", value: DVVTriplets.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorUnbondingDelegationsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:DVVTriplets: Could not create message: ' + e.message) } }, @@ -2053,107 +2061,99 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgCreateValidator({ value }: msgCreateValidatorParams): EncodeObject { - try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: MsgCreateValidator.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgCreateValidator: Could not create message: ' + e.message) - } - }, - - msgUndelegate({ value }: msgUndelegateParams): EncodeObject { + queryValidatorUnbondingDelegationsResponse({ value }: queryValidatorUnbondingDelegationsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: MsgUndelegate.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", value: QueryValidatorUnbondingDelegationsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUndelegate: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorUnbondingDelegationsResponse: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + queryDelegatorValidatorResponse({ value }: queryDelegatorValidatorResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", value: QueryDelegatorValidatorResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorValidatorResponse: Could not create message: ' + e.message) } }, - unbondingDelegation({ value }: unbondingDelegationParams): EncodeObject { + commission({ value }: commissionParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", value: UnbondingDelegation.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.Commission", value: Commission.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:UnbondingDelegation: Could not create message: ' + e.message) + throw new Error('TxClient:Commission: Could not create message: ' + e.message) } }, - stakeAuthorizationValidators({ value }: stakeAuthorizationValidatorsParams): EncodeObject { + delegationResponse({ value }: delegationResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization_Validators", value: StakeAuthorization_Validators.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", value: DelegationResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:StakeAuthorization_Validators: Could not create message: ' + e.message) + throw new Error('TxClient:DelegationResponse: Could not create message: ' + e.message) } }, - queryPoolResponse({ value }: queryPoolResponseParams): EncodeObject { + description({ value }: descriptionParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", value: QueryPoolResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.Description", value: Description.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPoolResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Description: Could not create message: ' + e.message) } }, - msgEditValidator({ value }: msgEditValidatorParams): EncodeObject { + queryValidatorResponse({ value }: queryValidatorResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: MsgEditValidator.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", value: QueryValidatorResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgEditValidator: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorResponse: Could not create message: ' + e.message) } }, - validator({ value }: validatorParams): EncodeObject { + queryDelegatorDelegationsResponse({ value }: queryDelegatorDelegationsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.Validator", value: Validator.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", value: QueryDelegatorDelegationsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Validator: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorDelegationsResponse: Could not create message: ' + e.message) } }, - commissionRates({ value }: commissionRatesParams): EncodeObject { + queryRedelegationsResponse({ value }: queryRedelegationsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.CommissionRates", value: CommissionRates.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", value: QueryRedelegationsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:CommissionRates: Could not create message: ' + e.message) + throw new Error('TxClient:QueryRedelegationsResponse: Could not create message: ' + e.message) } }, - dvpairs({ value }: dvpairsParams): EncodeObject { + queryUnbondingDelegationResponse({ value }: queryUnbondingDelegationResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.DVPairs", value: DVPairs.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", value: QueryUnbondingDelegationResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DVPairs: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUnbondingDelegationResponse: Could not create message: ' + e.message) } }, - stakeAuthorization({ value }: stakeAuthorizationParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", value: StakeAuthorization.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:StakeAuthorization: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - queryUnbondingDelegationResponse({ value }: queryUnbondingDelegationResponseParams): EncodeObject { + redelegation({ value }: redelegationParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", value: QueryUnbondingDelegationResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.Redelegation", value: Redelegation.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUnbondingDelegationResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Redelegation: Could not create message: ' + e.message) } }, - queryDelegatorValidatorsRequest({ value }: queryDelegatorValidatorsRequestParams): EncodeObject { + msgCreateValidator({ value }: msgCreateValidatorParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", value: QueryDelegatorValidatorsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: MsgCreateValidator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorValidatorsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateValidator: Could not create message: ' + e.message) } }, @@ -2165,91 +2165,91 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryDelegatorValidatorResponse({ value }: queryDelegatorValidatorResponseParams): EncodeObject { + queryPoolResponse({ value }: queryPoolResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", value: QueryDelegatorValidatorResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", value: QueryPoolResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegatorValidatorResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPoolResponse: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + msgDelegateResponse({ value }: msgDelegateResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", value: MsgDelegateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDelegateResponse: Could not create message: ' + e.message) } }, - msgCreateValidatorResponse({ value }: msgCreateValidatorResponseParams): EncodeObject { + validator({ value }: validatorParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", value: MsgCreateValidatorResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.Validator", value: Validator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateValidatorResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Validator: Could not create message: ' + e.message) } }, - msgDelegate({ value }: msgDelegateParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDelegate: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - redelegationEntry({ value }: redelegationEntryParams): EncodeObject { + queryDelegatorDelegationsRequest({ value }: queryDelegatorDelegationsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", value: RedelegationEntry.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", value: QueryDelegatorDelegationsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:RedelegationEntry: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDelegatorDelegationsRequest: Could not create message: ' + e.message) } }, - queryValidatorsResponse({ value }: queryValidatorsResponseParams): EncodeObject { + queryPoolRequest({ value }: queryPoolRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", value: QueryValidatorsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", value: QueryPoolRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPoolRequest: Could not create message: ' + e.message) } }, - queryValidatorsRequest({ value }: queryValidatorsRequestParams): EncodeObject { + msgBeginRedelegateResponse({ value }: msgBeginRedelegateResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", value: QueryValidatorsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", value: MsgBeginRedelegateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgBeginRedelegateResponse: Could not create message: ' + e.message) } }, - queryValidatorRequest({ value }: queryValidatorRequestParams): EncodeObject { + msgCancelUnbondingDelegationResponse({ value }: msgCancelUnbondingDelegationResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", value: QueryValidatorRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", value: MsgCancelUnbondingDelegationResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCancelUnbondingDelegationResponse: Could not create message: ' + e.message) } }, - queryValidatorUnbondingDelegationsRequest({ value }: queryValidatorUnbondingDelegationsRequestParams): EncodeObject { + queryValidatorDelegationsResponse({ value }: queryValidatorDelegationsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", value: QueryValidatorUnbondingDelegationsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", value: QueryValidatorDelegationsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryValidatorUnbondingDelegationsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorDelegationsResponse: Could not create message: ' + e.message) } }, - queryDelegationResponse({ value }: queryDelegationResponseParams): EncodeObject { + unbondingDelegation({ value }: unbondingDelegationParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", value: QueryDelegationResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", value: UnbondingDelegation.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDelegationResponse: Could not create message: ' + e.message) + throw new Error('TxClient:UnbondingDelegation: Could not create message: ' + e.message) } }, - historicalInfo({ value }: historicalInfoParams): EncodeObject { + dvpairs({ value }: dvpairsParams): EncodeObject { try { - return { typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", value: HistoricalInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.staking.v1beta1.DVPairs", value: DVPairs.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:HistoricalInfo: Could not create message: ' + e.message) + throw new Error('TxClient:DVPairs: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.staking.v1beta1/registry.ts b/ts-client/cosmos.staking.v1beta1/registry.ts index 55d17565..305db057 100755 --- a/ts-client/cosmos.staking.v1beta1/registry.ts +++ b/ts-client/cosmos.staking.v1beta1/registry.ts @@ -1,140 +1,140 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgDelegateResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { GenesisState } from "./types/cosmos/staking/v1beta1/genesis"; -import { LastValidatorPower } from "./types/cosmos/staking/v1beta1/genesis"; -import { Params } from "./types/cosmos/staking/v1beta1/staking"; -import { ValidatorUpdates } from "./types/cosmos/staking/v1beta1/staking"; -import { DelegationResponse } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryRedelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryHistoricalInfoRequest } from "./types/cosmos/staking/v1beta1/query"; -import { MsgCancelUnbondingDelegation } from "./types/cosmos/staking/v1beta1/tx"; -import { QueryDelegationRequest } from "./types/cosmos/staking/v1beta1/query"; -import { MsgEditValidatorResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { Description } from "./types/cosmos/staking/v1beta1/staking"; -import { Commission } from "./types/cosmos/staking/v1beta1/staking"; -import { ValAddresses } from "./types/cosmos/staking/v1beta1/staking"; -import { DVVTriplets } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryDelegatorUnbondingDelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryRedelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryPoolRequest } from "./types/cosmos/staking/v1beta1/query"; -import { MsgCancelUnbondingDelegationResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { Pool } from "./types/cosmos/staking/v1beta1/staking"; -import { UnbondingDelegationEntry } from "./types/cosmos/staking/v1beta1/staking"; -import { MsgBeginRedelegateResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUndelegateResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { DVPair } from "./types/cosmos/staking/v1beta1/staking"; -import { Delegation } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryValidatorDelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorDelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorUnbondingDelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorDelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorValidatorRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryHistoricalInfoResponse } from "./types/cosmos/staking/v1beta1/query"; -import { Redelegation } from "./types/cosmos/staking/v1beta1/staking"; -import { RedelegationResponse } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryDelegatorDelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { DVVTriplet } from "./types/cosmos/staking/v1beta1/staking"; -import { MsgBeginRedelegate } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUpdateParams } from "./types/cosmos/staking/v1beta1/tx"; -import { QueryParamsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryUnbondingDelegationRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorUnbondingDelegationsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorValidatorsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { MsgCreateValidator } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUndelegate } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUpdateParamsResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { UnbondingDelegation } from "./types/cosmos/staking/v1beta1/staking"; -import { StakeAuthorization_Validators } from "./types/cosmos/staking/v1beta1/authz"; -import { QueryPoolResponse } from "./types/cosmos/staking/v1beta1/query"; -import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx"; -import { Validator } from "./types/cosmos/staking/v1beta1/staking"; -import { CommissionRates } from "./types/cosmos/staking/v1beta1/staking"; -import { DVPairs } from "./types/cosmos/staking/v1beta1/staking"; -import { StakeAuthorization } from "./types/cosmos/staking/v1beta1/authz"; -import { QueryUnbondingDelegationResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegatorValidatorsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { RedelegationEntryResponse } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryDelegatorValidatorResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryParamsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { MsgCreateValidatorResponse } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgDelegate } from "./types/cosmos/staking/v1beta1/tx"; -import { RedelegationEntry } from "./types/cosmos/staking/v1beta1/staking"; -import { QueryValidatorsResponse } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryValidatorUnbondingDelegationsRequest } from "./types/cosmos/staking/v1beta1/query"; -import { QueryDelegationResponse } from "./types/cosmos/staking/v1beta1/query"; -import { HistoricalInfo } from "./types/cosmos/staking/v1beta1/staking"; +import { MsgEditValidatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { QueryDelegationRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryValidatorsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { CommissionRates } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { RedelegationEntry } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { MsgEditValidator } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgUndelegate } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { DVPair } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { ValidatorUpdates } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryValidatorRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryValidatorDelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorUnbondingDelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryRedelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryValidatorsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { MsgUndelegateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgDelegate } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { QueryDelegatorValidatorsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { RedelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { DVVTriplet } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { StakeAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/authz"; +import { StakeAuthorization_Validators } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/authz"; +import { MsgBeginRedelegate } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { LastValidatorPower } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/genesis"; +import { QueryValidatorUnbondingDelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { HistoricalInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { ValAddresses } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { Pool } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryUnbondingDelegationRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { MsgCreateValidatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/genesis"; +import { QueryDelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorValidatorRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryHistoricalInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryHistoricalInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { UnbondingDelegationEntry } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { MsgCancelUnbondingDelegation } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { QueryDelegatorUnbondingDelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { Delegation } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { DVVTriplets } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryDelegatorValidatorsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryValidatorUnbondingDelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorValidatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { Commission } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { DelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { Description } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryValidatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorDelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryRedelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryUnbondingDelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { Redelegation } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { MsgCreateValidator } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { RedelegationEntryResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryPoolResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { MsgDelegateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { Validator } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryDelegatorDelegationsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { QueryPoolRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { MsgBeginRedelegateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { MsgCancelUnbondingDelegationResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/tx"; +import { QueryValidatorDelegationsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/query"; +import { UnbondingDelegation } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; +import { DVPairs } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/staking/v1beta1/staking"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.staking.v1beta1.MsgDelegateResponse", MsgDelegateResponse], - ["/cosmos.staking.v1beta1.GenesisState", GenesisState], - ["/cosmos.staking.v1beta1.LastValidatorPower", LastValidatorPower], + ["/cosmos.staking.v1beta1.MsgEditValidatorResponse", MsgEditValidatorResponse], + ["/cosmos.staking.v1beta1.MsgUpdateParams", MsgUpdateParams], + ["/cosmos.staking.v1beta1.QueryDelegationRequest", QueryDelegationRequest], + ["/cosmos.staking.v1beta1.QueryValidatorsResponse", QueryValidatorsResponse], + ["/cosmos.staking.v1beta1.CommissionRates", CommissionRates], + ["/cosmos.staking.v1beta1.RedelegationEntry", RedelegationEntry], + ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], + ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate], + ["/cosmos.staking.v1beta1.DVPair", DVPair], ["/cosmos.staking.v1beta1.Params", Params], ["/cosmos.staking.v1beta1.ValidatorUpdates", ValidatorUpdates], - ["/cosmos.staking.v1beta1.DelegationResponse", DelegationResponse], + ["/cosmos.staking.v1beta1.QueryValidatorRequest", QueryValidatorRequest], + ["/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", QueryValidatorDelegationsRequest], + ["/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", QueryDelegatorUnbondingDelegationsResponse], ["/cosmos.staking.v1beta1.QueryRedelegationsRequest", QueryRedelegationsRequest], - ["/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", QueryHistoricalInfoRequest], - ["/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", MsgCancelUnbondingDelegation], - ["/cosmos.staking.v1beta1.QueryDelegationRequest", QueryDelegationRequest], - ["/cosmos.staking.v1beta1.MsgEditValidatorResponse", MsgEditValidatorResponse], - ["/cosmos.staking.v1beta1.Description", Description], - ["/cosmos.staking.v1beta1.Commission", Commission], + ["/cosmos.staking.v1beta1.QueryValidatorsRequest", QueryValidatorsRequest], + ["/cosmos.staking.v1beta1.MsgUndelegateResponse", MsgUndelegateResponse], + ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], + ["/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", QueryDelegatorValidatorsRequest], + ["/cosmos.staking.v1beta1.RedelegationResponse", RedelegationResponse], + ["/cosmos.staking.v1beta1.DVVTriplet", DVVTriplet], + ["/cosmos.staking.v1beta1.StakeAuthorization", StakeAuthorization], + ["/cosmos.staking.v1beta1.StakeAuthorization_Validators", StakeAuthorization_Validators], + ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], + ["/cosmos.staking.v1beta1.LastValidatorPower", LastValidatorPower], + ["/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", QueryValidatorUnbondingDelegationsRequest], + ["/cosmos.staking.v1beta1.HistoricalInfo", HistoricalInfo], ["/cosmos.staking.v1beta1.ValAddresses", ValAddresses], - ["/cosmos.staking.v1beta1.DVVTriplets", DVVTriplets], - ["/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", QueryDelegatorUnbondingDelegationsRequest], - ["/cosmos.staking.v1beta1.QueryRedelegationsResponse", QueryRedelegationsResponse], - ["/cosmos.staking.v1beta1.QueryPoolRequest", QueryPoolRequest], - ["/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", MsgCancelUnbondingDelegationResponse], ["/cosmos.staking.v1beta1.Pool", Pool], + ["/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", QueryUnbondingDelegationRequest], + ["/cosmos.staking.v1beta1.MsgCreateValidatorResponse", MsgCreateValidatorResponse], + ["/cosmos.staking.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], + ["/cosmos.staking.v1beta1.GenesisState", GenesisState], + ["/cosmos.staking.v1beta1.QueryDelegationResponse", QueryDelegationResponse], + ["/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", QueryDelegatorValidatorRequest], + ["/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", QueryHistoricalInfoRequest], + ["/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", QueryHistoricalInfoResponse], ["/cosmos.staking.v1beta1.UnbondingDelegationEntry", UnbondingDelegationEntry], - ["/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", MsgBeginRedelegateResponse], - ["/cosmos.staking.v1beta1.MsgUndelegateResponse", MsgUndelegateResponse], - ["/cosmos.staking.v1beta1.DVPair", DVPair], + ["/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", MsgCancelUnbondingDelegation], + ["/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", QueryDelegatorUnbondingDelegationsRequest], ["/cosmos.staking.v1beta1.Delegation", Delegation], - ["/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", QueryValidatorDelegationsRequest], - ["/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", QueryValidatorDelegationsResponse], + ["/cosmos.staking.v1beta1.DVVTriplets", DVVTriplets], + ["/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", QueryDelegatorValidatorsResponse], ["/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", QueryValidatorUnbondingDelegationsResponse], - ["/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", QueryDelegatorDelegationsRequest], - ["/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", QueryDelegatorValidatorRequest], - ["/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", QueryHistoricalInfoResponse], - ["/cosmos.staking.v1beta1.Redelegation", Redelegation], - ["/cosmos.staking.v1beta1.RedelegationResponse", RedelegationResponse], + ["/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", QueryDelegatorValidatorResponse], + ["/cosmos.staking.v1beta1.Commission", Commission], + ["/cosmos.staking.v1beta1.DelegationResponse", DelegationResponse], + ["/cosmos.staking.v1beta1.Description", Description], + ["/cosmos.staking.v1beta1.QueryValidatorResponse", QueryValidatorResponse], ["/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", QueryDelegatorDelegationsResponse], - ["/cosmos.staking.v1beta1.DVVTriplet", DVVTriplet], - ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], - ["/cosmos.staking.v1beta1.MsgUpdateParams", MsgUpdateParams], + ["/cosmos.staking.v1beta1.QueryRedelegationsResponse", QueryRedelegationsResponse], + ["/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", QueryUnbondingDelegationResponse], ["/cosmos.staking.v1beta1.QueryParamsResponse", QueryParamsResponse], - ["/cosmos.staking.v1beta1.QueryValidatorResponse", QueryValidatorResponse], - ["/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", QueryUnbondingDelegationRequest], - ["/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", QueryDelegatorUnbondingDelegationsResponse], - ["/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", QueryDelegatorValidatorsResponse], + ["/cosmos.staking.v1beta1.Redelegation", Redelegation], ["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], - ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate], - ["/cosmos.staking.v1beta1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/cosmos.staking.v1beta1.UnbondingDelegation", UnbondingDelegation], - ["/cosmos.staking.v1beta1.StakeAuthorization_Validators", StakeAuthorization_Validators], + ["/cosmos.staking.v1beta1.RedelegationEntryResponse", RedelegationEntryResponse], ["/cosmos.staking.v1beta1.QueryPoolResponse", QueryPoolResponse], - ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], + ["/cosmos.staking.v1beta1.MsgDelegateResponse", MsgDelegateResponse], ["/cosmos.staking.v1beta1.Validator", Validator], - ["/cosmos.staking.v1beta1.CommissionRates", CommissionRates], - ["/cosmos.staking.v1beta1.DVPairs", DVPairs], - ["/cosmos.staking.v1beta1.StakeAuthorization", StakeAuthorization], - ["/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", QueryUnbondingDelegationResponse], - ["/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", QueryDelegatorValidatorsRequest], - ["/cosmos.staking.v1beta1.RedelegationEntryResponse", RedelegationEntryResponse], - ["/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", QueryDelegatorValidatorResponse], ["/cosmos.staking.v1beta1.QueryParamsRequest", QueryParamsRequest], - ["/cosmos.staking.v1beta1.MsgCreateValidatorResponse", MsgCreateValidatorResponse], - ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], - ["/cosmos.staking.v1beta1.RedelegationEntry", RedelegationEntry], - ["/cosmos.staking.v1beta1.QueryValidatorsResponse", QueryValidatorsResponse], - ["/cosmos.staking.v1beta1.QueryValidatorsRequest", QueryValidatorsRequest], - ["/cosmos.staking.v1beta1.QueryValidatorRequest", QueryValidatorRequest], - ["/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", QueryValidatorUnbondingDelegationsRequest], - ["/cosmos.staking.v1beta1.QueryDelegationResponse", QueryDelegationResponse], - ["/cosmos.staking.v1beta1.HistoricalInfo", HistoricalInfo], + ["/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", QueryDelegatorDelegationsRequest], + ["/cosmos.staking.v1beta1.QueryPoolRequest", QueryPoolRequest], + ["/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", MsgBeginRedelegateResponse], + ["/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", MsgCancelUnbondingDelegationResponse], + ["/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", QueryValidatorDelegationsResponse], + ["/cosmos.staking.v1beta1.UnbondingDelegation", UnbondingDelegation], + ["/cosmos.staking.v1beta1.DVPairs", DVPairs], ]; diff --git a/ts-client/cosmos.staking.v1beta1/types/amino/amino.ts b/ts-client/cosmos.staking.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.staking.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.staking.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.staking.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.staking.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.staking.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.staking.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.staking.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.staking.v1beta1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/cosmos.staking.v1beta1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmos.staking.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.staking.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.staking.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.staking.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.staking.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.staking.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.staking.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.staking.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.staking.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.staking.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.staking.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.staking.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.staking.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.staking.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.staking.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.staking.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.staking.v1beta1/types/google/api/http.ts b/ts-client/cosmos.staking.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.staking.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.staking.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.staking.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.staking.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.staking.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.staking.v1beta1/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/cosmos.staking.v1beta1/types/google/protobuf/duration.ts +++ b/ts-client/cosmos.staking.v1beta1/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.staking.v1beta1/types/route-name.eta b/ts-client/cosmos.staking.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.staking.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.tx.v1beta1/module.ts b/ts-client/cosmos.tx.v1beta1/module.ts index c4871b7d..506368de 100755 --- a/ts-client/cosmos.tx.v1beta1/module.ts +++ b/ts-client/cosmos.tx.v1beta1/module.ts @@ -6,97 +6,97 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { SimulateRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxEncodeAminoRequest } from "./types/cosmos/tx/v1beta1/service"; -import { ModeInfo_Single } from "./types/cosmos/tx/v1beta1/tx"; -import { GetTxsEventResponse } from "./types/cosmos/tx/v1beta1/service"; -import { BroadcastTxRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxDecodeRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxEncodeRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxBody } from "./types/cosmos/tx/v1beta1/tx"; -import { GetTxRequest } from "./types/cosmos/tx/v1beta1/service"; -import { GetTxResponse } from "./types/cosmos/tx/v1beta1/service"; -import { Tip } from "./types/cosmos/tx/v1beta1/tx"; -import { TxEncodeAminoResponse } from "./types/cosmos/tx/v1beta1/service"; -import { Tx } from "./types/cosmos/tx/v1beta1/tx"; -import { SignDoc } from "./types/cosmos/tx/v1beta1/tx"; -import { ModeInfo } from "./types/cosmos/tx/v1beta1/tx"; -import { ModeInfo_Multi } from "./types/cosmos/tx/v1beta1/tx"; -import { SimulateResponse } from "./types/cosmos/tx/v1beta1/service"; -import { BroadcastTxResponse } from "./types/cosmos/tx/v1beta1/service"; -import { TxEncodeResponse } from "./types/cosmos/tx/v1beta1/service"; -import { GetBlockWithTxsResponse } from "./types/cosmos/tx/v1beta1/service"; -import { AuthInfo } from "./types/cosmos/tx/v1beta1/tx"; -import { TxDecodeAminoRequest } from "./types/cosmos/tx/v1beta1/service"; -import { GetTxsEventRequest } from "./types/cosmos/tx/v1beta1/service"; -import { GetBlockWithTxsRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxRaw } from "./types/cosmos/tx/v1beta1/tx"; -import { Fee } from "./types/cosmos/tx/v1beta1/tx"; -import { TxDecodeAminoResponse } from "./types/cosmos/tx/v1beta1/service"; -import { SignDocDirectAux } from "./types/cosmos/tx/v1beta1/tx"; -import { SignerInfo } from "./types/cosmos/tx/v1beta1/tx"; -import { AuxSignerData } from "./types/cosmos/tx/v1beta1/tx"; -import { TxDecodeResponse } from "./types/cosmos/tx/v1beta1/service"; - - -export { SimulateRequest, TxEncodeAminoRequest, ModeInfo_Single, GetTxsEventResponse, BroadcastTxRequest, TxDecodeRequest, TxEncodeRequest, TxBody, GetTxRequest, GetTxResponse, Tip, TxEncodeAminoResponse, Tx, SignDoc, ModeInfo, ModeInfo_Multi, SimulateResponse, BroadcastTxResponse, TxEncodeResponse, GetBlockWithTxsResponse, AuthInfo, TxDecodeAminoRequest, GetTxsEventRequest, GetBlockWithTxsRequest, TxRaw, Fee, TxDecodeAminoResponse, SignDocDirectAux, SignerInfo, AuxSignerData, TxDecodeResponse }; +import { GetTxsEventResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { GetTxResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxEncodeAminoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxDecodeAminoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxRaw } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { GetBlockWithTxsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { SimulateRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxEncodeRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxEncodeAminoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { ModeInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { Tip } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { BroadcastTxRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxDecodeRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { SignerInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { GetTxRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxDecodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { SignDoc } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { ModeInfo_Single } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { ModeInfo_Multi } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { TxDecodeAminoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { Fee } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { SimulateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxEncodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { Tx } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { SignDocDirectAux } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { TxBody } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { GetTxsEventRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { BroadcastTxResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { GetBlockWithTxsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { AuthInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { AuxSignerData } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; + + +export { GetTxsEventResponse, GetTxResponse, TxEncodeAminoResponse, TxDecodeAminoRequest, TxRaw, GetBlockWithTxsRequest, SimulateRequest, TxEncodeRequest, TxEncodeAminoRequest, ModeInfo, Tip, BroadcastTxRequest, TxDecodeRequest, SignerInfo, GetTxRequest, TxDecodeResponse, SignDoc, ModeInfo_Single, ModeInfo_Multi, TxDecodeAminoResponse, Fee, SimulateResponse, TxEncodeResponse, Tx, SignDocDirectAux, TxBody, GetTxsEventRequest, BroadcastTxResponse, GetBlockWithTxsResponse, AuthInfo, AuxSignerData }; -type sendSimulateRequestParams = { - value: SimulateRequest, +type sendGetTxsEventResponseParams = { + value: GetTxsEventResponse, fee?: StdFee, memo?: string }; -type sendTxEncodeAminoRequestParams = { - value: TxEncodeAminoRequest, +type sendGetTxResponseParams = { + value: GetTxResponse, fee?: StdFee, memo?: string }; -type sendModeInfo_SingleParams = { - value: ModeInfo_Single, +type sendTxEncodeAminoResponseParams = { + value: TxEncodeAminoResponse, fee?: StdFee, memo?: string }; -type sendGetTxsEventResponseParams = { - value: GetTxsEventResponse, +type sendTxDecodeAminoRequestParams = { + value: TxDecodeAminoRequest, fee?: StdFee, memo?: string }; -type sendBroadcastTxRequestParams = { - value: BroadcastTxRequest, +type sendTxRawParams = { + value: TxRaw, fee?: StdFee, memo?: string }; -type sendTxDecodeRequestParams = { - value: TxDecodeRequest, +type sendGetBlockWithTxsRequestParams = { + value: GetBlockWithTxsRequest, fee?: StdFee, memo?: string }; -type sendTxEncodeRequestParams = { - value: TxEncodeRequest, +type sendSimulateRequestParams = { + value: SimulateRequest, fee?: StdFee, memo?: string }; -type sendTxBodyParams = { - value: TxBody, +type sendTxEncodeRequestParams = { + value: TxEncodeRequest, fee?: StdFee, memo?: string }; -type sendGetTxRequestParams = { - value: GetTxRequest, +type sendTxEncodeAminoRequestParams = { + value: TxEncodeAminoRequest, fee?: StdFee, memo?: string }; -type sendGetTxResponseParams = { - value: GetTxResponse, +type sendModeInfoParams = { + value: ModeInfo, fee?: StdFee, memo?: string }; @@ -107,251 +107,251 @@ type sendTipParams = { memo?: string }; -type sendTxEncodeAminoResponseParams = { - value: TxEncodeAminoResponse, +type sendBroadcastTxRequestParams = { + value: BroadcastTxRequest, fee?: StdFee, memo?: string }; -type sendTxParams = { - value: Tx, +type sendTxDecodeRequestParams = { + value: TxDecodeRequest, fee?: StdFee, memo?: string }; -type sendSignDocParams = { - value: SignDoc, +type sendSignerInfoParams = { + value: SignerInfo, fee?: StdFee, memo?: string }; -type sendModeInfoParams = { - value: ModeInfo, +type sendGetTxRequestParams = { + value: GetTxRequest, fee?: StdFee, memo?: string }; -type sendModeInfo_MultiParams = { - value: ModeInfo_Multi, +type sendTxDecodeResponseParams = { + value: TxDecodeResponse, fee?: StdFee, memo?: string }; -type sendSimulateResponseParams = { - value: SimulateResponse, +type sendSignDocParams = { + value: SignDoc, fee?: StdFee, memo?: string }; -type sendBroadcastTxResponseParams = { - value: BroadcastTxResponse, +type sendModeInfo_SingleParams = { + value: ModeInfo_Single, fee?: StdFee, memo?: string }; -type sendTxEncodeResponseParams = { - value: TxEncodeResponse, +type sendModeInfo_MultiParams = { + value: ModeInfo_Multi, fee?: StdFee, memo?: string }; -type sendGetBlockWithTxsResponseParams = { - value: GetBlockWithTxsResponse, +type sendTxDecodeAminoResponseParams = { + value: TxDecodeAminoResponse, fee?: StdFee, memo?: string }; -type sendAuthInfoParams = { - value: AuthInfo, +type sendFeeParams = { + value: Fee, fee?: StdFee, memo?: string }; -type sendTxDecodeAminoRequestParams = { - value: TxDecodeAminoRequest, +type sendSimulateResponseParams = { + value: SimulateResponse, fee?: StdFee, memo?: string }; -type sendGetTxsEventRequestParams = { - value: GetTxsEventRequest, +type sendTxEncodeResponseParams = { + value: TxEncodeResponse, fee?: StdFee, memo?: string }; -type sendGetBlockWithTxsRequestParams = { - value: GetBlockWithTxsRequest, +type sendTxParams = { + value: Tx, fee?: StdFee, memo?: string }; -type sendTxRawParams = { - value: TxRaw, +type sendSignDocDirectAuxParams = { + value: SignDocDirectAux, fee?: StdFee, memo?: string }; -type sendFeeParams = { - value: Fee, +type sendTxBodyParams = { + value: TxBody, fee?: StdFee, memo?: string }; -type sendTxDecodeAminoResponseParams = { - value: TxDecodeAminoResponse, +type sendGetTxsEventRequestParams = { + value: GetTxsEventRequest, fee?: StdFee, memo?: string }; -type sendSignDocDirectAuxParams = { - value: SignDocDirectAux, +type sendBroadcastTxResponseParams = { + value: BroadcastTxResponse, fee?: StdFee, memo?: string }; -type sendSignerInfoParams = { - value: SignerInfo, +type sendGetBlockWithTxsResponseParams = { + value: GetBlockWithTxsResponse, fee?: StdFee, memo?: string }; -type sendAuxSignerDataParams = { - value: AuxSignerData, +type sendAuthInfoParams = { + value: AuthInfo, fee?: StdFee, memo?: string }; -type sendTxDecodeResponseParams = { - value: TxDecodeResponse, +type sendAuxSignerDataParams = { + value: AuxSignerData, fee?: StdFee, memo?: string }; -type simulateRequestParams = { - value: SimulateRequest, +type getTxsEventResponseParams = { + value: GetTxsEventResponse, }; -type txEncodeAminoRequestParams = { - value: TxEncodeAminoRequest, +type getTxResponseParams = { + value: GetTxResponse, }; -type modeInfoSingleParams = { - value: ModeInfo_Single, +type txEncodeAminoResponseParams = { + value: TxEncodeAminoResponse, }; -type getTxsEventResponseParams = { - value: GetTxsEventResponse, +type txDecodeAminoRequestParams = { + value: TxDecodeAminoRequest, }; -type broadcastTxRequestParams = { - value: BroadcastTxRequest, +type txRawParams = { + value: TxRaw, }; -type txDecodeRequestParams = { - value: TxDecodeRequest, +type getBlockWithTxsRequestParams = { + value: GetBlockWithTxsRequest, }; -type txEncodeRequestParams = { - value: TxEncodeRequest, +type simulateRequestParams = { + value: SimulateRequest, }; -type txBodyParams = { - value: TxBody, +type txEncodeRequestParams = { + value: TxEncodeRequest, }; -type getTxRequestParams = { - value: GetTxRequest, +type txEncodeAminoRequestParams = { + value: TxEncodeAminoRequest, }; -type getTxResponseParams = { - value: GetTxResponse, +type modeInfoParams = { + value: ModeInfo, }; type tipParams = { value: Tip, }; -type txEncodeAminoResponseParams = { - value: TxEncodeAminoResponse, +type broadcastTxRequestParams = { + value: BroadcastTxRequest, }; -type txParams = { - value: Tx, +type txDecodeRequestParams = { + value: TxDecodeRequest, +}; + +type signerInfoParams = { + value: SignerInfo, +}; + +type getTxRequestParams = { + value: GetTxRequest, +}; + +type txDecodeResponseParams = { + value: TxDecodeResponse, }; type signDocParams = { value: SignDoc, }; -type modeInfoParams = { - value: ModeInfo, +type modeInfoSingleParams = { + value: ModeInfo_Single, }; type modeInfoMultiParams = { value: ModeInfo_Multi, }; -type simulateResponseParams = { - value: SimulateResponse, +type txDecodeAminoResponseParams = { + value: TxDecodeAminoResponse, }; -type broadcastTxResponseParams = { - value: BroadcastTxResponse, +type feeParams = { + value: Fee, +}; + +type simulateResponseParams = { + value: SimulateResponse, }; type txEncodeResponseParams = { value: TxEncodeResponse, }; -type getBlockWithTxsResponseParams = { - value: GetBlockWithTxsResponse, +type txParams = { + value: Tx, }; -type authInfoParams = { - value: AuthInfo, +type signDocDirectAuxParams = { + value: SignDocDirectAux, }; -type txDecodeAminoRequestParams = { - value: TxDecodeAminoRequest, +type txBodyParams = { + value: TxBody, }; type getTxsEventRequestParams = { value: GetTxsEventRequest, }; -type getBlockWithTxsRequestParams = { - value: GetBlockWithTxsRequest, -}; - -type txRawParams = { - value: TxRaw, -}; - -type feeParams = { - value: Fee, -}; - -type txDecodeAminoResponseParams = { - value: TxDecodeAminoResponse, +type broadcastTxResponseParams = { + value: BroadcastTxResponse, }; -type signDocDirectAuxParams = { - value: SignDocDirectAux, +type getBlockWithTxsResponseParams = { + value: GetBlockWithTxsResponse, }; -type signerInfoParams = { - value: SignerInfo, +type authInfoParams = { + value: AuthInfo, }; type auxSignerDataParams = { value: AuxSignerData, }; -type txDecodeResponseParams = { - value: TxDecodeResponse, -}; - export const registry = new Registry(msgTypes); @@ -382,143 +382,143 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendSimulateRequest({ value, fee, memo }: sendSimulateRequestParams): Promise { + async sendGetTxsEventResponse({ value, fee, memo }: sendGetTxsEventResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendSimulateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetTxsEventResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.simulateRequest({ value: SimulateRequest.fromPartial(value) }) + let msg = this.getTxsEventResponse({ value: GetTxsEventResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSimulateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetTxsEventResponse: Could not broadcast Tx: '+ e.message) } }, - async sendTxEncodeAminoRequest({ value, fee, memo }: sendTxEncodeAminoRequestParams): Promise { + async sendGetTxResponse({ value, fee, memo }: sendGetTxResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxEncodeAminoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetTxResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txEncodeAminoRequest({ value: TxEncodeAminoRequest.fromPartial(value) }) + let msg = this.getTxResponse({ value: GetTxResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxEncodeAminoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetTxResponse: Could not broadcast Tx: '+ e.message) } }, - async sendModeInfo_Single({ value, fee, memo }: sendModeInfo_SingleParams): Promise { + async sendTxEncodeAminoResponse({ value, fee, memo }: sendTxEncodeAminoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendModeInfo_Single: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxEncodeAminoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.modeInfoSingle({ value: ModeInfo_Single.fromPartial(value) }) + let msg = this.txEncodeAminoResponse({ value: TxEncodeAminoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendModeInfo_Single: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxEncodeAminoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGetTxsEventResponse({ value, fee, memo }: sendGetTxsEventResponseParams): Promise { + async sendTxDecodeAminoRequest({ value, fee, memo }: sendTxDecodeAminoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetTxsEventResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxDecodeAminoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getTxsEventResponse({ value: GetTxsEventResponse.fromPartial(value) }) + let msg = this.txDecodeAminoRequest({ value: TxDecodeAminoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetTxsEventResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxDecodeAminoRequest: Could not broadcast Tx: '+ e.message) } }, - async sendBroadcastTxRequest({ value, fee, memo }: sendBroadcastTxRequestParams): Promise { + async sendTxRaw({ value, fee, memo }: sendTxRawParams): Promise { if (!signer) { - throw new Error('TxClient:sendBroadcastTxRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxRaw: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.broadcastTxRequest({ value: BroadcastTxRequest.fromPartial(value) }) + let msg = this.txRaw({ value: TxRaw.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendBroadcastTxRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxRaw: Could not broadcast Tx: '+ e.message) } }, - async sendTxDecodeRequest({ value, fee, memo }: sendTxDecodeRequestParams): Promise { + async sendGetBlockWithTxsRequest({ value, fee, memo }: sendGetBlockWithTxsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxDecodeRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetBlockWithTxsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txDecodeRequest({ value: TxDecodeRequest.fromPartial(value) }) + let msg = this.getBlockWithTxsRequest({ value: GetBlockWithTxsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxDecodeRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetBlockWithTxsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendTxEncodeRequest({ value, fee, memo }: sendTxEncodeRequestParams): Promise { + async sendSimulateRequest({ value, fee, memo }: sendSimulateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxEncodeRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSimulateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txEncodeRequest({ value: TxEncodeRequest.fromPartial(value) }) + let msg = this.simulateRequest({ value: SimulateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxEncodeRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSimulateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendTxBody({ value, fee, memo }: sendTxBodyParams): Promise { + async sendTxEncodeRequest({ value, fee, memo }: sendTxEncodeRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxBody: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxEncodeRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txBody({ value: TxBody.fromPartial(value) }) + let msg = this.txEncodeRequest({ value: TxEncodeRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxBody: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxEncodeRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGetTxRequest({ value, fee, memo }: sendGetTxRequestParams): Promise { + async sendTxEncodeAminoRequest({ value, fee, memo }: sendTxEncodeAminoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetTxRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxEncodeAminoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getTxRequest({ value: GetTxRequest.fromPartial(value) }) + let msg = this.txEncodeAminoRequest({ value: TxEncodeAminoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetTxRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxEncodeAminoRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGetTxResponse({ value, fee, memo }: sendGetTxResponseParams): Promise { + async sendModeInfo({ value, fee, memo }: sendModeInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetTxResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendModeInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getTxResponse({ value: GetTxResponse.fromPartial(value) }) + let msg = this.modeInfo({ value: ModeInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetTxResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendModeInfo: Could not broadcast Tx: '+ e.message) } }, @@ -536,364 +536,364 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendTxEncodeAminoResponse({ value, fee, memo }: sendTxEncodeAminoResponseParams): Promise { + async sendBroadcastTxRequest({ value, fee, memo }: sendBroadcastTxRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxEncodeAminoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendBroadcastTxRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txEncodeAminoResponse({ value: TxEncodeAminoResponse.fromPartial(value) }) + let msg = this.broadcastTxRequest({ value: BroadcastTxRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxEncodeAminoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendBroadcastTxRequest: Could not broadcast Tx: '+ e.message) } }, - async sendTx({ value, fee, memo }: sendTxParams): Promise { + async sendTxDecodeRequest({ value, fee, memo }: sendTxDecodeRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTx: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxDecodeRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.tx({ value: Tx.fromPartial(value) }) + let msg = this.txDecodeRequest({ value: TxDecodeRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTx: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxDecodeRequest: Could not broadcast Tx: '+ e.message) } }, - async sendSignDoc({ value, fee, memo }: sendSignDocParams): Promise { + async sendSignerInfo({ value, fee, memo }: sendSignerInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendSignDoc: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSignerInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.signDoc({ value: SignDoc.fromPartial(value) }) + let msg = this.signerInfo({ value: SignerInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSignDoc: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSignerInfo: Could not broadcast Tx: '+ e.message) } }, - async sendModeInfo({ value, fee, memo }: sendModeInfoParams): Promise { + async sendGetTxRequest({ value, fee, memo }: sendGetTxRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendModeInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetTxRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.modeInfo({ value: ModeInfo.fromPartial(value) }) + let msg = this.getTxRequest({ value: GetTxRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendModeInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetTxRequest: Could not broadcast Tx: '+ e.message) } }, - async sendModeInfo_Multi({ value, fee, memo }: sendModeInfo_MultiParams): Promise { + async sendTxDecodeResponse({ value, fee, memo }: sendTxDecodeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendModeInfo_Multi: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxDecodeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.modeInfoMulti({ value: ModeInfo_Multi.fromPartial(value) }) + let msg = this.txDecodeResponse({ value: TxDecodeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendModeInfo_Multi: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxDecodeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendSimulateResponse({ value, fee, memo }: sendSimulateResponseParams): Promise { + async sendSignDoc({ value, fee, memo }: sendSignDocParams): Promise { if (!signer) { - throw new Error('TxClient:sendSimulateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSignDoc: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.simulateResponse({ value: SimulateResponse.fromPartial(value) }) + let msg = this.signDoc({ value: SignDoc.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSimulateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSignDoc: Could not broadcast Tx: '+ e.message) } }, - async sendBroadcastTxResponse({ value, fee, memo }: sendBroadcastTxResponseParams): Promise { + async sendModeInfo_Single({ value, fee, memo }: sendModeInfo_SingleParams): Promise { if (!signer) { - throw new Error('TxClient:sendBroadcastTxResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendModeInfo_Single: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.broadcastTxResponse({ value: BroadcastTxResponse.fromPartial(value) }) + let msg = this.modeInfoSingle({ value: ModeInfo_Single.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendBroadcastTxResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendModeInfo_Single: Could not broadcast Tx: '+ e.message) } }, - async sendTxEncodeResponse({ value, fee, memo }: sendTxEncodeResponseParams): Promise { + async sendModeInfo_Multi({ value, fee, memo }: sendModeInfo_MultiParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxEncodeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendModeInfo_Multi: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txEncodeResponse({ value: TxEncodeResponse.fromPartial(value) }) + let msg = this.modeInfoMulti({ value: ModeInfo_Multi.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxEncodeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendModeInfo_Multi: Could not broadcast Tx: '+ e.message) } }, - async sendGetBlockWithTxsResponse({ value, fee, memo }: sendGetBlockWithTxsResponseParams): Promise { + async sendTxDecodeAminoResponse({ value, fee, memo }: sendTxDecodeAminoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetBlockWithTxsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxDecodeAminoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getBlockWithTxsResponse({ value: GetBlockWithTxsResponse.fromPartial(value) }) + let msg = this.txDecodeAminoResponse({ value: TxDecodeAminoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetBlockWithTxsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxDecodeAminoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAuthInfo({ value, fee, memo }: sendAuthInfoParams): Promise { + async sendFee({ value, fee, memo }: sendFeeParams): Promise { if (!signer) { - throw new Error('TxClient:sendAuthInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendFee: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.authInfo({ value: AuthInfo.fromPartial(value) }) + let msg = this.fee({ value: Fee.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAuthInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendFee: Could not broadcast Tx: '+ e.message) } }, - async sendTxDecodeAminoRequest({ value, fee, memo }: sendTxDecodeAminoRequestParams): Promise { + async sendSimulateResponse({ value, fee, memo }: sendSimulateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxDecodeAminoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSimulateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txDecodeAminoRequest({ value: TxDecodeAminoRequest.fromPartial(value) }) + let msg = this.simulateResponse({ value: SimulateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxDecodeAminoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSimulateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGetTxsEventRequest({ value, fee, memo }: sendGetTxsEventRequestParams): Promise { + async sendTxEncodeResponse({ value, fee, memo }: sendTxEncodeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetTxsEventRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxEncodeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getTxsEventRequest({ value: GetTxsEventRequest.fromPartial(value) }) + let msg = this.txEncodeResponse({ value: TxEncodeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetTxsEventRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxEncodeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGetBlockWithTxsRequest({ value, fee, memo }: sendGetBlockWithTxsRequestParams): Promise { + async sendTx({ value, fee, memo }: sendTxParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetBlockWithTxsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTx: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getBlockWithTxsRequest({ value: GetBlockWithTxsRequest.fromPartial(value) }) + let msg = this.tx({ value: Tx.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetBlockWithTxsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTx: Could not broadcast Tx: '+ e.message) } }, - async sendTxRaw({ value, fee, memo }: sendTxRawParams): Promise { + async sendSignDocDirectAux({ value, fee, memo }: sendSignDocDirectAuxParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxRaw: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSignDocDirectAux: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txRaw({ value: TxRaw.fromPartial(value) }) + let msg = this.signDocDirectAux({ value: SignDocDirectAux.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxRaw: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSignDocDirectAux: Could not broadcast Tx: '+ e.message) } }, - async sendFee({ value, fee, memo }: sendFeeParams): Promise { + async sendTxBody({ value, fee, memo }: sendTxBodyParams): Promise { if (!signer) { - throw new Error('TxClient:sendFee: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTxBody: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.fee({ value: Fee.fromPartial(value) }) + let msg = this.txBody({ value: TxBody.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendFee: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTxBody: Could not broadcast Tx: '+ e.message) } }, - async sendTxDecodeAminoResponse({ value, fee, memo }: sendTxDecodeAminoResponseParams): Promise { + async sendGetTxsEventRequest({ value, fee, memo }: sendGetTxsEventRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxDecodeAminoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetTxsEventRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txDecodeAminoResponse({ value: TxDecodeAminoResponse.fromPartial(value) }) + let msg = this.getTxsEventRequest({ value: GetTxsEventRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxDecodeAminoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetTxsEventRequest: Could not broadcast Tx: '+ e.message) } }, - async sendSignDocDirectAux({ value, fee, memo }: sendSignDocDirectAuxParams): Promise { + async sendBroadcastTxResponse({ value, fee, memo }: sendBroadcastTxResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendSignDocDirectAux: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendBroadcastTxResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.signDocDirectAux({ value: SignDocDirectAux.fromPartial(value) }) + let msg = this.broadcastTxResponse({ value: BroadcastTxResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSignDocDirectAux: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendBroadcastTxResponse: Could not broadcast Tx: '+ e.message) } }, - async sendSignerInfo({ value, fee, memo }: sendSignerInfoParams): Promise { + async sendGetBlockWithTxsResponse({ value, fee, memo }: sendGetBlockWithTxsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendSignerInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetBlockWithTxsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.signerInfo({ value: SignerInfo.fromPartial(value) }) + let msg = this.getBlockWithTxsResponse({ value: GetBlockWithTxsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSignerInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetBlockWithTxsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAuxSignerData({ value, fee, memo }: sendAuxSignerDataParams): Promise { + async sendAuthInfo({ value, fee, memo }: sendAuthInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendAuxSignerData: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAuthInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.auxSignerData({ value: AuxSignerData.fromPartial(value) }) + let msg = this.authInfo({ value: AuthInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAuxSignerData: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAuthInfo: Could not broadcast Tx: '+ e.message) } }, - async sendTxDecodeResponse({ value, fee, memo }: sendTxDecodeResponseParams): Promise { + async sendAuxSignerData({ value, fee, memo }: sendAuxSignerDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendTxDecodeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAuxSignerData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.txDecodeResponse({ value: TxDecodeResponse.fromPartial(value) }) + let msg = this.auxSignerData({ value: AuxSignerData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTxDecodeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAuxSignerData: Could not broadcast Tx: '+ e.message) } }, - simulateRequest({ value }: simulateRequestParams): EncodeObject { + getTxsEventResponse({ value }: getTxsEventResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", value: SimulateRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", value: GetTxsEventResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SimulateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GetTxsEventResponse: Could not create message: ' + e.message) } }, - txEncodeAminoRequest({ value }: txEncodeAminoRequestParams): EncodeObject { + getTxResponse({ value }: getTxResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest", value: TxEncodeAminoRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", value: GetTxResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxEncodeAminoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GetTxResponse: Could not create message: ' + e.message) } }, - modeInfoSingle({ value }: modeInfoSingleParams): EncodeObject { + txEncodeAminoResponse({ value }: txEncodeAminoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.ModeInfo_Single", value: ModeInfo_Single.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse", value: TxEncodeAminoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ModeInfo_Single: Could not create message: ' + e.message) + throw new Error('TxClient:TxEncodeAminoResponse: Could not create message: ' + e.message) } }, - getTxsEventResponse({ value }: getTxsEventResponseParams): EncodeObject { + txDecodeAminoRequest({ value }: txDecodeAminoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", value: GetTxsEventResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest", value: TxDecodeAminoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetTxsEventResponse: Could not create message: ' + e.message) + throw new Error('TxClient:TxDecodeAminoRequest: Could not create message: ' + e.message) } }, - broadcastTxRequest({ value }: broadcastTxRequestParams): EncodeObject { + txRaw({ value }: txRawParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", value: BroadcastTxRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxRaw", value: TxRaw.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:BroadcastTxRequest: Could not create message: ' + e.message) + throw new Error('TxClient:TxRaw: Could not create message: ' + e.message) } }, - txDecodeRequest({ value }: txDecodeRequestParams): EncodeObject { + getBlockWithTxsRequest({ value }: getBlockWithTxsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest", value: TxDecodeRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", value: GetBlockWithTxsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxDecodeRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GetBlockWithTxsRequest: Could not create message: ' + e.message) } }, - txEncodeRequest({ value }: txEncodeRequestParams): EncodeObject { + simulateRequest({ value }: simulateRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest", value: TxEncodeRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", value: SimulateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxEncodeRequest: Could not create message: ' + e.message) + throw new Error('TxClient:SimulateRequest: Could not create message: ' + e.message) } }, - txBody({ value }: txBodyParams): EncodeObject { + txEncodeRequest({ value }: txEncodeRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxBody", value: TxBody.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest", value: TxEncodeRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxBody: Could not create message: ' + e.message) + throw new Error('TxClient:TxEncodeRequest: Could not create message: ' + e.message) } }, - getTxRequest({ value }: getTxRequestParams): EncodeObject { + txEncodeAminoRequest({ value }: txEncodeAminoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", value: GetTxRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest", value: TxEncodeAminoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetTxRequest: Could not create message: ' + e.message) + throw new Error('TxClient:TxEncodeAminoRequest: Could not create message: ' + e.message) } }, - getTxResponse({ value }: getTxResponseParams): EncodeObject { + modeInfo({ value }: modeInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", value: GetTxResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.ModeInfo", value: ModeInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetTxResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ModeInfo: Could not create message: ' + e.message) } }, @@ -905,163 +905,163 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - txEncodeAminoResponse({ value }: txEncodeAminoResponseParams): EncodeObject { + broadcastTxRequest({ value }: broadcastTxRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse", value: TxEncodeAminoResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", value: BroadcastTxRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxEncodeAminoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:BroadcastTxRequest: Could not create message: ' + e.message) } }, - tx({ value }: txParams): EncodeObject { + txDecodeRequest({ value }: txDecodeRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.Tx", value: Tx.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest", value: TxDecodeRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Tx: Could not create message: ' + e.message) + throw new Error('TxClient:TxDecodeRequest: Could not create message: ' + e.message) } }, - signDoc({ value }: signDocParams): EncodeObject { + signerInfo({ value }: signerInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.SignDoc", value: SignDoc.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.SignerInfo", value: SignerInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SignDoc: Could not create message: ' + e.message) + throw new Error('TxClient:SignerInfo: Could not create message: ' + e.message) } }, - modeInfo({ value }: modeInfoParams): EncodeObject { + getTxRequest({ value }: getTxRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.ModeInfo", value: ModeInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", value: GetTxRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ModeInfo: Could not create message: ' + e.message) + throw new Error('TxClient:GetTxRequest: Could not create message: ' + e.message) } }, - modeInfoMulti({ value }: modeInfoMultiParams): EncodeObject { + txDecodeResponse({ value }: txDecodeResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.ModeInfo_Multi", value: ModeInfo_Multi.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse", value: TxDecodeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ModeInfo_Multi: Could not create message: ' + e.message) + throw new Error('TxClient:TxDecodeResponse: Could not create message: ' + e.message) } }, - simulateResponse({ value }: simulateResponseParams): EncodeObject { + signDoc({ value }: signDocParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", value: SimulateResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.SignDoc", value: SignDoc.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SimulateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:SignDoc: Could not create message: ' + e.message) } }, - broadcastTxResponse({ value }: broadcastTxResponseParams): EncodeObject { + modeInfoSingle({ value }: modeInfoSingleParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", value: BroadcastTxResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.ModeInfo_Single", value: ModeInfo_Single.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:BroadcastTxResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ModeInfo_Single: Could not create message: ' + e.message) } }, - txEncodeResponse({ value }: txEncodeResponseParams): EncodeObject { + modeInfoMulti({ value }: modeInfoMultiParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse", value: TxEncodeResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.ModeInfo_Multi", value: ModeInfo_Multi.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxEncodeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ModeInfo_Multi: Could not create message: ' + e.message) } }, - getBlockWithTxsResponse({ value }: getBlockWithTxsResponseParams): EncodeObject { + txDecodeAminoResponse({ value }: txDecodeAminoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", value: GetBlockWithTxsResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse", value: TxDecodeAminoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetBlockWithTxsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:TxDecodeAminoResponse: Could not create message: ' + e.message) } }, - authInfo({ value }: authInfoParams): EncodeObject { + fee({ value }: feeParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.AuthInfo", value: AuthInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.Fee", value: Fee.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AuthInfo: Could not create message: ' + e.message) + throw new Error('TxClient:Fee: Could not create message: ' + e.message) } }, - txDecodeAminoRequest({ value }: txDecodeAminoRequestParams): EncodeObject { + simulateResponse({ value }: simulateResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest", value: TxDecodeAminoRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", value: SimulateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxDecodeAminoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:SimulateResponse: Could not create message: ' + e.message) } }, - getTxsEventRequest({ value }: getTxsEventRequestParams): EncodeObject { + txEncodeResponse({ value }: txEncodeResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", value: GetTxsEventRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse", value: TxEncodeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetTxsEventRequest: Could not create message: ' + e.message) + throw new Error('TxClient:TxEncodeResponse: Could not create message: ' + e.message) } }, - getBlockWithTxsRequest({ value }: getBlockWithTxsRequestParams): EncodeObject { + tx({ value }: txParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", value: GetBlockWithTxsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.Tx", value: Tx.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetBlockWithTxsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Tx: Could not create message: ' + e.message) } }, - txRaw({ value }: txRawParams): EncodeObject { + signDocDirectAux({ value }: signDocDirectAuxParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxRaw", value: TxRaw.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", value: SignDocDirectAux.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxRaw: Could not create message: ' + e.message) + throw new Error('TxClient:SignDocDirectAux: Could not create message: ' + e.message) } }, - fee({ value }: feeParams): EncodeObject { + txBody({ value }: txBodyParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.Fee", value: Fee.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.TxBody", value: TxBody.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Fee: Could not create message: ' + e.message) + throw new Error('TxClient:TxBody: Could not create message: ' + e.message) } }, - txDecodeAminoResponse({ value }: txDecodeAminoResponseParams): EncodeObject { + getTxsEventRequest({ value }: getTxsEventRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse", value: TxDecodeAminoResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", value: GetTxsEventRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxDecodeAminoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GetTxsEventRequest: Could not create message: ' + e.message) } }, - signDocDirectAux({ value }: signDocDirectAuxParams): EncodeObject { + broadcastTxResponse({ value }: broadcastTxResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", value: SignDocDirectAux.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", value: BroadcastTxResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SignDocDirectAux: Could not create message: ' + e.message) + throw new Error('TxClient:BroadcastTxResponse: Could not create message: ' + e.message) } }, - signerInfo({ value }: signerInfoParams): EncodeObject { + getBlockWithTxsResponse({ value }: getBlockWithTxsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.SignerInfo", value: SignerInfo.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", value: GetBlockWithTxsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SignerInfo: Could not create message: ' + e.message) + throw new Error('TxClient:GetBlockWithTxsResponse: Could not create message: ' + e.message) } }, - auxSignerData({ value }: auxSignerDataParams): EncodeObject { + authInfo({ value }: authInfoParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", value: AuxSignerData.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.AuthInfo", value: AuthInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AuxSignerData: Could not create message: ' + e.message) + throw new Error('TxClient:AuthInfo: Could not create message: ' + e.message) } }, - txDecodeResponse({ value }: txDecodeResponseParams): EncodeObject { + auxSignerData({ value }: auxSignerDataParams): EncodeObject { try { - return { typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse", value: TxDecodeResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", value: AuxSignerData.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TxDecodeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:AuxSignerData: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.tx.v1beta1/registry.ts b/ts-client/cosmos.tx.v1beta1/registry.ts index 39a96c36..5f9f8f4f 100755 --- a/ts-client/cosmos.tx.v1beta1/registry.ts +++ b/ts-client/cosmos.tx.v1beta1/registry.ts @@ -1,68 +1,68 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { SimulateRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxEncodeAminoRequest } from "./types/cosmos/tx/v1beta1/service"; -import { ModeInfo_Single } from "./types/cosmos/tx/v1beta1/tx"; -import { GetTxsEventResponse } from "./types/cosmos/tx/v1beta1/service"; -import { BroadcastTxRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxDecodeRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxEncodeRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxBody } from "./types/cosmos/tx/v1beta1/tx"; -import { GetTxRequest } from "./types/cosmos/tx/v1beta1/service"; -import { GetTxResponse } from "./types/cosmos/tx/v1beta1/service"; -import { Tip } from "./types/cosmos/tx/v1beta1/tx"; -import { TxEncodeAminoResponse } from "./types/cosmos/tx/v1beta1/service"; -import { Tx } from "./types/cosmos/tx/v1beta1/tx"; -import { SignDoc } from "./types/cosmos/tx/v1beta1/tx"; -import { ModeInfo } from "./types/cosmos/tx/v1beta1/tx"; -import { ModeInfo_Multi } from "./types/cosmos/tx/v1beta1/tx"; -import { SimulateResponse } from "./types/cosmos/tx/v1beta1/service"; -import { BroadcastTxResponse } from "./types/cosmos/tx/v1beta1/service"; -import { TxEncodeResponse } from "./types/cosmos/tx/v1beta1/service"; -import { GetBlockWithTxsResponse } from "./types/cosmos/tx/v1beta1/service"; -import { AuthInfo } from "./types/cosmos/tx/v1beta1/tx"; -import { TxDecodeAminoRequest } from "./types/cosmos/tx/v1beta1/service"; -import { GetTxsEventRequest } from "./types/cosmos/tx/v1beta1/service"; -import { GetBlockWithTxsRequest } from "./types/cosmos/tx/v1beta1/service"; -import { TxRaw } from "./types/cosmos/tx/v1beta1/tx"; -import { Fee } from "./types/cosmos/tx/v1beta1/tx"; -import { TxDecodeAminoResponse } from "./types/cosmos/tx/v1beta1/service"; -import { SignDocDirectAux } from "./types/cosmos/tx/v1beta1/tx"; -import { SignerInfo } from "./types/cosmos/tx/v1beta1/tx"; -import { AuxSignerData } from "./types/cosmos/tx/v1beta1/tx"; -import { TxDecodeResponse } from "./types/cosmos/tx/v1beta1/service"; +import { GetTxsEventResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { GetTxResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxEncodeAminoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxDecodeAminoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxRaw } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { GetBlockWithTxsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { SimulateRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxEncodeRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxEncodeAminoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { ModeInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { Tip } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { BroadcastTxRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxDecodeRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { SignerInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { GetTxRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxDecodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { SignDoc } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { ModeInfo_Single } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { ModeInfo_Multi } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { TxDecodeAminoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { Fee } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { SimulateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { TxEncodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { Tx } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { SignDocDirectAux } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { TxBody } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { GetTxsEventRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { BroadcastTxResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { GetBlockWithTxsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/service"; +import { AuthInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; +import { AuxSignerData } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/tx/v1beta1/tx"; const msgTypes: Array<[string, GeneratedType]> = [ + ["/cosmos.tx.v1beta1.GetTxsEventResponse", GetTxsEventResponse], + ["/cosmos.tx.v1beta1.GetTxResponse", GetTxResponse], + ["/cosmos.tx.v1beta1.TxEncodeAminoResponse", TxEncodeAminoResponse], + ["/cosmos.tx.v1beta1.TxDecodeAminoRequest", TxDecodeAminoRequest], + ["/cosmos.tx.v1beta1.TxRaw", TxRaw], + ["/cosmos.tx.v1beta1.GetBlockWithTxsRequest", GetBlockWithTxsRequest], ["/cosmos.tx.v1beta1.SimulateRequest", SimulateRequest], + ["/cosmos.tx.v1beta1.TxEncodeRequest", TxEncodeRequest], ["/cosmos.tx.v1beta1.TxEncodeAminoRequest", TxEncodeAminoRequest], - ["/cosmos.tx.v1beta1.ModeInfo_Single", ModeInfo_Single], - ["/cosmos.tx.v1beta1.GetTxsEventResponse", GetTxsEventResponse], + ["/cosmos.tx.v1beta1.ModeInfo", ModeInfo], + ["/cosmos.tx.v1beta1.Tip", Tip], ["/cosmos.tx.v1beta1.BroadcastTxRequest", BroadcastTxRequest], ["/cosmos.tx.v1beta1.TxDecodeRequest", TxDecodeRequest], - ["/cosmos.tx.v1beta1.TxEncodeRequest", TxEncodeRequest], - ["/cosmos.tx.v1beta1.TxBody", TxBody], + ["/cosmos.tx.v1beta1.SignerInfo", SignerInfo], ["/cosmos.tx.v1beta1.GetTxRequest", GetTxRequest], - ["/cosmos.tx.v1beta1.GetTxResponse", GetTxResponse], - ["/cosmos.tx.v1beta1.Tip", Tip], - ["/cosmos.tx.v1beta1.TxEncodeAminoResponse", TxEncodeAminoResponse], - ["/cosmos.tx.v1beta1.Tx", Tx], + ["/cosmos.tx.v1beta1.TxDecodeResponse", TxDecodeResponse], ["/cosmos.tx.v1beta1.SignDoc", SignDoc], - ["/cosmos.tx.v1beta1.ModeInfo", ModeInfo], + ["/cosmos.tx.v1beta1.ModeInfo_Single", ModeInfo_Single], ["/cosmos.tx.v1beta1.ModeInfo_Multi", ModeInfo_Multi], + ["/cosmos.tx.v1beta1.TxDecodeAminoResponse", TxDecodeAminoResponse], + ["/cosmos.tx.v1beta1.Fee", Fee], ["/cosmos.tx.v1beta1.SimulateResponse", SimulateResponse], - ["/cosmos.tx.v1beta1.BroadcastTxResponse", BroadcastTxResponse], ["/cosmos.tx.v1beta1.TxEncodeResponse", TxEncodeResponse], + ["/cosmos.tx.v1beta1.Tx", Tx], + ["/cosmos.tx.v1beta1.SignDocDirectAux", SignDocDirectAux], + ["/cosmos.tx.v1beta1.TxBody", TxBody], + ["/cosmos.tx.v1beta1.GetTxsEventRequest", GetTxsEventRequest], + ["/cosmos.tx.v1beta1.BroadcastTxResponse", BroadcastTxResponse], ["/cosmos.tx.v1beta1.GetBlockWithTxsResponse", GetBlockWithTxsResponse], ["/cosmos.tx.v1beta1.AuthInfo", AuthInfo], - ["/cosmos.tx.v1beta1.TxDecodeAminoRequest", TxDecodeAminoRequest], - ["/cosmos.tx.v1beta1.GetTxsEventRequest", GetTxsEventRequest], - ["/cosmos.tx.v1beta1.GetBlockWithTxsRequest", GetBlockWithTxsRequest], - ["/cosmos.tx.v1beta1.TxRaw", TxRaw], - ["/cosmos.tx.v1beta1.Fee", Fee], - ["/cosmos.tx.v1beta1.TxDecodeAminoResponse", TxDecodeAminoResponse], - ["/cosmos.tx.v1beta1.SignDocDirectAux", SignDocDirectAux], - ["/cosmos.tx.v1beta1.SignerInfo", SignerInfo], ["/cosmos.tx.v1beta1.AuxSignerData", AuxSignerData], - ["/cosmos.tx.v1beta1.TxDecodeResponse", TxDecodeResponse], ]; diff --git a/ts-client/cosmos.tx.v1beta1/types/amino/amino.ts b/ts-client/cosmos.tx.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.tx.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.tx.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.tx.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.tx.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.tx.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmos.tx.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmos.tx.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.tx.v1beta1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/cosmos.tx.v1beta1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmos.tx.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.tx.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.tx.v1beta1/types/cosmos/msg/v1/msg.ts new file mode 100644 index 00000000..7a993ec3 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/cosmos/msg/v1/msg.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.tx.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.tx.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.tx.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.tx.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.tx.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.tx.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.tx.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.tx.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.tx.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.tx.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.tx.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.tx.v1beta1/types/google/api/http.ts b/ts-client/cosmos.tx.v1beta1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmos.tx.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.tx.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.tx.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.tx.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.tx.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.tx.v1beta1/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/cosmos.tx.v1beta1/types/google/protobuf/duration.ts +++ b/ts-client/cosmos.tx.v1beta1/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.tx.v1beta1/types/route-name.eta b/ts-client/cosmos.tx.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.tx.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.upgrade.v1beta1/module.ts b/ts-client/cosmos.upgrade.v1beta1/module.ts index b58673e8..3cd0a7f5 100755 --- a/ts-client/cosmos.upgrade.v1beta1/module.ts +++ b/ts-client/cosmos.upgrade.v1beta1/module.ts @@ -6,54 +6,54 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgCancelUpgradeResponse } from "./types/cosmos/upgrade/v1beta1/tx"; import { SoftwareUpgradeProposal } from "./types/cosmos/upgrade/v1beta1/upgrade"; -import { QueryCurrentPlanResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { QueryUpgradedConsensusStateRequest } from "./types/cosmos/upgrade/v1beta1/query"; import { QueryAuthorityRequest } from "./types/cosmos/upgrade/v1beta1/query"; -import { MsgCancelUpgrade } from "./types/cosmos/upgrade/v1beta1/tx"; +import { MsgSoftwareUpgrade } from "./types/cosmos/upgrade/v1beta1/tx"; import { Plan } from "./types/cosmos/upgrade/v1beta1/upgrade"; -import { ModuleVersion } from "./types/cosmos/upgrade/v1beta1/upgrade"; -import { QueryModuleVersionsRequest } from "./types/cosmos/upgrade/v1beta1/query"; -import { QueryModuleVersionsResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { QueryUpgradedConsensusStateResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { QueryAuthorityResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { CancelSoftwareUpgradeProposal } from "./types/cosmos/upgrade/v1beta1/upgrade"; -import { QueryCurrentPlanRequest } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryCurrentPlanResponse } from "./types/cosmos/upgrade/v1beta1/query"; +import { MsgCancelUpgrade } from "./types/cosmos/upgrade/v1beta1/tx"; +import { MsgCancelUpgradeResponse } from "./types/cosmos/upgrade/v1beta1/tx"; import { QueryAppliedPlanRequest } from "./types/cosmos/upgrade/v1beta1/query"; import { QueryAppliedPlanResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { MsgSoftwareUpgrade } from "./types/cosmos/upgrade/v1beta1/tx"; +import { QueryModuleVersionsResponse } from "./types/cosmos/upgrade/v1beta1/query"; import { MsgSoftwareUpgradeResponse } from "./types/cosmos/upgrade/v1beta1/tx"; +import { CancelSoftwareUpgradeProposal } from "./types/cosmos/upgrade/v1beta1/upgrade"; +import { ModuleVersion } from "./types/cosmos/upgrade/v1beta1/upgrade"; +import { QueryCurrentPlanRequest } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryUpgradedConsensusStateRequest } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryUpgradedConsensusStateResponse } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryModuleVersionsRequest } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryAuthorityResponse } from "./types/cosmos/upgrade/v1beta1/query"; -export { MsgCancelUpgradeResponse, SoftwareUpgradeProposal, QueryCurrentPlanResponse, QueryUpgradedConsensusStateRequest, QueryAuthorityRequest, MsgCancelUpgrade, Plan, ModuleVersion, QueryModuleVersionsRequest, QueryModuleVersionsResponse, QueryUpgradedConsensusStateResponse, QueryAuthorityResponse, CancelSoftwareUpgradeProposal, QueryCurrentPlanRequest, QueryAppliedPlanRequest, QueryAppliedPlanResponse, MsgSoftwareUpgrade, MsgSoftwareUpgradeResponse }; +export { SoftwareUpgradeProposal, QueryAuthorityRequest, MsgSoftwareUpgrade, Plan, QueryCurrentPlanResponse, MsgCancelUpgrade, MsgCancelUpgradeResponse, QueryAppliedPlanRequest, QueryAppliedPlanResponse, QueryModuleVersionsResponse, MsgSoftwareUpgradeResponse, CancelSoftwareUpgradeProposal, ModuleVersion, QueryCurrentPlanRequest, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse, QueryModuleVersionsRequest, QueryAuthorityResponse }; -type sendMsgCancelUpgradeResponseParams = { - value: MsgCancelUpgradeResponse, +type sendSoftwareUpgradeProposalParams = { + value: SoftwareUpgradeProposal, fee?: StdFee, memo?: string }; -type sendSoftwareUpgradeProposalParams = { - value: SoftwareUpgradeProposal, +type sendQueryAuthorityRequestParams = { + value: QueryAuthorityRequest, fee?: StdFee, memo?: string }; -type sendQueryCurrentPlanResponseParams = { - value: QueryCurrentPlanResponse, +type sendMsgSoftwareUpgradeParams = { + value: MsgSoftwareUpgrade, fee?: StdFee, memo?: string }; -type sendQueryUpgradedConsensusStateRequestParams = { - value: QueryUpgradedConsensusStateRequest, +type sendPlanParams = { + value: Plan, fee?: StdFee, memo?: string }; -type sendQueryAuthorityRequestParams = { - value: QueryAuthorityRequest, +type sendQueryCurrentPlanResponseParams = { + value: QueryCurrentPlanResponse, fee?: StdFee, memo?: string }; @@ -64,20 +64,20 @@ type sendMsgCancelUpgradeParams = { memo?: string }; -type sendPlanParams = { - value: Plan, +type sendMsgCancelUpgradeResponseParams = { + value: MsgCancelUpgradeResponse, fee?: StdFee, memo?: string }; -type sendModuleVersionParams = { - value: ModuleVersion, +type sendQueryAppliedPlanRequestParams = { + value: QueryAppliedPlanRequest, fee?: StdFee, memo?: string }; -type sendQueryModuleVersionsRequestParams = { - value: QueryModuleVersionsRequest, +type sendQueryAppliedPlanResponseParams = { + value: QueryAppliedPlanResponse, fee?: StdFee, memo?: string }; @@ -88,20 +88,20 @@ type sendQueryModuleVersionsResponseParams = { memo?: string }; -type sendQueryUpgradedConsensusStateResponseParams = { - value: QueryUpgradedConsensusStateResponse, +type sendMsgSoftwareUpgradeResponseParams = { + value: MsgSoftwareUpgradeResponse, fee?: StdFee, memo?: string }; -type sendQueryAuthorityResponseParams = { - value: QueryAuthorityResponse, +type sendCancelSoftwareUpgradeProposalParams = { + value: CancelSoftwareUpgradeProposal, fee?: StdFee, memo?: string }; -type sendCancelSoftwareUpgradeProposalParams = { - value: CancelSoftwareUpgradeProposal, +type sendModuleVersionParams = { + value: ModuleVersion, fee?: StdFee, memo?: string }; @@ -112,101 +112,101 @@ type sendQueryCurrentPlanRequestParams = { memo?: string }; -type sendQueryAppliedPlanRequestParams = { - value: QueryAppliedPlanRequest, +type sendQueryUpgradedConsensusStateRequestParams = { + value: QueryUpgradedConsensusStateRequest, fee?: StdFee, memo?: string }; -type sendQueryAppliedPlanResponseParams = { - value: QueryAppliedPlanResponse, +type sendQueryUpgradedConsensusStateResponseParams = { + value: QueryUpgradedConsensusStateResponse, fee?: StdFee, memo?: string }; -type sendMsgSoftwareUpgradeParams = { - value: MsgSoftwareUpgrade, +type sendQueryModuleVersionsRequestParams = { + value: QueryModuleVersionsRequest, fee?: StdFee, memo?: string }; -type sendMsgSoftwareUpgradeResponseParams = { - value: MsgSoftwareUpgradeResponse, +type sendQueryAuthorityResponseParams = { + value: QueryAuthorityResponse, fee?: StdFee, memo?: string }; -type msgCancelUpgradeResponseParams = { - value: MsgCancelUpgradeResponse, -}; - type softwareUpgradeProposalParams = { value: SoftwareUpgradeProposal, }; -type queryCurrentPlanResponseParams = { - value: QueryCurrentPlanResponse, +type queryAuthorityRequestParams = { + value: QueryAuthorityRequest, }; -type queryUpgradedConsensusStateRequestParams = { - value: QueryUpgradedConsensusStateRequest, +type msgSoftwareUpgradeParams = { + value: MsgSoftwareUpgrade, }; -type queryAuthorityRequestParams = { - value: QueryAuthorityRequest, +type planParams = { + value: Plan, +}; + +type queryCurrentPlanResponseParams = { + value: QueryCurrentPlanResponse, }; type msgCancelUpgradeParams = { value: MsgCancelUpgrade, }; -type planParams = { - value: Plan, +type msgCancelUpgradeResponseParams = { + value: MsgCancelUpgradeResponse, }; -type moduleVersionParams = { - value: ModuleVersion, +type queryAppliedPlanRequestParams = { + value: QueryAppliedPlanRequest, }; -type queryModuleVersionsRequestParams = { - value: QueryModuleVersionsRequest, +type queryAppliedPlanResponseParams = { + value: QueryAppliedPlanResponse, }; type queryModuleVersionsResponseParams = { value: QueryModuleVersionsResponse, }; -type queryUpgradedConsensusStateResponseParams = { - value: QueryUpgradedConsensusStateResponse, -}; - -type queryAuthorityResponseParams = { - value: QueryAuthorityResponse, +type msgSoftwareUpgradeResponseParams = { + value: MsgSoftwareUpgradeResponse, }; type cancelSoftwareUpgradeProposalParams = { value: CancelSoftwareUpgradeProposal, }; +type moduleVersionParams = { + value: ModuleVersion, +}; + type queryCurrentPlanRequestParams = { value: QueryCurrentPlanRequest, }; -type queryAppliedPlanRequestParams = { - value: QueryAppliedPlanRequest, +type queryUpgradedConsensusStateRequestParams = { + value: QueryUpgradedConsensusStateRequest, }; -type queryAppliedPlanResponseParams = { - value: QueryAppliedPlanResponse, +type queryUpgradedConsensusStateResponseParams = { + value: QueryUpgradedConsensusStateResponse, }; -type msgSoftwareUpgradeParams = { - value: MsgSoftwareUpgrade, +type queryModuleVersionsRequestParams = { + value: QueryModuleVersionsRequest, }; -type msgSoftwareUpgradeResponseParams = { - value: MsgSoftwareUpgradeResponse, +type queryAuthorityResponseParams = { + value: QueryAuthorityResponse, }; @@ -239,73 +239,73 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgCancelUpgradeResponse({ value, fee, memo }: sendMsgCancelUpgradeResponseParams): Promise { + async sendSoftwareUpgradeProposal({ value, fee, memo }: sendSoftwareUpgradeProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCancelUpgradeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSoftwareUpgradeProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCancelUpgradeResponse({ value: MsgCancelUpgradeResponse.fromPartial(value) }) + let msg = this.softwareUpgradeProposal({ value: SoftwareUpgradeProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCancelUpgradeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSoftwareUpgradeProposal: Could not broadcast Tx: '+ e.message) } }, - async sendSoftwareUpgradeProposal({ value, fee, memo }: sendSoftwareUpgradeProposalParams): Promise { + async sendQueryAuthorityRequest({ value, fee, memo }: sendQueryAuthorityRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendSoftwareUpgradeProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAuthorityRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.softwareUpgradeProposal({ value: SoftwareUpgradeProposal.fromPartial(value) }) + let msg = this.queryAuthorityRequest({ value: QueryAuthorityRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSoftwareUpgradeProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAuthorityRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCurrentPlanResponse({ value, fee, memo }: sendQueryCurrentPlanResponseParams): Promise { + async sendMsgSoftwareUpgrade({ value, fee, memo }: sendMsgSoftwareUpgradeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCurrentPlanResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSoftwareUpgrade: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCurrentPlanResponse({ value: QueryCurrentPlanResponse.fromPartial(value) }) + let msg = this.msgSoftwareUpgrade({ value: MsgSoftwareUpgrade.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCurrentPlanResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSoftwareUpgrade: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUpgradedConsensusStateRequest({ value, fee, memo }: sendQueryUpgradedConsensusStateRequestParams): Promise { + async sendPlan({ value, fee, memo }: sendPlanParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradedConsensusStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPlan: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradedConsensusStateRequest({ value: QueryUpgradedConsensusStateRequest.fromPartial(value) }) + let msg = this.plan({ value: Plan.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradedConsensusStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPlan: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAuthorityRequest({ value, fee, memo }: sendQueryAuthorityRequestParams): Promise { + async sendQueryCurrentPlanResponse({ value, fee, memo }: sendQueryCurrentPlanResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAuthorityRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCurrentPlanResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAuthorityRequest({ value: QueryAuthorityRequest.fromPartial(value) }) + let msg = this.queryCurrentPlanResponse({ value: QueryCurrentPlanResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAuthorityRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCurrentPlanResponse: Could not broadcast Tx: '+ e.message) } }, @@ -323,45 +323,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendPlan({ value, fee, memo }: sendPlanParams): Promise { + async sendMsgCancelUpgradeResponse({ value, fee, memo }: sendMsgCancelUpgradeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendPlan: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCancelUpgradeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.plan({ value: Plan.fromPartial(value) }) + let msg = this.msgCancelUpgradeResponse({ value: MsgCancelUpgradeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPlan: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCancelUpgradeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendModuleVersion({ value, fee, memo }: sendModuleVersionParams): Promise { + async sendQueryAppliedPlanRequest({ value, fee, memo }: sendQueryAppliedPlanRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendModuleVersion: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAppliedPlanRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.moduleVersion({ value: ModuleVersion.fromPartial(value) }) + let msg = this.queryAppliedPlanRequest({ value: QueryAppliedPlanRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendModuleVersion: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAppliedPlanRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryModuleVersionsRequest({ value, fee, memo }: sendQueryModuleVersionsRequestParams): Promise { + async sendQueryAppliedPlanResponse({ value, fee, memo }: sendQueryAppliedPlanResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryModuleVersionsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAppliedPlanResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryModuleVersionsRequest({ value: QueryModuleVersionsRequest.fromPartial(value) }) + let msg = this.queryAppliedPlanResponse({ value: QueryAppliedPlanResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryModuleVersionsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAppliedPlanResponse: Could not broadcast Tx: '+ e.message) } }, @@ -379,45 +379,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryUpgradedConsensusStateResponse({ value, fee, memo }: sendQueryUpgradedConsensusStateResponseParams): Promise { + async sendMsgSoftwareUpgradeResponse({ value, fee, memo }: sendMsgSoftwareUpgradeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradedConsensusStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSoftwareUpgradeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradedConsensusStateResponse({ value: QueryUpgradedConsensusStateResponse.fromPartial(value) }) + let msg = this.msgSoftwareUpgradeResponse({ value: MsgSoftwareUpgradeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradedConsensusStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSoftwareUpgradeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAuthorityResponse({ value, fee, memo }: sendQueryAuthorityResponseParams): Promise { + async sendCancelSoftwareUpgradeProposal({ value, fee, memo }: sendCancelSoftwareUpgradeProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAuthorityResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCancelSoftwareUpgradeProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAuthorityResponse({ value: QueryAuthorityResponse.fromPartial(value) }) + let msg = this.cancelSoftwareUpgradeProposal({ value: CancelSoftwareUpgradeProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAuthorityResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCancelSoftwareUpgradeProposal: Could not broadcast Tx: '+ e.message) } }, - async sendCancelSoftwareUpgradeProposal({ value, fee, memo }: sendCancelSoftwareUpgradeProposalParams): Promise { + async sendModuleVersion({ value, fee, memo }: sendModuleVersionParams): Promise { if (!signer) { - throw new Error('TxClient:sendCancelSoftwareUpgradeProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendModuleVersion: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.cancelSoftwareUpgradeProposal({ value: CancelSoftwareUpgradeProposal.fromPartial(value) }) + let msg = this.moduleVersion({ value: ModuleVersion.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCancelSoftwareUpgradeProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendModuleVersion: Could not broadcast Tx: '+ e.message) } }, @@ -435,100 +435,100 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryAppliedPlanRequest({ value, fee, memo }: sendQueryAppliedPlanRequestParams): Promise { + async sendQueryUpgradedConsensusStateRequest({ value, fee, memo }: sendQueryUpgradedConsensusStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAppliedPlanRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradedConsensusStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAppliedPlanRequest({ value: QueryAppliedPlanRequest.fromPartial(value) }) + let msg = this.queryUpgradedConsensusStateRequest({ value: QueryUpgradedConsensusStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAppliedPlanRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradedConsensusStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAppliedPlanResponse({ value, fee, memo }: sendQueryAppliedPlanResponseParams): Promise { + async sendQueryUpgradedConsensusStateResponse({ value, fee, memo }: sendQueryUpgradedConsensusStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAppliedPlanResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradedConsensusStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAppliedPlanResponse({ value: QueryAppliedPlanResponse.fromPartial(value) }) + let msg = this.queryUpgradedConsensusStateResponse({ value: QueryUpgradedConsensusStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAppliedPlanResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradedConsensusStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSoftwareUpgrade({ value, fee, memo }: sendMsgSoftwareUpgradeParams): Promise { + async sendQueryModuleVersionsRequest({ value, fee, memo }: sendQueryModuleVersionsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSoftwareUpgrade: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryModuleVersionsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSoftwareUpgrade({ value: MsgSoftwareUpgrade.fromPartial(value) }) + let msg = this.queryModuleVersionsRequest({ value: QueryModuleVersionsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSoftwareUpgrade: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryModuleVersionsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSoftwareUpgradeResponse({ value, fee, memo }: sendMsgSoftwareUpgradeResponseParams): Promise { + async sendQueryAuthorityResponse({ value, fee, memo }: sendQueryAuthorityResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSoftwareUpgradeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAuthorityResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSoftwareUpgradeResponse({ value: MsgSoftwareUpgradeResponse.fromPartial(value) }) + let msg = this.queryAuthorityResponse({ value: QueryAuthorityResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSoftwareUpgradeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAuthorityResponse: Could not broadcast Tx: '+ e.message) } }, - msgCancelUpgradeResponse({ value }: msgCancelUpgradeResponseParams): EncodeObject { + softwareUpgradeProposal({ value }: softwareUpgradeProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", value: MsgCancelUpgradeResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", value: SoftwareUpgradeProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCancelUpgradeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:SoftwareUpgradeProposal: Could not create message: ' + e.message) } }, - softwareUpgradeProposal({ value }: softwareUpgradeProposalParams): EncodeObject { + queryAuthorityRequest({ value }: queryAuthorityRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", value: SoftwareUpgradeProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", value: QueryAuthorityRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SoftwareUpgradeProposal: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAuthorityRequest: Could not create message: ' + e.message) } }, - queryCurrentPlanResponse({ value }: queryCurrentPlanResponseParams): EncodeObject { + msgSoftwareUpgrade({ value }: msgSoftwareUpgradeParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", value: QueryCurrentPlanResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", value: MsgSoftwareUpgrade.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCurrentPlanResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSoftwareUpgrade: Could not create message: ' + e.message) } }, - queryUpgradedConsensusStateRequest({ value }: queryUpgradedConsensusStateRequestParams): EncodeObject { + plan({ value }: planParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", value: QueryUpgradedConsensusStateRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.Plan", value: Plan.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradedConsensusStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Plan: Could not create message: ' + e.message) } }, - queryAuthorityRequest({ value }: queryAuthorityRequestParams): EncodeObject { + queryCurrentPlanResponse({ value }: queryCurrentPlanResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", value: QueryAuthorityRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", value: QueryCurrentPlanResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAuthorityRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCurrentPlanResponse: Could not create message: ' + e.message) } }, @@ -540,27 +540,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - plan({ value }: planParams): EncodeObject { + msgCancelUpgradeResponse({ value }: msgCancelUpgradeResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.Plan", value: Plan.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", value: MsgCancelUpgradeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Plan: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCancelUpgradeResponse: Could not create message: ' + e.message) } }, - moduleVersion({ value }: moduleVersionParams): EncodeObject { + queryAppliedPlanRequest({ value }: queryAppliedPlanRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", value: ModuleVersion.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", value: QueryAppliedPlanRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ModuleVersion: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAppliedPlanRequest: Could not create message: ' + e.message) } }, - queryModuleVersionsRequest({ value }: queryModuleVersionsRequestParams): EncodeObject { + queryAppliedPlanResponse({ value }: queryAppliedPlanResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", value: QueryModuleVersionsRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", value: QueryAppliedPlanResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryModuleVersionsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAppliedPlanResponse: Could not create message: ' + e.message) } }, @@ -572,27 +572,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryUpgradedConsensusStateResponse({ value }: queryUpgradedConsensusStateResponseParams): EncodeObject { + msgSoftwareUpgradeResponse({ value }: msgSoftwareUpgradeResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", value: QueryUpgradedConsensusStateResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", value: MsgSoftwareUpgradeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradedConsensusStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSoftwareUpgradeResponse: Could not create message: ' + e.message) } }, - queryAuthorityResponse({ value }: queryAuthorityResponseParams): EncodeObject { + cancelSoftwareUpgradeProposal({ value }: cancelSoftwareUpgradeProposalParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", value: QueryAuthorityResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", value: CancelSoftwareUpgradeProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAuthorityResponse: Could not create message: ' + e.message) + throw new Error('TxClient:CancelSoftwareUpgradeProposal: Could not create message: ' + e.message) } }, - cancelSoftwareUpgradeProposal({ value }: cancelSoftwareUpgradeProposalParams): EncodeObject { + moduleVersion({ value }: moduleVersionParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", value: CancelSoftwareUpgradeProposal.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", value: ModuleVersion.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:CancelSoftwareUpgradeProposal: Could not create message: ' + e.message) + throw new Error('TxClient:ModuleVersion: Could not create message: ' + e.message) } }, @@ -604,35 +604,35 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryAppliedPlanRequest({ value }: queryAppliedPlanRequestParams): EncodeObject { + queryUpgradedConsensusStateRequest({ value }: queryUpgradedConsensusStateRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", value: QueryAppliedPlanRequest.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", value: QueryUpgradedConsensusStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAppliedPlanRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradedConsensusStateRequest: Could not create message: ' + e.message) } }, - queryAppliedPlanResponse({ value }: queryAppliedPlanResponseParams): EncodeObject { + queryUpgradedConsensusStateResponse({ value }: queryUpgradedConsensusStateResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", value: QueryAppliedPlanResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", value: QueryUpgradedConsensusStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAppliedPlanResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradedConsensusStateResponse: Could not create message: ' + e.message) } }, - msgSoftwareUpgrade({ value }: msgSoftwareUpgradeParams): EncodeObject { + queryModuleVersionsRequest({ value }: queryModuleVersionsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", value: MsgSoftwareUpgrade.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", value: QueryModuleVersionsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSoftwareUpgrade: Could not create message: ' + e.message) + throw new Error('TxClient:QueryModuleVersionsRequest: Could not create message: ' + e.message) } }, - msgSoftwareUpgradeResponse({ value }: msgSoftwareUpgradeResponseParams): EncodeObject { + queryAuthorityResponse({ value }: queryAuthorityResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", value: MsgSoftwareUpgradeResponse.fromPartial( value ) } + return { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", value: QueryAuthorityResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSoftwareUpgradeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAuthorityResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.upgrade.v1beta1/registry.ts b/ts-client/cosmos.upgrade.v1beta1/registry.ts index 4dd80664..53a8fd37 100755 --- a/ts-client/cosmos.upgrade.v1beta1/registry.ts +++ b/ts-client/cosmos.upgrade.v1beta1/registry.ts @@ -1,42 +1,42 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgCancelUpgradeResponse } from "./types/cosmos/upgrade/v1beta1/tx"; import { SoftwareUpgradeProposal } from "./types/cosmos/upgrade/v1beta1/upgrade"; -import { QueryCurrentPlanResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { QueryUpgradedConsensusStateRequest } from "./types/cosmos/upgrade/v1beta1/query"; import { QueryAuthorityRequest } from "./types/cosmos/upgrade/v1beta1/query"; -import { MsgCancelUpgrade } from "./types/cosmos/upgrade/v1beta1/tx"; +import { MsgSoftwareUpgrade } from "./types/cosmos/upgrade/v1beta1/tx"; import { Plan } from "./types/cosmos/upgrade/v1beta1/upgrade"; -import { ModuleVersion } from "./types/cosmos/upgrade/v1beta1/upgrade"; -import { QueryModuleVersionsRequest } from "./types/cosmos/upgrade/v1beta1/query"; -import { QueryModuleVersionsResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { QueryUpgradedConsensusStateResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { QueryAuthorityResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { CancelSoftwareUpgradeProposal } from "./types/cosmos/upgrade/v1beta1/upgrade"; -import { QueryCurrentPlanRequest } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryCurrentPlanResponse } from "./types/cosmos/upgrade/v1beta1/query"; +import { MsgCancelUpgrade } from "./types/cosmos/upgrade/v1beta1/tx"; +import { MsgCancelUpgradeResponse } from "./types/cosmos/upgrade/v1beta1/tx"; import { QueryAppliedPlanRequest } from "./types/cosmos/upgrade/v1beta1/query"; import { QueryAppliedPlanResponse } from "./types/cosmos/upgrade/v1beta1/query"; -import { MsgSoftwareUpgrade } from "./types/cosmos/upgrade/v1beta1/tx"; +import { QueryModuleVersionsResponse } from "./types/cosmos/upgrade/v1beta1/query"; import { MsgSoftwareUpgradeResponse } from "./types/cosmos/upgrade/v1beta1/tx"; +import { CancelSoftwareUpgradeProposal } from "./types/cosmos/upgrade/v1beta1/upgrade"; +import { ModuleVersion } from "./types/cosmos/upgrade/v1beta1/upgrade"; +import { QueryCurrentPlanRequest } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryUpgradedConsensusStateRequest } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryUpgradedConsensusStateResponse } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryModuleVersionsRequest } from "./types/cosmos/upgrade/v1beta1/query"; +import { QueryAuthorityResponse } from "./types/cosmos/upgrade/v1beta1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", MsgCancelUpgradeResponse], ["/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", SoftwareUpgradeProposal], - ["/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", QueryCurrentPlanResponse], - ["/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", QueryUpgradedConsensusStateRequest], ["/cosmos.upgrade.v1beta1.QueryAuthorityRequest", QueryAuthorityRequest], - ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade], + ["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.Plan", Plan], - ["/cosmos.upgrade.v1beta1.ModuleVersion", ModuleVersion], - ["/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", QueryModuleVersionsRequest], - ["/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", QueryModuleVersionsResponse], - ["/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", QueryUpgradedConsensusStateResponse], - ["/cosmos.upgrade.v1beta1.QueryAuthorityResponse", QueryAuthorityResponse], - ["/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", CancelSoftwareUpgradeProposal], - ["/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", QueryCurrentPlanRequest], + ["/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", QueryCurrentPlanResponse], + ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade], + ["/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", MsgCancelUpgradeResponse], ["/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", QueryAppliedPlanRequest], ["/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", QueryAppliedPlanResponse], - ["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], + ["/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", QueryModuleVersionsResponse], ["/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", MsgSoftwareUpgradeResponse], + ["/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", CancelSoftwareUpgradeProposal], + ["/cosmos.upgrade.v1beta1.ModuleVersion", ModuleVersion], + ["/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", QueryCurrentPlanRequest], + ["/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", QueryUpgradedConsensusStateRequest], + ["/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", QueryUpgradedConsensusStateResponse], + ["/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", QueryModuleVersionsRequest], + ["/cosmos.upgrade.v1beta1.QueryAuthorityResponse", QueryAuthorityResponse], ]; diff --git a/ts-client/cosmos.upgrade.v1beta1/types/amino/amino.ts b/ts-client/cosmos.upgrade.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts new file mode 100644 index 00000000..0dddf30c --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/runtime/v1alpha1/module.ts @@ -0,0 +1,378 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/runtime/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.app.runtime.v1alpha1"; + +/** Module is the config object for the runtime module. */ +export interface Module { + /** app_name is the name of the app. */ + appName: string; + /** + * begin_blockers specifies the module names of begin blockers + * to call in the order in which they should be called. If this is left empty + * no begin blocker will be registered. + */ + beginBlockers: string[]; + /** + * end_blockers specifies the module names of the end blockers + * to call in the order in which they should be called. If this is left empty + * no end blocker will be registered. + */ + endBlockers: string[]; + /** + * init_genesis specifies the module names of init genesis functions + * to call in the order in which they should be called. If this is left empty + * no init genesis function will be registered. + */ + initGenesis: string[]; + /** + * export_genesis specifies the order in which to export module genesis data. + * If this is left empty, the init_genesis order will be used for export genesis + * if it is specified. + */ + exportGenesis: string[]; + /** + * override_store_keys is an optional list of overrides for the module store keys + * to be used in keeper construction. + */ + overrideStoreKeys: StoreKeyConfig[]; + /** + * order_migrations defines the order in which module migrations are performed. + * If this is left empty, it uses the default migration order. + * https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.0-alpha2/types/module#DefaultMigrationsOrder + */ + orderMigrations: string[]; + /** + * precommiters specifies the module names of the precommiters + * to call in the order in which they should be called. If this is left empty + * no precommit function will be registered. + */ + precommiters: string[]; + /** + * prepare_check_staters specifies the module names of the prepare_check_staters + * to call in the order in which they should be called. If this is left empty + * no preparecheckstate function will be registered. + */ + prepareCheckStaters: string[]; +} + +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfig { + /** name of the module to override the store key of */ + moduleName: string; + /** the kv store key to use instead of the module name. */ + kvStoreKey: string; +} + +function createBaseModule(): Module { + return { + appName: "", + beginBlockers: [], + endBlockers: [], + initGenesis: [], + exportGenesis: [], + overrideStoreKeys: [], + orderMigrations: [], + precommiters: [], + prepareCheckStaters: [], + }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + for (const v of message.beginBlockers) { + writer.uint32(18).string(v!); + } + for (const v of message.endBlockers) { + writer.uint32(26).string(v!); + } + for (const v of message.initGenesis) { + writer.uint32(34).string(v!); + } + for (const v of message.exportGenesis) { + writer.uint32(42).string(v!); + } + for (const v of message.overrideStoreKeys) { + StoreKeyConfig.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.orderMigrations) { + writer.uint32(58).string(v!); + } + for (const v of message.precommiters) { + writer.uint32(66).string(v!); + } + for (const v of message.prepareCheckStaters) { + writer.uint32(74).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.appName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.beginBlockers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.endBlockers.push(reader.string()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.initGenesis.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.exportGenesis.push(reader.string()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.overrideStoreKeys.push(StoreKeyConfig.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.orderMigrations.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.precommiters.push(reader.string()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.prepareCheckStaters.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + beginBlockers: globalThis.Array.isArray(object?.beginBlockers) + ? object.beginBlockers.map((e: any) => globalThis.String(e)) + : [], + endBlockers: globalThis.Array.isArray(object?.endBlockers) + ? object.endBlockers.map((e: any) => globalThis.String(e)) + : [], + initGenesis: globalThis.Array.isArray(object?.initGenesis) + ? object.initGenesis.map((e: any) => globalThis.String(e)) + : [], + exportGenesis: globalThis.Array.isArray(object?.exportGenesis) + ? object.exportGenesis.map((e: any) => globalThis.String(e)) + : [], + overrideStoreKeys: globalThis.Array.isArray(object?.overrideStoreKeys) + ? object.overrideStoreKeys.map((e: any) => StoreKeyConfig.fromJSON(e)) + : [], + orderMigrations: globalThis.Array.isArray(object?.orderMigrations) + ? object.orderMigrations.map((e: any) => globalThis.String(e)) + : [], + precommiters: globalThis.Array.isArray(object?.precommiters) + ? object.precommiters.map((e: any) => globalThis.String(e)) + : [], + prepareCheckStaters: globalThis.Array.isArray(object?.prepareCheckStaters) + ? object.prepareCheckStaters.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.beginBlockers?.length) { + obj.beginBlockers = message.beginBlockers; + } + if (message.endBlockers?.length) { + obj.endBlockers = message.endBlockers; + } + if (message.initGenesis?.length) { + obj.initGenesis = message.initGenesis; + } + if (message.exportGenesis?.length) { + obj.exportGenesis = message.exportGenesis; + } + if (message.overrideStoreKeys?.length) { + obj.overrideStoreKeys = message.overrideStoreKeys.map((e) => StoreKeyConfig.toJSON(e)); + } + if (message.orderMigrations?.length) { + obj.orderMigrations = message.orderMigrations; + } + if (message.precommiters?.length) { + obj.precommiters = message.precommiters; + } + if (message.prepareCheckStaters?.length) { + obj.prepareCheckStaters = message.prepareCheckStaters; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.appName = object.appName ?? ""; + message.beginBlockers = object.beginBlockers?.map((e) => e) || []; + message.endBlockers = object.endBlockers?.map((e) => e) || []; + message.initGenesis = object.initGenesis?.map((e) => e) || []; + message.exportGenesis = object.exportGenesis?.map((e) => e) || []; + message.overrideStoreKeys = object.overrideStoreKeys?.map((e) => StoreKeyConfig.fromPartial(e)) || []; + message.orderMigrations = object.orderMigrations?.map((e) => e) || []; + message.precommiters = object.precommiters?.map((e) => e) || []; + message.prepareCheckStaters = object.prepareCheckStaters?.map((e) => e) || []; + return message; + }, +}; + +function createBaseStoreKeyConfig(): StoreKeyConfig { + return { moduleName: "", kvStoreKey: "" }; +} + +export const StoreKeyConfig: MessageFns = { + encode(message: StoreKeyConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.kvStoreKey !== "") { + writer.uint32(18).string(message.kvStoreKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreKeyConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKeyConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.kvStoreKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKeyConfig { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + kvStoreKey: isSet(object.kvStoreKey) ? globalThis.String(object.kvStoreKey) : "", + }; + }, + + toJSON(message: StoreKeyConfig): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.kvStoreKey !== "") { + obj.kvStoreKey = message.kvStoreKey; + } + return obj; + }, + + create, I>>(base?: I): StoreKeyConfig { + return StoreKeyConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKeyConfig { + const message = createBaseStoreKeyConfig(); + message.moduleName = object.moduleName ?? ""; + message.kvStoreKey = object.kvStoreKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/config.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/config.ts new file mode 100644 index 00000000..da9f2893 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/config.ts @@ -0,0 +1,339 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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[]; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is global (not module specific). + */ + golangBindings: GolangBinding[]; +} + +/** 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 + | undefined; + /** + * golang_bindings specifies explicit interface to implementation type bindings which + * depinject uses to resolve interface inputs to provider functions. The scope of this + * field's configuration is module specific. + */ + golangBindings: GolangBinding[]; +} + +/** GolangBinding is an explicit interface type to implementing type binding for dependency injection. */ +export interface GolangBinding { + /** interface_type is the interface type which will be bound to a specific implementation type */ + interfaceType: string; + /** implementation is the implementing type which will be supplied when an input of type interface is requested */ + implementation: string; +} + +function createBaseConfig(): Config { + return { modules: [], golangBindings: [] }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.modules) { + ModuleConfig.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.modules.push(ModuleConfig.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + modules: globalThis.Array.isArray(object?.modules) + ? object.modules.map((e: any) => ModuleConfig.fromJSON(e)) + : [], + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.modules?.length) { + obj.modules = message.modules.map((e) => ModuleConfig.toJSON(e)); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.modules = object.modules?.map((e) => ModuleConfig.fromPartial(e)) || []; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseModuleConfig(): ModuleConfig { + return { name: "", config: undefined, golangBindings: [] }; +} + +export const ModuleConfig: MessageFns = { + encode(message: ModuleConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.config !== undefined) { + Any.encode(message.config, writer.uint32(18).fork()).join(); + } + for (const v of message.golangBindings) { + GolangBinding.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.config = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.golangBindings.push(GolangBinding.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleConfig { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + config: isSet(object.config) ? Any.fromJSON(object.config) : undefined, + golangBindings: globalThis.Array.isArray(object?.golangBindings) + ? object.golangBindings.map((e: any) => GolangBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleConfig): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.config !== undefined) { + obj.config = Any.toJSON(message.config); + } + if (message.golangBindings?.length) { + obj.golangBindings = message.golangBindings.map((e) => GolangBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleConfig { + return ModuleConfig.fromPartial(base ?? ({} as any)); + }, + 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; + message.golangBindings = object.golangBindings?.map((e) => GolangBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGolangBinding(): GolangBinding { + return { interfaceType: "", implementation: "" }; +} + +export const GolangBinding: MessageFns = { + encode(message: GolangBinding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceType !== "") { + writer.uint32(10).string(message.interfaceType); + } + if (message.implementation !== "") { + writer.uint32(18).string(message.implementation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GolangBinding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGolangBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.interfaceType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.implementation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GolangBinding { + return { + interfaceType: isSet(object.interfaceType) ? globalThis.String(object.interfaceType) : "", + implementation: isSet(object.implementation) ? globalThis.String(object.implementation) : "", + }; + }, + + toJSON(message: GolangBinding): unknown { + const obj: any = {}; + if (message.interfaceType !== "") { + obj.interfaceType = message.interfaceType; + } + if (message.implementation !== "") { + obj.implementation = message.implementation; + } + return obj; + }, + + create, I>>(base?: I): GolangBinding { + return GolangBinding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GolangBinding { + const message = createBaseGolangBinding(); + message.interfaceType = object.interfaceType ?? ""; + message.implementation = object.implementation ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/query.ts new file mode 100644 index 00000000..3a172979 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/app/v1alpha1/query.ts @@ -0,0 +1,174 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +function createBaseQueryConfigRequest(): QueryConfigRequest { + return {}; +} + +export const QueryConfigRequest: MessageFns = { + encode(_: QueryConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConfigRequest { + return {}; + }, + + toJSON(_: QueryConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConfigRequest { + return QueryConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConfigRequest { + const message = createBaseQueryConfigRequest(); + return message; + }, +}; + +function createBaseQueryConfigResponse(): QueryConfigResponse { + return { config: undefined }; +} + +export const QueryConfigResponse: MessageFns = { + encode(message: QueryConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + Config.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = Config.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConfigResponse { + return { config: isSet(object.config) ? Config.fromJSON(object.config) : undefined }; + }, + + toJSON(message: QueryConfigResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = Config.toJSON(message.config); + } + return obj; + }, + + create, I>>(base?: I): QueryConfigResponse { + return QueryConfigResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.app.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/module/v1/module.ts new file mode 100644 index 00000000..c426dc68 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/module/v1/module.ts @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.auth.module.v1"; + +/** Module is the config object for the auth module. */ +export interface Module { + /** bech32_prefix is the bech32 account prefix for the app. */ + bech32Prefix: string; + /** module_account_permissions are module account permissions. */ + moduleAccountPermissions: ModuleAccountPermission[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermission { + /** account is the name of the module. */ + account: string; + /** + * permissions are the permissions this module has. Currently recognized + * values are minter, burner and staking. + */ + permissions: string[]; +} + +function createBaseModule(): Module { + return { bech32Prefix: "", moduleAccountPermissions: [], authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + for (const v of message.moduleAccountPermissions) { + ModuleAccountPermission.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(26).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.moduleAccountPermissions.push(ModuleAccountPermission.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "", + moduleAccountPermissions: globalThis.Array.isArray(object?.moduleAccountPermissions) + ? object.moduleAccountPermissions.map((e: any) => ModuleAccountPermission.fromJSON(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + if (message.moduleAccountPermissions?.length) { + obj.moduleAccountPermissions = message.moduleAccountPermissions.map((e) => ModuleAccountPermission.toJSON(e)); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.bech32Prefix = object.bech32Prefix ?? ""; + message.moduleAccountPermissions = + object.moduleAccountPermissions?.map((e) => ModuleAccountPermission.fromPartial(e)) || []; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseModuleAccountPermission(): ModuleAccountPermission { + return { account: "", permissions: [] }; +} + +export const ModuleAccountPermission: MessageFns = { + encode(message: ModuleAccountPermission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + for (const v of message.permissions) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccountPermission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccountPermission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccountPermission { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccountPermission): unknown { + const obj: any = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccountPermission { + return ModuleAccountPermission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccountPermission { + const message = createBaseModuleAccountPermission(); + message.account = object.account ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/auth.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..4dd78b9e --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,517 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/auth.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + pubKey: Any | undefined; + accountNumber: number; + sequence: number; +} + +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + baseAccount: BaseAccount | undefined; + name: string; + permissions: string[]; +} + +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredential { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + moduleName: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivationKeys: Uint8Array[]; +} + +/** Params defines the parameters for the auth module. */ +export interface Params { + maxMemoCharacters: number; + txSigLimit: number; + txSizeCostPerByte: number; + sigVerifyCostEd25519: number; + sigVerifyCostSecp256k1: number; +} + +function createBaseBaseAccount(): BaseAccount { + return { address: "", pubKey: undefined, accountNumber: 0, sequence: 0 }; +} + +export const BaseAccount: MessageFns = { + encode(message: BaseAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.accountNumber !== 0) { + writer.uint32(24).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseAccount { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): BaseAccount { + return BaseAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.accountNumber = object.accountNumber ?? 0; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModuleAccount(): ModuleAccount { + return { baseAccount: undefined, name: "", permissions: [] }; +} + +export const ModuleAccount: MessageFns = { + encode(message: ModuleAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + for (const v of message.permissions) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + name: isSet(object.name) ? globalThis.String(object.name) : "", + permissions: globalThis.Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccount { + return ModuleAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccount { + const message = createBaseModuleAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseModuleCredential(): ModuleCredential { + return { moduleName: "", derivationKeys: [] }; +} + +export const ModuleCredential: MessageFns = { + encode(message: ModuleCredential, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + for (const v of message.derivationKeys) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleCredential { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.derivationKeys.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleCredential { + return { + moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "", + derivationKeys: globalThis.Array.isArray(object?.derivationKeys) + ? object.derivationKeys.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: ModuleCredential): unknown { + const obj: any = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.derivationKeys?.length) { + obj.derivationKeys = message.derivationKeys.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleCredential { + return ModuleCredential.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleCredential { + const message = createBaseModuleCredential(); + message.moduleName = object.moduleName ?? ""; + message.derivationKeys = object.derivationKeys?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + maxMemoCharacters: 0, + txSigLimit: 0, + txSizeCostPerByte: 0, + sigVerifyCostEd25519: 0, + sigVerifyCostSecp256k1: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMemoCharacters !== 0) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxMemoCharacters = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.txSigLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.txSizeCostPerByte = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sigVerifyCostEd25519 = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sigVerifyCostSecp256k1 = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + maxMemoCharacters: isSet(object.maxMemoCharacters) ? globalThis.Number(object.maxMemoCharacters) : 0, + txSigLimit: isSet(object.txSigLimit) ? globalThis.Number(object.txSigLimit) : 0, + txSizeCostPerByte: isSet(object.txSizeCostPerByte) ? globalThis.Number(object.txSizeCostPerByte) : 0, + sigVerifyCostEd25519: isSet(object.sigVerifyCostEd25519) ? globalThis.Number(object.sigVerifyCostEd25519) : 0, + sigVerifyCostSecp256k1: isSet(object.sigVerifyCostSecp256k1) + ? globalThis.Number(object.sigVerifyCostSecp256k1) + : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.maxMemoCharacters !== 0) { + obj.maxMemoCharacters = Math.round(message.maxMemoCharacters); + } + if (message.txSigLimit !== 0) { + obj.txSigLimit = Math.round(message.txSigLimit); + } + if (message.txSizeCostPerByte !== 0) { + obj.txSizeCostPerByte = Math.round(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== 0) { + obj.sigVerifyCostEd25519 = Math.round(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== 0) { + obj.sigVerifyCostSecp256k1 = Math.round(message.sigVerifyCostSecp256k1); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.maxMemoCharacters = object.maxMemoCharacters ?? 0; + message.txSigLimit = object.txSigLimit ?? 0; + message.txSizeCostPerByte = object.txSizeCostPerByte ?? 0; + message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 ?? 0; + message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 00000000..d165dd08 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** accounts are the accounts present at genesis. */ + accounts: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, accounts: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.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) + ? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/query.ts new file mode 100644 index 00000000..e187ff09 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,1545 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { BaseAccount, 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} + +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account: Any | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequest { +} + +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponse { + accounts: Any[]; +} + +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequest { + name: string; +} + +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponse { + account: Any | undefined; +} + +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequest { +} + +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponse { + bech32Prefix: string; +} + +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequest { + addressBytes: Uint8Array; +} + +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponse { + addressString: string; +} + +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequest { + addressString: string; +} + +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponse { + addressBytes: Uint8Array; +} + +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequest { + /** + * Deprecated, use account_id instead + * + * id is the account number of the address to be queried. This field + * should have been an uint64 (like all account numbers), and will be + * updated to uint64 in a future version of the auth query. + * + * @deprecated + */ + id: number; + /** + * account_id is the account number of the address to be queried. + * + * Since: cosmos-sdk 0.47 + */ + accountId: number; +} + +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponse { + accountAddress: string; +} + +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequest { + /** address is the account address string. */ + address: string; +} + +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponse { + /** info is the account info which is represented by BaseAccount. */ + info: BaseAccount | undefined; +} + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsResponse { + return { + accounts: globalThis.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?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsResponse { + return QueryAccountsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { account: undefined }; +} + +export const QueryAccountResponse: MessageFns = { + encode(message: QueryAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryAccountResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountResponse { + return QueryAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { + return {}; +} + +export const QueryModuleAccountsRequest: MessageFns = { + encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryModuleAccountsRequest { + return {}; + }, + + toJSON(_: QueryModuleAccountsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, +}; + +function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { + return { accounts: [] }; +} + +export const QueryModuleAccountsResponse: MessageFns = { + encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryModuleAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameRequest(): QueryModuleAccountByNameRequest { + return { name: "" }; +} + +export const QueryModuleAccountByNameRequest: MessageFns = { + encode(message: QueryModuleAccountByNameRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryModuleAccountByNameRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleAccountByNameRequest { + return QueryModuleAccountByNameRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameRequest { + const message = createBaseQueryModuleAccountByNameRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryModuleAccountByNameResponse(): QueryModuleAccountByNameResponse { + return { account: undefined }; +} + +export const QueryModuleAccountByNameResponse: MessageFns = { + encode(message: QueryModuleAccountByNameResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountByNameResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryModuleAccountByNameResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryModuleAccountByNameResponse { + return QueryModuleAccountByNameResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryModuleAccountByNameResponse { + const message = createBaseQueryModuleAccountByNameResponse(); + message.account = (object.account !== undefined && object.account !== null) + ? Any.fromPartial(object.account) + : undefined; + return message; + }, +}; + +function createBaseBech32PrefixRequest(): Bech32PrefixRequest { + return {}; +} + +export const Bech32PrefixRequest: MessageFns = { + encode(_: Bech32PrefixRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Bech32PrefixRequest { + return {}; + }, + + toJSON(_: Bech32PrefixRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Bech32PrefixRequest { + return Bech32PrefixRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, +}; + +function createBaseBech32PrefixResponse(): Bech32PrefixResponse { + return { bech32Prefix: "" }; +} + +export const Bech32PrefixResponse: MessageFns = { + encode(message: Bech32PrefixResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bech32Prefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Bech32PrefixResponse { + return { bech32Prefix: isSet(object.bech32Prefix) ? globalThis.String(object.bech32Prefix) : "" }; + }, + + toJSON(message: Bech32PrefixResponse): unknown { + const obj: any = {}; + if (message.bech32Prefix !== "") { + obj.bech32Prefix = message.bech32Prefix; + } + return obj; + }, + + create, I>>(base?: I): Bech32PrefixResponse { + return Bech32PrefixResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + message.bech32Prefix = object.bech32Prefix ?? ""; + return message; + }, +}; + +function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressBytesToStringRequest: MessageFns = { + encode(message: AddressBytesToStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringRequest { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressBytesToStringRequest): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringRequest { + return AddressBytesToStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { + return { addressString: "" }; +} + +export const AddressBytesToStringResponse: MessageFns = { + encode(message: AddressBytesToStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringResponse { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressBytesToStringResponse): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressBytesToStringResponse { + return AddressBytesToStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { + return { addressString: "" }; +} + +export const AddressStringToBytesRequest: MessageFns = { + encode(message: AddressStringToBytesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesRequest { + return { addressString: isSet(object.addressString) ? globalThis.String(object.addressString) : "" }; + }, + + toJSON(message: AddressStringToBytesRequest): unknown { + const obj: any = {}; + if (message.addressString !== "") { + obj.addressString = message.addressString; + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesRequest { + return AddressStringToBytesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + message.addressString = object.addressString ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { + return { addressBytes: new Uint8Array(0) }; +} + +export const AddressStringToBytesResponse: MessageFns = { + encode(message: AddressStringToBytesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addressBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesResponse { + return { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array(0) }; + }, + + toJSON(message: AddressStringToBytesResponse): unknown { + const obj: any = {}; + if (message.addressBytes.length !== 0) { + obj.addressBytes = base64FromBytes(message.addressBytes); + } + return obj; + }, + + create, I>>(base?: I): AddressStringToBytesResponse { + return AddressStringToBytesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + message.addressBytes = object.addressBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAccountAddressByIDRequest(): QueryAccountAddressByIDRequest { + return { id: 0, accountId: 0 }; +} + +export const QueryAccountAddressByIDRequest: MessageFns = { + encode(message: QueryAccountAddressByIDRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int64(message.id); + } + if (message.accountId !== 0) { + writer.uint32(16).uint64(message.accountId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.accountId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDRequest { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0, + }; + }, + + toJSON(message: QueryAccountAddressByIDRequest): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.accountId !== 0) { + obj.accountId = Math.round(message.accountId); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDRequest { + return QueryAccountAddressByIDRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDRequest { + const message = createBaseQueryAccountAddressByIDRequest(); + message.id = object.id ?? 0; + message.accountId = object.accountId ?? 0; + return message; + }, +}; + +function createBaseQueryAccountAddressByIDResponse(): QueryAccountAddressByIDResponse { + return { accountAddress: "" }; +} + +export const QueryAccountAddressByIDResponse: MessageFns = { + encode(message: QueryAccountAddressByIDResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.accountAddress !== "") { + writer.uint32(10).string(message.accountAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accountAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountAddressByIDResponse { + return { accountAddress: isSet(object.accountAddress) ? globalThis.String(object.accountAddress) : "" }; + }, + + toJSON(message: QueryAccountAddressByIDResponse): unknown { + const obj: any = {}; + if (message.accountAddress !== "") { + obj.accountAddress = message.accountAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountAddressByIDResponse { + return QueryAccountAddressByIDResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAccountAddressByIDResponse { + const message = createBaseQueryAccountAddressByIDResponse(); + message.accountAddress = object.accountAddress ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoRequest(): QueryAccountInfoRequest { + return { address: "" }; +} + +export const QueryAccountInfoRequest: MessageFns = { + encode(message: QueryAccountInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoRequest { + return QueryAccountInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountInfoResponse(): QueryAccountInfoResponse { + return { info: undefined }; +} + +export const QueryAccountInfoResponse: MessageFns = { + encode(message: QueryAccountInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + BaseAccount.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.info = BaseAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountInfoResponse { + return { info: isSet(object.info) ? BaseAccount.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryAccountInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = BaseAccount.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountInfoResponse { + return QueryAccountInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + message.info = (object.info !== undefined && object.info !== null) + ? BaseAccount.fromPartial(object.info) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Accounts returns all the existing accounts. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.43 + */ + Accounts(request: QueryAccountsRequest): Promise; + /** Account returns account details based on address. */ + Account(request: QueryAccountRequest): Promise; + /** + * AccountAddressByID returns account address based on account number. + * + * Since: cosmos-sdk 0.46.2 + */ + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise; + /** Params queries all parameters. */ + Params(request: QueryParamsRequest): Promise; + /** + * ModuleAccounts returns all the existing module accounts. + * + * Since: cosmos-sdk 0.46 + */ + ModuleAccounts(request: QueryModuleAccountsRequest): Promise; + /** ModuleAccountByName returns the module account info by module name */ + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise; + /** + * Bech32Prefix queries bech32Prefix + * + * Since: cosmos-sdk 0.46 + */ + Bech32Prefix(request: Bech32PrefixRequest): Promise; + /** + * AddressBytesToString converts Account Address bytes to string + * + * Since: cosmos-sdk 0.46 + */ + AddressBytesToString(request: AddressBytesToStringRequest): Promise; + /** + * AddressStringToBytes converts Address string to bytes + * + * Since: cosmos-sdk 0.46 + */ + AddressStringToBytes(request: AddressStringToBytesRequest): Promise; + /** + * AccountInfo queries account info which is common to all account types. + * + * Since: cosmos-sdk 0.47 + */ + AccountInfo(request: QueryAccountInfoRequest): Promise; +} + +export const QueryServiceName = "cosmos.auth.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 || QueryServiceName; + this.rpc = rpc; + this.Accounts = this.Accounts.bind(this); + this.Account = this.Account.bind(this); + this.AccountAddressByID = this.AccountAddressByID.bind(this); + this.Params = this.Params.bind(this); + this.ModuleAccounts = this.ModuleAccounts.bind(this); + this.ModuleAccountByName = this.ModuleAccountByName.bind(this); + this.Bech32Prefix = this.Bech32Prefix.bind(this); + this.AddressBytesToString = this.AddressBytesToString.bind(this); + this.AddressStringToBytes = this.AddressStringToBytes.bind(this); + this.AccountInfo = this.AccountInfo.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 BinaryReader(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 BinaryReader(data))); + } + + AccountAddressByID(request: QueryAccountAddressByIDRequest): Promise { + const data = QueryAccountAddressByIDRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountAddressByID", data); + return promise.then((data) => QueryAccountAddressByIDResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ModuleAccountByName(request: QueryModuleAccountByNameRequest): Promise { + const data = QueryModuleAccountByNameRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ModuleAccountByName", data); + return promise.then((data) => QueryModuleAccountByNameResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + AccountInfo(request: QueryAccountInfoRequest): Promise { + const data = QueryAccountInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountInfo", data); + return promise.then((data) => QueryAccountInfoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/tx.ts new file mode 100644 index 00000000..535a19af --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/auth/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/auth/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./auth"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/auth parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/auth Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the x/auth module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.auth.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/module/v1/module.ts new file mode 100644 index 00000000..053622ff --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.authz.module.v1"; + +/** Module is the config object of the authz module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/authz.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 00000000..a3685068 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * time when the grant will expire and will be pruned. If null, then the grant + * doesn't have a time expiration (other conditions in `authorization` + * may apply to invalidate the grant) + */ + expiration: Date | undefined; +} + +/** + * GrantAuthorization extends a grant with both the addresses of the grantee and granter. + * It is used in genesis.proto and query.proto + */ +export interface GrantAuthorization { + granter: string; + grantee: string; + authorization: Any | undefined; + expiration: Date | undefined; +} + +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItem { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msgTypeUrls: string[]; +} + +function createBaseGenericAuthorization(): GenericAuthorization { + return { msg: "" }; +} + +export const GenericAuthorization: MessageFns = { + encode(message: GenericAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msg = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenericAuthorization { + return { msg: isSet(object.msg) ? globalThis.String(object.msg) : "" }; + }, + + toJSON(message: GenericAuthorization): unknown { + const obj: any = {}; + if (message.msg !== "") { + obj.msg = message.msg; + } + return obj; + }, + + create, I>>(base?: I): GenericAuthorization { + return GenericAuthorization.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: GrantAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(26).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantAuthorization { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.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 = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GrantAuthorization { + return GrantAuthorization.fromPartial(base ?? ({} as any)); + }, + 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 { msgTypeUrls: [] }; +} + +export const GrantQueueItem: MessageFns = { + encode(message: GrantQueueItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.msgTypeUrls) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantQueueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantQueueItem { + return { + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: GrantQueueItem): unknown { + const obj: any = {}; + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): GrantQueueItem { + return GrantQueueItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/event.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/event.ts new file mode 100644 index 00000000..42e74923 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,235 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 */ + msgTypeUrl: 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 */ + msgTypeUrl: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} + +function createBaseEventGrant(): EventGrant { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventGrant: MessageFns = { + encode(message: EventGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventGrant { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventGrant): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventGrant { + return EventGrant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventGrant { + const message = createBaseEventGrant(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseEventRevoke(): EventRevoke { + return { msgTypeUrl: "", granter: "", grantee: "" }; +} + +export const EventRevoke: MessageFns = { + encode(message: EventRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(18).string(message.msgTypeUrl); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 18) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventRevoke { + return { + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventRevoke): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventRevoke { + return EventRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventRevoke { + const message = createBaseEventRevoke(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 00000000..96e4d5bf --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorization) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.authorization.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + authorization: globalThis.Array.isArray(object?.authorization) + ? object.authorization.map((e: any) => GrantAuthorization.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.authorization?.length) { + obj.authorization = message.authorization.map((e) => GrantAuthorization.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/query.ts new file mode 100644 index 00000000..ef3cc0e5 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,629 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + msgTypeUrl: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryGrantsRequest(): QueryGrantsRequest { + return { granter: "", grantee: "", msgTypeUrl: "", pagination: undefined }; +} + +export const QueryGrantsRequest: MessageFns = { + encode(message: QueryGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsRequest { + return QueryGrantsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + 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: MessageFns = { + encode(message: QueryGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsResponse { + return QueryGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsResponse { + return { + grants: globalThis.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?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.authz.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 00000000..10bc628d --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,565 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/authz/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse { +} + +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExec { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; +} + +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} + +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevoke { + granter: string; + grantee: string; + msgTypeUrl: string; +} + +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponse { +} + +function createBaseMsgGrant(): MsgGrant { + return { granter: "", grantee: "", grant: undefined }; +} + +export const MsgGrant: MessageFns = { + encode(message: MsgGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + Grant.encode(message.grant, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.grant = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined, + }; + }, + + toJSON(message: MsgGrant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.grant !== undefined) { + obj.grant = Grant.toJSON(message.grant); + } + return obj; + }, + + create, I>>(base?: I): MsgGrant { + return MsgGrant.fromPartial(base ?? ({} as any)); + }, + 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 createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} + +export const MsgGrantResponse: MessageFns = { + encode(_: MsgGrantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantResponse { + return {}; + }, + + toJSON(_: MsgGrantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantResponse { + return MsgGrantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { grantee: "", msgs: [] }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { results: [] }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgRevoke(): MsgRevoke { + return { granter: "", grantee: "", msgTypeUrl: "" }; +} + +export const MsgRevoke: MessageFns = { + encode(message: MsgRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevoke { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "", + }; + }, + + toJSON(message: MsgRevoke): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgRevoke { + return MsgRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} + +export const MsgRevokeResponse: MessageFns = { + encode(_: MsgRevokeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeResponse { + return {}; + }, + + toJSON(_: MsgRevokeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeResponse { + return MsgRevokeResponse.fromPartial(base ?? ({} as any)); + }, + 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 const MsgServiceName = "cosmos.authz.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/autocli/v1/options.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/autocli/v1/options.ts new file mode 100644 index 00000000..4ad6ac83 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/autocli/v1/options.ts @@ -0,0 +1,1019 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/options.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** ModuleOptions describes the CLI options for a Cosmos SDK module. */ +export interface ModuleOptions { + /** tx describes the tx commands for the module. */ + tx: + | ServiceCommandDescriptor + | undefined; + /** query describes the queries commands for the module. */ + query: ServiceCommandDescriptor | undefined; +} + +/** ServiceCommandDescriptor describes a CLI command based on a protobuf service. */ +export interface ServiceCommandDescriptor { + /** + * service is the fully qualified name of the protobuf service to build + * the command from. It can be left empty if sub_commands are used instead + * which may be the case if a module provides multiple tx and/or query services. + */ + service: string; + /** + * rpc_command_options are options for commands generated from rpc methods. + * If no options are specified for a given rpc method on the service, a + * command will be generated for that method with the default options. + */ + rpcCommandOptions: RpcCommandOptions[]; + /** + * sub_commands is a map of optional sub-commands for this command based on + * different protobuf services. The map key is used as the name of the + * sub-command. + */ + subCommands: { [key: string]: ServiceCommandDescriptor }; +} + +export interface ServiceCommandDescriptor_SubCommandsEntry { + key: string; + value: ServiceCommandDescriptor | undefined; +} + +/** + * RpcCommandOptions specifies options for commands generated from protobuf + * rpc methods. + */ +export interface RpcCommandOptions { + /** + * rpc_method is short name of the protobuf rpc method that this command is + * generated from. + */ + rpcMethod: string; + /** + * use is the one-line usage method. It also allows specifying an alternate + * name for the command as the first word of the usage text. + * + * By default the name of an rpc command is the kebab-case short name of the + * rpc method. + */ + use: string; + /** long is the long message shown in the 'help ' output. */ + long: string; + /** short is the short description shown in the 'help' output. */ + short: string; + /** example is examples of how to use the command. */ + example: string; + /** alias is an array of aliases that can be used instead of the first word in Use. */ + alias: string[]; + /** + * suggest_for is an array of command names for which this command will be suggested - + * similar to aliases but only suggests. + */ + suggestFor: string[]; + /** deprecated defines, if this command is deprecated and should print this string when used. */ + deprecated: string; + /** + * version defines the version for this command. If this value is non-empty and the command does not + * define a "version" flag, a "version" boolean flag will be added to the command and, if specified, + * will print content of the "Version" variable. A shorthand "v" flag will also be added if the + * command does not define one. + */ + version: string; + /** + * flag_options are options for flags generated from rpc request fields. + * By default all request fields are configured as flags. They can + * also be configured as positional args instead using positional_args. + */ + flagOptions: { [key: string]: FlagOptions }; + /** positional_args specifies positional arguments for the command. */ + positionalArgs: PositionalArgDescriptor[]; + /** skip specifies whether to skip this rpc method when generating commands. */ + skip: boolean; +} + +export interface RpcCommandOptions_FlagOptionsEntry { + key: string; + value: FlagOptions | undefined; +} + +/** + * FlagOptions are options for flags generated from rpc request fields. + * By default, all request fields are configured as flags based on the + * kebab-case name of the field. Fields can be turned into positional arguments + * instead by using RpcCommandOptions.positional_args. + */ +export interface FlagOptions { + /** name is an alternate name to use for the field flag. */ + name: string; + /** shorthand is a one-letter abbreviated flag. */ + shorthand: string; + /** usage is the help message. */ + usage: string; + /** default_value is the default value as text. */ + defaultValue: string; + /** deprecated is the usage text to show if this flag is deprecated. */ + deprecated: string; + /** shorthand_deprecated is the usage text to show if the shorthand of this flag is deprecated. */ + shorthandDeprecated: string; + /** hidden hides the flag from help/usage text */ + hidden: boolean; +} + +/** PositionalArgDescriptor describes a positional argument. */ +export interface PositionalArgDescriptor { + /** + * proto_field specifies the proto field to use as the positional arg. Any + * fields used as positional args will not have a flag generated. + */ + protoField: string; + /** + * varargs makes a positional parameter a varargs parameter. This can only be + * applied to last positional parameter and the proto_field must a repeated + * field. + */ + varargs: boolean; +} + +function createBaseModuleOptions(): ModuleOptions { + return { tx: undefined, query: undefined }; +} + +export const ModuleOptions: MessageFns = { + encode(message: ModuleOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + ServiceCommandDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.query !== undefined) { + ServiceCommandDescriptor.encode(message.query, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.query = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleOptions { + return { + tx: isSet(object.tx) ? ServiceCommandDescriptor.fromJSON(object.tx) : undefined, + query: isSet(object.query) ? ServiceCommandDescriptor.fromJSON(object.query) : undefined, + }; + }, + + toJSON(message: ModuleOptions): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = ServiceCommandDescriptor.toJSON(message.tx); + } + if (message.query !== undefined) { + obj.query = ServiceCommandDescriptor.toJSON(message.query); + } + return obj; + }, + + create, I>>(base?: I): ModuleOptions { + return ModuleOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleOptions { + const message = createBaseModuleOptions(); + message.tx = (object.tx !== undefined && object.tx !== null) + ? ServiceCommandDescriptor.fromPartial(object.tx) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ServiceCommandDescriptor.fromPartial(object.query) + : undefined; + return message; + }, +}; + +function createBaseServiceCommandDescriptor(): ServiceCommandDescriptor { + return { service: "", rpcCommandOptions: [], subCommands: {} }; +} + +export const ServiceCommandDescriptor: MessageFns = { + encode(message: ServiceCommandDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.service !== "") { + writer.uint32(10).string(message.service); + } + for (const v of message.rpcCommandOptions) { + RpcCommandOptions.encode(v!, writer.uint32(18).fork()).join(); + } + Object.entries(message.subCommands).forEach(([key, value]) => { + ServiceCommandDescriptor_SubCommandsEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.service = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcCommandOptions.push(RpcCommandOptions.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + const entry3 = ServiceCommandDescriptor_SubCommandsEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.subCommands[entry3.key] = entry3.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor { + return { + service: isSet(object.service) ? globalThis.String(object.service) : "", + rpcCommandOptions: globalThis.Array.isArray(object?.rpcCommandOptions) + ? object.rpcCommandOptions.map((e: any) => RpcCommandOptions.fromJSON(e)) + : [], + subCommands: isObject(object.subCommands) + ? Object.entries(object.subCommands).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + acc[key] = ServiceCommandDescriptor.fromJSON(value); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: ServiceCommandDescriptor): unknown { + const obj: any = {}; + if (message.service !== "") { + obj.service = message.service; + } + if (message.rpcCommandOptions?.length) { + obj.rpcCommandOptions = message.rpcCommandOptions.map((e) => RpcCommandOptions.toJSON(e)); + } + if (message.subCommands) { + const entries = Object.entries(message.subCommands); + if (entries.length > 0) { + obj.subCommands = {}; + entries.forEach(([k, v]) => { + obj.subCommands[k] = ServiceCommandDescriptor.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): ServiceCommandDescriptor { + return ServiceCommandDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceCommandDescriptor { + const message = createBaseServiceCommandDescriptor(); + message.service = object.service ?? ""; + message.rpcCommandOptions = object.rpcCommandOptions?.map((e) => RpcCommandOptions.fromPartial(e)) || []; + message.subCommands = Object.entries(object.subCommands ?? {}).reduce<{ [key: string]: ServiceCommandDescriptor }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ServiceCommandDescriptor.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseServiceCommandDescriptor_SubCommandsEntry(): ServiceCommandDescriptor_SubCommandsEntry { + return { key: "", value: undefined }; +} + +export const ServiceCommandDescriptor_SubCommandsEntry: MessageFns = { + encode(message: ServiceCommandDescriptor_SubCommandsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ServiceCommandDescriptor.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCommandDescriptor_SubCommandsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ServiceCommandDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceCommandDescriptor_SubCommandsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ServiceCommandDescriptor.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ServiceCommandDescriptor_SubCommandsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ServiceCommandDescriptor.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + return ServiceCommandDescriptor_SubCommandsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ServiceCommandDescriptor_SubCommandsEntry { + const message = createBaseServiceCommandDescriptor_SubCommandsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ServiceCommandDescriptor.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseRpcCommandOptions(): RpcCommandOptions { + return { + rpcMethod: "", + use: "", + long: "", + short: "", + example: "", + alias: [], + suggestFor: [], + deprecated: "", + version: "", + flagOptions: {}, + positionalArgs: [], + skip: false, + }; +} + +export const RpcCommandOptions: MessageFns = { + encode(message: RpcCommandOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rpcMethod !== "") { + writer.uint32(10).string(message.rpcMethod); + } + if (message.use !== "") { + writer.uint32(18).string(message.use); + } + if (message.long !== "") { + writer.uint32(26).string(message.long); + } + if (message.short !== "") { + writer.uint32(34).string(message.short); + } + if (message.example !== "") { + writer.uint32(42).string(message.example); + } + for (const v of message.alias) { + writer.uint32(50).string(v!); + } + for (const v of message.suggestFor) { + writer.uint32(58).string(v!); + } + if (message.deprecated !== "") { + writer.uint32(66).string(message.deprecated); + } + if (message.version !== "") { + writer.uint32(74).string(message.version); + } + Object.entries(message.flagOptions).forEach(([key, value]) => { + RpcCommandOptions_FlagOptionsEntry.encode({ key: key as any, value }, writer.uint32(82).fork()).join(); + }); + for (const v of message.positionalArgs) { + PositionalArgDescriptor.encode(v!, writer.uint32(90).fork()).join(); + } + if (message.skip !== false) { + writer.uint32(96).bool(message.skip); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rpcMethod = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.use = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.long = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.short = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.example = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.alias.push(reader.string()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.suggestFor.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.deprecated = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.version = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + const entry10 = RpcCommandOptions_FlagOptionsEntry.decode(reader, reader.uint32()); + if (entry10.value !== undefined) { + message.flagOptions[entry10.key] = entry10.value; + } + continue; + case 11: + if (tag !== 90) { + break; + } + + message.positionalArgs.push(PositionalArgDescriptor.decode(reader, reader.uint32())); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.skip = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions { + return { + rpcMethod: isSet(object.rpcMethod) ? globalThis.String(object.rpcMethod) : "", + use: isSet(object.use) ? globalThis.String(object.use) : "", + long: isSet(object.long) ? globalThis.String(object.long) : "", + short: isSet(object.short) ? globalThis.String(object.short) : "", + example: isSet(object.example) ? globalThis.String(object.example) : "", + alias: globalThis.Array.isArray(object?.alias) ? object.alias.map((e: any) => globalThis.String(e)) : [], + suggestFor: globalThis.Array.isArray(object?.suggestFor) + ? object.suggestFor.map((e: any) => globalThis.String(e)) + : [], + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + flagOptions: isObject(object.flagOptions) + ? Object.entries(object.flagOptions).reduce<{ [key: string]: FlagOptions }>((acc, [key, value]) => { + acc[key] = FlagOptions.fromJSON(value); + return acc; + }, {}) + : {}, + positionalArgs: globalThis.Array.isArray(object?.positionalArgs) + ? object.positionalArgs.map((e: any) => PositionalArgDescriptor.fromJSON(e)) + : [], + skip: isSet(object.skip) ? globalThis.Boolean(object.skip) : false, + }; + }, + + toJSON(message: RpcCommandOptions): unknown { + const obj: any = {}; + if (message.rpcMethod !== "") { + obj.rpcMethod = message.rpcMethod; + } + if (message.use !== "") { + obj.use = message.use; + } + if (message.long !== "") { + obj.long = message.long; + } + if (message.short !== "") { + obj.short = message.short; + } + if (message.example !== "") { + obj.example = message.example; + } + if (message.alias?.length) { + obj.alias = message.alias; + } + if (message.suggestFor?.length) { + obj.suggestFor = message.suggestFor; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.flagOptions) { + const entries = Object.entries(message.flagOptions); + if (entries.length > 0) { + obj.flagOptions = {}; + entries.forEach(([k, v]) => { + obj.flagOptions[k] = FlagOptions.toJSON(v); + }); + } + } + if (message.positionalArgs?.length) { + obj.positionalArgs = message.positionalArgs.map((e) => PositionalArgDescriptor.toJSON(e)); + } + if (message.skip !== false) { + obj.skip = message.skip; + } + return obj; + }, + + create, I>>(base?: I): RpcCommandOptions { + return RpcCommandOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RpcCommandOptions { + const message = createBaseRpcCommandOptions(); + message.rpcMethod = object.rpcMethod ?? ""; + message.use = object.use ?? ""; + message.long = object.long ?? ""; + message.short = object.short ?? ""; + message.example = object.example ?? ""; + message.alias = object.alias?.map((e) => e) || []; + message.suggestFor = object.suggestFor?.map((e) => e) || []; + message.deprecated = object.deprecated ?? ""; + message.version = object.version ?? ""; + message.flagOptions = Object.entries(object.flagOptions ?? {}).reduce<{ [key: string]: FlagOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = FlagOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + message.positionalArgs = object.positionalArgs?.map((e) => PositionalArgDescriptor.fromPartial(e)) || []; + message.skip = object.skip ?? false; + return message; + }, +}; + +function createBaseRpcCommandOptions_FlagOptionsEntry(): RpcCommandOptions_FlagOptionsEntry { + return { key: "", value: undefined }; +} + +export const RpcCommandOptions_FlagOptionsEntry: MessageFns = { + encode(message: RpcCommandOptions_FlagOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + FlagOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RpcCommandOptions_FlagOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = FlagOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RpcCommandOptions_FlagOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? FlagOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: RpcCommandOptions_FlagOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = FlagOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): RpcCommandOptions_FlagOptionsEntry { + return RpcCommandOptions_FlagOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RpcCommandOptions_FlagOptionsEntry { + const message = createBaseRpcCommandOptions_FlagOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? FlagOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseFlagOptions(): FlagOptions { + return { + name: "", + shorthand: "", + usage: "", + defaultValue: "", + deprecated: "", + shorthandDeprecated: "", + hidden: false, + }; +} + +export const FlagOptions: MessageFns = { + encode(message: FlagOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.shorthand !== "") { + writer.uint32(18).string(message.shorthand); + } + if (message.usage !== "") { + writer.uint32(26).string(message.usage); + } + if (message.defaultValue !== "") { + writer.uint32(34).string(message.defaultValue); + } + if (message.deprecated !== "") { + writer.uint32(50).string(message.deprecated); + } + if (message.shorthandDeprecated !== "") { + writer.uint32(58).string(message.shorthandDeprecated); + } + if (message.hidden !== false) { + writer.uint32(64).bool(message.hidden); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlagOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlagOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.shorthand = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.usage = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.defaultValue = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.deprecated = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.shorthandDeprecated = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.hidden = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FlagOptions { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + shorthand: isSet(object.shorthand) ? globalThis.String(object.shorthand) : "", + usage: isSet(object.usage) ? globalThis.String(object.usage) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + deprecated: isSet(object.deprecated) ? globalThis.String(object.deprecated) : "", + shorthandDeprecated: isSet(object.shorthandDeprecated) ? globalThis.String(object.shorthandDeprecated) : "", + hidden: isSet(object.hidden) ? globalThis.Boolean(object.hidden) : false, + }; + }, + + toJSON(message: FlagOptions): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.shorthand !== "") { + obj.shorthand = message.shorthand; + } + if (message.usage !== "") { + obj.usage = message.usage; + } + if (message.defaultValue !== "") { + obj.defaultValue = message.defaultValue; + } + if (message.deprecated !== "") { + obj.deprecated = message.deprecated; + } + if (message.shorthandDeprecated !== "") { + obj.shorthandDeprecated = message.shorthandDeprecated; + } + if (message.hidden !== false) { + obj.hidden = message.hidden; + } + return obj; + }, + + create, I>>(base?: I): FlagOptions { + return FlagOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlagOptions { + const message = createBaseFlagOptions(); + message.name = object.name ?? ""; + message.shorthand = object.shorthand ?? ""; + message.usage = object.usage ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.deprecated = object.deprecated ?? ""; + message.shorthandDeprecated = object.shorthandDeprecated ?? ""; + message.hidden = object.hidden ?? false; + return message; + }, +}; + +function createBasePositionalArgDescriptor(): PositionalArgDescriptor { + return { protoField: "", varargs: false }; +} + +export const PositionalArgDescriptor: MessageFns = { + encode(message: PositionalArgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protoField !== "") { + writer.uint32(10).string(message.protoField); + } + if (message.varargs !== false) { + writer.uint32(16).bool(message.varargs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PositionalArgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePositionalArgDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protoField = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.varargs = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PositionalArgDescriptor { + return { + protoField: isSet(object.protoField) ? globalThis.String(object.protoField) : "", + varargs: isSet(object.varargs) ? globalThis.Boolean(object.varargs) : false, + }; + }, + + toJSON(message: PositionalArgDescriptor): unknown { + const obj: any = {}; + if (message.protoField !== "") { + obj.protoField = message.protoField; + } + if (message.varargs !== false) { + obj.varargs = message.varargs; + } + return obj; + }, + + create, I>>(base?: I): PositionalArgDescriptor { + return PositionalArgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PositionalArgDescriptor { + const message = createBasePositionalArgDescriptor(); + message.protoField = object.protoField ?? ""; + message.varargs = object.varargs ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/autocli/v1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/autocli/v1/query.ts new file mode 100644 index 00000000..5fcd821c --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/autocli/v1/query.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/autocli/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ModuleOptions } from "./options"; + +export const protobufPackage = "cosmos.autocli.v1"; + +/** AppOptionsRequest is the RemoteInfoService/AppOptions request type. */ +export interface AppOptionsRequest { +} + +/** AppOptionsResponse is the RemoteInfoService/AppOptions response type. */ +export interface AppOptionsResponse { + /** module_options is a map of module name to autocli module options. */ + moduleOptions: { [key: string]: ModuleOptions }; +} + +export interface AppOptionsResponse_ModuleOptionsEntry { + key: string; + value: ModuleOptions | undefined; +} + +function createBaseAppOptionsRequest(): AppOptionsRequest { + return {}; +} + +export const AppOptionsRequest: MessageFns = { + encode(_: AppOptionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): AppOptionsRequest { + return {}; + }, + + toJSON(_: AppOptionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): AppOptionsRequest { + return AppOptionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): AppOptionsRequest { + const message = createBaseAppOptionsRequest(); + return message; + }, +}; + +function createBaseAppOptionsResponse(): AppOptionsResponse { + return { moduleOptions: {} }; +} + +export const AppOptionsResponse: MessageFns = { + encode(message: AppOptionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.moduleOptions).forEach(([key, value]) => { + AppOptionsResponse_ModuleOptionsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = AppOptionsResponse_ModuleOptionsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.moduleOptions[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse { + return { + moduleOptions: isObject(object.moduleOptions) + ? Object.entries(object.moduleOptions).reduce<{ [key: string]: ModuleOptions }>((acc, [key, value]) => { + acc[key] = ModuleOptions.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: AppOptionsResponse): unknown { + const obj: any = {}; + if (message.moduleOptions) { + const entries = Object.entries(message.moduleOptions); + if (entries.length > 0) { + obj.moduleOptions = {}; + entries.forEach(([k, v]) => { + obj.moduleOptions[k] = ModuleOptions.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): AppOptionsResponse { + return AppOptionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AppOptionsResponse { + const message = createBaseAppOptionsResponse(); + message.moduleOptions = Object.entries(object.moduleOptions ?? {}).reduce<{ [key: string]: ModuleOptions }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ModuleOptions.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseAppOptionsResponse_ModuleOptionsEntry(): AppOptionsResponse_ModuleOptionsEntry { + return { key: "", value: undefined }; +} + +export const AppOptionsResponse_ModuleOptionsEntry: MessageFns = { + encode(message: AppOptionsResponse_ModuleOptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ModuleOptions.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppOptionsResponse_ModuleOptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ModuleOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppOptionsResponse_ModuleOptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? ModuleOptions.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: AppOptionsResponse_ModuleOptionsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ModuleOptions.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): AppOptionsResponse_ModuleOptionsEntry { + return AppOptionsResponse_ModuleOptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): AppOptionsResponse_ModuleOptionsEntry { + const message = createBaseAppOptionsResponse_ModuleOptionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ModuleOptions.fromPartial(object.value) + : undefined; + return message; + }, +}; + +/** + * RemoteInfoService provides clients with the information they need + * to build dynamically CLI clients for remote chains. + */ +export interface Query { + /** AppOptions returns the autocli options for all of the modules in an app. */ + AppOptions(request: AppOptionsRequest): Promise; +} + +export const QueryServiceName = "cosmos.autocli.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 || QueryServiceName; + this.rpc = rpc; + this.AppOptions = this.AppOptions.bind(this); + } + AppOptions(request: AppOptionsRequest): Promise { + const data = AppOptionsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AppOptions", data); + return promise.then((data) => AppOptionsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/module/v1/module.ts new file mode 100644 index 00000000..18dd6917 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/module/v1/module.ts @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.bank.module.v1"; + +/** Module is the config object of the bank module. */ +export interface Module { + /** + * blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving + * funds. If left empty it defaults to the list of account names supplied in the auth module configuration as + * module_account_permissions + */ + blockedModuleAccountsOverride: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** + * restrictions_order specifies the order of send restrictions and should be + * a list of module names which provide a send restriction instance. If no + * order is provided, then restrictions will be applied in alphabetical order + * of module names. + */ + restrictionsOrder: string[]; +} + +function createBaseModule(): Module { + return { blockedModuleAccountsOverride: [], authority: "", restrictionsOrder: [] }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.blockedModuleAccountsOverride) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + for (const v of message.restrictionsOrder) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockedModuleAccountsOverride.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.restrictionsOrder.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + blockedModuleAccountsOverride: globalThis.Array.isArray(object?.blockedModuleAccountsOverride) + ? object.blockedModuleAccountsOverride.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + restrictionsOrder: globalThis.Array.isArray(object?.restrictionsOrder) + ? object.restrictionsOrder.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.blockedModuleAccountsOverride?.length) { + obj.blockedModuleAccountsOverride = message.blockedModuleAccountsOverride; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.restrictionsOrder?.length) { + obj.restrictionsOrder = message.restrictionsOrder; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.blockedModuleAccountsOverride = object.blockedModuleAccountsOverride?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.restrictionsOrder = object.restrictionsOrder?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/authz.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 00000000..3437ed53 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,127 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + spendLimit: Coin[]; + /** + * allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + * granter. If omitted, any recipient is allowed. + * + * Since: cosmos-sdk 0.47 + */ + allowList: string[]; +} + +function createBaseSendAuthorization(): SendAuthorization { + return { spendLimit: [], allowList: [] }; +} + +export const SendAuthorization: MessageFns = { + encode(message: SendAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.allowList) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendAuthorization { + return { + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + allowList: globalThis.Array.isArray(object?.allowList) + ? object.allowList.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: SendAuthorization): unknown { + const obj: any = {}; + if (message.spendLimit?.length) { + obj.spendLimit = message.spendLimit.map((e) => Coin.toJSON(e)); + } + if (message.allowList?.length) { + obj.allowList = message.allowList; + } + return obj; + }, + + create, I>>(base?: I): SendAuthorization { + return SendAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.allowList = object.allowList?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/bank.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..92e997fb --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,755 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/bank.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** Params defines the parameters for the bank module. */ +export interface Params { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + * + * @deprecated + */ + sendEnabled: SendEnabled[]; + defaultSendEnabled: boolean; +} + +/** + * 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 */ + denomUnits: DenomUnit[]; + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ + base: string; + /** + * display indicates the suggested denom that should be + * displayed in clients. + */ + display: string; + /** + * name defines the name of the token (eg: Cosmos Atom) + * + * Since: cosmos-sdk 0.43 + */ + name: string; + /** + * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + * be the same as the display. + * + * Since: cosmos-sdk 0.43 + */ + symbol: string; + /** + * URI to a document (on or off-chain) that contains additional information. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uri: string; + /** + * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + * the document didn't change. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uriHash: string; +} + +function createBaseParams(): Params { + return { sendEnabled: [], defaultSendEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.defaultSendEnabled !== false) { + writer.uint32(16).bool(message.defaultSendEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.defaultSendEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + defaultSendEnabled: isSet(object.defaultSendEnabled) ? globalThis.Boolean(object.defaultSendEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.defaultSendEnabled !== false) { + obj.defaultSendEnabled = message.defaultSendEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.defaultSendEnabled = object.defaultSendEnabled ?? false; + return message; + }, +}; + +function createBaseSendEnabled(): SendEnabled { + return { denom: "", enabled: false }; +} + +export const SendEnabled: MessageFns = { + encode(message: SendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled !== false) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendEnabled { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false, + }; + }, + + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.enabled !== false) { + obj.enabled = message.enabled; + } + return obj; + }, + + create, I>>(base?: I): SendEnabled { + return SendEnabled.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Input, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Input { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Input { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Input): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Input { + return Input.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Output, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Output { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Output { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Output): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Output { + return Output.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Supply, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Supply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSupply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.total.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Supply { + return { total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: Supply): unknown { + const obj: any = {}; + if (message.total?.length) { + obj.total = message.total.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Supply { + return Supply.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomUnit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } + for (const v of message.aliases) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomUnit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.exponent = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.aliases.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomUnit { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + exponent: isSet(object.exponent) ? globalThis.Number(object.exponent) : 0, + aliases: globalThis.Array.isArray(object?.aliases) ? object.aliases.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.exponent !== 0) { + obj.exponent = Math.round(message.exponent); + } + if (message.aliases?.length) { + obj.aliases = message.aliases; + } + return obj; + }, + + create, I>>(base?: I): DenomUnit { + return DenomUnit.fromPartial(base ?? ({} as any)); + }, + 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: "", denomUnits: [], base: "", display: "", name: "", symbol: "", uri: "", uriHash: "" }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denomUnits) { + DenomUnit.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } + if (message.name !== "") { + writer.uint32(42).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(50).string(message.symbol); + } + if (message.uri !== "") { + writer.uint32(58).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(66).string(message.uriHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denomUnits.push(DenomUnit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.base = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.display = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.symbol = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.uri = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.uriHash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + description: isSet(object.description) ? globalThis.String(object.description) : "", + denomUnits: globalThis.Array.isArray(object?.denomUnits) + ? object.denomUnits.map((e: any) => DenomUnit.fromJSON(e)) + : [], + base: isSet(object.base) ? globalThis.String(object.base) : "", + display: isSet(object.display) ? globalThis.String(object.display) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.description !== "") { + obj.description = message.description; + } + if (message.denomUnits?.length) { + obj.denomUnits = message.denomUnits.map((e) => DenomUnit.toJSON(e)); + } + if (message.base !== "") { + obj.base = message.base; + } + if (message.display !== "") { + obj.display = message.display; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denomUnits = object.denomUnits?.map((e) => DenomUnit.fromPartial(e)) || []; + message.base = object.base ?? ""; + message.display = object.display ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 00000000..b9d9a434 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,270 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** 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 different coins. */ + denomMetadata: Metadata[]; + /** + * send_enabled defines the denoms where send is enabled or disabled. + * + * Since: cosmos-sdk 0.47 + */ + sendEnabled: SendEnabled[]; +} + +/** + * 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: [], denomMetadata: [], sendEnabled: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.balances) { + Balance.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.denomMetadata) { + Metadata.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balances.push(Balance.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.denomMetadata.push(Metadata.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + balances: globalThis.Array.isArray(object?.balances) ? object.balances.map((e: any) => Balance.fromJSON(e)) : [], + supply: globalThis.Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + denomMetadata: globalThis.Array.isArray(object?.denomMetadata) + ? object.denomMetadata.map((e: any) => Metadata.fromJSON(e)) + : [], + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Balance.toJSON(e)); + } + if (message.supply?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.denomMetadata?.length) { + obj.denomMetadata = message.denomMetadata.map((e) => Metadata.toJSON(e)); + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.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) + ? Params.fromPartial(object.params) + : undefined; + message.balances = object.balances?.map((e) => Balance.fromPartial(e)) || []; + message.supply = object.supply?.map((e) => Coin.fromPartial(e)) || []; + message.denomMetadata = object.denomMetadata?.map((e) => Metadata.fromPartial(e)) || []; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBalance(): Balance { + return { address: "", coins: [] }; +} + +export const Balance: MessageFns = { + encode(message: Balance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Balance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Balance { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Balance): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Balance { + return Balance.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/query.ts new file mode 100644 index 00000000..67edba9b --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,2382 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params, SendEnabled } 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 | undefined; +} + +/** 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 + | undefined; + /** + * resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. + * + * Since: cosmos-sdk 0.50 + */ + resolveDenom: boolean; +} + +/** + * 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 | undefined; +} + +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} + +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponse { + /** balance is the balance of the coin. */ + balance: Coin | undefined; +} + +/** + * 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 | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 provides the parameters of the bank module. */ + params: Params | undefined; +} + +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} + +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata: Metadata | undefined; +} + +/** + * 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 | undefined; +} + +/** + * DenomOwner defines structure representing an account that owns or holds a + * particular denominated token. It contains the account address and account + * balance of the denominated token. + * + * Since: cosmos-sdk 0.46 + */ +export interface DenomOwner { + /** address defines the address that owns a particular denomination. */ + address: string; + /** balance is the balance of the denominated coin for an account. */ + balance: Coin | undefined; +} + +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryRequest { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequest { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination: PageRequest | undefined; +} + +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponse { + sendEnabled: SendEnabled[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination: PageResponse | undefined; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { address: "", denom: "" }; +} + +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + 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, resolveDenom: false }; +} + +export const QueryAllBalancesRequest: MessageFns = { + encode(message: QueryAllBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.resolveDenom !== false) { + writer.uint32(24).bool(message.resolveDenom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.resolveDenom = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + resolveDenom: isSet(object.resolveDenom) ? globalThis.Boolean(object.resolveDenom) : false, + }; + }, + + toJSON(message: QueryAllBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.resolveDenom !== false) { + obj.resolveDenom = message.resolveDenom; + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesRequest { + return QueryAllBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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; + message.resolveDenom = object.resolveDenom ?? false; + return message; + }, +}; + +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { balances: [], pagination: undefined }; +} + +export const QueryAllBalancesResponse: MessageFns = { + encode(message: QueryAllBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesResponse { + return QueryAllBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesResponse { + return { + balances: globalThis.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?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.fromPartial(base ?? ({} as any)); + }, + 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 createBaseQuerySpendableBalanceByDenomRequest(): QuerySpendableBalanceByDenomRequest { + return { address: "", denom: "" }; +} + +export const QuerySpendableBalanceByDenomRequest: MessageFns = { + encode(message: QuerySpendableBalanceByDenomRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QuerySpendableBalanceByDenomRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySpendableBalanceByDenomResponse(): QuerySpendableBalanceByDenomResponse { + return { balance: undefined }; +} + +export const QuerySpendableBalanceByDenomResponse: MessageFns = { + encode(message: QuerySpendableBalanceByDenomResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalanceByDenomResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QuerySpendableBalanceByDenomResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>( + base?: I, + ): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + message.balance = (object.balance !== undefined && object.balance !== null) + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; + +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { pagination: undefined }; +} + +export const QueryTotalSupplyRequest: MessageFns = { + encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryTotalSupplyRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyResponse { + return { + supply: globalThis.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?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySupplyOfRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QuerySupplyOfRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfRequest { + return QuerySupplyOfRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { amount: undefined }; +} + +export const QuerySupplyOfResponse: MessageFns = { + encode(message: QuerySupplyOfResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfResponse { + return { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; + }, + + toJSON(message: QuerySupplyOfResponse): unknown { + const obj: any = {}; + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfResponse { + return QuerySupplyOfResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { pagination: undefined }; +} + +export const QueryDenomsMetadataRequest: MessageFns = { + encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDenomsMetadataRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.metadatas) { + Metadata.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadatas.push(Metadata.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataResponse { + return { + metadatas: globalThis.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?.length) { + obj.metadatas = message.metadatas.map((e) => Metadata.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataResponse: MessageFns = { + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringRequest(): QueryDenomMetadataByQueryStringRequest { + return { denom: "" }; +} + +export const QueryDenomMetadataByQueryStringRequest: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringRequest { + return QueryDenomMetadataByQueryStringRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringRequest { + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataByQueryStringResponse(): QueryDenomMetadataByQueryStringResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataByQueryStringResponse: MessageFns = { + encode(message: QueryDenomMetadataByQueryStringResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataByQueryStringResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataByQueryStringResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDenomMetadataByQueryStringResponse { + return QueryDenomMetadataByQueryStringResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomMetadataByQueryStringResponse { + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + 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: MessageFns = { + encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: DenomOwner, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomOwner(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomOwner { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DenomOwner): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DenomOwner { + return DenomOwner.fromPartial(base ?? ({} as any)); + }, + 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 { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersResponse: MessageFns = { + encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryRequest(): QueryDenomOwnersByQueryRequest { + return { denom: "", pagination: undefined }; +} + +export const QueryDenomOwnersByQueryRequest: MessageFns = { + encode(message: QueryDenomOwnersByQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryRequest { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryRequest { + return QueryDenomOwnersByQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryRequest { + const message = createBaseQueryDenomOwnersByQueryRequest(); + message.denom = object.denom ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersByQueryResponse(): QueryDenomOwnersByQueryResponse { + return { denomOwners: [], pagination: undefined }; +} + +export const QueryDenomOwnersByQueryResponse: MessageFns = { + encode(message: QueryDenomOwnersByQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomOwnersByQueryResponse { + return { + denomOwners: globalThis.Array.isArray(object?.denomOwners) + ? object.denomOwners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersByQueryResponse): unknown { + const obj: any = {}; + if (message.denomOwners?.length) { + obj.denomOwners = message.denomOwners.map((e) => DenomOwner.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomOwnersByQueryResponse { + return QueryDenomOwnersByQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDenomOwnersByQueryResponse { + const message = createBaseQueryDenomOwnersByQueryResponse(); + message.denomOwners = object.denomOwners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledRequest(): QuerySendEnabledRequest { + return { denoms: [], pagination: undefined }; +} + +export const QuerySendEnabledRequest: MessageFns = { + encode(message: QuerySendEnabledRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denoms.push(reader.string()); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledRequest { + return { + denoms: globalThis.Array.isArray(object?.denoms) ? object.denoms.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledRequest): unknown { + const obj: any = {}; + if (message.denoms?.length) { + obj.denoms = message.denoms; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledRequest { + return QuerySendEnabledRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map((e) => e) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySendEnabledResponse(): QuerySendEnabledResponse { + return { sendEnabled: [], pagination: undefined }; +} + +export const QuerySendEnabledResponse: MessageFns = { + encode(message: QuerySendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(794).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 99: + if (tag !== 794) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySendEnabledResponse { + return { + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySendEnabledResponse): unknown { + const obj: any = {}; + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySendEnabledResponse { + return QuerySendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + AllBalances(request: QueryAllBalancesRequest): Promise; + /** + * SpendableBalances queries the spendable balance of all coins for a single + * account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + SpendableBalances(request: QuerySpendableBalancesRequest): Promise; + /** + * SpendableBalanceByDenom queries the spendable balance of a single denom for + * a single account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.47 + */ + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise; + /** + * TotalSupply queries the total supply of all coins. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + TotalSupply(request: QueryTotalSupplyRequest): Promise; + /** + * SupplyOf queries the supply of a single coin. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + SupplyOf(request: QuerySupplyOfRequest): Promise; + /** Params queries the parameters of x/bank module. */ + Params(request: QueryParamsRequest): Promise; + /** DenomMetadata queries the client metadata of a given coin denomination. */ + DenomMetadata(request: QueryDenomMetadataRequest): Promise; + /** DenomMetadataByQueryString queries the client metadata of a given coin denomination. */ + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + DenomOwners(request: QueryDenomOwnersRequest): Promise; + /** + * DenomOwnersByQuery queries for all account addresses that own a particular token + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise; + /** + * SendEnabled queries for SendEnabled entries. + * + * This query only returns denominations that have specific SendEnabled settings. + * Any denomination that does not have a specific setting will use the default + * params.default_send_enabled, and will not be returned by this query. + * + * Since: cosmos-sdk 0.47 + */ + SendEnabled(request: QuerySendEnabledRequest): Promise; +} + +export const QueryServiceName = "cosmos.bank.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 || QueryServiceName; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.AllBalances = this.AllBalances.bind(this); + this.SpendableBalances = this.SpendableBalances.bind(this); + this.SpendableBalanceByDenom = this.SpendableBalanceByDenom.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.DenomMetadataByQueryString = this.DenomMetadataByQueryString.bind(this); + this.DenomsMetadata = this.DenomsMetadata.bind(this); + this.DenomOwners = this.DenomOwners.bind(this); + this.DenomOwnersByQuery = this.DenomOwnersByQuery.bind(this); + this.SendEnabled = this.SendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SpendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise { + const data = QuerySpendableBalanceByDenomRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SpendableBalanceByDenom", data); + return promise.then((data) => QuerySpendableBalanceByDenomResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomMetadataByQueryString( + request: QueryDenomMetadataByQueryStringRequest, + ): Promise { + const data = QueryDenomMetadataByQueryStringRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomMetadataByQueryString", data); + return promise.then((data) => QueryDenomMetadataByQueryStringResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + DenomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise { + const data = QueryDenomOwnersByQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomOwnersByQuery", data); + return promise.then((data) => QueryDenomOwnersByQueryResponse.decode(new BinaryReader(data))); + } + + SendEnabled(request: QuerySendEnabledRequest): Promise { + const data = QuerySendEnabledRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendEnabled", data); + return promise.then((data) => QuerySendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 00000000..1f1637f5 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,687 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/bank/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Input, Output, Params, SendEnabled } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSend { + fromAddress: string; + toAddress: 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, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: Input[]; + outputs: Output[]; +} + +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabled { + /** authority is the address that controls the module. */ + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; +} + +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponse { +} + +function createBaseMsgSend(): MsgSend { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +function createBaseMsgMultiSend(): MsgMultiSend { + return { inputs: [], outputs: [] }; +} + +export const MsgMultiSend: MessageFns = { + encode(message: MsgMultiSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.inputs) { + Input.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.outputs) { + Output.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inputs.push(Input.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outputs.push(Output.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgMultiSend { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e: any) => Input.fromJSON(e)) : [], + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e: any) => Output.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgMultiSend): unknown { + const obj: any = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => Input.toJSON(e)); + } + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => Output.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgMultiSend { + return MsgMultiSend.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgMultiSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgMultiSendResponse { + return {}; + }, + + toJSON(_: MsgMultiSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgMultiSendResponse { + return MsgMultiSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSetSendEnabled(): MsgSetSendEnabled { + return { authority: "", sendEnabled: [], useDefaultFor: [] }; +} + +export const MsgSetSendEnabled: MessageFns = { + encode(message: MsgSetSendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.useDefaultFor) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.useDefaultFor.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetSendEnabled { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + sendEnabled: globalThis.Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + useDefaultFor: globalThis.Array.isArray(object?.useDefaultFor) + ? object.useDefaultFor.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgSetSendEnabled): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.sendEnabled?.length) { + obj.sendEnabled = message.sendEnabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.useDefaultFor?.length) { + obj.useDefaultFor = message.useDefaultFor; + } + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabled { + return MsgSetSendEnabled.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + message.authority = object.authority ?? ""; + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.useDefaultFor = object.useDefaultFor?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgSetSendEnabledResponse(): MsgSetSendEnabledResponse { + return {}; +} + +export const MsgSetSendEnabledResponse: MessageFns = { + encode(_: MsgSetSendEnabledResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetSendEnabledResponse { + return {}; + }, + + toJSON(_: MsgSetSendEnabledResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/bank module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SetSendEnabled is a governance operation for setting the SendEnabled flag + * on any number of Denoms. Only the entries to add or update should be + * included. Entries that already exist in the store, but that aren't + * included in this message, will be left unchanged. + * + * Since: cosmos-sdk 0.47 + */ + SetSendEnabled(request: MsgSetSendEnabled): Promise; +} + +export const MsgServiceName = "cosmos.bank.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 || MsgServiceName; + this.rpc = rpc; + this.Send = this.Send.bind(this); + this.MultiSend = this.MultiSend.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.SetSendEnabled = this.SetSendEnabled.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + SetSendEnabled(request: MsgSetSendEnabled): Promise { + const data = MsgSetSendEnabled.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetSendEnabled", data); + return promise.then((data) => MsgSetSendEnabledResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 00000000..6da88804 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1425 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/abci/v1beta1/abci.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Event } from "../../../../tendermint/abci/types"; +import { Block } from "../../../../tendermint/types/block"; + +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: number; + /** The transaction hash. */ + txhash: string; + /** Namespace for the Code */ + codespace: string; + /** Response code. */ + code: number; + /** Result bytes, if any. */ + data: string; + /** + * The output of the application's logger (raw string). May be + * non-deterministic. + */ + rawLog: string; + /** The output of the application's logger (typed). May be non-deterministic. */ + logs: ABCIMessageLog[]; + /** Additional information. May be non-deterministic. */ + info: string; + /** Amount of gas requested for transaction. */ + gasWanted: number; + /** Amount of gas consumed by transaction. */ + gasUsed: number; + /** The request transaction bytes. */ + tx: + | Any + | undefined; + /** + * Time of the previous block. For heights > 1, it's the weighted median of + * the timestamps of the valid votes in the block.LastCommit. For height == 1, + * it's genesis time. + */ + timestamp: string; + /** + * Events defines all the events emitted by processing a transaction. Note, + * these events include those emitted by processing all the messages and those + * emitted from the ante. Whereas Logs contains the events, with + * additional metadata, emitted only by processing the messages. + * + * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + */ + events: Event[]; +} + +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLog { + msgIndex: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEvent[]; +} + +/** + * 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. */ + gasWanted: number; + /** GasUsed is the amount of gas actually consumed. */ + gasUsed: number; +} + +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface Result { + /** + * Data is any data returned from message or handler execution. It MUST be + * length prefixed in order to separate data from multiple message executions. + * Deprecated. This field is still populated, but prefer msg_response instead + * because it also contains the Msg response typeURL. + * + * @deprecated + */ + data: Uint8Array; + /** Log contains the log information from message or handler execution. */ + log: string; + /** + * Events contains a slice of Event objects that were emitted during message + * or handler execution. + */ + events: Event[]; + /** + * msg_responses contains the Msg handler responses type packed in Anys. + * + * Since: cosmos-sdk 0.46 + */ + msgResponses: Any[]; +} + +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponse { + gasInfo: GasInfo | undefined; + result: Result | undefined; +} + +/** + * MsgData defines the data returned in a Result object during message + * execution. + * + * @deprecated + */ +export interface MsgData { + msgType: 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 + */ + msgResponses: Any[]; +} + +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResult { + /** Count of all txs */ + totalCount: number; + /** Count of txs in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count txs per page */ + limit: number; + /** List of txs in current page */ + txs: TxResponse[]; +} + +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResult { + /** Count of all blocks */ + totalCount: number; + /** Count of blocks in current page */ + count: number; + /** Index of current page, start from 1 */ + pageNumber: number; + /** Count of total pages */ + pageTotal: number; + /** Max count blocks per page */ + limit: number; + /** List of blocks in current page */ + blocks: Block[]; +} + +function createBaseTxResponse(): TxResponse { + return { + height: 0, + txhash: "", + codespace: "", + code: 0, + data: "", + rawLog: "", + logs: [], + info: "", + gasWanted: 0, + gasUsed: 0, + tx: undefined, + timestamp: "", + events: [], + }; +} + +export const TxResponse: MessageFns = { + encode(message: TxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.rawLog !== "") { + writer.uint32(50).string(message.rawLog); + } + for (const v of message.logs) { + ABCIMessageLog.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.info !== "") { + writer.uint32(66).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(72).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(80).int64(message.gasUsed); + } + if (message.tx !== undefined) { + Any.encode(message.tx, writer.uint32(90).fork()).join(); + } + if (message.timestamp !== "") { + writer.uint32(98).string(message.timestamp); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(106).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txhash = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codespace = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.code = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.data = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.rawLog = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.info = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.tx = Any.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.timestamp = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResponse { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + txhash: isSet(object.txhash) ? globalThis.String(object.txhash) : "", + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + rawLog: isSet(object.rawLog) ? globalThis.String(object.rawLog) : "", + logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => ABCIMessageLog.fromJSON(e)) : [], + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + tx: isSet(object.tx) ? Any.fromJSON(object.tx) : undefined, + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.txhash !== "") { + obj.txhash = message.txhash; + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.rawLog !== "") { + obj.rawLog = message.rawLog; + } + if (message.logs?.length) { + obj.logs = message.logs.map((e) => ABCIMessageLog.toJSON(e)); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + if (message.tx !== undefined) { + obj.tx = Any.toJSON(message.tx); + } + if (message.timestamp !== "") { + obj.timestamp = message.timestamp; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxResponse { + return TxResponse.fromPartial(base ?? ({} as any)); + }, + 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.rawLog = object.rawLog ?? ""; + message.logs = object.logs?.map((e) => ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 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 { msgIndex: 0, log: "", events: [] }; +} + +export const ABCIMessageLog: MessageFns = { + encode(message: ABCIMessageLog, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgIndex !== 0) { + writer.uint32(8).uint32(message.msgIndex); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + StringEvent.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIMessageLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.msgIndex = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(StringEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIMessageLog { + return { + msgIndex: isSet(object.msgIndex) ? globalThis.Number(object.msgIndex) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => StringEvent.fromJSON(e)) : [], + }; + }, + + toJSON(message: ABCIMessageLog): unknown { + const obj: any = {}; + if (message.msgIndex !== 0) { + obj.msgIndex = Math.round(message.msgIndex); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => StringEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ABCIMessageLog { + return ABCIMessageLog.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msgIndex = object.msgIndex ?? 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: MessageFns = { + encode(message: StringEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + Attribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(Attribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StringEvent { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => Attribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: StringEvent): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => Attribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): StringEvent { + return StringEvent.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Attribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Attribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Attribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: Attribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Attribute { + return Attribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseGasInfo(): GasInfo { + return { gasWanted: 0, gasUsed: 0 }; +} + +export const GasInfo: MessageFns = { + encode(message: GasInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasWanted !== 0) { + writer.uint32(8).uint64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(16).uint64(message.gasUsed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.gasWanted = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasUsed = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GasInfo { + return { + gasWanted: isSet(object.gasWanted) ? globalThis.Number(object.gasWanted) : 0, + gasUsed: isSet(object.gasUsed) ? globalThis.Number(object.gasUsed) : 0, + }; + }, + + toJSON(message: GasInfo): unknown { + const obj: any = {}; + if (message.gasWanted !== 0) { + obj.gasWanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gasUsed = Math.round(message.gasUsed); + } + return obj; + }, + + create, I>>(base?: I): GasInfo { + return GasInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GasInfo { + const message = createBaseGasInfo(); + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + return message; + }, +}; + +function createBaseResult(): Result { + return { data: new Uint8Array(0), log: "", events: [], msgResponses: [] }; +} + +export const Result: MessageFns = { + encode(message: Result, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Result { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Result { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Result): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Result { + return Result.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Result { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSimulationResponse(): SimulationResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulationResponse: MessageFns = { + encode(message: SimulationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulationResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulationResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulationResponse { + return SimulationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulationResponse { + const message = createBaseSimulationResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseMsgData(): MsgData { + return { msgType: "", data: new Uint8Array(0) }; +} + +export const MsgData: MessageFns = { + encode(message: MsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgType !== "") { + writer.uint32(10).string(message.msgType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msgType = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgData { + return { + msgType: isSet(object.msgType) ? globalThis.String(object.msgType) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: MsgData): unknown { + const obj: any = {}; + if (message.msgType !== "") { + obj.msgType = message.msgType; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): MsgData { + return MsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgData { + const message = createBaseMsgData(); + message.msgType = object.msgType ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxMsgData(): TxMsgData { + return { data: [], msgResponses: [] }; +} + +export const TxMsgData: MessageFns = { + encode(message: TxMsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.data) { + MsgData.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data.push(MsgData.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgResponses.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxMsgData { + return { + data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => MsgData.fromJSON(e)) : [], + msgResponses: globalThis.Array.isArray(object?.msgResponses) + ? object.msgResponses.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxMsgData): unknown { + const obj: any = {}; + if (message.data?.length) { + obj.data = message.data.map((e) => MsgData.toJSON(e)); + } + if (message.msgResponses?.length) { + obj.msgResponses = message.msgResponses.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxMsgData { + return TxMsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map((e) => MsgData.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchTxsResult(): SearchTxsResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, txs: [] }; +} + +export const SearchTxsResult: MessageFns = { + encode(message: SearchTxsResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).uint64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).uint64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).uint64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).uint64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + for (const v of message.txs) { + TxResponse.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchTxsResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.txs.push(TxResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchTxsResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => TxResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchTxsResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => TxResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchTxsResult { + return SearchTxsResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.txs = object.txs?.map((e) => TxResponse.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchBlocksResult(): SearchBlocksResult { + return { totalCount: 0, count: 0, pageNumber: 0, pageTotal: 0, limit: 0, blocks: [] }; +} + +export const SearchBlocksResult: MessageFns = { + encode(message: SearchBlocksResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalCount !== 0) { + writer.uint32(8).int64(message.totalCount); + } + if (message.count !== 0) { + writer.uint32(16).int64(message.count); + } + if (message.pageNumber !== 0) { + writer.uint32(24).int64(message.pageNumber); + } + if (message.pageTotal !== 0) { + writer.uint32(32).int64(message.pageTotal); + } + if (message.limit !== 0) { + writer.uint32(40).int64(message.limit); + } + for (const v of message.blocks) { + Block.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchBlocksResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchBlocksResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.totalCount = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.pageNumber = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pageTotal = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.blocks.push(Block.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchBlocksResult { + return { + totalCount: isSet(object.totalCount) ? globalThis.Number(object.totalCount) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + pageNumber: isSet(object.pageNumber) ? globalThis.Number(object.pageNumber) : 0, + pageTotal: isSet(object.pageTotal) ? globalThis.Number(object.pageTotal) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e: any) => Block.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchBlocksResult): unknown { + const obj: any = {}; + if (message.totalCount !== 0) { + obj.totalCount = Math.round(message.totalCount); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.pageNumber !== 0) { + obj.pageNumber = Math.round(message.pageNumber); + } + if (message.pageTotal !== 0) { + obj.pageTotal = Math.round(message.pageTotal); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.blocks?.length) { + obj.blocks = message.blocks.map((e) => Block.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchBlocksResult { + return SearchBlocksResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchBlocksResult { + const message = createBaseSearchBlocksResult(); + message.totalCount = object.totalCount ?? 0; + message.count = object.count ?? 0; + message.pageNumber = object.pageNumber ?? 0; + message.pageTotal = object.pageTotal ?? 0; + message.limit = object.limit ?? 0; + message.blocks = object.blocks?.map((e) => Block.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/node/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/node/v1beta1/query.ts new file mode 100644 index 00000000..ee56c0a8 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/node/v1beta1/query.ts @@ -0,0 +1,476 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/node/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.base.node.v1beta1"; + +/** ConfigRequest defines the request structure for the Config gRPC query. */ +export interface ConfigRequest { +} + +/** ConfigResponse defines the response structure for the Config gRPC query. */ +export interface ConfigResponse { + minimumGasPrice: string; + pruningKeepRecent: string; + pruningInterval: string; + haltHeight: number; +} + +/** StateRequest defines the request structure for the status of a node. */ +export interface StatusRequest { +} + +/** StateResponse defines the response structure for the status of a node. */ +export interface StatusResponse { + /** earliest block height available in the store */ + earliestStoreHeight: number; + /** current block height */ + height: number; + /** block height timestamp */ + timestamp: + | Date + | undefined; + /** app hash of the current block */ + appHash: Uint8Array; + /** validator hash provided by the consensus header */ + validatorHash: Uint8Array; +} + +function createBaseConfigRequest(): ConfigRequest { + return {}; +} + +export const ConfigRequest: MessageFns = { + encode(_: ConfigRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ConfigRequest { + return {}; + }, + + toJSON(_: ConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ConfigRequest { + return ConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ConfigRequest { + const message = createBaseConfigRequest(); + return message; + }, +}; + +function createBaseConfigResponse(): ConfigResponse { + return { minimumGasPrice: "", pruningKeepRecent: "", pruningInterval: "", haltHeight: 0 }; +} + +export const ConfigResponse: MessageFns = { + encode(message: ConfigResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minimumGasPrice !== "") { + writer.uint32(10).string(message.minimumGasPrice); + } + if (message.pruningKeepRecent !== "") { + writer.uint32(18).string(message.pruningKeepRecent); + } + if (message.pruningInterval !== "") { + writer.uint32(26).string(message.pruningInterval); + } + if (message.haltHeight !== 0) { + writer.uint32(32).uint64(message.haltHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minimumGasPrice = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pruningKeepRecent = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pruningInterval = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.haltHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigResponse { + return { + minimumGasPrice: isSet(object.minimumGasPrice) ? globalThis.String(object.minimumGasPrice) : "", + pruningKeepRecent: isSet(object.pruningKeepRecent) ? globalThis.String(object.pruningKeepRecent) : "", + pruningInterval: isSet(object.pruningInterval) ? globalThis.String(object.pruningInterval) : "", + haltHeight: isSet(object.haltHeight) ? globalThis.Number(object.haltHeight) : 0, + }; + }, + + toJSON(message: ConfigResponse): unknown { + const obj: any = {}; + if (message.minimumGasPrice !== "") { + obj.minimumGasPrice = message.minimumGasPrice; + } + if (message.pruningKeepRecent !== "") { + obj.pruningKeepRecent = message.pruningKeepRecent; + } + if (message.pruningInterval !== "") { + obj.pruningInterval = message.pruningInterval; + } + if (message.haltHeight !== 0) { + obj.haltHeight = Math.round(message.haltHeight); + } + return obj; + }, + + create, I>>(base?: I): ConfigResponse { + return ConfigResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigResponse { + const message = createBaseConfigResponse(); + message.minimumGasPrice = object.minimumGasPrice ?? ""; + message.pruningKeepRecent = object.pruningKeepRecent ?? ""; + message.pruningInterval = object.pruningInterval ?? ""; + message.haltHeight = object.haltHeight ?? 0; + return message; + }, +}; + +function createBaseStatusRequest(): StatusRequest { + return {}; +} + +export const StatusRequest: MessageFns = { + encode(_: StatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): StatusRequest { + return {}; + }, + + toJSON(_: StatusRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): StatusRequest { + return StatusRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): StatusRequest { + const message = createBaseStatusRequest(); + return message; + }, +}; + +function createBaseStatusResponse(): StatusResponse { + return { + earliestStoreHeight: 0, + height: 0, + timestamp: undefined, + appHash: new Uint8Array(0), + validatorHash: new Uint8Array(0), + }; +} + +export const StatusResponse: MessageFns = { + encode(message: StatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.earliestStoreHeight !== 0) { + writer.uint32(8).uint64(message.earliestStoreHeight); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(34).bytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + writer.uint32(42).bytes(message.validatorHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.earliestStoreHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StatusResponse { + return { + earliestStoreHeight: isSet(object.earliestStoreHeight) ? globalThis.Number(object.earliestStoreHeight) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + validatorHash: isSet(object.validatorHash) ? bytesFromBase64(object.validatorHash) : new Uint8Array(0), + }; + }, + + toJSON(message: StatusResponse): unknown { + const obj: any = {}; + if (message.earliestStoreHeight !== 0) { + obj.earliestStoreHeight = Math.round(message.earliestStoreHeight); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + obj.validatorHash = base64FromBytes(message.validatorHash); + } + return obj; + }, + + create, I>>(base?: I): StatusResponse { + return StatusResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatusResponse { + const message = createBaseStatusResponse(); + message.earliestStoreHeight = object.earliestStoreHeight ?? 0; + message.height = object.height ?? 0; + message.timestamp = object.timestamp ?? undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + message.validatorHash = object.validatorHash ?? new Uint8Array(0); + return message; + }, +}; + +/** Service defines the gRPC querier service for node related queries. */ +export interface Service { + /** Config queries for the operator configuration. */ + Config(request: ConfigRequest): Promise; + /** Status queries for the node status. */ + Status(request: StatusRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.node.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + this.rpc = rpc; + this.Config = this.Config.bind(this); + this.Status = this.Status.bind(this); + } + Config(request: ConfigRequest): Promise { + const data = ConfigRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Config", data); + return promise.then((data) => ConfigResponse.decode(new BinaryReader(data))); + } + + Status(request: StatusRequest): Promise { + const data = StatusRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Status", data); + return promise.then((data) => StatusResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..effd5449 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} + +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + 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(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: 0 }; +} + +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts new file mode 100644 index 00000000..ebb67be4 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/reflection/v1beta1/reflection.ts @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v1beta1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. */ + interfaceNames: string[]; +} + +/** + * ListImplementationsRequest is the request type of the ListImplementations + * RPC. + */ +export interface ListImplementationsRequest { + /** interface_name defines the interface to query the implementations for. */ + interfaceName: string; +} + +/** + * ListImplementationsResponse is the response type of the ListImplementations + * RPC. + */ +export interface ListImplementationsResponse { + implementationMessageNames: string[]; +} + +function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { + return {}; +} + +export const ListAllInterfacesRequest: MessageFns = { + encode(_: ListAllInterfacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListAllInterfacesRequest { + return {}; + }, + + toJSON(_: ListAllInterfacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesRequest { + return ListAllInterfacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListAllInterfacesRequest { + const message = createBaseListAllInterfacesRequest(); + return message; + }, +}; + +function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { + return { interfaceNames: [] }; +} + +export const ListAllInterfacesResponse: MessageFns = { + encode(message: ListAllInterfacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaceNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAllInterfacesResponse { + return { + interfaceNames: globalThis.Array.isArray(object?.interfaceNames) + ? object.interfaceNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListAllInterfacesResponse): unknown { + const obj: any = {}; + if (message.interfaceNames?.length) { + obj.interfaceNames = message.interfaceNames; + } + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesResponse { + return ListAllInterfacesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListAllInterfacesResponse { + const message = createBaseListAllInterfacesResponse(); + message.interfaceNames = object.interfaceNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListImplementationsRequest(): ListImplementationsRequest { + return { interfaceName: "" }; +} + +export const ListImplementationsRequest: MessageFns = { + encode(message: ListImplementationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interfaceName !== "") { + writer.uint32(10).string(message.interfaceName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaceName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsRequest { + return { interfaceName: isSet(object.interfaceName) ? globalThis.String(object.interfaceName) : "" }; + }, + + toJSON(message: ListImplementationsRequest): unknown { + const obj: any = {}; + if (message.interfaceName !== "") { + obj.interfaceName = message.interfaceName; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsRequest { + return ListImplementationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsRequest { + const message = createBaseListImplementationsRequest(); + message.interfaceName = object.interfaceName ?? ""; + return message; + }, +}; + +function createBaseListImplementationsResponse(): ListImplementationsResponse { + return { implementationMessageNames: [] }; +} + +export const ListImplementationsResponse: MessageFns = { + encode(message: ListImplementationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.implementationMessageNames) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.implementationMessageNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsResponse { + return { + implementationMessageNames: globalThis.Array.isArray(object?.implementationMessageNames) + ? object.implementationMessageNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListImplementationsResponse): unknown { + const obj: any = {}; + if (message.implementationMessageNames?.length) { + obj.implementationMessageNames = message.implementationMessageNames; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsResponse { + return ListImplementationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsResponse { + const message = createBaseListImplementationsResponse(); + message.implementationMessageNames = object.implementationMessageNames?.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 const ReflectionServiceServiceName = "cosmos.base.reflection.v1beta1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 00000000..23a7ca89 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,2057 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/reflection/v2alpha1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 + | undefined; + /** chain provides the chain descriptor */ + chain: + | ChainDescriptor + | undefined; + /** codec provides metadata information regarding codec related types */ + codec: + | CodecDescriptor + | undefined; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration: + | ConfigurationDescriptor + | undefined; + /** query_services provides metadata information regarding the available queriable endpoints */ + queryServices: + | QueryServicesDescriptor + | undefined; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx: TxDescriptor | undefined; +} + +/** 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 */ + signModes: 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 + */ + authnInfoProviderMethodFullname: 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 + */ + interfaceAcceptingMessages: InterfaceAcceptingMessageDescriptor[]; + /** interface_implementers is a list of the descriptors of the interface implementers */ + interfaceImplementers: 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 + */ + typeUrl: 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) + */ + fieldDescriptorNames: string[]; +} + +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptor { + /** bech32_account_address_prefix is the account address prefix */ + bech32AccountAddressPrefix: 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. */ + msgTypeUrl: 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptor { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + queryServices: 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 */ + isModule: 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 + */ + fullQueryPath: string; +} + +function createBaseAppDescriptor(): AppDescriptor { + return { + authn: undefined, + chain: undefined, + codec: undefined, + configuration: undefined, + queryServices: undefined, + tx: undefined, + }; +} + +export const AppDescriptor: MessageFns = { + encode(message: AppDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).join(); + } + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).join(); + } + if (message.configuration !== undefined) { + ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).join(); + } + if (message.queryServices !== undefined) { + QueryServicesDescriptor.encode(message.queryServices, writer.uint32(42).fork()).join(); + } + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.queryServices = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + queryServices: isSet(object.queryServices) ? QueryServicesDescriptor.fromJSON(object.queryServices) : undefined, + tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined, + }; + }, + + toJSON(message: AppDescriptor): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + if (message.configuration !== undefined) { + obj.configuration = ConfigurationDescriptor.toJSON(message.configuration); + } + if (message.queryServices !== undefined) { + obj.queryServices = QueryServicesDescriptor.toJSON(message.queryServices); + } + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): AppDescriptor { + return AppDescriptor.fromPartial(base ?? ({} as any)); + }, + 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.queryServices = (object.queryServices !== undefined && object.queryServices !== null) + ? QueryServicesDescriptor.fromPartial(object.queryServices) + : 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: MessageFns = { + encode(message: TxDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.msgs) { + MsgDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(MsgDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => MsgDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => MsgDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxDescriptor { + return TxDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 { signModes: [] }; +} + +export const AuthnDescriptor: MessageFns = { + encode(message: AuthnDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signModes) { + SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthnDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.signModes.push(SigningModeDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthnDescriptor { + return { + signModes: globalThis.Array.isArray(object?.signModes) + ? object.signModes.map((e: any) => SigningModeDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AuthnDescriptor): unknown { + const obj: any = {}; + if (message.signModes?.length) { + obj.signModes = message.signModes.map((e) => SigningModeDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): AuthnDescriptor { + return AuthnDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.signModes = object.signModes?.map((e) => SigningModeDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningModeDescriptor(): SigningModeDescriptor { + return { name: "", number: 0, authnInfoProviderMethodFullname: "" }; +} + +export const SigningModeDescriptor: MessageFns = { + encode(message: SigningModeDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + writer.uint32(26).string(message.authnInfoProviderMethodFullname); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningModeDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authnInfoProviderMethodFullname = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningModeDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + authnInfoProviderMethodFullname: isSet(object.authnInfoProviderMethodFullname) + ? globalThis.String(object.authnInfoProviderMethodFullname) + : "", + }; + }, + + toJSON(message: SigningModeDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.authnInfoProviderMethodFullname !== "") { + obj.authnInfoProviderMethodFullname = message.authnInfoProviderMethodFullname; + } + return obj; + }, + + create, I>>(base?: I): SigningModeDescriptor { + return SigningModeDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.authnInfoProviderMethodFullname = object.authnInfoProviderMethodFullname ?? ""; + return message; + }, +}; + +function createBaseChainDescriptor(): ChainDescriptor { + return { id: "" }; +} + +export const ChainDescriptor: MessageFns = { + encode(message: ChainDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChainDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChainDescriptor { + return { id: isSet(object.id) ? globalThis.String(object.id) : "" }; + }, + + toJSON(message: ChainDescriptor): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): ChainDescriptor { + return ChainDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ChainDescriptor { + const message = createBaseChainDescriptor(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseCodecDescriptor(): CodecDescriptor { + return { interfaces: [] }; +} + +export const CodecDescriptor: MessageFns = { + encode(message: CodecDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaces) { + InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CodecDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CodecDescriptor { + return { + interfaces: globalThis.Array.isArray(object?.interfaces) + ? object.interfaces.map((e: any) => InterfaceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: CodecDescriptor): unknown { + const obj: any = {}; + if (message.interfaces?.length) { + obj.interfaces = message.interfaces.map((e) => InterfaceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CodecDescriptor { + return CodecDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map((e) => InterfaceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { fullname: "", interfaceAcceptingMessages: [], interfaceImplementers: [] }; +} + +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.interfaceAcceptingMessages) { + InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.interfaceImplementers) { + InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.interfaceAcceptingMessages.push(InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.interfaceImplementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + interfaceAcceptingMessages: globalThis.Array.isArray(object?.interfaceAcceptingMessages) + ? object.interfaceAcceptingMessages.map((e: any) => InterfaceAcceptingMessageDescriptor.fromJSON(e)) + : [], + interfaceImplementers: globalThis.Array.isArray(object?.interfaceImplementers) + ? object.interfaceImplementers.map((e: any) => InterfaceImplementerDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.interfaceAcceptingMessages?.length) { + obj.interfaceAcceptingMessages = message.interfaceAcceptingMessages.map((e) => + InterfaceAcceptingMessageDescriptor.toJSON(e) + ); + } + if (message.interfaceImplementers?.length) { + obj.interfaceImplementers = message.interfaceImplementers.map((e) => InterfaceImplementerDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): InterfaceDescriptor { + return InterfaceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.fullname = object.fullname ?? ""; + message.interfaceAcceptingMessages = + object.interfaceAcceptingMessages?.map((e) => InterfaceAcceptingMessageDescriptor.fromPartial(e)) || []; + message.interfaceImplementers = + object.interfaceImplementers?.map((e) => InterfaceImplementerDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { + return { fullname: "", typeUrl: "" }; +} + +export const InterfaceImplementerDescriptor: MessageFns = { + encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.typeUrl !== "") { + writer.uint32(18).string(message.typeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceImplementerDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.typeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceImplementerDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", + }; + }, + + toJSON(message: InterfaceImplementerDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.typeUrl !== "") { + obj.typeUrl = message.typeUrl; + } + return obj; + }, + + create, I>>(base?: I): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + message.fullname = object.fullname ?? ""; + message.typeUrl = object.typeUrl ?? ""; + return message; + }, +}; + +function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { + return { fullname: "", fieldDescriptorNames: [] }; +} + +export const InterfaceAcceptingMessageDescriptor: MessageFns = { + encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.fieldDescriptorNames) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fieldDescriptorNames.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceAcceptingMessageDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + fieldDescriptorNames: globalThis.Array.isArray(object?.fieldDescriptorNames) + ? object.fieldDescriptorNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: InterfaceAcceptingMessageDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.fieldDescriptorNames?.length) { + obj.fieldDescriptorNames = message.fieldDescriptorNames; + } + return obj; + }, + + create, I>>( + base?: I, + ): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + message.fullname = object.fullname ?? ""; + message.fieldDescriptorNames = object.fieldDescriptorNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseConfigurationDescriptor(): ConfigurationDescriptor { + return { bech32AccountAddressPrefix: "" }; +} + +export const ConfigurationDescriptor: MessageFns = { + encode(message: ConfigurationDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32AccountAddressPrefix !== "") { + writer.uint32(10).string(message.bech32AccountAddressPrefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigurationDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.bech32AccountAddressPrefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigurationDescriptor { + return { + bech32AccountAddressPrefix: isSet(object.bech32AccountAddressPrefix) + ? globalThis.String(object.bech32AccountAddressPrefix) + : "", + }; + }, + + toJSON(message: ConfigurationDescriptor): unknown { + const obj: any = {}; + if (message.bech32AccountAddressPrefix !== "") { + obj.bech32AccountAddressPrefix = message.bech32AccountAddressPrefix; + } + return obj; + }, + + create, I>>(base?: I): ConfigurationDescriptor { + return ConfigurationDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + message.bech32AccountAddressPrefix = object.bech32AccountAddressPrefix ?? ""; + return message; + }, +}; + +function createBaseMsgDescriptor(): MsgDescriptor { + return { msgTypeUrl: "" }; +} + +export const MsgDescriptor: MessageFns = { + encode(message: MsgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(10).string(message.msgTypeUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.msgTypeUrl = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDescriptor { + return { msgTypeUrl: isSet(object.msgTypeUrl) ? globalThis.String(object.msgTypeUrl) : "" }; + }, + + toJSON(message: MsgDescriptor): unknown { + const obj: any = {}; + if (message.msgTypeUrl !== "") { + obj.msgTypeUrl = message.msgTypeUrl; + } + return obj; + }, + + create, I>>(base?: I): MsgDescriptor { + return MsgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDescriptor { + const message = createBaseMsgDescriptor(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; + +function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { + return {}; +} + +export const GetAuthnDescriptorRequest: MessageFns = { + encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetAuthnDescriptorRequest { + return {}; + }, + + toJSON(_: GetAuthnDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, +}; + +function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { + return { authn: undefined }; +} + +export const GetAuthnDescriptorResponse: MessageFns = { + encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetAuthnDescriptorResponse { + return { authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined }; + }, + + toJSON(message: GetAuthnDescriptorResponse): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetChainDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetChainDescriptorRequest { + return {}; + }, + + toJSON(_: GetChainDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorRequest { + return GetChainDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, +}; + +function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { + return { chain: undefined }; +} + +export const GetChainDescriptorResponse: MessageFns = { + encode(message: GetChainDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetChainDescriptorResponse { + return { chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined }; + }, + + toJSON(message: GetChainDescriptorResponse): unknown { + const obj: any = {}; + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorResponse { + return GetChainDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetCodecDescriptorRequest { + return {}; + }, + + toJSON(_: GetCodecDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, +}; + +function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { + return { codec: undefined }; +} + +export const GetCodecDescriptorResponse: MessageFns = { + encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCodecDescriptorResponse { + return { codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined }; + }, + + toJSON(message: GetCodecDescriptorResponse): unknown { + const obj: any = {}; + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetConfigurationDescriptorRequest { + return {}; + }, + + toJSON(_: GetConfigurationDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, +}; + +function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { + return { config: undefined }; +} + +export const GetConfigurationDescriptorResponse: MessageFns = { + encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.config = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetConfigurationDescriptorResponse { + return { config: isSet(object.config) ? ConfigurationDescriptor.fromJSON(object.config) : undefined }; + }, + + toJSON(message: GetConfigurationDescriptorResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = ConfigurationDescriptor.toJSON(message.config); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetQueryServicesDescriptorRequest { + return {}; + }, + + toJSON(_: GetQueryServicesDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, +}; + +function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { + return { queries: undefined }; +} + +export const GetQueryServicesDescriptorResponse: MessageFns = { + encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.queries !== undefined) { + QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetQueryServicesDescriptorResponse { + return { queries: isSet(object.queries) ? QueryServicesDescriptor.fromJSON(object.queries) : undefined }; + }, + + toJSON(message: GetQueryServicesDescriptorResponse): unknown { + const obj: any = {}; + if (message.queries !== undefined) { + obj.queries = QueryServicesDescriptor.toJSON(message.queries); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: GetTxDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetTxDescriptorRequest { + return {}; + }, + + toJSON(_: GetTxDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorRequest { + return GetTxDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, +}; + +function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { + return { tx: undefined }; +} + +export const GetTxDescriptorResponse: MessageFns = { + encode(message: GetTxDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxDescriptorResponse { + return { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: GetTxDescriptorResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorResponse { + return GetTxDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { queryServices: [] }; +} + +export const QueryServicesDescriptor: MessageFns = { + encode(message: QueryServicesDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.queryServices) { + QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServicesDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.queryServices.push(QueryServiceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServicesDescriptor { + return { + queryServices: globalThis.Array.isArray(object?.queryServices) + ? object.queryServices.map((e: any) => QueryServiceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServicesDescriptor): unknown { + const obj: any = {}; + if (message.queryServices?.length) { + obj.queryServices = message.queryServices.map((e) => QueryServiceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServicesDescriptor { + return QueryServicesDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.queryServices = object.queryServices?.map((e) => QueryServiceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { + return { fullname: "", isModule: false, methods: [] }; +} + +export const QueryServiceDescriptor: MessageFns = { + encode(message: QueryServiceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.isModule !== false) { + writer.uint32(16).bool(message.isModule); + } + for (const v of message.methods) { + QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServiceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isModule = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServiceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + isModule: isSet(object.isModule) ? globalThis.Boolean(object.isModule) : false, + methods: globalThis.Array.isArray(object?.methods) + ? object.methods.map((e: any) => QueryMethodDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServiceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.isModule !== false) { + obj.isModule = message.isModule; + } + if (message.methods?.length) { + obj.methods = message.methods.map((e) => QueryMethodDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServiceDescriptor { + return QueryServiceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + message.fullname = object.fullname ?? ""; + message.isModule = object.isModule ?? false; + message.methods = object.methods?.map((e) => QueryMethodDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { + return { name: "", fullQueryPath: "" }; +} + +export const QueryMethodDescriptor: MessageFns = { + encode(message: QueryMethodDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.fullQueryPath !== "") { + writer.uint32(18).string(message.fullQueryPath); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryMethodDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullQueryPath = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryMethodDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + fullQueryPath: isSet(object.fullQueryPath) ? globalThis.String(object.fullQueryPath) : "", + }; + }, + + toJSON(message: QueryMethodDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.fullQueryPath !== "") { + obj.fullQueryPath = message.fullQueryPath; + } + return obj; + }, + + create, I>>(base?: I): QueryMethodDescriptor { + return QueryMethodDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + message.name = object.name ?? ""; + message.fullQueryPath = object.fullQueryPath ?? ""; + 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 const ReflectionServiceServiceName = "cosmos.base.reflection.v2alpha1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts new file mode 100644 index 00000000..f58dfb17 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/tendermint/v1beta1/query.ts @@ -0,0 +1,1974 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { DefaultNodeInfo } from "../../../../tendermint/p2p/types"; +import { Block } from "../../../../tendermint/types/block"; +import { BlockID } from "../../../../tendermint/types/types"; +import { PageRequest, PageResponse } from "../../query/v1beta1/pagination"; +import { Block as Block1 } from "./types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightRequest { + height: number; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetRequest { + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetResponse { + blockHeight: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** Validator is the type for the validator-set. */ +export interface Validator { + address: string; + pubKey: Any | undefined; + votingPower: number; + proposerPriority: number; +} + +/** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightRequest { + height: number; +} + +/** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightResponse { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + blockId: + | BlockID + | undefined; + /** Deprecated: please use `sdk_block` instead */ + block: + | Block + | undefined; + /** Since: cosmos-sdk 0.47 */ + sdkBlock: Block1 | undefined; +} + +/** 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 { + defaultNodeInfo: DefaultNodeInfo | undefined; + applicationVersion: VersionInfo | undefined; +} + +/** VersionInfo is the type for the GetNodeInfoResponse message. */ +export interface VersionInfo { + name: string; + appName: string; + version: string; + gitCommit: string; + buildTags: string; + goVersion: string; + buildDeps: Module[]; + /** Since: cosmos-sdk 0.43 */ + cosmosSdkVersion: string; +} + +/** Module is the type for VersionInfo */ +export interface Module { + /** module path */ + path: string; + /** module version */ + version: string; + /** checksum */ + sum: string; +} + +/** ABCIQueryRequest defines the request structure for the ABCIQuery gRPC query. */ +export interface ABCIQueryRequest { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +/** + * ABCIQueryResponse defines the response structure for the ABCIQuery gRPC query. + * + * Note: This type is a duplicate of the ResponseQuery proto type defined in + * Tendermint. + */ +export interface ABCIQueryResponse { + code: number; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +/** + * ProofOp defines an operation used for calculating Merkle root. The data could + * be arbitrary format, providing necessary data for example neighbouring node + * hash. + * + * Note: This type is a duplicate of the ProofOp proto type defined in Tendermint. + */ +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} + +/** + * ProofOps is Merkle proof defined by the list of ProofOps. + * + * Note: This type is a duplicate of the ProofOps proto type defined in Tendermint. + */ +export interface ProofOps { + ops: ProofOp[]; +} + +function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequest { + return { height: 0, pagination: undefined }; +} + +export const GetValidatorSetByHeightRequest: MessageFns = { + encode(message: GetValidatorSetByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightRequest { + return GetValidatorSetByHeightRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetValidatorSetByHeightResponse: MessageFns = { + encode(message: GetValidatorSetByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightResponse { + return GetValidatorSetByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetValidatorSetByHeightResponse { + const message = createBaseGetValidatorSetByHeightResponse(); + message.blockHeight = object.blockHeight ?? 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: MessageFns = { + encode(message: GetLatestValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: GetLatestValidatorSetRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetRequest { + return GetLatestValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + 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 { blockHeight: 0, validators: [], pagination: undefined }; +} + +export const GetLatestValidatorSetResponse: MessageFns = { + encode(message: GetLatestValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetResponse { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + validators: globalThis.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 = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetResponse { + return GetLatestValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetLatestValidatorSetResponse { + const message = createBaseGetLatestValidatorSetResponse(); + message.blockHeight = object.blockHeight ?? 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: "", pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { + return { height: 0 }; +} + +export const GetBlockByHeightRequest: MessageFns = { + encode(message: GetBlockByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: GetBlockByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightRequest { + return GetBlockByHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightRequest { + const message = createBaseGetBlockByHeightRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetBlockByHeightResponse: MessageFns = { + encode(message: GetBlockByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetBlockByHeightResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightResponse { + return GetBlockByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightResponse { + const message = createBaseGetBlockByHeightResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { + return {}; +} + +export const GetLatestBlockRequest: MessageFns = { + encode(_: GetLatestBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetLatestBlockRequest { + return {}; + }, + + toJSON(_: GetLatestBlockRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetLatestBlockRequest { + return GetLatestBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetLatestBlockRequest { + const message = createBaseGetLatestBlockRequest(); + return message; + }, +}; + +function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { + return { blockId: undefined, block: undefined, sdkBlock: undefined }; +} + +export const GetLatestBlockResponse: MessageFns = { + encode(message: GetLatestBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.sdkBlock !== undefined) { + Block1.encode(message.sdkBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sdkBlock = Block1.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestBlockResponse { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + sdkBlock: isSet(object.sdkBlock) ? Block1.fromJSON(object.sdkBlock) : undefined, + }; + }, + + toJSON(message: GetLatestBlockResponse): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.sdkBlock !== undefined) { + obj.sdkBlock = Block1.toJSON(message.sdkBlock); + } + return obj; + }, + + create, I>>(base?: I): GetLatestBlockResponse { + return GetLatestBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetLatestBlockResponse { + const message = createBaseGetLatestBlockResponse(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.sdkBlock = (object.sdkBlock !== undefined && object.sdkBlock !== null) + ? Block1.fromPartial(object.sdkBlock) + : undefined; + return message; + }, +}; + +function createBaseGetSyncingRequest(): GetSyncingRequest { + return {}; +} + +export const GetSyncingRequest: MessageFns = { + encode(_: GetSyncingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetSyncingRequest { + return {}; + }, + + toJSON(_: GetSyncingRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetSyncingRequest { + return GetSyncingRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetSyncingRequest { + const message = createBaseGetSyncingRequest(); + return message; + }, +}; + +function createBaseGetSyncingResponse(): GetSyncingResponse { + return { syncing: false }; +} + +export const GetSyncingResponse: MessageFns = { + encode(message: GetSyncingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.syncing !== false) { + writer.uint32(8).bool(message.syncing); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.syncing = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetSyncingResponse { + return { syncing: isSet(object.syncing) ? globalThis.Boolean(object.syncing) : false }; + }, + + toJSON(message: GetSyncingResponse): unknown { + const obj: any = {}; + if (message.syncing !== false) { + obj.syncing = message.syncing; + } + return obj; + }, + + create, I>>(base?: I): GetSyncingResponse { + return GetSyncingResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetSyncingResponse { + const message = createBaseGetSyncingResponse(); + message.syncing = object.syncing ?? false; + return message; + }, +}; + +function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { + return {}; +} + +export const GetNodeInfoRequest: MessageFns = { + encode(_: GetNodeInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetNodeInfoRequest { + return {}; + }, + + toJSON(_: GetNodeInfoRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetNodeInfoRequest { + return GetNodeInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetNodeInfoRequest { + const message = createBaseGetNodeInfoRequest(); + return message; + }, +}; + +function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { + return { defaultNodeInfo: undefined, applicationVersion: undefined }; +} + +export const GetNodeInfoResponse: MessageFns = { + encode(message: GetNodeInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.defaultNodeInfo !== undefined) { + DefaultNodeInfo.encode(message.defaultNodeInfo, writer.uint32(10).fork()).join(); + } + if (message.applicationVersion !== undefined) { + VersionInfo.encode(message.applicationVersion, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.defaultNodeInfo = DefaultNodeInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.applicationVersion = VersionInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetNodeInfoResponse { + return { + defaultNodeInfo: isSet(object.defaultNodeInfo) ? DefaultNodeInfo.fromJSON(object.defaultNodeInfo) : undefined, + applicationVersion: isSet(object.applicationVersion) + ? VersionInfo.fromJSON(object.applicationVersion) + : undefined, + }; + }, + + toJSON(message: GetNodeInfoResponse): unknown { + const obj: any = {}; + if (message.defaultNodeInfo !== undefined) { + obj.defaultNodeInfo = DefaultNodeInfo.toJSON(message.defaultNodeInfo); + } + if (message.applicationVersion !== undefined) { + obj.applicationVersion = VersionInfo.toJSON(message.applicationVersion); + } + return obj; + }, + + create, I>>(base?: I): GetNodeInfoResponse { + return GetNodeInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetNodeInfoResponse { + const message = createBaseGetNodeInfoResponse(); + message.defaultNodeInfo = (object.defaultNodeInfo !== undefined && object.defaultNodeInfo !== null) + ? DefaultNodeInfo.fromPartial(object.defaultNodeInfo) + : undefined; + message.applicationVersion = (object.applicationVersion !== undefined && object.applicationVersion !== null) + ? VersionInfo.fromPartial(object.applicationVersion) + : undefined; + return message; + }, +}; + +function createBaseVersionInfo(): VersionInfo { + return { + name: "", + appName: "", + version: "", + gitCommit: "", + buildTags: "", + goVersion: "", + buildDeps: [], + cosmosSdkVersion: "", + }; +} + +export const VersionInfo: MessageFns = { + encode(message: VersionInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.appName !== "") { + writer.uint32(18).string(message.appName); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.gitCommit !== "") { + writer.uint32(34).string(message.gitCommit); + } + if (message.buildTags !== "") { + writer.uint32(42).string(message.buildTags); + } + if (message.goVersion !== "") { + writer.uint32(50).string(message.goVersion); + } + for (const v of message.buildDeps) { + Module.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.cosmosSdkVersion !== "") { + writer.uint32(66).string(message.cosmosSdkVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.version = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gitCommit = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.buildTags = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.goVersion = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.buildDeps.push(Module.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.cosmosSdkVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + appName: isSet(object.appName) ? globalThis.String(object.appName) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + gitCommit: isSet(object.gitCommit) ? globalThis.String(object.gitCommit) : "", + buildTags: isSet(object.buildTags) ? globalThis.String(object.buildTags) : "", + goVersion: isSet(object.goVersion) ? globalThis.String(object.goVersion) : "", + buildDeps: globalThis.Array.isArray(object?.buildDeps) + ? object.buildDeps.map((e: any) => Module.fromJSON(e)) + : [], + cosmosSdkVersion: isSet(object.cosmosSdkVersion) ? globalThis.String(object.cosmosSdkVersion) : "", + }; + }, + + toJSON(message: VersionInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.gitCommit !== "") { + obj.gitCommit = message.gitCommit; + } + if (message.buildTags !== "") { + obj.buildTags = message.buildTags; + } + if (message.goVersion !== "") { + obj.goVersion = message.goVersion; + } + if (message.buildDeps?.length) { + obj.buildDeps = message.buildDeps.map((e) => Module.toJSON(e)); + } + if (message.cosmosSdkVersion !== "") { + obj.cosmosSdkVersion = message.cosmosSdkVersion; + } + return obj; + }, + + create, I>>(base?: I): VersionInfo { + return VersionInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionInfo { + const message = createBaseVersionInfo(); + message.name = object.name ?? ""; + message.appName = object.appName ?? ""; + message.version = object.version ?? ""; + message.gitCommit = object.gitCommit ?? ""; + message.buildTags = object.buildTags ?? ""; + message.goVersion = object.goVersion ?? ""; + message.buildDeps = object.buildDeps?.map((e) => Module.fromPartial(e)) || []; + message.cosmosSdkVersion = object.cosmosSdkVersion ?? ""; + return message; + }, +}; + +function createBaseModule(): Module { + return { path: "", version: "", sum: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sum = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + path: isSet(object.path) ? globalThis.String(object.path) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + sum: isSet(object.sum) ? globalThis.String(object.sum) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.sum !== "") { + obj.sum = message.sum; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.path = object.path ?? ""; + message.version = object.version ?? ""; + message.sum = object.sum ?? ""; + return message; + }, +}; + +function createBaseABCIQueryRequest(): ABCIQueryRequest { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const ABCIQueryRequest: MessageFns = { + encode(message: ABCIQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryRequest { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: ABCIQueryRequest): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryRequest { + return ABCIQueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryRequest { + const message = createBaseABCIQueryRequest(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseABCIQueryResponse(): ABCIQueryResponse { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ABCIQueryResponse: MessageFns = { + encode(message: ABCIQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIQueryResponse { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ABCIQueryResponse): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ABCIQueryResponse { + return ABCIQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIQueryResponse { + const message = createBaseABCIQueryResponse(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? 0; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseProofOp(): ProofOp { + return { type: "", key: new Uint8Array(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + 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; + /** + * ABCIQuery defines a query handler that supports ABCI queries directly to the + * application, bypassing Tendermint completely. The ABCI query must contain + * a valid and supported path, including app, custom, p2p, and store. + * + * Since: cosmos-sdk 0.46 + */ + ABCIQuery(request: ABCIQueryRequest): Promise; +} + +export const ServiceServiceName = "cosmos.base.tendermint.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.ABCIQuery = this.ABCIQuery.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + ABCIQuery(request: ABCIQueryRequest): Promise { + const data = ABCIQueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ABCIQuery", data); + return promise.then((data) => ABCIQueryResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts new file mode 100644 index 00000000..2d229c81 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/tendermint/v1beta1/types.ts @@ -0,0 +1,530 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/tendermint/v1beta1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { EvidenceList } from "../../../../tendermint/types/evidence"; +import { BlockID, Commit, Data } from "../../../../tendermint/types/types"; +import { Consensus } from "../../../../tendermint/version/types"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** + * Block is tendermint type Block, with the Header proposer address + * field converted to bech32 string. + */ +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +/** Header defines the structure of a Tendermint block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** + * proposer_address is the original block proposer address, formatted as a Bech32 string. + * In Tendermint, this type is `bytes`, but in the SDK, we convert it to a Bech32 string + * for better UX. + */ + proposerAddress: string; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: "", + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + writer.uint32(114).string(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? globalThis.String(object.proposerAddress) : "", + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress !== "") { + obj.proposerAddress = message.proposerAddress; + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..72eff8cb --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,335 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ +export interface IntProto { + int: string; +} + +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ +export interface DecProto { + dec: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +export const IntProto: MessageFns = { + encode(message: IntProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IntProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.int = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IntProto { + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + 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 ?? ""; + return message; + }, +}; + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +export const DecProto: MessageFns = { + encode(message: DecProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dec = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecProto { + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + 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 ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/module/v1/module.ts new file mode 100644 index 00000000..733fcc4e --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.circuit.module.v1"; + +/** Module is the config object of the circuit module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/query.ts new file mode 100644 index 00000000..7d1037ab --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/query.ts @@ -0,0 +1,470 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GenesisAccountPermissions, Permissions } from "./types"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + address: string; +} + +/** AccountResponse is the response type for the Query/Account RPC method. */ +export interface AccountResponse { + permission: Permissions | undefined; +} + +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ +export interface QueryAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** AccountsResponse is the response type for the Query/Accounts RPC method. */ +export interface AccountsResponse { + accounts: GenesisAccountPermissions[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryDisableListRequest is the request type for the Query/DisabledList RPC method. */ +export interface QueryDisabledListRequest { +} + +/** DisabledListResponse is the response type for the Query/DisabledList RPC method. */ +export interface DisabledListResponse { + disabledList: string[]; +} + +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { address: "" }; +} + +export const QueryAccountRequest: MessageFns = { + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseAccountResponse(): AccountResponse { + return { permission: undefined }; +} + +export const AccountResponse: MessageFns = { + encode(message: AccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.permission !== undefined) { + Permissions.encode(message.permission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.permission = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccountResponse { + return { permission: isSet(object.permission) ? Permissions.fromJSON(object.permission) : undefined }; + }, + + toJSON(message: AccountResponse): unknown { + const obj: any = {}; + if (message.permission !== undefined) { + obj.permission = Permissions.toJSON(message.permission); + } + return obj; + }, + + create, I>>(base?: I): AccountResponse { + return AccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccountResponse { + const message = createBaseAccountResponse(); + message.permission = (object.permission !== undefined && object.permission !== null) + ? Permissions.fromPartial(object.permission) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest: MessageFns = { + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseAccountsResponse(): AccountsResponse { + return { accounts: [], pagination: undefined }; +} + +export const AccountsResponse: MessageFns = { + encode(message: AccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e: any) => GenesisAccountPermissions.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: AccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => GenesisAccountPermissions.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): AccountsResponse { + return AccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccountsResponse { + const message = createBaseAccountsResponse(); + message.accounts = object.accounts?.map((e) => GenesisAccountPermissions.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDisabledListRequest(): QueryDisabledListRequest { + return {}; +} + +export const QueryDisabledListRequest: MessageFns = { + encode(_: QueryDisabledListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDisabledListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDisabledListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryDisabledListRequest { + return {}; + }, + + toJSON(_: QueryDisabledListRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryDisabledListRequest { + return QueryDisabledListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryDisabledListRequest { + const message = createBaseQueryDisabledListRequest(); + return message; + }, +}; + +function createBaseDisabledListResponse(): DisabledListResponse { + return { disabledList: [] }; +} + +export const DisabledListResponse: MessageFns = { + encode(message: DisabledListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.disabledList) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DisabledListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDisabledListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.disabledList.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DisabledListResponse { + return { + disabledList: globalThis.Array.isArray(object?.disabledList) + ? object.disabledList.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: DisabledListResponse): unknown { + const obj: any = {}; + if (message.disabledList?.length) { + obj.disabledList = message.disabledList; + } + return obj; + }, + + create, I>>(base?: I): DisabledListResponse { + return DisabledListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DisabledListResponse { + const message = createBaseDisabledListResponse(); + message.disabledList = object.disabledList?.map((e) => e) || []; + return message; + }, +}; + +/** Query defines the circuit gRPC querier service. */ +export interface Query { + /** Account returns account permissions. */ + Account(request: QueryAccountRequest): Promise; + /** Account returns account permissions. */ + Accounts(request: QueryAccountsRequest): Promise; + /** DisabledList returns a list of disabled message urls */ + DisabledList(request: QueryDisabledListRequest): Promise; +} + +export const QueryServiceName = "cosmos.circuit.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 || QueryServiceName; + this.rpc = rpc; + this.Account = this.Account.bind(this); + this.Accounts = this.Accounts.bind(this); + this.DisabledList = this.DisabledList.bind(this); + } + Account(request: QueryAccountRequest): Promise { + const data = QueryAccountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Account", data); + return promise.then((data) => AccountResponse.decode(new BinaryReader(data))); + } + + Accounts(request: QueryAccountsRequest): Promise { + const data = QueryAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Accounts", data); + return promise.then((data) => AccountsResponse.decode(new BinaryReader(data))); + } + + DisabledList(request: QueryDisabledListRequest): Promise { + const data = QueryDisabledListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DisabledList", data); + return promise.then((data) => DisabledListResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/tx.ts new file mode 100644 index 00000000..1cc16218 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/tx.ts @@ -0,0 +1,566 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Permissions } from "./types"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. */ +export interface MsgAuthorizeCircuitBreaker { + /** + * granter is the granter of the circuit breaker permissions and must have + * LEVEL_SUPER_ADMIN. + */ + granter: string; + /** grantee is the account authorized with the provided permissions. */ + grantee: string; + /** + * permissions are the circuit breaker permissions that the grantee receives. + * These will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can + * be specified to revoke all permissions. + */ + permissions: Permissions | undefined; +} + +/** MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. */ +export interface MsgAuthorizeCircuitBreakerResponse { + success: boolean; +} + +/** MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. */ +export interface MsgTripCircuitBreaker { + /** authority is the account authorized to trip the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of type URLs to immediately stop processing. + * IF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY. + * This value is validated against the authority's permissions and if the + * authority does not have permissions to trip the specified msg type URLs + * (or all URLs), the operation will fail. + */ + msgTypeUrls: string[]; +} + +/** MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. */ +export interface MsgTripCircuitBreakerResponse { + success: boolean; +} + +/** MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. */ +export interface MsgResetCircuitBreaker { + /** authority is the account authorized to trip or reset the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of Msg type URLs to resume processing. If + * it is left empty all Msg processing for type URLs that the account is + * authorized to trip will resume. + */ + msgTypeUrls: string[]; +} + +/** MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. */ +export interface MsgResetCircuitBreakerResponse { + success: boolean; +} + +function createBaseMsgAuthorizeCircuitBreaker(): MsgAuthorizeCircuitBreaker { + return { granter: "", grantee: "", permissions: undefined }; +} + +export const MsgAuthorizeCircuitBreaker: MessageFns = { + encode(message: MsgAuthorizeCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAuthorizeCircuitBreaker { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, + }; + }, + + toJSON(message: MsgAuthorizeCircuitBreaker): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.permissions !== undefined) { + obj.permissions = Permissions.toJSON(message.permissions); + } + return obj; + }, + + create, I>>(base?: I): MsgAuthorizeCircuitBreaker { + return MsgAuthorizeCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgAuthorizeCircuitBreaker { + const message = createBaseMsgAuthorizeCircuitBreaker(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.permissions = (object.permissions !== undefined && object.permissions !== null) + ? Permissions.fromPartial(object.permissions) + : undefined; + return message; + }, +}; + +function createBaseMsgAuthorizeCircuitBreakerResponse(): MsgAuthorizeCircuitBreakerResponse { + return { success: false }; +} + +export const MsgAuthorizeCircuitBreakerResponse: MessageFns = { + encode(message: MsgAuthorizeCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAuthorizeCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgAuthorizeCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgAuthorizeCircuitBreakerResponse { + return MsgAuthorizeCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgAuthorizeCircuitBreakerResponse { + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +function createBaseMsgTripCircuitBreaker(): MsgTripCircuitBreaker { + return { authority: "", msgTypeUrls: [] }; +} + +export const MsgTripCircuitBreaker: MessageFns = { + encode(message: MsgTripCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgTripCircuitBreaker { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgTripCircuitBreaker): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): MsgTripCircuitBreaker { + return MsgTripCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgTripCircuitBreaker { + const message = createBaseMsgTripCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgTripCircuitBreakerResponse(): MsgTripCircuitBreakerResponse { + return { success: false }; +} + +export const MsgTripCircuitBreakerResponse: MessageFns = { + encode(message: MsgTripCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgTripCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgTripCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>(base?: I): MsgTripCircuitBreakerResponse { + return MsgTripCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgTripCircuitBreakerResponse { + const message = createBaseMsgTripCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +function createBaseMsgResetCircuitBreaker(): MsgResetCircuitBreaker { + return { authority: "", msgTypeUrls: [] }; +} + +export const MsgResetCircuitBreaker: MessageFns = { + encode(message: MsgResetCircuitBreaker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msgTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgResetCircuitBreaker { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + msgTypeUrls: globalThis.Array.isArray(object?.msgTypeUrls) + ? object.msgTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: MsgResetCircuitBreaker): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.msgTypeUrls?.length) { + obj.msgTypeUrls = message.msgTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): MsgResetCircuitBreaker { + return MsgResetCircuitBreaker.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgResetCircuitBreaker { + const message = createBaseMsgResetCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgResetCircuitBreakerResponse(): MsgResetCircuitBreakerResponse { + return { success: false }; +} + +export const MsgResetCircuitBreakerResponse: MessageFns = { + encode(message: MsgResetCircuitBreakerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgResetCircuitBreakerResponse { + return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false }; + }, + + toJSON(message: MsgResetCircuitBreakerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + return obj; + }, + + create, I>>(base?: I): MsgResetCircuitBreakerResponse { + return MsgResetCircuitBreakerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgResetCircuitBreakerResponse { + const message = createBaseMsgResetCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, +}; + +/** Msg defines the circuit Msg service. */ +export interface Msg { + /** + * AuthorizeCircuitBreaker allows a super-admin to grant (or revoke) another + * account's circuit breaker permissions. + */ + AuthorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise; + /** TripCircuitBreaker pauses processing of Msg's in the state machine. */ + TripCircuitBreaker(request: MsgTripCircuitBreaker): Promise; + /** + * ResetCircuitBreaker resumes processing of Msg's in the state machine that + * have been been paused using TripCircuitBreaker. + */ + ResetCircuitBreaker(request: MsgResetCircuitBreaker): Promise; +} + +export const MsgServiceName = "cosmos.circuit.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 || MsgServiceName; + this.rpc = rpc; + this.AuthorizeCircuitBreaker = this.AuthorizeCircuitBreaker.bind(this); + this.TripCircuitBreaker = this.TripCircuitBreaker.bind(this); + this.ResetCircuitBreaker = this.ResetCircuitBreaker.bind(this); + } + AuthorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise { + const data = MsgAuthorizeCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizeCircuitBreaker", data); + return promise.then((data) => MsgAuthorizeCircuitBreakerResponse.decode(new BinaryReader(data))); + } + + TripCircuitBreaker(request: MsgTripCircuitBreaker): Promise { + const data = MsgTripCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "TripCircuitBreaker", data); + return promise.then((data) => MsgTripCircuitBreakerResponse.decode(new BinaryReader(data))); + } + + ResetCircuitBreaker(request: MsgResetCircuitBreaker): Promise { + const data = MsgResetCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "ResetCircuitBreaker", data); + return promise.then((data) => MsgResetCircuitBreakerResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/types.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/types.ts new file mode 100644 index 00000000..6810f76c --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/circuit/v1/types.ts @@ -0,0 +1,356 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/circuit/v1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.circuit.v1"; + +/** + * Permissions are the permissions that an account has to trip + * or reset the circuit breaker. + */ +export interface Permissions { + /** level is the level of permissions granted to this account. */ + level: Permissions_Level; + /** + * limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type + * URLs that the account can trip. It is an error to use limit_type_urls with + * a level other than LEVEL_SOME_MSGS. + */ + limitTypeUrls: string[]; +} + +/** Level is the permission level. */ +export enum Permissions_Level { + /** + * LEVEL_NONE_UNSPECIFIED - LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit + * breaker permissions. + */ + LEVEL_NONE_UNSPECIFIED = 0, + /** + * LEVEL_SOME_MSGS - LEVEL_SOME_MSGS indicates that the account will have permission to + * trip or reset the circuit breaker for some Msg type URLs. If this level + * is chosen, a non-empty list of Msg type URLs must be provided in + * limit_type_urls. + */ + LEVEL_SOME_MSGS = 1, + /** + * LEVEL_ALL_MSGS - LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit + * breaker for Msg's of all type URLs. + */ + LEVEL_ALL_MSGS = 2, + /** + * LEVEL_SUPER_ADMIN - LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker + * actions and can grant permissions to other accounts. + */ + LEVEL_SUPER_ADMIN = 3, + UNRECOGNIZED = -1, +} + +export function permissions_LevelFromJSON(object: any): Permissions_Level { + switch (object) { + case 0: + case "LEVEL_NONE_UNSPECIFIED": + return Permissions_Level.LEVEL_NONE_UNSPECIFIED; + case 1: + case "LEVEL_SOME_MSGS": + return Permissions_Level.LEVEL_SOME_MSGS; + case 2: + case "LEVEL_ALL_MSGS": + return Permissions_Level.LEVEL_ALL_MSGS; + case 3: + case "LEVEL_SUPER_ADMIN": + return Permissions_Level.LEVEL_SUPER_ADMIN; + case -1: + case "UNRECOGNIZED": + default: + return Permissions_Level.UNRECOGNIZED; + } +} + +export function permissions_LevelToJSON(object: Permissions_Level): string { + switch (object) { + case Permissions_Level.LEVEL_NONE_UNSPECIFIED: + return "LEVEL_NONE_UNSPECIFIED"; + case Permissions_Level.LEVEL_SOME_MSGS: + return "LEVEL_SOME_MSGS"; + case Permissions_Level.LEVEL_ALL_MSGS: + return "LEVEL_ALL_MSGS"; + case Permissions_Level.LEVEL_SUPER_ADMIN: + return "LEVEL_SUPER_ADMIN"; + case Permissions_Level.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** GenesisAccountPermissions is the account permissions for the circuit breaker in genesis */ +export interface GenesisAccountPermissions { + address: string; + permissions: Permissions | undefined; +} + +/** GenesisState is the state that must be provided at genesis. */ +export interface GenesisState { + accountPermissions: GenesisAccountPermissions[]; + disabledTypeUrls: string[]; +} + +function createBasePermissions(): Permissions { + return { level: 0, limitTypeUrls: [] }; +} + +export const Permissions: MessageFns = { + encode(message: Permissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.level !== 0) { + writer.uint32(8).int32(message.level); + } + for (const v of message.limitTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Permissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermissions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.level = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.limitTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Permissions { + return { + level: isSet(object.level) ? permissions_LevelFromJSON(object.level) : 0, + limitTypeUrls: globalThis.Array.isArray(object?.limitTypeUrls) + ? object.limitTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Permissions): unknown { + const obj: any = {}; + if (message.level !== 0) { + obj.level = permissions_LevelToJSON(message.level); + } + if (message.limitTypeUrls?.length) { + obj.limitTypeUrls = message.limitTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): Permissions { + return Permissions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Permissions { + const message = createBasePermissions(); + message.level = object.level ?? 0; + message.limitTypeUrls = object.limitTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGenesisAccountPermissions(): GenesisAccountPermissions { + return { address: "", permissions: undefined }; +} + +export const GenesisAccountPermissions: MessageFns = { + encode(message: GenesisAccountPermissions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisAccountPermissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisAccountPermissions(); + 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 !== 18) { + break; + } + + message.permissions = Permissions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisAccountPermissions { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined, + }; + }, + + toJSON(message: GenesisAccountPermissions): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.permissions !== undefined) { + obj.permissions = Permissions.toJSON(message.permissions); + } + return obj; + }, + + create, I>>(base?: I): GenesisAccountPermissions { + return GenesisAccountPermissions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisAccountPermissions { + const message = createBaseGenesisAccountPermissions(); + message.address = object.address ?? ""; + message.permissions = (object.permissions !== undefined && object.permissions !== null) + ? Permissions.fromPartial(object.permissions) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { accountPermissions: [], disabledTypeUrls: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accountPermissions) { + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.disabledTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.accountPermissions.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.disabledTypeUrls.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + accountPermissions: globalThis.Array.isArray(object?.accountPermissions) + ? object.accountPermissions.map((e: any) => GenesisAccountPermissions.fromJSON(e)) + : [], + disabledTypeUrls: globalThis.Array.isArray(object?.disabledTypeUrls) + ? object.disabledTypeUrls.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.accountPermissions?.length) { + obj.accountPermissions = message.accountPermissions.map((e) => GenesisAccountPermissions.toJSON(e)); + } + if (message.disabledTypeUrls?.length) { + obj.disabledTypeUrls = message.disabledTypeUrls; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.accountPermissions = object.accountPermissions?.map((e) => GenesisAccountPermissions.fromPartial(e)) || []; + message.disabledTypeUrls = object.disabledTypeUrls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/module/v1/module.ts new file mode 100644 index 00000000..97a0d394 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.consensus.module.v1"; + +/** Module is the config object of the consensus module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/v1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/v1/query.ts new file mode 100644 index 00000000..3fe04bb9 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/v1/query.ts @@ -0,0 +1,180 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ConsensusParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponse { + /** + * params are the tendermint consensus params stored in the consensus module. + * Please note that `params.version` is not populated in this response, it is + * tracked separately in the x/upgrade module. + */ + params: ConsensusParams | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + ConsensusParams.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = ConsensusParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? ConsensusParams.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = ConsensusParams.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) + ? ConsensusParams.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/consensus module. */ + Params(request: QueryParamsRequest): Promise; +} + +export const QueryServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/v1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/v1/tx.ts new file mode 100644 index 00000000..c95b67fe --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/consensus/v1/tx.ts @@ -0,0 +1,266 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/consensus/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ABCIParams, BlockParams, EvidenceParams, ValidatorParams } from "../../../tendermint/types/params"; + +export const protobufPackage = "cosmos.consensus.v1"; + +/** Since: cosmos-sdk 0.47 */ + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/consensus parameters to update. + * VersionsParams is not included in this Msg because it is tracked + * separarately in x/upgrade. + * + * NOTE: All parameters must be supplied. + */ + block: BlockParams | undefined; + evidence: EvidenceParams | undefined; + validator: + | ValidatorParams + | undefined; + /** Since: cosmos-sdk 0.50 */ + abci: ABCIParams | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", block: undefined, evidence: undefined, validator: undefined, abci: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + 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 ?? ""; + 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.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the consensus Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/consensus module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.consensus.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/module/v1/module.ts new file mode 100644 index 00000000..3ae9a625 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/module/v1/module.ts @@ -0,0 +1,117 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crisis.module.v1"; + +/** Module is the config object of the crisis module. */ +export interface Module { + /** fee_collector_name is the name of the FeeCollector ModuleAccount. */ + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts new file mode 100644 index 00000000..4ebe6590 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/v1beta1/genesis.ts @@ -0,0 +1,104 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + */ + constantFee: Coin | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { constantFee: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 26) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/v1beta1/tx.ts new file mode 100644 index 00000000..90d17bf8 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crisis/v1beta1/tx.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crisis/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.crisis.v1beta1"; + +/** MsgVerifyInvariant represents a message to verify a particular invariance. */ +export interface MsgVerifyInvariant { + /** sender is the account address of private key to send coins to fee collector account. */ + sender: string; + /** name of the invariant module. */ + invariantModuleName: string; + /** invariant_route is the msg's invariant route. */ + invariantRoute: string; +} + +/** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ +export interface MsgVerifyInvariantResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** constant_fee defines the x/crisis parameter. */ + constantFee: Coin | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { + return { sender: "", invariantModuleName: "", invariantRoute: "" }; +} + +export const MsgVerifyInvariant: MessageFns = { + encode(message: MsgVerifyInvariant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.invariantModuleName !== "") { + writer.uint32(18).string(message.invariantModuleName); + } + if (message.invariantRoute !== "") { + writer.uint32(26).string(message.invariantRoute); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.invariantModuleName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.invariantRoute = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVerifyInvariant { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + invariantModuleName: isSet(object.invariantModuleName) ? globalThis.String(object.invariantModuleName) : "", + invariantRoute: isSet(object.invariantRoute) ? globalThis.String(object.invariantRoute) : "", + }; + }, + + toJSON(message: MsgVerifyInvariant): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.invariantModuleName !== "") { + obj.invariantModuleName = message.invariantModuleName; + } + if (message.invariantRoute !== "") { + obj.invariantRoute = message.invariantRoute; + } + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariant { + return MsgVerifyInvariant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVerifyInvariant { + const message = createBaseMsgVerifyInvariant(); + message.sender = object.sender ?? ""; + message.invariantModuleName = object.invariantModuleName ?? ""; + message.invariantRoute = object.invariantRoute ?? ""; + return message; + }, +}; + +function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { + return {}; +} + +export const MsgVerifyInvariantResponse: MessageFns = { + encode(_: MsgVerifyInvariantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVerifyInvariantResponse { + return {}; + }, + + toJSON(_: MsgVerifyInvariantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariantResponse { + return MsgVerifyInvariantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVerifyInvariantResponse { + const message = createBaseMsgVerifyInvariantResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", constantFee: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.constantFee !== undefined) { + Coin.encode(message.constantFee, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.constantFee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.constantFee !== undefined) { + obj.constantFee = Coin.toJSON(message.constantFee); + } + 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 ?? ""; + message.constantFee = (object.constantFee !== undefined && object.constantFee !== null) + ? Coin.fromPartial(object.constantFee) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** VerifyInvariant defines a method to verify a particular invariant. */ + VerifyInvariant(request: MsgVerifyInvariant): Promise; + /** + * UpdateParams defines a governance operation for updating the x/crisis module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.crisis.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 || MsgServiceName; + this.rpc = rpc; + this.VerifyInvariant = this.VerifyInvariant.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/ed25519/keys.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 00000000..59fab7e6 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,193 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/ed25519/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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; +} + +/** + * 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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/hd/v1/hd.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/hd/v1/hd.ts new file mode 100644 index 00000000..55be1b9c --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/hd/v1/hd.ts @@ -0,0 +1,173 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/hd/v1/hd.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.crypto.hd.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + coinType: 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 */ + addressIndex: number; +} + +function createBaseBIP44Params(): BIP44Params { + return { purpose: 0, coinType: 0, account: 0, change: false, addressIndex: 0 }; +} + +export const BIP44Params: MessageFns = { + encode(message: BIP44Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.purpose !== 0) { + writer.uint32(8).uint32(message.purpose); + } + if (message.coinType !== 0) { + writer.uint32(16).uint32(message.coinType); + } + if (message.account !== 0) { + writer.uint32(24).uint32(message.account); + } + if (message.change !== false) { + writer.uint32(32).bool(message.change); + } + if (message.addressIndex !== 0) { + writer.uint32(40).uint32(message.addressIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BIP44Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.purpose = reader.uint32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.coinType = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.account = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.change = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.addressIndex = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BIP44Params { + return { + purpose: isSet(object.purpose) ? globalThis.Number(object.purpose) : 0, + coinType: isSet(object.coinType) ? globalThis.Number(object.coinType) : 0, + account: isSet(object.account) ? globalThis.Number(object.account) : 0, + change: isSet(object.change) ? globalThis.Boolean(object.change) : false, + addressIndex: isSet(object.addressIndex) ? globalThis.Number(object.addressIndex) : 0, + }; + }, + + toJSON(message: BIP44Params): unknown { + const obj: any = {}; + if (message.purpose !== 0) { + obj.purpose = Math.round(message.purpose); + } + if (message.coinType !== 0) { + obj.coinType = Math.round(message.coinType); + } + if (message.account !== 0) { + obj.account = Math.round(message.account); + } + if (message.change !== false) { + obj.change = message.change; + } + if (message.addressIndex !== 0) { + obj.addressIndex = Math.round(message.addressIndex); + } + return obj; + }, + + create, I>>(base?: I): BIP44Params { + return BIP44Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BIP44Params { + const message = createBaseBIP44Params(); + message.purpose = object.purpose ?? 0; + message.coinType = object.coinType ?? 0; + message.account = object.account ?? 0; + message.change = object.change ?? false; + message.addressIndex = object.addressIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/keyring/v1/record.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/keyring/v1/record.ts new file mode 100644 index 00000000..d6e83b43 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/keyring/v1/record.ts @@ -0,0 +1,432 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/keyring/v1/record.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { BIP44Params } from "../../hd/v1/hd"; + +export const protobufPackage = "cosmos.crypto.keyring.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 */ + pubKey: + | Any + | undefined; + /** local stores the private key locally. */ + local?: + | Record_Local + | undefined; + /** ledger stores the information about a Ledger key. */ + ledger?: + | Record_Ledger + | undefined; + /** Multi does not store any other information. */ + multi?: + | Record_Multi + | undefined; + /** Offline does not store any other information. */ + offline?: Record_Offline | undefined; +} + +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_Local { + privKey: Any | undefined; +} + +/** Ledger item */ +export interface Record_Ledger { + path: BIP44Params | undefined; +} + +/** Multi item */ +export interface Record_Multi { +} + +/** Offline item */ +export interface Record_Offline { +} + +function createBaseRecord(): Record { + return { name: "", pubKey: undefined, local: undefined, ledger: undefined, multi: undefined, offline: undefined }; +} + +export const Record: MessageFns = { + encode(message: Record, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.local !== undefined) { + Record_Local.encode(message.local, writer.uint32(26).fork()).join(); + } + if (message.ledger !== undefined) { + Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).join(); + } + if (message.multi !== undefined) { + Record_Multi.encode(message.multi, writer.uint32(42).fork()).join(); + } + if (message.offline !== undefined) { + Record_Offline.encode(message.offline, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.local = Record_Local.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.ledger = Record_Ledger.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.multi = Record_Multi.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.offline = Record_Offline.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : 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 = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.pubKey !== undefined) { + obj.pubKey = Any.toJSON(message.pubKey); + } + if (message.local !== undefined) { + obj.local = Record_Local.toJSON(message.local); + } + if (message.ledger !== undefined) { + obj.ledger = Record_Ledger.toJSON(message.ledger); + } + if (message.multi !== undefined) { + obj.multi = Record_Multi.toJSON(message.multi); + } + if (message.offline !== undefined) { + obj.offline = Record_Offline.toJSON(message.offline); + } + return obj; + }, + + create, I>>(base?: I): Record { + return Record.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record { + const message = createBaseRecord(); + message.name = object.name ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : 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 { privKey: undefined }; +} + +export const Record_Local: MessageFns = { + encode(message: Record_Local, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.privKey !== undefined) { + Any.encode(message.privKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Local { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.privKey = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Record_Local { + return { privKey: isSet(object.privKey) ? Any.fromJSON(object.privKey) : undefined }; + }, + + toJSON(message: Record_Local): unknown { + const obj: any = {}; + if (message.privKey !== undefined) { + obj.privKey = Any.toJSON(message.privKey); + } + return obj; + }, + + create, I>>(base?: I): Record_Local { + return Record_Local.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Record_Local { + const message = createBaseRecord_Local(); + message.privKey = (object.privKey !== undefined && object.privKey !== null) + ? Any.fromPartial(object.privKey) + : undefined; + return message; + }, +}; + +function createBaseRecord_Ledger(): Record_Ledger { + return { path: undefined }; +} + +export const Record_Ledger: MessageFns = { + encode(message: Record_Ledger, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined) { + BIP44Params.encode(message.path, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Ledger { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.path = BIP44Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.path !== undefined) { + obj.path = BIP44Params.toJSON(message.path); + } + return obj; + }, + + create, I>>(base?: I): Record_Ledger { + return Record_Ledger.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: Record_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Multi { + return {}; + }, + + toJSON(_: Record_Multi): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Multi { + return Record_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, +}; + +function createBaseRecord_Offline(): Record_Offline { + return {}; +} + +export const Record_Offline: MessageFns = { + encode(_: Record_Offline, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Record_Offline { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Record_Offline { + return {}; + }, + + toJSON(_: Record_Offline): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Record_Offline { + return Record_Offline.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/multisig/keys.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/multisig/keys.ts new file mode 100644 index 00000000..3aacbfda --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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; + publicKeys: Any[]; +} + +function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { + return { threshold: 0, publicKeys: [] }; +} + +export const LegacyAminoPubKey: MessageFns = { + encode(message: LegacyAminoPubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.publicKeys) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LegacyAminoPubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.threshold = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKeys.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyAminoPubKey { + return { + threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0, + publicKeys: globalThis.Array.isArray(object?.publicKeys) + ? object.publicKeys.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LegacyAminoPubKey): unknown { + const obj: any = {}; + if (message.threshold !== 0) { + obj.threshold = Math.round(message.threshold); + } + if (message.publicKeys?.length) { + obj.publicKeys = message.publicKeys.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LegacyAminoPubKey { + return LegacyAminoPubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.publicKeys = object.publicKeys?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 00000000..4f9b99a2 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/multisig/v1beta1/multisig.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 { + extraBitsStored: number; + elems: Uint8Array; +} + +function createBaseMultiSignature(): MultiSignature { + return { signatures: [] }; +} + +export const MultiSignature: MessageFns = { + encode(message: MultiSignature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiSignature { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: MultiSignature): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MultiSignature { + return MultiSignature.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCompactBitArray(): CompactBitArray { + return { extraBitsStored: 0, elems: new Uint8Array(0) }; +} + +export const CompactBitArray: MessageFns = { + encode(message: CompactBitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompactBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.extraBitsStored = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.elems = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompactBitArray { + return { + extraBitsStored: isSet(object.extraBitsStored) ? globalThis.Number(object.extraBitsStored) : 0, + elems: isSet(object.elems) ? bytesFromBase64(object.elems) : new Uint8Array(0), + }; + }, + + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + if (message.extraBitsStored !== 0) { + obj.extraBitsStored = Math.round(message.extraBitsStored); + } + if (message.elems.length !== 0) { + obj.elems = base64FromBytes(message.elems); + } + return obj; + }, + + create, I>>(base?: I): CompactBitArray { + return CompactBitArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extraBitsStored = object.extraBitsStored ?? 0; + message.elems = object.elems ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/secp256k1/keys.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 00000000..7f79f331 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256k1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/secp256r1/keys.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 00000000..54922e63 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,191 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/crypto/secp256r1/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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(0) }; +} + +export const PubKey: MessageFns = { + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { secret: new Uint8Array(0) }; +} + +export const PrivKey: MessageFns = { + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.secret = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { secret: isSet(object.secret) ? bytesFromBase64(object.secret) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.secret.length !== 0) { + obj.secret = base64FromBytes(message.secret); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/module/v1/module.ts new file mode 100644 index 00000000..23f8378a --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.distribution.module.v1"; + +/** Module is the config object of the distribution module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..f23cc1d6 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1149 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/distribution.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled !== false) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? globalThis.String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? globalThis.String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? globalThis.String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? globalThis.Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled !== false) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards: MessageFns = { + encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: globalThis.Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? globalThis.Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 0; + return message; + }, +}; + +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { rewards: [], period: 0 }; +} + +export const ValidatorCurrentRewards: MessageFns = { + encode(message: ValidatorCurrentRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommission { + return { + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorAccumulatedCommission): unknown { + const obj: any = {}; + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent: MessageFns = { + encode(message: ValidatorSlashEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? globalThis.Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? globalThis.String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents: MessageFns = { + encode(message: ValidatorSlashEvents, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSlashEvents) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvents(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool: MessageFns = { + encode(message: FeePool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.communityPool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeePool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: globalThis.Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { title: "", description: "", recipient: "", amount: [] }; +} + +export const CommunityPoolSpendProposal: MessageFns = { + encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommunityPoolSpendProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo: MessageFns = { + encode(message: DelegatorStartingInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (message.height !== 0) { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? globalThis.Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? globalThis.String(object.stake) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward: MessageFns = { + encode(message: DelegationDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + reward: globalThis.Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + message.reward = object.reward?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { title: "", description: "", recipient: "", amount: "", deposit: "" }; +} + +export const CommunityPoolSpendProposalWithDeposit: MessageFns = { + encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposalWithDeposit { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + deposit: isSet(object.deposit) ? globalThis.String(object.deposit) : "", + }; + }, + + toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..16d378f9 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1000 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo: MessageFns = { + encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord: MessageFns = { + encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord: MessageFns = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.accumulated !== undefined) { + ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommissionRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord: MessageFns = { + encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + if (message.rewards !== undefined) { + ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord: MessageFns = { + encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.rewards !== undefined) { + ValidatorCurrentRewards.encode(message.rewards, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord: MessageFns = { + encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord: MessageFns = { + encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).join(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.validatorSlashEvents) { + ValidatorSlashEventRecord.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: globalThis.Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? globalThis.String(object.previousProposer) : "", + outstandingRewards: globalThis.Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: globalThis.Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: globalThis.Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: globalThis.Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: globalThis.Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: globalThis.Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..9d32e8cb --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1674 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest: MessageFns = { + encode(message: QueryValidatorDistributionInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse: MessageFns = { + encode(message: QueryValidatorDistributionInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + selfBondRewards: globalThis.Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: globalThis.Array.isArray(object?.commission) + ? object.commission.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { + return { rewards: undefined }; +} + +export const QueryValidatorOutstandingRewardsResponse: MessageFns = { + encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rewards !== undefined) { + ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest: MessageFns = { + encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { + return { commission: undefined }; +} + +export const QueryValidatorCommissionResponse: MessageFns = { + encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commission !== undefined) { + ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest: MessageFns = { + encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? globalThis.Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? globalThis.Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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: MessageFns = { + encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.slashes) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesResponse { + return { + slashes: globalThis.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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest: MessageFns = { + encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { + return { rewards: [] }; +} + +export const QueryDelegationRewardsResponse: MessageFns = { + encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest: MessageFns = { + encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { + return { rewards: [], total: [] }; +} + +export const QueryDelegationTotalRewardsResponse: MessageFns = { + encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.total) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) + ? object.rewards.map((e: any) => DelegationDelegatorReward.fromJSON(e)) + : [], + total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationTotalRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [] }; +} + +export const QueryDelegatorValidatorsResponse: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse: MessageFns = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} + +export const QueryCommunityPoolRequest: MessageFns = { + encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, +}; + +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { pool: [] }; +} + +export const QueryCommunityPoolResponse: MessageFns = { + encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommunityPoolResponse { + return { pool: globalThis.Array.isArray(object?.pool) ? object.pool.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryCommunityPoolResponse): unknown { + const obj: any = {}; + if (message.pool?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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 BinaryReader(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..bf362224 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1161 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/distribution/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress: MessageFns = { + encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? globalThis.String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} + +export const MsgSetWithdrawAddressResponse: MessageFns = { + encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward: MessageFns = { + encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return { amount: [] }; +} + +export const MsgWithdrawDelegatorRewardResponse: MessageFns = { + encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorRewardResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawDelegatorRewardResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission: MessageFns = { + encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return { amount: [] }; +} + +export const MsgWithdrawValidatorCommissionResponse: MessageFns = { + encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommissionResponse { + return { amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MsgFundCommunityPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgFundCommunityPool { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: MsgFundCommunityPool): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend: MessageFns = { + encode(message: MsgCommunityPoolSpend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse: MessageFns = { + encode(_: MsgCommunityPoolSpendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool: MessageFns = { + encode(message: MsgDepositValidatorRewardsPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse: MessageFns = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(new BinaryReader(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/module/v1/module.ts new file mode 100644 index 00000000..f92e0da7 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.evidence.module.v1"; + +/** Module is the config object of the evidence module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts new file mode 100644 index 00000000..16d4bb94 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/evidence.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/evidence.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the equivocation height. */ + height: number; + /** time is the equivocation time. */ + time: + | Date + | undefined; + /** power is the equivocation validator power. */ + power: number; + /** consensus_address is the equivocation validator consensus address. */ + consensusAddress: string; +} + +function createBaseEquivocation(): Equivocation { + return { height: 0, time: undefined, power: 0, consensusAddress: "" }; +} + +export const Equivocation: MessageFns = { + encode(message: Equivocation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(24).int64(message.power); + } + if (message.consensusAddress !== "") { + writer.uint32(34).string(message.consensusAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Equivocation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensusAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Equivocation { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + consensusAddress: isSet(object.consensusAddress) ? globalThis.String(object.consensusAddress) : "", + }; + }, + + toJSON(message: Equivocation): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + if (message.consensusAddress !== "") { + obj.consensusAddress = message.consensusAddress; + } + return obj; + }, + + create, I>>(base?: I): Equivocation { + return Equivocation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Equivocation { + const message = createBaseEquivocation(); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.power = object.power ?? 0; + message.consensusAddress = object.consensusAddress ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts new file mode 100644 index 00000000..5d6dc17a --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/genesis.ts @@ -0,0 +1,97 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.evidence.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/query.ts new file mode 100644 index 00000000..41408c8a --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/query.ts @@ -0,0 +1,408 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + * Deprecated: Use hash, a HEX encoded string, instead. + * + * @deprecated + */ + evidenceHash: Uint8Array; + /** + * hash defines the evidence hash of the requested evidence. + * + * Since: cosmos-sdk 0.47 + */ + hash: string; +} + +/** QueryEvidenceResponse is the response type for the Query/Evidence RPC method. */ +export interface QueryEvidenceResponse { + /** evidence returns the requested evidence. */ + evidence: Any | undefined; +} + +/** + * QueryEvidenceRequest is the request type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { + return { evidenceHash: new Uint8Array(0), hash: "" }; +} + +export const QueryEvidenceRequest: MessageFns = { + encode(message: QueryEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidenceHash.length !== 0) { + writer.uint32(10).bytes(message.evidenceHash); + } + if (message.hash !== "") { + writer.uint32(18).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceRequest { + return { + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + hash: isSet(object.hash) ? globalThis.String(object.hash) : "", + }; + }, + + toJSON(message: QueryEvidenceRequest): unknown { + const obj: any = {}; + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceRequest { + return QueryEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEvidenceRequest { + const message = createBaseQueryEvidenceRequest(); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { + return { evidence: undefined }; +} + +export const QueryEvidenceResponse: MessageFns = { + encode(message: QueryEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceResponse { + return { evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined }; + }, + + toJSON(message: QueryEvidenceResponse): unknown { + const obj: any = {}; + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceResponse { + return QueryEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllEvidenceRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceRequest { + return QueryAllEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.evidence.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceResponse { + return { + evidence: globalThis.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?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceResponse { + return QueryAllEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.evidence.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/tx.ts new file mode 100644 index 00000000..04c14d2d --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/evidence/v1beta1/tx.ts @@ -0,0 +1,240 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/evidence/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the signer account address of evidence. */ + submitter: string; + /** evidence defines the evidence of misbehavior. */ + evidence: Any | undefined; +} + +/** 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: MessageFns = { + encode(message: MsgSubmitEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.submitter !== "") { + writer.uint32(10).string(message.submitter); + } + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.submitter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidence { + return { + submitter: isSet(object.submitter) ? globalThis.String(object.submitter) : "", + evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined, + }; + }, + + toJSON(message: MsgSubmitEvidence): unknown { + const obj: any = {}; + if (message.submitter !== "") { + obj.submitter = message.submitter; + } + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidence { + return MsgSubmitEvidence.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const MsgSubmitEvidenceResponse: MessageFns = { + encode(message: MsgSubmitEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidenceResponse { + return { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0) }; + }, + + toJSON(message: MsgSubmitEvidenceResponse): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidenceResponse { + return MsgSubmitEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEvidenceResponse { + const message = createBaseMsgSubmitEvidenceResponse(); + message.hash = object.hash ?? new Uint8Array(0); + 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 const MsgServiceName = "cosmos.evidence.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 || MsgServiceName; + 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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/module/v1/module.ts new file mode 100644 index 00000000..386f9d26 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.feegrant.module.v1"; + +/** Module is the config object of the feegrant module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts new file mode 100644 index 00000000..9c002d76 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/feegrant.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/feegrant.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 coins + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowance { + /** + * spend_limit specifies the maximum amount of coins that can be spent + * by this allowance and will be updated as coins are spent. If it is + * empty, there is no spend limit and any amount of coins can be spent. + */ + spendLimit: Coin[]; + /** expiration specifies an optional time when this allowance expires */ + expiration: Date | undefined; +} + +/** + * 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 + | undefined; + /** + * period specifies the time duration in which period_spend_limit coins can + * be spent before that allowance is reset + */ + period: + | Duration + | undefined; + /** + * period_spend_limit specifies the maximum number of coins that can be spent + * in the period + */ + periodSpendLimit: Coin[]; + /** period_can_spend is the number of coins left to be spent before the period_reset time */ + periodCanSpend: 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 + */ + periodReset: Date | undefined; +} + +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowance { + /** allowance can be any of basic and periodic fee allowance. */ + allowance: + | Any + | undefined; + /** allowed_messages are the messages for which the grantee has the access. */ + allowedMessages: 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 | undefined; +} + +function createBaseBasicAllowance(): BasicAllowance { + return { spendLimit: [], expiration: undefined }; +} + +export const BasicAllowance: MessageFns = { + encode(message: BasicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BasicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BasicAllowance { + return { + spendLimit: globalThis.Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: BasicAllowance): unknown { + const obj: any = {}; + if (message.spendLimit?.length) { + obj.spendLimit = message.spendLimit.map((e) => Coin.toJSON(e)); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): BasicAllowance { + return BasicAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBasePeriodicAllowance(): PeriodicAllowance { + return { basic: undefined, period: undefined, periodSpendLimit: [], periodCanSpend: [], periodReset: undefined }; +} + +export const PeriodicAllowance: MessageFns = { + encode(message: PeriodicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.basic !== undefined) { + BasicAllowance.encode(message.basic, writer.uint32(10).fork()).join(); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(18).fork()).join(); + } + for (const v of message.periodSpendLimit) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.periodCanSpend) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.periodReset !== undefined) { + Timestamp.encode(toTimestamp(message.periodReset), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.basic = BasicAllowance.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.period = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.periodSpendLimit.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.periodCanSpend.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.periodReset = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + periodSpendLimit: globalThis.Array.isArray(object?.periodSpendLimit) + ? object.periodSpendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + periodCanSpend: globalThis.Array.isArray(object?.periodCanSpend) + ? object.periodCanSpend.map((e: any) => Coin.fromJSON(e)) + : [], + periodReset: isSet(object.periodReset) ? fromJsonTimestamp(object.periodReset) : undefined, + }; + }, + + toJSON(message: PeriodicAllowance): unknown { + const obj: any = {}; + if (message.basic !== undefined) { + obj.basic = BasicAllowance.toJSON(message.basic); + } + if (message.period !== undefined) { + obj.period = Duration.toJSON(message.period); + } + if (message.periodSpendLimit?.length) { + obj.periodSpendLimit = message.periodSpendLimit.map((e) => Coin.toJSON(e)); + } + if (message.periodCanSpend?.length) { + obj.periodCanSpend = message.periodCanSpend.map((e) => Coin.toJSON(e)); + } + if (message.periodReset !== undefined) { + obj.periodReset = message.periodReset.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): PeriodicAllowance { + return PeriodicAllowance.fromPartial(base ?? ({} as any)); + }, + 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.periodSpendLimit = object.periodSpendLimit?.map((e) => Coin.fromPartial(e)) || []; + message.periodCanSpend = object.periodCanSpend?.map((e) => Coin.fromPartial(e)) || []; + message.periodReset = object.periodReset ?? undefined; + return message; + }, +}; + +function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { + return { allowance: undefined, allowedMessages: [] }; +} + +export const AllowedMsgAllowance: MessageFns = { + encode(message: AllowedMsgAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(10).fork()).join(); + } + for (const v of message.allowedMessages) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AllowedMsgAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowedMessages.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AllowedMsgAllowance { + return { + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + allowedMessages: globalThis.Array.isArray(object?.allowedMessages) + ? object.allowedMessages.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: AllowedMsgAllowance): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + if (message.allowedMessages?.length) { + obj.allowedMessages = message.allowedMessages; + } + return obj; + }, + + create, I>>(base?: I): AllowedMsgAllowance { + return AllowedMsgAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + message.allowedMessages = object.allowedMessages?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGrant(): Grant { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const Grant: MessageFns = { + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Grant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts new file mode 100644 index 00000000..14bfd526 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + allowances: globalThis.Array.isArray(object?.allowances) + ? object.allowances.map((e: any) => Grant.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.allowances?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 00000000..3f0c781d --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,586 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** + * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterResponse { + /** allowances that have been issued by the granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { + return { granter: "", grantee: "" }; +} + +export const QueryAllowanceRequest: MessageFns = { + encode(message: QueryAllowanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: QueryAllowanceRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceRequest { + return QueryAllowanceRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Grant.encode(message.allowance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowance = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceResponse { + return { allowance: isSet(object.allowance) ? Grant.fromJSON(object.allowance) : undefined }; + }, + + toJSON(message: QueryAllowanceResponse): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Grant.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceResponse { + return QueryAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesRequest { + return QueryAllowancesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesResponse { + return { + allowances: globalThis.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?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesResponse { + return QueryAllowancesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesByGranterRequest { + return QueryAllowancesByGranterRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterResponse { + return { + allowances: globalThis.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?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAllowancesByGranterResponse { + return QueryAllowancesByGranterResponse.fromPartial(base ?? ({} as any)); + }, + 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 granted allwance to the grantee by the granter. */ + Allowance(request: QueryAllowanceRequest): Promise; + /** Allowances returns all the grants for the given grantee address. */ + Allowances(request: QueryAllowancesRequest): Promise; + /** + * AllowancesByGranter returns all the grants given by an address + * + * Since: cosmos-sdk 0.46 + */ + AllowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; +} + +export const QueryServiceName = "cosmos.feegrant.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 00000000..052862c2 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,490 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/feegrant/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 { +} + +/** + * MsgPruneAllowances prunes expired fee allowances. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowances { + /** pruner is the address of the user pruning expired allowances. */ + pruner: string; +} + +/** + * MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowancesResponse { +} + +function createBaseMsgGrantAllowance(): MsgGrantAllowance { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const MsgGrantAllowance: MessageFns = { + encode(message: MsgGrantAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrantAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: MsgGrantAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowance { + return MsgGrantAllowance.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantAllowanceResponse { + return {}; + }, + + toJSON(_: MsgGrantAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { + return { granter: "", grantee: "" }; +} + +export const MsgRevokeAllowance: MessageFns = { + encode(message: MsgRevokeAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevokeAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: MsgRevokeAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowance { + return MsgRevokeAllowance.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeAllowanceResponse { + return {}; + }, + + toJSON(_: MsgRevokeAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgPruneAllowances(): MsgPruneAllowances { + return { pruner: "" }; +} + +export const MsgPruneAllowances: MessageFns = { + encode(message: MsgPruneAllowances, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pruner !== "") { + writer.uint32(10).string(message.pruner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pruner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgPruneAllowances { + return { pruner: isSet(object.pruner) ? globalThis.String(object.pruner) : "" }; + }, + + toJSON(message: MsgPruneAllowances): unknown { + const obj: any = {}; + if (message.pruner !== "") { + obj.pruner = message.pruner; + } + return obj; + }, + + create, I>>(base?: I): MsgPruneAllowances { + return MsgPruneAllowances.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgPruneAllowances { + const message = createBaseMsgPruneAllowances(); + message.pruner = object.pruner ?? ""; + return message; + }, +}; + +function createBaseMsgPruneAllowancesResponse(): MsgPruneAllowancesResponse { + return {}; +} + +export const MsgPruneAllowancesResponse: MessageFns = { + encode(_: MsgPruneAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgPruneAllowancesResponse { + return {}; + }, + + toJSON(_: MsgPruneAllowancesResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgPruneAllowancesResponse { + return MsgPruneAllowancesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgPruneAllowancesResponse { + const message = createBaseMsgPruneAllowancesResponse(); + 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; + /** + * PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + * + * Since cosmos-sdk 0.50 + */ + PruneAllowances(request: MsgPruneAllowances): Promise; +} + +export const MsgServiceName = "cosmos.feegrant.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 || MsgServiceName; + this.rpc = rpc; + this.GrantAllowance = this.GrantAllowance.bind(this); + this.RevokeAllowance = this.RevokeAllowance.bind(this); + this.PruneAllowances = this.PruneAllowances.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 BinaryReader(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 BinaryReader(data))); + } + + PruneAllowances(request: MsgPruneAllowances): Promise { + const data = MsgPruneAllowances.encode(request).finish(); + const promise = this.rpc.request(this.service, "PruneAllowances", data); + return promise.then((data) => MsgPruneAllowancesResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/genutil/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/genutil/module/v1/module.ts new file mode 100644 index 00000000..a7da77b1 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/genutil/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.module.v1"; + +/** Module is the config object for the genutil module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts new file mode 100644 index 00000000..11bd3193 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/genutil/v1beta1/genesis.ts @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/genutil/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.genutil.v1beta1"; + +/** GenesisState defines the raw genesis transaction in JSON. */ +export interface GenesisState { + /** gen_txs defines the genesis transactions. */ + genTxs: Uint8Array[]; +} + +function createBaseGenesisState(): GenesisState { + return { genTxs: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.genTxs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.genTxs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + genTxs: globalThis.Array.isArray(object?.genTxs) ? object.genTxs.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.genTxs?.length) { + obj.genTxs = message.genTxs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.genTxs = object.genTxs?.map((e) => e) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/module/v1/module.ts new file mode 100644 index 00000000..d95ae5ed --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/module/v1/module.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.gov.module.v1"; + +/** Module is the config object of the gov module. */ +export interface Module { + /** + * max_metadata_len defines the maximum proposal metadata length. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { maxMetadataLen: 0, authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxMetadataLen !== 0) { + writer.uint32(8).uint64(message.maxMetadataLen); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxMetadataLen = object.maxMetadataLen ?? 0; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/genesis.ts new file mode 100644 index 00000000..d6adbe5f --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/genesis.ts @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Deposit, DepositParams, Params, 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. */ + startingProposalId: number; + /** 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[]; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: + | Params + | undefined; + /** + * The constitution allows builders to lay a foundation and define purpose. + * This is an immutable string set in genesis. + * There are no amendments, to go outside of scope, just fork. + * constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. + * + * Since: cosmos-sdk 0.50 + */ + constitution: string; + portId: string; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + params: undefined, + constitution: "", + portId: "", + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(66).fork()).join(); + } + if (message.constitution !== "") { + writer.uint32(74).string(message.constitution); + } + if (message.portId !== "") { + writer.uint32(82).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.constitution = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.constitution = object.constitution ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/gov.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/gov.ts new file mode 100644 index 00000000..8b77a89a --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/gov.ts @@ -0,0 +1,2031 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines an encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + /** + * PROPOSAL_STATUS_TALLY_PERIOD - PROPOSAL_STATUS_TALLY_PERIOD defines a proposal status during the tally + * period. + */ + PROPOSAL_STATUS_TALLY_PERIOD = 6, + 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 6: + case "PROPOSAL_STATUS_TALLY_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_TALLY_PERIOD; + 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.PROPOSAL_STATUS_TALLY_PERIOD: + return "PROPOSAL_STATUS_TALLY_PERIOD"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** id defines the unique id of the proposal. */ + id: number; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: Any[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; + /** + * expedited defines if the proposal is expedited + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; + /** + * failed_reason defines the reason why the proposal failed + * + * Since: cosmos-sdk 0.50 + */ + failedReason: string; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** decryption key is used to decrypt the encrypted votes during the tally phase */ + decryptionKey: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes_count is the number of yes votes on a proposal. */ + yesCount: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstainCount: string; + /** no_count is the number of no votes on a proposal. */ + noCount: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + noWithVetoCount: string; + /** encrypted_count is the number of encrypted votes on a proposal. */ + encryptedCount: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOption[]; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + */ + metadata: string; + encryptedVoteData: string; +} + +/** + * DepositParams defines the params for deposits on governance proposals. + * + * @deprecated + */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** + * VotingParams defines the params for voting on governance proposals. + * + * @deprecated + */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** + * TallyParams defines the params for tallying votes on governance proposals. + * + * @deprecated + */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; +} + +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface Params { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: + | Duration + | undefined; + /** Duration of the voting period. */ + votingPeriod: + | Duration + | undefined; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + minInitialDepositRatio: string; + /** + * The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelRatio: string; + /** + * The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + * If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelDest: string; + /** + * Duration of the voting period of an expedited proposal. + * + * Since: cosmos-sdk 0.50 + */ + expeditedVotingPeriod: + | Duration + | undefined; + /** + * Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. + * + * Since: cosmos-sdk 0.50 + */ + expeditedThreshold: string; + /** Minimum expedited deposit for a proposal to enter voting period. */ + expeditedMinDeposit: Coin[]; + /** burn deposits if a proposal does not meet quorum */ + burnVoteQuorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burnProposalDepositPrevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burnVoteVeto: boolean; + /** + * The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + * Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + * required. + * + * Since: cosmos-sdk 0.50 + */ + minDepositRatio: string; + /** Duration of the voting period. */ + maxTallyPeriod: Duration | undefined; + trustedCounterParties: TrustedCounterParty[]; + channelId: string; + isSourceChain: boolean; +} + +export interface DecryptedVoteOption { + /** option defines the vote option. */ + option: VoteOption; + randomNo: number; +} + +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + messages: [], + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + metadata: "", + title: "", + summary: "", + proposer: "", + expedited: false, + failedReason: "", + hasEncryptedVotes: false, + identity: "", + pubkey: "", + decryptionKey: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(90).string(message.title); + } + if (message.summary !== "") { + writer.uint32(98).string(message.summary); + } + if (message.proposer !== "") { + writer.uint32(106).string(message.proposer); + } + if (message.expedited !== false) { + writer.uint32(112).bool(message.expedited); + } + if (message.failedReason !== "") { + writer.uint32(122).string(message.failedReason); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(128).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(138).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(146).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(154).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.metadata = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.title = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.summary = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.proposer = reader.string(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.expedited = reader.bool(); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.failedReason = reader.string(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.identity = reader.string(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.pubkey = reader.string(); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(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, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + failedReason: isSet(object.failedReason) ? globalThis.String(object.failedReason) : "", + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(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.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + if (message.failedReason !== "") { + obj.failedReason = message.failedReason; + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + 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; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.proposer = object.proposer ?? ""; + message.expedited = object.expedited ?? false; + message.failedReason = object.failedReason ?? ""; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "", encryptedCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + if (message.encryptedCount !== "") { + writer.uint32(42).string(message.encryptedCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + encryptedCount: isSet(object.encryptedCount) ? globalThis.String(object.encryptedCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + if (message.encryptedCount !== "") { + obj.encryptedCount = message.encryptedCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + message.encryptedCount = object.encryptedCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", options: [], metadata: "", encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(42).string(message.metadata); + } + if (message.encryptedVoteData !== "") { + writer.uint32(50).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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) : "", + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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; + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: "", threshold: "", vetoThreshold: "" }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(26).string(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + 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 ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + minDeposit: [], + maxDepositPeriod: undefined, + votingPeriod: undefined, + quorum: "", + threshold: "", + vetoThreshold: "", + minInitialDepositRatio: "", + proposalCancelRatio: "", + proposalCancelDest: "", + expeditedVotingPeriod: undefined, + expeditedThreshold: "", + expeditedMinDeposit: [], + burnVoteQuorum: false, + burnProposalDepositPrevote: false, + burnVoteVeto: false, + minDepositRatio: "", + maxTallyPeriod: undefined, + trustedCounterParties: [], + channelId: "", + isSourceChain: false, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(26).fork()).join(); + } + if (message.quorum !== "") { + writer.uint32(34).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(42).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(50).string(message.vetoThreshold); + } + if (message.minInitialDepositRatio !== "") { + writer.uint32(58).string(message.minInitialDepositRatio); + } + if (message.proposalCancelRatio !== "") { + writer.uint32(66).string(message.proposalCancelRatio); + } + if (message.proposalCancelDest !== "") { + writer.uint32(74).string(message.proposalCancelDest); + } + if (message.expeditedVotingPeriod !== undefined) { + Duration.encode(message.expeditedVotingPeriod, writer.uint32(82).fork()).join(); + } + if (message.expeditedThreshold !== "") { + writer.uint32(90).string(message.expeditedThreshold); + } + for (const v of message.expeditedMinDeposit) { + Coin.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.burnVoteQuorum !== false) { + writer.uint32(104).bool(message.burnVoteQuorum); + } + if (message.burnProposalDepositPrevote !== false) { + writer.uint32(112).bool(message.burnProposalDepositPrevote); + } + if (message.burnVoteVeto !== false) { + writer.uint32(120).bool(message.burnVoteVeto); + } + if (message.minDepositRatio !== "") { + writer.uint32(130).string(message.minDepositRatio); + } + if (message.maxTallyPeriod !== undefined) { + Duration.encode(message.maxTallyPeriod, writer.uint32(138).fork()).join(); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(146).fork()).join(); + } + if (message.channelId !== "") { + writer.uint32(154).string(message.channelId); + } + if (message.isSourceChain !== false) { + writer.uint32(160).bool(message.isSourceChain); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.quorum = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.threshold = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.vetoThreshold = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.minInitialDepositRatio = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposalCancelRatio = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.proposalCancelDest = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.expeditedVotingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.expeditedThreshold = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.expeditedMinDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.burnVoteQuorum = reader.bool(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.burnProposalDepositPrevote = reader.bool(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.burnVoteVeto = reader.bool(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.minDepositRatio = reader.string(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.maxTallyPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.channelId = reader.string(); + continue; + case 20: + if (tag !== 160) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) ? globalThis.String(object.vetoThreshold) : "", + minInitialDepositRatio: isSet(object.minInitialDepositRatio) + ? globalThis.String(object.minInitialDepositRatio) + : "", + proposalCancelRatio: isSet(object.proposalCancelRatio) ? globalThis.String(object.proposalCancelRatio) : "", + proposalCancelDest: isSet(object.proposalCancelDest) ? globalThis.String(object.proposalCancelDest) : "", + expeditedVotingPeriod: isSet(object.expeditedVotingPeriod) + ? Duration.fromJSON(object.expeditedVotingPeriod) + : undefined, + expeditedThreshold: isSet(object.expeditedThreshold) ? globalThis.String(object.expeditedThreshold) : "", + expeditedMinDeposit: globalThis.Array.isArray(object?.expeditedMinDeposit) + ? object.expeditedMinDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + burnVoteQuorum: isSet(object.burnVoteQuorum) ? globalThis.Boolean(object.burnVoteQuorum) : false, + burnProposalDepositPrevote: isSet(object.burnProposalDepositPrevote) + ? globalThis.Boolean(object.burnProposalDepositPrevote) + : false, + burnVoteVeto: isSet(object.burnVoteVeto) ? globalThis.Boolean(object.burnVoteVeto) : false, + minDepositRatio: isSet(object.minDepositRatio) ? globalThis.String(object.minDepositRatio) : "", + maxTallyPeriod: isSet(object.maxTallyPeriod) ? Duration.fromJSON(object.maxTallyPeriod) : undefined, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.vetoThreshold !== "") { + obj.vetoThreshold = message.vetoThreshold; + } + if (message.minInitialDepositRatio !== "") { + obj.minInitialDepositRatio = message.minInitialDepositRatio; + } + if (message.proposalCancelRatio !== "") { + obj.proposalCancelRatio = message.proposalCancelRatio; + } + if (message.proposalCancelDest !== "") { + obj.proposalCancelDest = message.proposalCancelDest; + } + if (message.expeditedVotingPeriod !== undefined) { + obj.expeditedVotingPeriod = Duration.toJSON(message.expeditedVotingPeriod); + } + if (message.expeditedThreshold !== "") { + obj.expeditedThreshold = message.expeditedThreshold; + } + if (message.expeditedMinDeposit?.length) { + obj.expeditedMinDeposit = message.expeditedMinDeposit.map((e) => Coin.toJSON(e)); + } + if (message.burnVoteQuorum !== false) { + obj.burnVoteQuorum = message.burnVoteQuorum; + } + if (message.burnProposalDepositPrevote !== false) { + obj.burnProposalDepositPrevote = message.burnProposalDepositPrevote; + } + if (message.burnVoteVeto !== false) { + obj.burnVoteVeto = message.burnVoteVeto; + } + if (message.minDepositRatio !== "") { + obj.minDepositRatio = message.minDepositRatio; + } + if (message.maxTallyPeriod !== undefined) { + obj.maxTallyPeriod = Duration.toJSON(message.maxTallyPeriod); + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + message.minInitialDepositRatio = object.minInitialDepositRatio ?? ""; + message.proposalCancelRatio = object.proposalCancelRatio ?? ""; + message.proposalCancelDest = object.proposalCancelDest ?? ""; + message.expeditedVotingPeriod = + (object.expeditedVotingPeriod !== undefined && object.expeditedVotingPeriod !== null) + ? Duration.fromPartial(object.expeditedVotingPeriod) + : undefined; + message.expeditedThreshold = object.expeditedThreshold ?? ""; + message.expeditedMinDeposit = object.expeditedMinDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.burnVoteQuorum = object.burnVoteQuorum ?? false; + message.burnProposalDepositPrevote = object.burnProposalDepositPrevote ?? false; + message.burnVoteVeto = object.burnVoteVeto ?? false; + message.minDepositRatio = object.minDepositRatio ?? ""; + message.maxTallyPeriod = (object.maxTallyPeriod !== undefined && object.maxTallyPeriod !== null) + ? Duration.fromPartial(object.maxTallyPeriod) + : undefined; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.channelId = object.channelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + return message; + }, +}; + +function createBaseDecryptedVoteOption(): DecryptedVoteOption { + return { option: 0, randomNo: 0 }; +} + +export const DecryptedVoteOption: MessageFns = { + encode(message: DecryptedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.randomNo !== 0) { + writer.uint32(16).int64(message.randomNo); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.randomNo = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + randomNo: isSet(object.randomNo) ? globalThis.Number(object.randomNo) : 0, + }; + }, + + toJSON(message: DecryptedVoteOption): unknown { + const obj: any = {}; + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.randomNo !== 0) { + obj.randomNo = Math.round(message.randomNo); + } + return obj; + }, + + create, I>>(base?: I): DecryptedVoteOption { + return DecryptedVoteOption.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptedVoteOption { + const message = createBaseDecryptedVoteOption(); + message.option = object.option ?? 0; + message.randomNo = object.randomNo ?? 0; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/query.ts new file mode 100644 index 00000000..54a6bef2 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/query.ts @@ -0,0 +1,1575 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + Deposit, + DepositParams, + Params, + Proposal, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyParams, + TallyResult, + Vote, + VotingParams, +} from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryConstitutionRequest is the request type for the Query/Constitution RPC method */ +export interface QueryConstitutionRequest { +} + +/** QueryConstitutionResponse is the response type for the Query/Constitution RPC method */ +export interface QueryConstitutionResponse { + constitution: string; +} + +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + /** proposal is the requested governance proposal. */ + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + * + * @deprecated + */ + votingParams: + | VotingParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + * + * @deprecated + */ + depositParams: + | DepositParams + | undefined; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + * + * @deprecated + */ + tallyParams: + | TallyParams + | undefined; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params: Params | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryConstitutionRequest(): QueryConstitutionRequest { + return {}; +} + +export const QueryConstitutionRequest: MessageFns = { + encode(_: QueryConstitutionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryConstitutionRequest { + return {}; + }, + + toJSON(_: QueryConstitutionRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryConstitutionRequest { + return QueryConstitutionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryConstitutionRequest { + const message = createBaseQueryConstitutionRequest(); + return message; + }, +}; + +function createBaseQueryConstitutionResponse(): QueryConstitutionResponse { + return { constitution: "" }; +} + +export const QueryConstitutionResponse: MessageFns = { + encode(message: QueryConstitutionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constitution !== "") { + writer.uint32(10).string(message.constitution); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.constitution = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryConstitutionResponse { + return { constitution: isSet(object.constitution) ? globalThis.String(object.constitution) : "" }; + }, + + toJSON(message: QueryConstitutionResponse): unknown { + const obj: any = {}; + if (message.constitution !== "") { + obj.constitution = message.constitution; + } + return obj; + }, + + create, I>>(base?: I): QueryConstitutionResponse { + return QueryConstitutionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryConstitutionResponse { + const message = createBaseQueryConstitutionResponse(); + message.constitution = object.constitution ?? ""; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined, params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + 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.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Constitution queries the chain's constitution. */ + Constitution(request: QueryConstitutionRequest): Promise; + /** 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 on 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 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 || QueryServiceName; + this.rpc = rpc; + this.Constitution = this.Constitution.bind(this); + 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); + } + Constitution(request: QueryConstitutionRequest): Promise { + const data = QueryConstitutionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Constitution", data); + return promise.then((data) => QueryConstitutionResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/tx.ts new file mode 100644 index 00000000..9f8156b7 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1/tx.ts @@ -0,0 +1,1531 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params, VoteOption, voteOptionFromJSON, voteOptionToJSON, WeightedVoteOption } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages: Any[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * expedited defines if the proposal is expedited or not + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContent { + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** authority must be the gov module address. */ + authority: string; +} + +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse { +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata: string; +} + +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse { +} + +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCancelProposal is the Msg/CancelProposal request type. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** canceled_time is the time when proposal is canceled. */ + canceledTime: + | Date + | undefined; + /** canceled_height defines the block height at which the proposal is canceled. */ + canceledHeight: number; +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { messages: [], initialDeposit: [], proposer: "", metadata: "", title: "", summary: "", expedited: false }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.summary !== "") { + writer.uint32(50).string(message.summary); + } + if (message.expedited !== false) { + writer.uint32(56).bool(message.expedited); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.title = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.summary = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expedited = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + expedited: isSet(object.expedited) ? globalThis.Boolean(object.expedited) : false, + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + if (message.expedited !== false) { + obj.expedited = message.expedited; + } + 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)) || []; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.expedited = object.expedited ?? false; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { content: undefined, authority: "" }; +} + +export const MsgExecLegacyContent: MessageFns = { + encode(message: MsgExecLegacyContent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecLegacyContent { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: MsgExecLegacyContent): unknown { + const obj: any = {}; + 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) + ? Any.fromPartial(object.content) + : undefined; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} + +export const MsgExecLegacyContentResponse: MessageFns = { + encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgExecLegacyContentResponse { + return {}; + }, + + toJSON(_: MsgExecLegacyContentResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "" }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "", metadata: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [], metadata: "" }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCancelProposal(): MsgCancelProposal { + return { proposalId: 0, proposer: "" }; +} + +export const MsgCancelProposal: MessageFns = { + encode(message: MsgCancelProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.proposer !== "") { + writer.uint32(18).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgCancelProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposal { + return MsgCancelProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposal { + const message = createBaseMsgCancelProposal(); + message.proposalId = object.proposalId ?? 0; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgCancelProposalResponse(): MsgCancelProposalResponse { + return { proposalId: 0, canceledTime: undefined, canceledHeight: 0 }; +} + +export const MsgCancelProposalResponse: MessageFns = { + encode(message: MsgCancelProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.canceledTime !== undefined) { + Timestamp.encode(toTimestamp(message.canceledTime), writer.uint32(18).fork()).join(); + } + if (message.canceledHeight !== 0) { + writer.uint32(24).uint64(message.canceledHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.canceledTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.canceledHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelProposalResponse { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + canceledTime: isSet(object.canceledTime) ? fromJsonTimestamp(object.canceledTime) : undefined, + canceledHeight: isSet(object.canceledHeight) ? globalThis.Number(object.canceledHeight) : 0, + }; + }, + + toJSON(message: MsgCancelProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.canceledTime !== undefined) { + obj.canceledTime = message.canceledTime.toISOString(); + } + if (message.canceledHeight !== 0) { + obj.canceledHeight = Math.round(message.canceledHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelProposalResponse { + return MsgCancelProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelProposalResponse { + const message = createBaseMsgCancelProposalResponse(); + message.proposalId = object.proposalId ?? 0; + message.canceledTime = object.canceledTime ?? undefined; + message.canceledHeight = object.canceledHeight ?? 0; + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given the messages. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + */ + ExecLegacyContent(request: MsgExecLegacyContent): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): Promise; + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; + /** + * UpdateParams defines a governance operation for updating the x/gov module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CancelProposal defines a method to cancel governance proposal + * + * Since: cosmos-sdk 0.50 + */ + CancelProposal(request: MsgCancelProposal): 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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.ExecLegacyContent = this.ExecLegacyContent.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.CancelProposal = this.CancelProposal.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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelProposal(request: MsgCancelProposal): Promise { + const data = MsgCancelProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelProposal", data); + return promise.then((data) => MsgCancelProposalResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 00000000..f70b4ccf --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,234 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + startingProposalId: number; + /** 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[]; + /** deposit_params defines all the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** voting_params defines all the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** tally_params defines all the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: 0, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startingProposalId !== 0) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).join(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.startingProposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) ? globalThis.Number(object.startingProposalId) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.startingProposalId !== 0) { + obj.startingProposalId = Math.round(message.startingProposalId); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId ?? 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.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/gov.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 00000000..b58fe54c --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1356 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/gov.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** VOTE_OPTION_ENCRYPTED - VOTE_OPTION_ENCRYPTED defines a encrypted vote */ + VOTE_OPTION_ENCRYPTED = 5, + 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 5: + case "VOTE_OPTION_ENCRYPTED": + return VoteOption.VOTE_OPTION_ENCRYPTED; + 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.VOTE_OPTION_ENCRYPTED: + return "VOTE_OPTION_ENCRYPTED"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} + +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** content is the proposal's content. */ + content: + | Any + | undefined; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: + | TallyResult + | undefined; + /** submit_time is the time of proposal submission. */ + submitTime: + | Date + | undefined; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: + | Date + | undefined; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: + | Date + | undefined; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: + | Date + | undefined; + /** flag to check if proposal has at least one encrypted vote */ + hasEncryptedVotes: boolean; + /** identity and pubkey are used to submit encrypted votes */ + identity: string; + pubkey: string; + /** aggregated keyshare is used to decrypt the encrypted votes during the tally phase */ + aggrKeyshare: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + noWithVeto: string; + /** encrypted is the number of encrypted votes on a proposal. */ + encrypted: 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 defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + * + * @deprecated + */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOption[]; + encryptedVoteData: string; +} + +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration | undefined; +} + +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration | undefined; +} + +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: Uint8Array; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: Uint8Array; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: Uint8Array; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption: MessageFns = { + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + 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; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseTextProposal(): TextProposal { + return { title: "", description: "" }; +} + +export const TextProposal: MessageFns = { + encode(message: TextProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TextProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: TextProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): TextProposal { + return TextProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const Deposit: MessageFns = { + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + proposalId: 0, + content: undefined, + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + hasEncryptedVotes: false, + identity: "", + pubkey: "", + aggrKeyshare: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).join(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).join(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).join(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).join(); + } + if (message.hasEncryptedVotes !== false) { + writer.uint32(80).bool(message.hasEncryptedVotes); + } + if (message.identity !== "") { + writer.uint32(90).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(98).string(message.pubkey); + } + if (message.aggrKeyshare !== "") { + writer.uint32(106).string(message.aggrKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.hasEncryptedVotes = reader.bool(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.identity = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.pubkey = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.aggrKeyshare = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, + totalDeposit: globalThis.Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined, + votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined, + hasEncryptedVotes: isSet(object.hasEncryptedVotes) ? globalThis.Boolean(object.hasEncryptedVotes) : false, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + aggrKeyshare: isSet(object.aggrKeyshare) ? globalThis.String(object.aggrKeyshare) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.depositEndTime !== undefined) { + obj.depositEndTime = message.depositEndTime.toISOString(); + } + if (message.totalDeposit?.length) { + obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e)); + } + if (message.votingStartTime !== undefined) { + obj.votingStartTime = message.votingStartTime.toISOString(); + } + if (message.votingEndTime !== undefined) { + obj.votingEndTime = message.votingEndTime.toISOString(); + } + if (message.hasEncryptedVotes !== false) { + obj.hasEncryptedVotes = message.hasEncryptedVotes; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.aggrKeyshare !== "") { + obj.aggrKeyshare = message.aggrKeyshare; + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.proposalId = object.proposalId ?? 0; + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.hasEncryptedVotes = object.hasEncryptedVotes ?? false; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.aggrKeyshare = object.aggrKeyshare ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes: "", abstain: "", no: "", noWithVeto: "", encrypted: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yes !== "") { + writer.uint32(10).string(message.yes); + } + if (message.abstain !== "") { + writer.uint32(18).string(message.abstain); + } + if (message.no !== "") { + writer.uint32(26).string(message.no); + } + if (message.noWithVeto !== "") { + writer.uint32(34).string(message.noWithVeto); + } + if (message.encrypted !== "") { + writer.uint32(42).string(message.encrypted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yes = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstain = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.no = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVeto = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encrypted = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes: isSet(object.yes) ? globalThis.String(object.yes) : "", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "", + no: isSet(object.no) ? globalThis.String(object.no) : "", + noWithVeto: isSet(object.noWithVeto) ? globalThis.String(object.noWithVeto) : "", + encrypted: isSet(object.encrypted) ? globalThis.String(object.encrypted) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yes !== "") { + obj.yes = message.yes; + } + if (message.abstain !== "") { + obj.abstain = message.abstain; + } + if (message.no !== "") { + obj.no = message.no; + } + if (message.noWithVeto !== "") { + obj.noWithVeto = message.noWithVeto; + } + if (message.encrypted !== "") { + obj.encrypted = message.encrypted; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.noWithVeto = object.noWithVeto ?? ""; + message.encrypted = object.encrypted ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, options: [], encryptedVoteData: "" }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.encryptedVoteData !== "") { + writer.uint32(42).string(message.encryptedVoteData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedVoteData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + encryptedVoteData: isSet(object.encryptedVoteData) ? globalThis.String(object.encryptedVoteData) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + if (message.encryptedVoteData !== "") { + obj.encryptedVoteData = message.encryptedVoteData; + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.encryptedVoteData = object.encryptedVoteData ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { minDeposit: [], maxDepositPeriod: undefined }; +} + +export const DepositParams: MessageFns = { + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + minDeposit: globalThis.Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit?.length) { + obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e)); + } + if (message.maxDepositPeriod !== undefined) { + obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null) + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { votingPeriod: undefined }; +} + +export const VotingParams: MessageFns = { + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: new Uint8Array(0), threshold: new Uint8Array(0), vetoThreshold: new Uint8Array(0) }; +} + +export const TallyParams: MessageFns = { + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + writer.uint32(26).bytes(message.vetoThreshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vetoThreshold = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? bytesFromBase64(object.quorum) : new Uint8Array(0), + threshold: isSet(object.threshold) ? bytesFromBase64(object.threshold) : new Uint8Array(0), + vetoThreshold: isSet(object.vetoThreshold) ? bytesFromBase64(object.vetoThreshold) : new Uint8Array(0), + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum.length !== 0) { + obj.quorum = base64FromBytes(message.quorum); + } + if (message.threshold.length !== 0) { + obj.threshold = base64FromBytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + obj.vetoThreshold = base64FromBytes(message.vetoThreshold); + } + 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 ?? new Uint8Array(0); + message.threshold = object.threshold ?? new Uint8Array(0); + message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/query.ts new file mode 100644 index 00000000..1e13f7d3 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1413 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. */ + proposalId: number; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal: Proposal | undefined; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 defines the queried vote. */ + vote: Vote | undefined; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + votingParams: + | VotingParams + | undefined; + /** deposit_params defines the parameters related to deposit. */ + depositParams: + | DepositParams + | undefined; + /** tally_params defines the parameters related to tally. */ + tallyParams: TallyParams | undefined; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposalStatus: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest: MessageFns = { + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + 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 = {}; + if (message.proposalStatus !== 0) { + obj.proposalStatus = proposalStatusToJSON(message.proposalStatus); + } + 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.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse: MessageFns = { + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + 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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposalId: 0, voter: "" }; +} + +export const QueryVoteRequest: MessageFns = { + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse: MessageFns = { + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + 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; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesRequest: MessageFns = { + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + 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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { paramsType: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.paramsType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { paramsType: isSet(object.paramsType) ? globalThis.String(object.paramsType) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.paramsType !== "") { + obj.paramsType = message.paramsType; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { votingParams: undefined, depositParams: undefined, tallyParams: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).join(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).join(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingParams = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositParams = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) ? VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: isSet(object.depositParams) ? DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.votingParams !== undefined) { + obj.votingParams = VotingParams.toJSON(message.votingParams); + } + if (message.depositParams !== undefined) { + obj.depositParams = DepositParams.toJSON(message.depositParams); + } + if (message.tallyParams !== undefined) { + obj.tallyParams = TallyParams.toJSON(message.tallyParams); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = (object.votingParams !== undefined && object.votingParams !== null) + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = (object.depositParams !== undefined && object.depositParams !== null) + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = (object.tallyParams !== undefined && object.tallyParams !== null) + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposalId: 0, depositor: "" }; +} + +export const QueryDepositRequest: MessageFns = { + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse: MessageFns = { + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + 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) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposalId: 0, pagination: undefined }; +} + +export const QueryDepositsRequest: MessageFns = { + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + 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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + 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)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? 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 on proposalID, depositor address. */ + 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 const QueryServiceName = "cosmos.gov.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 00000000..85994854 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,880 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/gov/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 is the proposal's content. */ + content: + | Any + | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteEncrypted defines a message to cast an encrypted vote. */ +export interface MsgVoteEncrypted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** encrypted_data defines the encrypted vote option. */ + encryptedData: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteEncryptedResponse { +} + +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + 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 defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { content: undefined, initialDeposit: [], proposer: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + initialDeposit: globalThis.Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.initialDeposit?.length) { + obj.initialDeposit = message.initialDeposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.initialDeposit = object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteEncrypted(): MsgVoteEncrypted { + return { proposalId: 0, voter: "", encryptedData: "" }; +} + +export const MsgVoteEncrypted: MessageFns = { + encode(message: MsgVoteEncrypted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncrypted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncrypted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteEncrypted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: MsgVoteEncrypted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): MsgVoteEncrypted { + return MsgVoteEncrypted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteEncrypted { + const message = createBaseMsgVoteEncrypted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseMsgVoteEncryptedResponse(): MsgVoteEncryptedResponse { + return {}; +} + +export const MsgVoteEncryptedResponse: MessageFns = { + encode(_: MsgVoteEncryptedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteEncryptedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteEncryptedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteEncryptedResponse { + return {}; + }, + + toJSON(_: MsgVoteEncryptedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteEncryptedResponse { + return MsgVoteEncryptedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteEncryptedResponse { + const message = createBaseMsgVoteEncryptedResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposalId: 0, voter: "", options: [] }; +} + +export const MsgVoteWeighted: MessageFns = { + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgVoteWeighted { + return MsgVoteWeighted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse: MessageFns = { + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposalId: 0, depositor: "", amount: [] }; +} + +export const MsgDeposit: MessageFns = { + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 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 = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + 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.proposalId = object.proposalId ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse: MessageFns = { + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteEncrypted defines a method to add an encrypted vote on a specific proposal. */ + VoteEncrypted(request: MsgVoteEncrypted): 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 const MsgServiceName = "cosmos.gov.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 || MsgServiceName; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteEncrypted = this.VoteEncrypted.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 BinaryReader(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 BinaryReader(data))); + } + + VoteEncrypted(request: MsgVoteEncrypted): Promise { + const data = MsgVoteEncrypted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteEncrypted", data); + return promise.then((data) => MsgVoteEncryptedResponse.decode(new BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/module/v1/module.ts new file mode 100644 index 00000000..fbcfb65d --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/module/v1/module.ts @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../../../google/protobuf/duration"; + +export const protobufPackage = "cosmos.group.module.v1"; + +/** Module is the config object of the group module. */ +export interface Module { + /** + * max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + * to execute the proposal. + */ + maxExecutionPeriod: + | Duration + | undefined; + /** + * max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: number; +} + +function createBaseModule(): Module { + return { maxExecutionPeriod: undefined, maxMetadataLen: 0 }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxExecutionPeriod !== undefined) { + Duration.encode(message.maxExecutionPeriod, writer.uint32(10).fork()).join(); + } + if (message.maxMetadataLen !== 0) { + writer.uint32(16).uint64(message.maxMetadataLen); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxMetadataLen = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + maxExecutionPeriod: isSet(object.maxExecutionPeriod) ? Duration.fromJSON(object.maxExecutionPeriod) : undefined, + maxMetadataLen: isSet(object.maxMetadataLen) ? globalThis.Number(object.maxMetadataLen) : 0, + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.maxExecutionPeriod !== undefined) { + obj.maxExecutionPeriod = Duration.toJSON(message.maxExecutionPeriod); + } + if (message.maxMetadataLen !== 0) { + obj.maxMetadataLen = Math.round(message.maxMetadataLen); + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.maxExecutionPeriod = (object.maxExecutionPeriod !== undefined && object.maxExecutionPeriod !== null) + ? Duration.fromPartial(object.maxExecutionPeriod) + : undefined; + message.maxMetadataLen = object.maxMetadataLen ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/events.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/events.ts new file mode 100644 index 00000000..6a221d4e --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/events.ts @@ -0,0 +1,780 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/events.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyResult, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroup { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** 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. */ + proposalId: number; +} + +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposal { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVote { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; +} + +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExec { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** result is the proposal execution result. */ + result: ProposalExecutorResult; + /** logs contains error logs in case the execution result is FAILURE. */ + logs: string; +} + +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroup { + /** group_id is the unique ID of the group. */ + groupId: number; + /** address is the account address of the group member. */ + address: string; +} + +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPruned { + /** proposal_id is the unique ID of the proposal. */ + proposalId: number; + /** status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). */ + status: ProposalStatus; + /** tally_result is the proposal tally result (when applicable). */ + tallyResult: TallyResult | undefined; +} + +function createBaseEventCreateGroup(): EventCreateGroup { + return { groupId: 0 }; +} + +export const EventCreateGroup: MessageFns = { + encode(message: EventCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventCreateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroup { + return EventCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroup { + const message = createBaseEventCreateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventUpdateGroup(): EventUpdateGroup { + return { groupId: 0 }; +} + +export const EventUpdateGroup: MessageFns = { + encode(message: EventUpdateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroup { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: EventUpdateGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroup { + return EventUpdateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { + return { address: "" }; +} + +export const EventCreateGroupPolicy: MessageFns = { + encode(message: EventCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventCreateGroupPolicy { + return EventCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { + return { address: "" }; +} + +export const EventUpdateGroupPolicy: MessageFns = { + encode(message: EventUpdateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateGroupPolicy { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: EventUpdateGroupPolicy): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventUpdateGroupPolicy { + return EventUpdateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventSubmitProposal(): EventSubmitProposal { + return { proposalId: 0 }; +} + +export const EventSubmitProposal: MessageFns = { + encode(message: EventSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSubmitProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventSubmitProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventSubmitProposal { + return EventSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventWithdrawProposal(): EventWithdrawProposal { + return { proposalId: 0 }; +} + +export const EventWithdrawProposal: MessageFns = { + encode(message: EventWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventWithdrawProposal { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventWithdrawProposal { + return EventWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventVote(): EventVote { + return { proposalId: 0 }; +} + +export const EventVote: MessageFns = { + encode(message: EventVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventVote { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: EventVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): EventVote { + return EventVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventVote { + const message = createBaseEventVote(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseEventExec(): EventExec { + return { proposalId: 0, result: 0, logs: "" }; +} + +export const EventExec: MessageFns = { + encode(message: EventExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + if (message.logs !== "") { + writer.uint32(26).string(message.logs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.logs = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0, + logs: isSet(object.logs) ? globalThis.String(object.logs) : "", + }; + }, + + toJSON(message: EventExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + if (message.logs !== "") { + obj.logs = message.logs; + } + return obj; + }, + + create, I>>(base?: I): EventExec { + return EventExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventExec { + const message = createBaseEventExec(); + message.proposalId = object.proposalId ?? 0; + message.result = object.result ?? 0; + message.logs = object.logs ?? ""; + return message; + }, +}; + +function createBaseEventLeaveGroup(): EventLeaveGroup { + return { groupId: 0, address: "" }; +} + +export const EventLeaveGroup: MessageFns = { + encode(message: EventLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventLeaveGroup { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: EventLeaveGroup): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): EventLeaveGroup { + return EventLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + message.groupId = object.groupId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventProposalPruned(): EventProposalPruned { + return { proposalId: 0, status: 0, tallyResult: undefined }; +} + +export const EventProposalPruned: MessageFns = { + encode(message: EventProposalPruned, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.tallyResult !== undefined) { + TallyResult.encode(message.tallyResult, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventProposalPruned { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventProposalPruned(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.status = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventProposalPruned { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + tallyResult: isSet(object.tallyResult) ? TallyResult.fromJSON(object.tallyResult) : undefined, + }; + }, + + toJSON(message: EventProposalPruned): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.tallyResult !== undefined) { + obj.tallyResult = TallyResult.toJSON(message.tallyResult); + } + return obj; + }, + + create, I>>(base?: I): EventProposalPruned { + return EventProposalPruned.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventProposalPruned { + const message = createBaseEventProposalPruned(); + message.proposalId = object.proposalId ?? 0; + message.status = object.status ?? 0; + message.tallyResult = (object.tallyResult !== undefined && object.tallyResult !== null) + ? TallyResult.fromPartial(object.tallyResult) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/genesis.ts new file mode 100644 index 00000000..b2d21dd4 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/genesis.ts @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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. + */ + groupSeq: number; + /** groups is the list of groups info. */ + groups: GroupInfo[]; + /** group_members is the list of groups members. */ + groupMembers: GroupMember[]; + /** + * group_policy_seq is the group policy table orm.Sequence, + * it is used to generate the next group policy account address. + */ + groupPolicySeq: number; + /** group_policies is the list of group policies info. */ + groupPolicies: GroupPolicyInfo[]; + /** + * proposal_seq is the proposal table orm.Sequence, + * it is used to get the next proposal ID. + */ + proposalSeq: number; + /** proposals is the list of proposals. */ + proposals: Proposal[]; + /** votes is the list of votes. */ + votes: Vote[]; +} + +function createBaseGenesisState(): GenesisState { + return { + groupSeq: 0, + groups: [], + groupMembers: [], + groupPolicySeq: 0, + groupPolicies: [], + proposalSeq: 0, + proposals: [], + votes: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupSeq !== 0) { + writer.uint32(8).uint64(message.groupSeq); + } + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.groupMembers) { + GroupMember.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.groupPolicySeq !== 0) { + writer.uint32(32).uint64(message.groupPolicySeq); + } + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.proposalSeq !== 0) { + writer.uint32(48).uint64(message.proposalSeq); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 8) { + break; + } + + message.groupSeq = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMembers.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.groupPolicySeq = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.proposalSeq = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + groupSeq: isSet(object.groupSeq) ? globalThis.Number(object.groupSeq) : 0, + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + groupMembers: globalThis.Array.isArray(object?.groupMembers) + ? object.groupMembers.map((e: any) => GroupMember.fromJSON(e)) + : [], + groupPolicySeq: isSet(object.groupPolicySeq) ? globalThis.Number(object.groupPolicySeq) : 0, + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + proposalSeq: isSet(object.proposalSeq) ? globalThis.Number(object.proposalSeq) : 0, + proposals: globalThis.Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.groupSeq !== 0) { + obj.groupSeq = Math.round(message.groupSeq); + } + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.groupMembers?.length) { + obj.groupMembers = message.groupMembers.map((e) => GroupMember.toJSON(e)); + } + if (message.groupPolicySeq !== 0) { + obj.groupPolicySeq = Math.round(message.groupPolicySeq); + } + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.proposalSeq !== 0) { + obj.proposalSeq = Math.round(message.proposalSeq); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.groupSeq = object.groupSeq ?? 0; + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.groupMembers = object.groupMembers?.map((e) => GroupMember.fromPartial(e)) || []; + message.groupPolicySeq = object.groupPolicySeq ?? 0; + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.proposalSeq = object.proposalSeq ?? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/query.ts new file mode 100644 index 00000000..d64f831a --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/query.ts @@ -0,0 +1,2395 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, TallyResult, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequest { + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponse { + /** info is the GroupInfo of the group. */ + info: GroupInfo | undefined; +} + +/** 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 of the group policy. */ + info: GroupPolicyInfo | undefined; +} + +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequest { + /** group_id is the unique ID of the group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequest { + /** group_id is the unique ID of the group policy's group. */ + groupId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponse { + /** group_policies are the group policies info associated with the provided group. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** 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 | undefined; +} + +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponse { + /** group_policies are the group policies info with provided admin. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; +} + +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponse { + /** proposal is the proposal info. */ + proposal: Proposal | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** 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 | undefined; +} + +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequest { + /** proposal_id is the unique id of a proposal. */ + proposalId: number; +} + +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult | undefined; +} + +/** + * QueryGroupsRequest is the Query/Groups request type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryGroupsResponse is the Query/Groups response type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsResponse { + /** `groups` is all the groups present in state. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { + return { groupId: 0 }; +} + +export const QueryGroupInfoRequest: MessageFns = { + encode(message: QueryGroupInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoRequest { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: QueryGroupInfoRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoRequest { + return QueryGroupInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { + return { info: undefined }; +} + +export const QueryGroupInfoResponse: MessageFns = { + encode(message: QueryGroupInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoResponse { + return { info: isSet(object.info) ? GroupInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupInfoResponse { + return QueryGroupInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupPolicyInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryGroupPolicyInfoRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoRequest { + return QueryGroupPolicyInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { + return { info: undefined }; +} + +export const QueryGroupPolicyInfoResponse: MessageFns = { + encode(message: QueryGroupPolicyInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info = GroupPolicyInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoResponse { + return { info: isSet(object.info) ? GroupPolicyInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupPolicyInfoResponse): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = GroupPolicyInfo.toJSON(message.info); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupPolicyInfoResponse { + return QueryGroupPolicyInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupMembersRequest: MessageFns = { + encode(message: QueryGroupMembersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupMembersRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersRequest { + return QueryGroupMembersRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + message.groupId = object.groupId ?? 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: MessageFns = { + encode(message: QueryGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.members) { + GroupMember.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.members.push(GroupMember.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersResponse { + return { + members: globalThis.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?.length) { + obj.members = message.members.map((e) => GroupMember.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupMembersResponse { + return QueryGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminRequest { + return QueryGroupsByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByAdminResponse { + return QueryGroupsByAdminResponse.fromPartial(base ?? ({} as any)); + }, + 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 { groupId: 0, pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupRequest: MessageFns = { + encode(message: QueryGroupPoliciesByGroupRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupRequest { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupRequest): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupRequest { + return QueryGroupPoliciesByGroupRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + message.groupId = object.groupId ?? 0; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { + return { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupResponse: MessageFns = { + encode(message: QueryGroupPoliciesByGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByGroupResponse { + return QueryGroupPoliciesByGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.groupPolicies = object.groupPolicies?.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: MessageFns = { + encode(message: QueryGroupPoliciesByAdminRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminRequest { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminRequest): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminRequest { + return QueryGroupPoliciesByAdminRequest.fromPartial(base ?? ({} as any)); + }, + 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 { groupPolicies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByAdminResponse: MessageFns = { + encode(message: QueryGroupPoliciesByAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminResponse { + return { + groupPolicies: globalThis.Array.isArray(object?.groupPolicies) + ? object.groupPolicies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminResponse): unknown { + const obj: any = {}; + if (message.groupPolicies?.length) { + obj.groupPolicies = message.groupPolicies.map((e) => GroupPolicyInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryGroupPoliciesByAdminResponse { + return QueryGroupPoliciesByAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.groupPolicies = object.groupPolicies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposalId: 0 }; +} + +export const QueryProposalRequest: MessageFns = { + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse: MessageFns = { + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + 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) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { + return { address: "", pagination: undefined }; +} + +export const QueryProposalsByGroupPolicyRequest: MessageFns = { + encode(message: QueryProposalsByGroupPolicyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsByGroupPolicyRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyRequest { + return QueryProposalsByGroupPolicyRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryProposalsByGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyResponse { + return { + 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: QueryProposalsByGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryProposalsByGroupPolicyResponse { + return QueryProposalsByGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, voter: "" }; +} + +export const QueryVoteByProposalVoterRequest: MessageFns = { + encode(message: QueryVoteByProposalVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteByProposalVoterRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + return obj; + }, + + create, I>>(base?: I): QueryVoteByProposalVoterRequest { + return QueryVoteByProposalVoterRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { + return { vote: undefined }; +} + +export const QueryVoteByProposalVoterResponse: MessageFns = { + encode(message: QueryVoteByProposalVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteByProposalVoterResponse): unknown { + const obj: any = {}; + if (message.vote !== undefined) { + obj.vote = Vote.toJSON(message.vote); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVoteByProposalVoterResponse { + return QueryVoteByProposalVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0, pagination: undefined }; +} + +export const QueryVotesByProposalRequest: MessageFns = { + encode(message: QueryVotesByProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalRequest { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByProposalRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalRequest { + return QueryVotesByProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(message: QueryVotesByProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalResponse { + return { + 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: QueryVotesByProposalResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByProposalResponse { + return QueryVotesByProposalResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voter !== "") { + writer.uint32(10).string(message.voter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.voter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterRequest { + return { + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByVoterRequest): unknown { + const obj: any = {}; + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterRequest { + return QueryVotesByVoterRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryVotesByVoterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterResponse { + return { + 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: QueryVotesByVoterResponse): unknown { + const obj: any = {}; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesByVoterResponse { + return QueryVotesByVoterResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByMemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberRequest { + return QueryGroupsByMemberRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryGroupsByMemberResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberResponse { + return { + groups: globalThis.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?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsByMemberResponse { + return QueryGroupsByMemberResponse.fromPartial(base ?? ({} as any)); + }, + 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 { proposalId: 0 }; +} + +export const QueryTallyResultRequest: MessageFns = { + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse: MessageFns = { + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + 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) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsRequest(): QueryGroupsRequest { + return { pagination: undefined }; +} + +export const QueryGroupsRequest: MessageFns = { + encode(message: QueryGroupsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGroupsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsRequest { + return QueryGroupsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsRequest { + const message = createBaseQueryGroupsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsResponse(): QueryGroupsResponse { + return { groups: [], pagination: undefined }; +} + +export const QueryGroupsResponse: MessageFns = { + encode(message: QueryGroupsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGroupsResponse { + return { + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsResponse): unknown { + const obj: any = {}; + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGroupsResponse { + return QueryGroupsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGroupsResponse { + const message = createBaseQueryGroupsResponse(); + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : 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 by group id. */ + 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; + /** GroupPoliciesByAdmin 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 id. */ + 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 returns the tally result of a proposal. If the proposal is + * still in voting period, then this query computes the current tally state, + * which might not be final. On the other hand, if the proposal is final, + * then it simply returns the `final_tally_result` state stored in the + * proposal itself. + */ + TallyResult(request: QueryTallyResultRequest): Promise; + /** + * Groups queries all groups in state. + * + * Since: cosmos-sdk 0.47.1 + */ + Groups(request: QueryGroupsRequest): Promise; +} + +export const QueryServiceName = "cosmos.group.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 || QueryServiceName; + 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); + this.Groups = this.Groups.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + Groups(request: QueryGroupsRequest): Promise { + const data = QueryGroupsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Groups", data); + return promise.then((data) => QueryGroupsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/tx.ts new file mode 100644 index 00000000..006eb292 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/tx.ts @@ -0,0 +1,2576 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { + MemberRequest, + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + VoteOption, + voteOptionFromJSON, + voteOptionToJSON, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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: MemberRequest[]; + /** 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. */ + groupId: number; +} + +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembers { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + memberUpdates: MemberRequest[]; +} + +/** 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. */ + groupId: number; + /** new_admin is the group new admin account address. */ + newAdmin: 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. */ + groupId: number; + /** 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. */ + groupId: number; + /** metadata is any arbitrary metadata attached to the group policy. */ + metadata: string; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of the group policy. */ + groupPolicyAddress: string; + /** new_admin is the new group policy admin. */ + newAdmin: string; +} + +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponse { +} + +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicy { + /** admin is the account address of the group and group policy admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequest[]; + /** group_metadata is any arbitrary metadata attached to the group. */ + groupMetadata: string; + /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ + groupPolicyMetadata: string; + /** + * group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + * and group policy admin. + */ + groupPolicyAsAdmin: boolean; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponse { + /** group_id is the unique ID of the newly created group with policy. */ + groupId: number; + /** group_policy_address is the account address of the newly created group policy. */ + groupPolicyAddress: string; +} + +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** decision_policy is the updated group policy's decision policy. */ + decisionPolicy: Any | undefined; +} + +/** 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; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** metadata is the group policy metadata to be updated. */ + metadata: string; +} + +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponse { +} + +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposal { + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * proposers are the account addresses of the proposers. + * Proposers signatures will be counted as yes votes. + */ + proposers: string[]; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * exec defines the mode of execution of the proposal, + * whether it should be executed immediately on creation or not. + * If so, proposers signatures are considered as Yes votes. + */ + exec: Exec; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal is the unique ID of the proposal. */ + proposalId: number; +} + +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposal { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** 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. */ + proposalId: number; + /** voter is the voter account address. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} + +/** 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. */ + proposalId: number; + /** executor is the account address used to execute the proposal. */ + executor: string; +} + +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponse { + /** result is the final result of the proposal execution. */ + result: ProposalExecutorResult; +} + +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroup { + /** address is the account address of the group member. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; +} + +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponse { +} + +function createBaseMsgCreateGroup(): MsgCreateGroup { + return { admin: "", members: [], metadata: "" }; +} + +export const MsgCreateGroup: MessageFns = { + encode(message: MsgCreateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroup { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgCreateGroup): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroup { + return MsgCreateGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { + return { groupId: 0 }; +} + +export const MsgCreateGroupResponse: MessageFns = { + encode(message: MsgCreateGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupResponse { + return { groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0 }; + }, + + toJSON(message: MsgCreateGroupResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupResponse { + return MsgCreateGroupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { + return { admin: "", groupId: 0, memberUpdates: [] }; +} + +export const MsgUpdateGroupMembers: MessageFns = { + encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + for (const v of message.memberUpdates) { + MemberRequest.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.memberUpdates.push(MemberRequest.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMembers { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + memberUpdates: globalThis.Array.isArray(object?.memberUpdates) + ? object.memberUpdates.map((e: any) => MemberRequest.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgUpdateGroupMembers): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.memberUpdates?.length) { + obj.memberUpdates = message.memberUpdates.map((e) => MemberRequest.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.memberUpdates = object.memberUpdates?.map((e) => MemberRequest.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { + return {}; +} + +export const MsgUpdateGroupMembersResponse: MessageFns = { + encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMembersResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMembersResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { + return { admin: "", groupId: 0, newAdmin: "" }; +} + +export const MsgUpdateGroupAdmin: MessageFns = { + encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { + return {}; +} + +export const MsgUpdateGroupAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { + return { admin: "", groupId: 0, metadata: "" }; +} + +export const MsgUpdateGroupMetadata: MessageFns = { + encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { + return {}; +} + +export const MsgUpdateGroupMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { + return { admin: "", groupId: 0, metadata: "", decisionPolicy: undefined }; +} + +export const MsgCreateGroupPolicy: MessageFns = { + encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId ?? 0; + message.metadata = object.metadata ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { + return { address: "" }; +} + +export const MsgCreateGroupPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicyResponse { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: MsgCreateGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { + return { admin: "", groupPolicyAddress: "", newAdmin: "" }; +} + +export const MsgUpdateGroupPolicyAdmin: MessageFns = { + encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyAdmin { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + newAdmin: isSet(object.newAdmin) ? globalThis.String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyAdmin): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { + return {}; +} + +export const MsgUpdateGroupPolicyAdminResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { + return { + admin: "", + members: [], + groupMetadata: "", + groupPolicyMetadata: "", + groupPolicyAsAdmin: false, + decisionPolicy: undefined, + }; +} + +export const MsgCreateGroupWithPolicy: MessageFns = { + encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.groupMetadata !== "") { + writer.uint32(26).string(message.groupMetadata); + } + if (message.groupPolicyMetadata !== "") { + writer.uint32(34).string(message.groupPolicyMetadata); + } + if (message.groupPolicyAsAdmin !== false) { + writer.uint32(40).bool(message.groupPolicyAsAdmin); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.members.push(MemberRequest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.groupMetadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.groupPolicyMetadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.groupPolicyAsAdmin = reader.bool(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + members: globalThis.Array.isArray(object?.members) + ? object.members.map((e: any) => MemberRequest.fromJSON(e)) + : [], + groupMetadata: isSet(object.groupMetadata) ? globalThis.String(object.groupMetadata) : "", + groupPolicyMetadata: isSet(object.groupPolicyMetadata) ? globalThis.String(object.groupPolicyMetadata) : "", + groupPolicyAsAdmin: isSet(object.groupPolicyAsAdmin) ? globalThis.Boolean(object.groupPolicyAsAdmin) : false, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupWithPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.members?.length) { + obj.members = message.members.map((e) => MemberRequest.toJSON(e)); + } + if (message.groupMetadata !== "") { + obj.groupMetadata = message.groupMetadata; + } + if (message.groupPolicyMetadata !== "") { + obj.groupPolicyMetadata = message.groupPolicyMetadata; + } + if (message.groupPolicyAsAdmin !== false) { + obj.groupPolicyAsAdmin = message.groupPolicyAsAdmin; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => MemberRequest.fromPartial(e)) || []; + message.groupMetadata = object.groupMetadata ?? ""; + message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; + message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { + return { groupId: 0, groupPolicyAddress: "" }; +} + +export const MsgCreateGroupWithPolicyResponse: MessageFns = { + encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicyResponse { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + }; + }, + + toJSON(message: MsgCreateGroupWithPolicyResponse): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + message.groupId = object.groupId ?? 0; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { + return { admin: "", groupPolicyAddress: "", decisionPolicy: undefined }; +} + +export const MsgUpdateGroupPolicyDecisionPolicy: MessageFns = { + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyDecisionPolicy { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + }; + }, + + toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; +} + +export const MsgUpdateGroupPolicyDecisionPolicyResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { + return { admin: "", groupPolicyAddress: "", metadata: "" }; +} + +export const MsgUpdateGroupPolicyMetadata: MessageFns = { + encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyMetadata { + return { + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { + return {}; +} + +export const MsgUpdateGroupPolicyMetadataResponse: MessageFns = { + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, +}; + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { groupPolicyAddress: "", proposers: [], metadata: "", messages: [], exec: 0, title: "", summary: "" }; +} + +export const MsgSubmitProposal: MessageFns = { + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupPolicyAddress !== "") { + writer.uint32(10).string(message.groupPolicyAddress); + } + for (const v of message.proposers) { + writer.uint32(18).string(v!); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + if (message.title !== "") { + writer.uint32(50).string(message.title); + } + if (message.summary !== "") { + writer.uint32(58).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.title = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.metadata = object.metadata ?? ""; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.exec = object.exec ?? 0; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposalId: 0 }; +} + +export const MsgSubmitProposalResponse: MessageFns = { + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId ?? 0; + return message; + }, +}; + +function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { + return { proposalId: 0, address: "" }; +} + +export const MsgWithdrawProposal: MessageFns = { + encode(message: MsgWithdrawProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawProposal { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: MsgWithdrawProposal): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposal { + return MsgWithdrawProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + message.proposalId = object.proposalId ?? 0; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { + return {}; +} + +export const MsgWithdrawProposalResponse: MessageFns = { + encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgWithdrawProposalResponse { + return {}; + }, + + toJSON(_: MsgWithdrawProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposalId: 0, voter: "", option: 0, metadata: "", exec: 0 }; +} + +export const MsgVote: MessageFns = { + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.exec = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.exec !== 0) { + obj.exec = execToJSON(message.exec); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId ?? 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: MessageFns = { + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { proposalId: 0, executor: "" }; +} + +export const MsgExec: MessageFns = { + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.executor !== "") { + writer.uint32(18).string(message.executor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.executor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + executor: isSet(object.executor) ? globalThis.String(object.executor) : "", + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.executor !== "") { + obj.executor = message.executor; + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.proposalId = object.proposalId ?? 0; + message.executor = object.executor ?? ""; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { result: 0 }; +} + +export const MsgExecResponse: MessageFns = { + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = proposalExecutorResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroup(): MsgLeaveGroup { + return { address: "", groupId: 0 }; +} + +export const MsgLeaveGroup: MessageFns = { + encode(message: MsgLeaveGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgLeaveGroup { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + }; + }, + + toJSON(message: MsgLeaveGroup): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroup { + return MsgLeaveGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + return message; + }, +}; + +function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { + return {}; +} + +export const MsgLeaveGroupResponse: MessageFns = { + encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgLeaveGroupResponse { + return {}; + }, + + toJSON(_: MsgLeaveGroupResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.fromPartial(base ?? ({} as any)); + }, + 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 withdraws 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 const MsgServiceName = "cosmos.group.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/types.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/types.ts new file mode 100644 index 00000000..3f7a9e54 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/group/v1/types.ts @@ -0,0 +1,1799 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/group/v1/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.group.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** VoteOption enumerates the valid vote options for a given proposal. */ +export enum VoteOption { + /** + * VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will + * return an error. + */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} + +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} + +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalStatus defines proposal statuses. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when submitted. */ + PROPOSAL_STATUS_SUBMITTED = 1, + /** + * PROPOSAL_STATUS_ACCEPTED - Final status of a proposal when the final tally is done and the outcome + * passes the group policy's decision policy. + */ + PROPOSAL_STATUS_ACCEPTED = 2, + /** + * PROPOSAL_STATUS_REJECTED - Final status of a proposal when the final tally is done and the outcome + * is rejected by the group policy's decision policy. + */ + PROPOSAL_STATUS_REJECTED = 3, + /** + * PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group policy is modified before the + * final tally. + */ + PROPOSAL_STATUS_ABORTED = 4, + /** + * PROPOSAL_STATUS_WITHDRAWN - A proposal can be withdrawn before the voting start time by the owner. + * When this happens the final status is Withdrawn. + */ + PROPOSAL_STATUS_WITHDRAWN = 5, + UNRECOGNIZED = -1, +} + +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_SUBMITTED": + return ProposalStatus.PROPOSAL_STATUS_SUBMITTED; + case 2: + case "PROPOSAL_STATUS_ACCEPTED": + return ProposalStatus.PROPOSAL_STATUS_ACCEPTED; + case 3: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 4: + case "PROPOSAL_STATUS_ABORTED": + return ProposalStatus.PROPOSAL_STATUS_ABORTED; + case 5: + case "PROPOSAL_STATUS_WITHDRAWN": + return ProposalStatus.PROPOSAL_STATUS_WITHDRAWN; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} + +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_SUBMITTED: + return "PROPOSAL_STATUS_SUBMITTED"; + case ProposalStatus.PROPOSAL_STATUS_ACCEPTED: + return "PROPOSAL_STATUS_ACCEPTED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return "PROPOSAL_STATUS_ABORTED"; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return "PROPOSAL_STATUS_WITHDRAWN"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalExecutorResult defines types of proposal executor results. */ +export enum ProposalExecutorResult { + /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ + PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0, + /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ + PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1, + /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ + PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2, + /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ + PROPOSAL_EXECUTOR_RESULT_FAILURE = 3, + UNRECOGNIZED = -1, +} + +export function proposalExecutorResultFromJSON(object: any): ProposalExecutorResult { + switch (object) { + case 0: + case "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; + case 1: + case "PROPOSAL_EXECUTOR_RESULT_NOT_RUN": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN; + case 2: + case "PROPOSAL_EXECUTOR_RESULT_SUCCESS": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS; + case 3: + case "PROPOSAL_EXECUTOR_RESULT_FAILURE": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE; + case -1: + case "UNRECOGNIZED": + default: + return ProposalExecutorResult.UNRECOGNIZED; + } +} + +export function proposalExecutorResultToJSON(object: ProposalExecutorResult): string { + switch (object) { + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: + return "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN: + return "PROPOSAL_EXECUTOR_RESULT_NOT_RUN"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS: + return "PROPOSAL_EXECUTOR_RESULT_SUCCESS"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE: + return "PROPOSAL_EXECUTOR_RESULT_FAILURE"; + case ProposalExecutorResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface Member { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + addedAt: Date | undefined; +} + +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequest { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; +} + +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicy { + /** + * threshold is the minimum weighted sum of `YES` votes that must be met or + * exceeded for a proposal to succeed. + */ + threshold: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicy { + /** + * percentage is the minimum percentage of the weighted sum of `YES` votes must + * meet for a proposal to succeed. + */ + percentage: string; + /** windows defines the different windows for voting and execution. */ + windows: DecisionPolicyWindows | undefined; +} + +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindows { + /** + * voting_period is the duration from submission of a proposal to the end of voting period + * Within this times votes can be submitted with MsgVote. + */ + votingPeriod: + | Duration + | undefined; + /** + * min_execution_period is the minimum duration after the proposal submission + * where members can start sending MsgExec. This means that the window for + * sending a MsgExec transaction is: + * `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + * where max_execution_period is a app-specific config, defined in the keeper. + * If not set, min_execution_period will default to 0. + * + * Please make sure to set a `min_execution_period` that is smaller than + * `voting_period + max_execution_period`, or else the above execution window + * is empty, meaning that all proposals created with this decision policy + * won't be able to be executed. + */ + minExecutionPeriod: Duration | undefined; +} + +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfo { + /** id is the unique ID of the group. */ + id: number; + /** admin is the account address of the group's admin. */ + admin: string; + /** + * metadata is any arbitrary metadata to attached to the group. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 + */ + metadata: string; + /** + * version is used to track changes to a group's membership structure that + * would break existing proposals. Whenever any members weight is changed, + * or any member is added or removed this version is incremented and will + * cause proposals based on older versions of this group to fail + */ + version: number; + /** total_weight is the sum of the group members' weights. */ + totalWeight: string; + /** created_at is a timestamp specifying when a group was created. */ + createdAt: Date | undefined; +} + +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMember { + /** group_id is the unique ID of the group. */ + groupId: number; + /** member is the member data. */ + member: Member | undefined; +} + +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfo { + /** address is the account address of group policy. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: number; + /** admin is the account address of the group admin. */ + admin: string; + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ + metadata: string; + /** + * version is used to track changes to a group's GroupPolicyInfo structure that + * would create a different result on a running proposal. + */ + version: number; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy: + | Any + | undefined; + /** created_at is a timestamp specifying when a group policy was created. */ + createdAt: Date | undefined; +} + +/** + * 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: number; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ + metadata: string; + /** proposers are the account addresses of the proposers. */ + proposers: string[]; + /** submit_time is a timestamp specifying when a proposal was submitted. */ + submitTime: + | Date + | undefined; + /** + * group_version tracks the version of the group at proposal submission. + * This field is here for informational purposes only. + */ + groupVersion: number; + /** + * group_policy_version tracks the version of the group policy at proposal submission. + * When a decision policy is changed, existing proposals from previous policy + * versions will become invalid with the `ABORTED` status. + * This field is here for informational purposes only. + */ + groupPolicyVersion: number; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option. It is empty at submission, and only + * populated after tallying, at voting period end or at proposal execution, + * whichever happens first. + */ + finalTallyResult: + | TallyResult + | undefined; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successful MsgExec is called before (to execute a proposal whose + * tally is successful before the voting period ends), tallying will be done + * at this point, and the `final_tally_result`and `status` fields will be + * accordingly updated. + */ + votingPeriodEnd: + | Date + | undefined; + /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ + executorResult: ProposalExecutorResult; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} + +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResult { + /** yes_count is the weighted sum of yes votes. */ + yesCount: string; + /** abstain_count is the weighted sum of abstainers. */ + abstainCount: string; + /** no_count is the weighted sum of no votes. */ + noCount: string; + /** no_with_veto_count is the weighted sum of veto. */ + noWithVetoCount: string; +} + +/** Vote represents a vote for a proposal.string metadata */ +export interface Vote { + /** proposal is the unique ID of the proposal. */ + proposalId: number; + /** voter is the account address of the voter. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 + */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submitTime: Date | undefined; +} + +function createBaseMember(): Member { + return { address: "", weight: "", metadata: "", addedAt: undefined }; +} + +export const Member: MessageFns = { + encode(message: Member, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.addedAt !== undefined) { + Timestamp.encode(toTimestamp(message.addedAt), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Member { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.addedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Member { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + addedAt: isSet(object.addedAt) ? fromJsonTimestamp(object.addedAt) : undefined, + }; + }, + + toJSON(message: Member): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.addedAt !== undefined) { + obj.addedAt = message.addedAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Member { + return Member.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Member { + const message = createBaseMember(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + message.addedAt = object.addedAt ?? undefined; + return message; + }, +}; + +function createBaseMemberRequest(): MemberRequest { + return { address: "", weight: "", metadata: "" }; +} + +export const MemberRequest: MessageFns = { + encode(message: MemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MemberRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + }; + }, + + toJSON(message: MemberRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.weight !== "") { + obj.weight = message.weight; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + + create, I>>(base?: I): MemberRequest { + return MemberRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MemberRequest { + const message = createBaseMemberRequest(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { + return { threshold: "", windows: undefined }; +} + +export const ThresholdDecisionPolicy: MessageFns = { + encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== "") { + writer.uint32(10).string(message.threshold); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseThresholdDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.threshold = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ThresholdDecisionPolicy { + return { + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: ThresholdDecisionPolicy): unknown { + const obj: any = {}; + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: PercentageDecisionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.percentage !== "") { + writer.uint32(10).string(message.percentage); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePercentageDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.percentage = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PercentageDecisionPolicy { + return { + percentage: isSet(object.percentage) ? globalThis.String(object.percentage) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: PercentageDecisionPolicy): unknown { + const obj: any = {}; + if (message.percentage !== "") { + obj.percentage = message.percentage; + } + if (message.windows !== undefined) { + obj.windows = DecisionPolicyWindows.toJSON(message.windows); + } + return obj; + }, + + create, I>>(base?: I): PercentageDecisionPolicy { + return PercentageDecisionPolicy.fromPartial(base ?? ({} as any)); + }, + 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 { votingPeriod: undefined, minExecutionPeriod: undefined }; +} + +export const DecisionPolicyWindows: MessageFns = { + encode(message: DecisionPolicyWindows, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).join(); + } + if (message.minExecutionPeriod !== undefined) { + Duration.encode(message.minExecutionPeriod, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecisionPolicyWindows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votingPeriod = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minExecutionPeriod = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecisionPolicyWindows { + return { + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + minExecutionPeriod: isSet(object.minExecutionPeriod) ? Duration.fromJSON(object.minExecutionPeriod) : undefined, + }; + }, + + toJSON(message: DecisionPolicyWindows): unknown { + const obj: any = {}; + if (message.votingPeriod !== undefined) { + obj.votingPeriod = Duration.toJSON(message.votingPeriod); + } + if (message.minExecutionPeriod !== undefined) { + obj.minExecutionPeriod = Duration.toJSON(message.minExecutionPeriod); + } + return obj; + }, + + create, I>>(base?: I): DecisionPolicyWindows { + return DecisionPolicyWindows.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null) + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.minExecutionPeriod = (object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null) + ? Duration.fromPartial(object.minExecutionPeriod) + : undefined; + return message; + }, +}; + +function createBaseGroupInfo(): GroupInfo { + return { id: 0, admin: "", metadata: "", version: 0, totalWeight: "", createdAt: undefined }; +} + +export const GroupInfo: MessageFns = { + encode(message: GroupInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.totalWeight !== "") { + writer.uint32(42).string(message.totalWeight); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.admin = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.totalWeight = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupInfo { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + totalWeight: isSet(object.totalWeight) ? globalThis.String(object.totalWeight) : "", + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupInfo): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.totalWeight !== "") { + obj.totalWeight = message.totalWeight; + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupInfo { + return GroupInfo.fromPartial(base ?? ({} as any)); + }, + 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.totalWeight = object.totalWeight ?? ""; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseGroupMember(): GroupMember { + return { groupId: 0, member: undefined }; +} + +export const GroupMember: MessageFns = { + encode(message: GroupMember, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupId !== 0) { + writer.uint32(8).uint64(message.groupId); + } + if (message.member !== undefined) { + Member.encode(message.member, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.member = Member.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupMember { + return { + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + member: isSet(object.member) ? Member.fromJSON(object.member) : undefined, + }; + }, + + toJSON(message: GroupMember): unknown { + const obj: any = {}; + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.member !== undefined) { + obj.member = Member.toJSON(message.member); + } + return obj; + }, + + create, I>>(base?: I): GroupMember { + return GroupMember.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupMember { + const message = createBaseGroupMember(); + message.groupId = object.groupId ?? 0; + message.member = (object.member !== undefined && object.member !== null) + ? Member.fromPartial(object.member) + : undefined; + return message; + }, +}; + +function createBaseGroupPolicyInfo(): GroupPolicyInfo { + return { + address: "", + groupId: 0, + admin: "", + metadata: "", + version: 0, + decisionPolicy: undefined, + createdAt: undefined, + }; +} + +export const GroupPolicyInfo: MessageFns = { + encode(message: GroupPolicyInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== 0) { + writer.uint32(16).uint64(message.groupId); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.version !== 0) { + writer.uint32(40).uint64(message.version); + } + if (message.decisionPolicy !== undefined) { + Any.encode(message.decisionPolicy, writer.uint32(50).fork()).join(); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupPolicyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.groupId = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.admin = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decisionPolicy = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupPolicyInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + groupId: isSet(object.groupId) ? globalThis.Number(object.groupId) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, + createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, + }; + }, + + toJSON(message: GroupPolicyInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.groupId !== 0) { + obj.groupId = Math.round(message.groupId); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.decisionPolicy !== undefined) { + obj.decisionPolicy = Any.toJSON(message.decisionPolicy); + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GroupPolicyInfo { + return GroupPolicyInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + message.address = object.address ?? ""; + message.groupId = object.groupId ?? 0; + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version ?? 0; + message.decisionPolicy = (object.decisionPolicy !== undefined && object.decisionPolicy !== null) + ? Any.fromPartial(object.decisionPolicy) + : undefined; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: 0, + groupPolicyAddress: "", + metadata: "", + proposers: [], + submitTime: undefined, + groupVersion: 0, + groupPolicyVersion: 0, + status: 0, + finalTallyResult: undefined, + votingPeriodEnd: undefined, + executorResult: 0, + messages: [], + title: "", + summary: "", + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint64(message.id); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.proposers) { + writer.uint32(34).string(v!); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + if (message.groupVersion !== 0) { + writer.uint32(48).uint64(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + writer.uint32(56).uint64(message.groupPolicyVersion); + } + if (message.status !== 0) { + writer.uint32(64).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(74).fork()).join(); + } + if (message.votingPeriodEnd !== undefined) { + Timestamp.encode(toTimestamp(message.votingPeriodEnd), writer.uint32(82).fork()).join(); + } + if (message.executorResult !== 0) { + writer.uint32(88).int32(message.executorResult); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.title !== "") { + writer.uint32(106).string(message.title); + } + if (message.summary !== "") { + writer.uint32(114).string(message.summary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.groupPolicyAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.metadata = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposers.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.groupVersion = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.groupPolicyVersion = longToNumber(reader.uint64()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.status = reader.int32() as any; + continue; + case 9: + if (tag !== 74) { + break; + } + + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.votingPeriodEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.executorResult = reader.int32() as any; + continue; + case 12: + if (tag !== 98) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.title = reader.string(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.summary = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + groupPolicyAddress: isSet(object.groupPolicyAddress) ? globalThis.String(object.groupPolicyAddress) : "", + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + proposers: globalThis.Array.isArray(object?.proposers) + ? object.proposers.map((e: any) => globalThis.String(e)) + : [], + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + groupVersion: isSet(object.groupVersion) ? globalThis.Number(object.groupVersion) : 0, + groupPolicyVersion: isSet(object.groupPolicyVersion) ? globalThis.Number(object.groupPolicyVersion) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, + votingPeriodEnd: isSet(object.votingPeriodEnd) ? fromJsonTimestamp(object.votingPeriodEnd) : undefined, + executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : 0, + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + title: isSet(object.title) ? globalThis.String(object.title) : "", + summary: isSet(object.summary) ? globalThis.String(object.summary) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.groupPolicyAddress !== "") { + obj.groupPolicyAddress = message.groupPolicyAddress; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.proposers?.length) { + obj.proposers = message.proposers; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + if (message.groupVersion !== 0) { + obj.groupVersion = Math.round(message.groupVersion); + } + if (message.groupPolicyVersion !== 0) { + obj.groupPolicyVersion = Math.round(message.groupPolicyVersion); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.finalTallyResult !== undefined) { + obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult); + } + if (message.votingPeriodEnd !== undefined) { + obj.votingPeriodEnd = message.votingPeriodEnd.toISOString(); + } + if (message.executorResult !== 0) { + obj.executorResult = proposalExecutorResultToJSON(message.executorResult); + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.summary !== "") { + obj.summary = message.summary; + } + 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; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.submitTime = object.submitTime ?? undefined; + message.groupVersion = object.groupVersion ?? 0; + message.groupPolicyVersion = object.groupPolicyVersion ?? 0; + message.status = object.status ?? 0; + message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null) + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; + message.executorResult = object.executorResult ?? 0; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yesCount: "", abstainCount: "", noCount: "", noWithVetoCount: "" }; +} + +export const TallyResult: MessageFns = { + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yesCount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstainCount = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.noCount = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.noWithVetoCount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? globalThis.String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) ? globalThis.String(object.abstainCount) : "", + noCount: isSet(object.noCount) ? globalThis.String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) ? globalThis.String(object.noWithVetoCount) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yesCount !== "") { + obj.yesCount = message.yesCount; + } + if (message.abstainCount !== "") { + obj.abstainCount = message.abstainCount; + } + if (message.noCount !== "") { + obj.noCount = message.noCount; + } + if (message.noWithVetoCount !== "") { + obj.noWithVetoCount = message.noWithVetoCount; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposalId: 0, voter: "", option: 0, metadata: "", submitTime: undefined }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== 0) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposalId = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.metadata = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) ? globalThis.Number(object.proposalId) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? globalThis.String(object.metadata) : "", + submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposalId !== 0) { + obj.proposalId = Math.round(message.proposalId); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + if (message.submitTime !== undefined) { + obj.submitTime = message.submitTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.submitTime = object.submitTime ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/module/v1/module.ts new file mode 100644 index 00000000..233c0dd3 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/module/v1/module.ts @@ -0,0 +1,116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.module.v1"; + +/** Module is the config object of the mint module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { feeCollectorName: "", authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.feeCollectorName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + feeCollectorName: isSet(object.feeCollectorName) ? globalThis.String(object.feeCollectorName) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.feeCollectorName !== "") { + obj.feeCollectorName = message.feeCollectorName; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 00000000..d5580d2d --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,124 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** params defines all the parameters of the module. */ + params: Params | undefined; +} + +function createBaseGenesisState(): GenesisState { + return { minter: undefined, params: undefined }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.minter = Minter.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.minter !== undefined) { + obj.minter = Minter.toJSON(message.minter); + } + 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.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/mint.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 00000000..c9b14ff0 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,285 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/mint.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** Minter represents the minting state. */ +export interface Minter { + /** current annual inflation rate */ + inflation: string; + /** current annual expected provisions */ + annualProvisions: string; +} + +/** Params defines the parameters for the x/mint module. */ +export interface Params { + /** type of coin to mint */ + mintDenom: string; + /** maximum annual change in inflation rate */ + inflationRateChange: string; + /** maximum inflation rate */ + inflationMax: string; + /** minimum inflation rate */ + inflationMin: string; + /** goal of percent bonded atoms */ + goalBonded: string; + /** expected blocks per year */ + blocksPerYear: number; +} + +function createBaseMinter(): Minter { + return { inflation: "", annualProvisions: "" }; +} + +export const Minter: MessageFns = { + encode(message: Minter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation !== "") { + writer.uint32(10).string(message.inflation); + } + if (message.annualProvisions !== "") { + writer.uint32(18).string(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Minter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.annualProvisions = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Minter { + return { + inflation: isSet(object.inflation) ? globalThis.String(object.inflation) : "", + annualProvisions: isSet(object.annualProvisions) ? globalThis.String(object.annualProvisions) : "", + }; + }, + + toJSON(message: Minter): unknown { + const obj: any = {}; + if (message.inflation !== "") { + obj.inflation = message.inflation; + } + if (message.annualProvisions !== "") { + obj.annualProvisions = message.annualProvisions; + } + return obj; + }, + + create, I>>(base?: I): Minter { + return Minter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Minter { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annualProvisions = object.annualProvisions ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + mintDenom: "", + inflationRateChange: "", + inflationMax: "", + inflationMin: "", + goalBonded: "", + blocksPerYear: 0, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mintDenom !== "") { + writer.uint32(10).string(message.mintDenom); + } + if (message.inflationRateChange !== "") { + writer.uint32(18).string(message.inflationRateChange); + } + if (message.inflationMax !== "") { + writer.uint32(26).string(message.inflationMax); + } + if (message.inflationMin !== "") { + writer.uint32(34).string(message.inflationMin); + } + if (message.goalBonded !== "") { + writer.uint32(42).string(message.goalBonded); + } + if (message.blocksPerYear !== 0) { + writer.uint32(48).uint64(message.blocksPerYear); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.mintDenom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.inflationRateChange = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.inflationMax = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.inflationMin = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.goalBonded = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.blocksPerYear = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + mintDenom: isSet(object.mintDenom) ? globalThis.String(object.mintDenom) : "", + inflationRateChange: isSet(object.inflationRateChange) ? globalThis.String(object.inflationRateChange) : "", + inflationMax: isSet(object.inflationMax) ? globalThis.String(object.inflationMax) : "", + inflationMin: isSet(object.inflationMin) ? globalThis.String(object.inflationMin) : "", + goalBonded: isSet(object.goalBonded) ? globalThis.String(object.goalBonded) : "", + blocksPerYear: isSet(object.blocksPerYear) ? globalThis.Number(object.blocksPerYear) : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.mintDenom !== "") { + obj.mintDenom = message.mintDenom; + } + if (message.inflationRateChange !== "") { + obj.inflationRateChange = message.inflationRateChange; + } + if (message.inflationMax !== "") { + obj.inflationMax = message.inflationMax; + } + if (message.inflationMin !== "") { + obj.inflationMin = message.inflationMin; + } + if (message.goalBonded !== "") { + obj.goalBonded = message.goalBonded; + } + if (message.blocksPerYear !== 0) { + obj.blocksPerYear = Math.round(message.blocksPerYear); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.mintDenom = object.mintDenom ?? ""; + message.inflationRateChange = object.inflationRateChange ?? ""; + message.inflationMax = object.inflationMax ?? ""; + message.inflationMin = object.inflationMin ?? ""; + message.goalBonded = object.goalBonded ?? ""; + message.blocksPerYear = object.blocksPerYear ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/query.ts new file mode 100644 index 00000000..c90cf9db --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,450 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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. */ + annualProvisions: Uint8Array; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryInflationRequest(): QueryInflationRequest { + return {}; +} + +export const QueryInflationRequest: MessageFns = { + encode(_: QueryInflationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryInflationRequest { + return {}; + }, + + toJSON(_: QueryInflationRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryInflationRequest { + return QueryInflationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, +}; + +function createBaseQueryInflationResponse(): QueryInflationResponse { + return { inflation: new Uint8Array(0) }; +} + +export const QueryInflationResponse: MessageFns = { + encode(message: QueryInflationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.inflation = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryInflationResponse { + return { inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array(0) }; + }, + + toJSON(message: QueryInflationResponse): unknown { + const obj: any = {}; + if (message.inflation.length !== 0) { + obj.inflation = base64FromBytes(message.inflation); + } + return obj; + }, + + create, I>>(base?: I): QueryInflationResponse { + return QueryInflationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { + return {}; +} + +export const QueryAnnualProvisionsRequest: MessageFns = { + encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAnnualProvisionsRequest { + return {}; + }, + + toJSON(_: QueryAnnualProvisionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { + return { annualProvisions: new Uint8Array(0) }; +} + +export const QueryAnnualProvisionsResponse: MessageFns = { + encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.annualProvisions.length !== 0) { + writer.uint32(10).bytes(message.annualProvisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.annualProvisions = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAnnualProvisionsResponse { + return { + annualProvisions: isSet(object.annualProvisions) ? bytesFromBase64(object.annualProvisions) : new Uint8Array(0), + }; + }, + + toJSON(message: QueryAnnualProvisionsResponse): unknown { + const obj: any = {}; + if (message.annualProvisions.length !== 0) { + obj.annualProvisions = base64FromBytes(message.annualProvisions); + } + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annualProvisions = object.annualProvisions ?? new Uint8Array(0); + 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 const QueryServiceName = "cosmos.mint.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/tx.ts new file mode 100644 index 00000000..c3d6285e --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/mint/v1beta1/tx.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/mint/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./mint"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/mint parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the x/mint Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/mint module + * parameters. The authority is defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.mint.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 || 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/msg/textual/v1/textual.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/msg/textual/v1/textual.ts new file mode 100644 index 00000000..cb8b705c --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/msg/textual/v1/textual.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/textual/v1/textual.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.textual.v1"; diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/module/v1/module.ts new file mode 100644 index 00000000..6a444831 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.nft.module.v1"; + +/** Module is the config object of the nft module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/event.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/event.ts new file mode 100644 index 00000000..81e4fb5e --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/event.ts @@ -0,0 +1,349 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** EventSend is emitted on Msg/Send */ +export interface EventSend { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} + +/** EventMint is emitted on Mint */ +export interface EventMint { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} + +/** EventBurn is emitted on Burn */ +export interface EventBurn { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} + +function createBaseEventSend(): EventSend { + return { classId: "", id: "", sender: "", receiver: "" }; +} + +export const EventSend: MessageFns = { + encode(message: EventSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + 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: BinaryReader | Uint8Array, length?: number): EventSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.receiver = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSend { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", + }; + }, + + toJSON(message: EventSend): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + + create, I>>(base?: I): EventSend { + return EventSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSend { + const message = createBaseEventSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseEventMint(): EventMint { + return { classId: "", id: "", owner: "" }; +} + +export const EventMint: MessageFns = { + encode(message: EventMint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventMint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventMint { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: EventMint): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): EventMint { + return EventMint.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventMint { + const message = createBaseEventMint(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseEventBurn(): EventBurn { + return { classId: "", id: "", owner: "" }; +} + +export const EventBurn: MessageFns = { + encode(message: EventBurn, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventBurn { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventBurn { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: EventBurn): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): EventBurn { + return EventBurn.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventBurn { + const message = createBaseEventBurn(); + message.classId = object.classId ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/genesis.ts new file mode 100644 index 00000000..e310a55d --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/genesis.ts @@ -0,0 +1,200 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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[]; + /** entry defines all nft owned by a person. */ + 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: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + Entry.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.classes.push(Class.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(Entry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + classes: globalThis.Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => Entry.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.classes?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => Entry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Entry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Entry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.owner = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Entry { + return { + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + nfts: globalThis.Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + }; + }, + + toJSON(message: Entry): unknown { + const obj: any = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Entry { + return Entry.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/nft.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/nft.ts new file mode 100644 index 00000000..bbfc88c2 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/nft.ts @@ -0,0 +1,336 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/nft.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 */ + uriHash: string; + /** data is the app specific metadata of the NFT class. Optional */ + data: Any | undefined; +} + +/** NFT defines the NFT. */ +export interface NFT { + /** class_id associated with the NFT, similar to the contract address of ERC721 */ + classId: 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 */ + uriHash: string; + /** data is an app specific data of the NFT. Optional */ + data: Any | undefined; +} + +function createBaseClass(): Class { + return { id: "", name: "", symbol: "", description: "", uri: "", uriHash: "", data: undefined }; +} + +export const Class: MessageFns = { + encode(message: Class, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.uriHash !== "") { + writer.uint32(50).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Class { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.symbol = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.description = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.uri = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.uriHash = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Class { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: Class): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): Class { + return Class.fromPartial(base ?? ({} as any)); + }, + 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.uriHash = object.uriHash ?? ""; + message.data = (object.data !== undefined && object.data !== null) ? Any.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseNFT(): NFT { + return { classId: "", id: "", uri: "", uriHash: "", data: undefined }; +} + +export const NFT: MessageFns = { + encode(message: NFT, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.uri !== "") { + writer.uint32(26).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(34).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NFT { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.uri = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.uriHash = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NFT { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: NFT): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): NFT { + return NFT.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NFT { + const message = createBaseNFT(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/query.ts new file mode 100644 index 00000000..869693cd --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/query.ts @@ -0,0 +1,1152 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; +} + +/** QueryBalanceResponse is the response type for the Query/Balance RPC method */ +export interface QueryBalanceResponse { + /** amount is the number of all NFTs of a given class owned by the owner */ + amount: number; +} + +/** QueryOwnerRequest is the request type for the Query/Owner RPC method */ +export interface QueryOwnerRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} + +/** QueryOwnerResponse is the response type for the Query/Owner RPC method */ +export interface QueryOwnerResponse { + /** owner is the owner address of the nft */ + owner: string; +} + +/** QuerySupplyRequest is the request type for the Query/Supply RPC method */ +export interface QuerySupplyRequest { + /** class_id associated with the nft */ + classId: string; +} + +/** QuerySupplyResponse is the response type for the Query/Supply RPC method */ +export interface QuerySupplyResponse { + /** amount is the number of all NFTs from the given class */ + amount: number; +} + +/** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ +export interface QueryNFTsRequest { + /** class_id associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ +export interface QueryNFTsResponse { + /** NFT defines the NFT */ + nfts: NFT[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryNFTRequest is the request type for the Query/NFT RPC method */ +export interface QueryNFTRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} + +/** QueryNFTResponse is the response type for the Query/NFT RPC method */ +export interface QueryNFTResponse { + /** owner is the owner address of the nft */ + nft: NFT | undefined; +} + +/** QueryClassRequest is the request type for the Query/Class RPC method */ +export interface QueryClassRequest { + /** class_id associated with the nft */ + classId: string; +} + +/** QueryClassResponse is the response type for the Query/Class RPC method */ +export interface QueryClassResponse { + /** class defines the class of the nft type. */ + class: Class | undefined; +} + +/** QueryClassesRequest is the request type for the Query/Classes RPC method */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** QueryClassesResponse is the response type for the Query/Classes RPC method */ +export interface QueryClassesResponse { + /** class defines the class of the nft type. */ + classes: Class[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { classId: "", owner: "" }; +} + +export const QueryBalanceRequest: MessageFns = { + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.classId = object.classId ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { amount: 0 }; +} + +export const QueryBalanceResponse: MessageFns = { + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.amount = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; + +function createBaseQueryOwnerRequest(): QueryOwnerRequest { + return { classId: "", id: "" }; +} + +export const QueryOwnerRequest: MessageFns = { + encode(message: QueryOwnerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryOwnerRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: QueryOwnerRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): QueryOwnerRequest { + return QueryOwnerRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryOwnerRequest { + const message = createBaseQueryOwnerRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryOwnerResponse(): QueryOwnerResponse { + return { owner: "" }; +} + +export const QueryOwnerResponse: MessageFns = { + encode(message: QueryOwnerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryOwnerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.owner = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryOwnerResponse { + return { owner: isSet(object.owner) ? globalThis.String(object.owner) : "" }; + }, + + toJSON(message: QueryOwnerResponse): unknown { + const obj: any = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + + create, I>>(base?: I): QueryOwnerResponse { + return QueryOwnerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryOwnerResponse { + const message = createBaseQueryOwnerResponse(); + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyRequest(): QuerySupplyRequest { + return { classId: "" }; +} + +export const QuerySupplyRequest: MessageFns = { + encode(message: QuerySupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyRequest { + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; + }, + + toJSON(message: QuerySupplyRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyRequest { + return QuerySupplyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyRequest { + const message = createBaseQuerySupplyRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyResponse(): QuerySupplyResponse { + return { amount: 0 }; +} + +export const QuerySupplyResponse: MessageFns = { + encode(message: QuerySupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.amount = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyResponse { + return { amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0 }; + }, + + toJSON(message: QuerySupplyResponse): unknown { + const obj: any = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyResponse { + return QuerySupplyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyResponse { + const message = createBaseQuerySupplyResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; + +function createBaseQueryNFTsRequest(): QueryNFTsRequest { + return { classId: "", owner: "", pagination: undefined }; +} + +export const QueryNFTsRequest: MessageFns = { + encode(message: QueryNFTsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.owner = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTsRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryNFTsRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTsRequest { + return QueryNFTsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryNFTsRequest { + const message = createBaseQueryNFTsRequest(); + message.classId = object.classId ?? ""; + 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: MessageFns = { + encode(message: QueryNFTsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTsResponse { + return { + nfts: globalThis.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?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTsResponse { + return QueryNFTsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { classId: "", id: "" }; +} + +export const QueryNFTRequest: MessageFns = { + encode(message: QueryNFTRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTRequest { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: QueryNFTRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): QueryNFTRequest { + return QueryNFTRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryNFTRequest { + const message = createBaseQueryNFTRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryNFTResponse(): QueryNFTResponse { + return { nft: undefined }; +} + +export const QueryNFTResponse: MessageFns = { + encode(message: QueryNFTResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nft !== undefined) { + NFT.encode(message.nft, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNFTResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.nft = NFT.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNFTResponse { + return { nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined }; + }, + + toJSON(message: QueryNFTResponse): unknown { + const obj: any = {}; + if (message.nft !== undefined) { + obj.nft = NFT.toJSON(message.nft); + } + return obj; + }, + + create, I>>(base?: I): QueryNFTResponse { + return QueryNFTResponse.fromPartial(base ?? ({} as any)); + }, + 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 { classId: "" }; +} + +export const QueryClassRequest: MessageFns = { + encode(message: QueryClassRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassRequest { + return { classId: isSet(object.classId) ? globalThis.String(object.classId) : "" }; + }, + + toJSON(message: QueryClassRequest): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + + create, I>>(base?: I): QueryClassRequest { + return QueryClassRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryClassRequest { + const message = createBaseQueryClassRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; + +function createBaseQueryClassResponse(): QueryClassResponse { + return { class: undefined }; +} + +export const QueryClassResponse: MessageFns = { + encode(message: QueryClassResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.class !== undefined) { + Class.encode(message.class, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.class = Class.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassResponse { + return { class: isSet(object.class) ? Class.fromJSON(object.class) : undefined }; + }, + + toJSON(message: QueryClassResponse): unknown { + const obj: any = {}; + if (message.class !== undefined) { + obj.class = Class.toJSON(message.class); + } + return obj; + }, + + create, I>>(base?: I): QueryClassResponse { + return QueryClassResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryClassesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryClassesRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryClassesRequest { + return QueryClassesRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryClassesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryClassesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.classes.push(Class.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryClassesResponse { + return { + classes: globalThis.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?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryClassesResponse { + return QueryClassesResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.nft.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/tx.ts new file mode 100644 index 00000000..63ad423f --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/nft/v1beta1/tx.ts @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/nft/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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 */ + classId: 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 { classId: "", id: "", sender: "", receiver: "" }; +} + +export const MsgSend: MessageFns = { + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + 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: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.classId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.receiver = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "", + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse: MessageFns = { + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + 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 const MsgServiceName = "cosmos.nft.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 || MsgServiceName; + 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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts new file mode 100644 index 00000000..053430b5 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/module/v1alpha1/module.ts @@ -0,0 +1,82 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/module/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.module.v1alpha1"; + +/** + * Module defines the ORM module which adds providers to the app container for + * ORM ModuleDB's and in the future will automatically register query + * services for modules that use the ORM. + */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts new file mode 100644 index 00000000..da9a277e --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/query/v1alpha1/query.ts @@ -0,0 +1,911 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/query/v1alpha1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Duration } from "../../../../google/protobuf/duration"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { PageRequest, PageResponse } from "../../../base/query/v1beta1/pagination"; + +export const protobufPackage = "cosmos.orm.query.v1alpha1"; + +/** GetRequest is the Query/Get request type. */ +export interface GetRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. If it is non-empty, it must + * refer to an unique index. + */ + index: string; + /** + * values are the values of the fields corresponding to the requested index. + * There must be as many values provided as there are fields in the index and + * these values must correspond to the index field types. + */ + values: IndexValue[]; +} + +/** GetResponse is the Query/Get response type. */ +export interface GetResponse { + /** + * result is the result of the get query. If no value is found, the gRPC + * status code NOT_FOUND will be returned. + */ + result: Any | undefined; +} + +/** ListRequest is the Query/List request type. */ +export interface ListRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. + */ + index: string; + /** prefix defines a prefix query. */ + prefix?: + | ListRequest_Prefix + | undefined; + /** range defines a range query. */ + range?: + | ListRequest_Range + | undefined; + /** pagination is the pagination request. */ + pagination: PageRequest | undefined; +} + +/** Prefix specifies the arguments to a prefix query. */ +export interface ListRequest_Prefix { + /** + * values specifies the index values for the prefix query. + * It is valid to special a partial prefix with fewer values than + * the number of fields in the index. + */ + values: IndexValue[]; +} + +/** Range specifies the arguments to a range query. */ +export interface ListRequest_Range { + /** + * start specifies the starting index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + start: IndexValue[]; + /** + * end specifies the inclusive ending index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + end: IndexValue[]; +} + +/** ListResponse is the Query/List response type. */ +export interface ListResponse { + /** results are the results of the query. */ + results: Any[]; + /** pagination is the pagination response. */ + pagination: PageResponse | undefined; +} + +/** IndexValue represents the value of a field in an ORM index expression. */ +export interface IndexValue { + /** + * uint specifies a value for an uint32, fixed32, uint64, or fixed64 + * index field. + */ + uint?: + | number + | undefined; + /** + * int64 specifies a value for an int32, sfixed32, int64, or sfixed64 + * index field. + */ + int?: + | number + | undefined; + /** str specifies a value for a string index field. */ + str?: + | string + | undefined; + /** bytes specifies a value for a bytes index field. */ + bytes?: + | Uint8Array + | undefined; + /** enum specifies a value for an enum index field. */ + enum?: + | string + | undefined; + /** bool specifies a value for a bool index field. */ + bool?: + | boolean + | undefined; + /** timestamp specifies a value for a timestamp index field. */ + timestamp?: + | Date + | undefined; + /** duration specifies a value for a duration index field. */ + duration?: Duration | undefined; +} + +function createBaseGetRequest(): GetRequest { + return { messageName: "", index: "", values: [] }; +} + +export const GetRequest: MessageFns = { + encode(message: GetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: GetRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GetRequest { + return GetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetRequest { + const message = createBaseGetRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetResponse(): GetResponse { + return { result: undefined }; +} + +export const GetResponse: MessageFns = { + encode(message: GetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== undefined) { + Any.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.result = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetResponse { + return { result: isSet(object.result) ? Any.fromJSON(object.result) : undefined }; + }, + + toJSON(message: GetResponse): unknown { + const obj: any = {}; + if (message.result !== undefined) { + obj.result = Any.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): GetResponse { + return GetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetResponse { + const message = createBaseGetResponse(); + message.result = (object.result !== undefined && object.result !== null) + ? Any.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseListRequest(): ListRequest { + return { messageName: "", index: "", prefix: undefined, range: undefined, pagination: undefined }; +} + +export const ListRequest: MessageFns = { + encode(message: ListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + if (message.prefix !== undefined) { + ListRequest_Prefix.encode(message.prefix, writer.uint32(26).fork()).join(); + } + if (message.range !== undefined) { + ListRequest_Range.encode(message.range, writer.uint32(34).fork()).join(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.prefix = ListRequest_Prefix.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.range = ListRequest_Range.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest { + return { + messageName: isSet(object.messageName) ? globalThis.String(object.messageName) : "", + index: isSet(object.index) ? globalThis.String(object.index) : "", + prefix: isSet(object.prefix) ? ListRequest_Prefix.fromJSON(object.prefix) : undefined, + range: isSet(object.range) ? ListRequest_Range.fromJSON(object.range) : undefined, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListRequest): unknown { + const obj: any = {}; + if (message.messageName !== "") { + obj.messageName = message.messageName; + } + if (message.index !== "") { + obj.index = message.index; + } + if (message.prefix !== undefined) { + obj.prefix = ListRequest_Prefix.toJSON(message.prefix); + } + if (message.range !== undefined) { + obj.range = ListRequest_Range.toJSON(message.range); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListRequest { + return ListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest { + const message = createBaseListRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.prefix = (object.prefix !== undefined && object.prefix !== null) + ? ListRequest_Prefix.fromPartial(object.prefix) + : undefined; + message.range = (object.range !== undefined && object.range !== null) + ? ListRequest_Range.fromPartial(object.range) + : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseListRequest_Prefix(): ListRequest_Prefix { + return { values: [] }; +} + +export const ListRequest_Prefix: MessageFns = { + encode(message: ListRequest_Prefix, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Prefix { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Prefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.values.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Prefix { + return { + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Prefix): unknown { + const obj: any = {}; + if (message.values?.length) { + obj.values = message.values.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Prefix { + return ListRequest_Prefix.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Prefix { + const message = createBaseListRequest_Prefix(); + message.values = object.values?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListRequest_Range(): ListRequest_Range { + return { start: [], end: [] }; +} + +export const ListRequest_Range: MessageFns = { + encode(message: ListRequest_Range, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.start) { + IndexValue.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.end) { + IndexValue.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Range { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Range(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.start.push(IndexValue.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.end.push(IndexValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListRequest_Range { + return { + start: globalThis.Array.isArray(object?.start) ? object.start.map((e: any) => IndexValue.fromJSON(e)) : [], + end: globalThis.Array.isArray(object?.end) ? object.end.map((e: any) => IndexValue.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListRequest_Range): unknown { + const obj: any = {}; + if (message.start?.length) { + obj.start = message.start.map((e) => IndexValue.toJSON(e)); + } + if (message.end?.length) { + obj.end = message.end.map((e) => IndexValue.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListRequest_Range { + return ListRequest_Range.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListRequest_Range { + const message = createBaseListRequest_Range(); + message.start = object.start?.map((e) => IndexValue.fromPartial(e)) || []; + message.end = object.end?.map((e) => IndexValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListResponse(): ListResponse { + return { results: [], pagination: undefined }; +} + +export const ListResponse: MessageFns = { + encode(message: ListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(Any.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: ListResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): ListResponse { + return ListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListResponse { + const message = createBaseListResponse(); + message.results = object.results?.map((e) => Any.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseIndexValue(): IndexValue { + return { + uint: undefined, + int: undefined, + str: undefined, + bytes: undefined, + enum: undefined, + bool: undefined, + timestamp: undefined, + duration: undefined, + }; +} + +export const IndexValue: MessageFns = { + encode(message: IndexValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uint !== undefined) { + writer.uint32(8).uint64(message.uint); + } + if (message.int !== undefined) { + writer.uint32(16).int64(message.int); + } + if (message.str !== undefined) { + writer.uint32(26).string(message.str); + } + if (message.bytes !== undefined) { + writer.uint32(34).bytes(message.bytes); + } + if (message.enum !== undefined) { + writer.uint32(42).string(message.enum); + } + if (message.bool !== undefined) { + writer.uint32(48).bool(message.bool); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(58).fork()).join(); + } + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.uint = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.int = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.str = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.enum = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.bool = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.duration = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexValue { + return { + uint: isSet(object.uint) ? globalThis.Number(object.uint) : undefined, + int: isSet(object.int) ? globalThis.Number(object.int) : undefined, + str: isSet(object.str) ? globalThis.String(object.str) : undefined, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : undefined, + enum: isSet(object.enum) ? globalThis.String(object.enum) : undefined, + bool: isSet(object.bool) ? globalThis.Boolean(object.bool) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + }; + }, + + toJSON(message: IndexValue): unknown { + const obj: any = {}; + if (message.uint !== undefined) { + obj.uint = Math.round(message.uint); + } + if (message.int !== undefined) { + obj.int = Math.round(message.int); + } + if (message.str !== undefined) { + obj.str = message.str; + } + if (message.bytes !== undefined) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.enum !== undefined) { + obj.enum = message.enum; + } + if (message.bool !== undefined) { + obj.bool = message.bool; + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.duration !== undefined) { + obj.duration = Duration.toJSON(message.duration); + } + return obj; + }, + + create, I>>(base?: I): IndexValue { + return IndexValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexValue { + const message = createBaseIndexValue(); + message.uint = object.uint ?? undefined; + message.int = object.int ?? undefined; + message.str = object.str ?? undefined; + message.bytes = object.bytes ?? undefined; + message.enum = object.enum ?? undefined; + message.bool = object.bool ?? undefined; + message.timestamp = object.timestamp ?? undefined; + message.duration = (object.duration !== undefined && object.duration !== null) + ? Duration.fromPartial(object.duration) + : undefined; + return message; + }, +}; + +/** Query is a generic gRPC service for querying ORM data. */ +export interface Query { + /** Get queries an ORM table against an unique index. */ + Get(request: GetRequest): Promise; + /** List queries an ORM table against an index. */ + List(request: ListRequest): Promise; +} + +export const QueryServiceName = "cosmos.orm.query.v1alpha1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Get = this.Get.bind(this); + this.List = this.List.bind(this); + } + Get(request: GetRequest): Promise { + const data = GetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Get", data); + return promise.then((data) => GetResponse.decode(new BinaryReader(data))); + } + + List(request: ListRequest): Promise { + const data = ListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "List", data); + return promise.then((data) => ListResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/v1/orm.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/v1/orm.ts new file mode 100644 index 00000000..e13476dc --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/v1/orm.ts @@ -0,0 +1,444 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1/orm.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1"; + +/** TableDescriptor describes an ORM table. */ +export interface TableDescriptor { + /** primary_key defines the primary key for the table. */ + primaryKey: + | PrimaryKeyDescriptor + | undefined; + /** 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 is encoded such that values with only seconds occupy 6 bytes, + * values including nanos occupy 9 bytes, and nil values occupy 1 byte. When iterating, nil + * values will always be ordered last. Seconds and nanos values must conform to the officially + * specified ranges of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z and 0 to 999,999,999 respectively. + * - google.protobuf.Duration is 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. + */ + autoIncrement: 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 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 { primaryKey: undefined, index: [], id: 0 }; +} + +export const TableDescriptor: MessageFns = { + encode(message: TableDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.primaryKey !== undefined) { + PrimaryKeyDescriptor.encode(message.primaryKey, writer.uint32(10).fork()).join(); + } + for (const v of message.index) { + SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.id !== 0) { + writer.uint32(24).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TableDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.primaryKey = PrimaryKeyDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index.push(SecondaryIndexDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TableDescriptor { + return { + primaryKey: isSet(object.primaryKey) ? PrimaryKeyDescriptor.fromJSON(object.primaryKey) : undefined, + index: globalThis.Array.isArray(object?.index) + ? object.index.map((e: any) => SecondaryIndexDescriptor.fromJSON(e)) + : [], + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + }; + }, + + toJSON(message: TableDescriptor): unknown { + const obj: any = {}; + if (message.primaryKey !== undefined) { + obj.primaryKey = PrimaryKeyDescriptor.toJSON(message.primaryKey); + } + if (message.index?.length) { + obj.index = message.index.map((e) => SecondaryIndexDescriptor.toJSON(e)); + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): TableDescriptor { + return TableDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TableDescriptor { + const message = createBaseTableDescriptor(); + message.primaryKey = (object.primaryKey !== undefined && object.primaryKey !== null) + ? PrimaryKeyDescriptor.fromPartial(object.primaryKey) + : undefined; + message.index = object.index?.map((e) => SecondaryIndexDescriptor.fromPartial(e)) || []; + message.id = object.id ?? 0; + return message; + }, +}; + +function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { + return { fields: "", autoIncrement: false }; +} + +export const PrimaryKeyDescriptor: MessageFns = { + encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.autoIncrement !== false) { + writer.uint32(16).bool(message.autoIncrement); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrimaryKeyDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.autoIncrement = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrimaryKeyDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + autoIncrement: isSet(object.autoIncrement) ? globalThis.Boolean(object.autoIncrement) : false, + }; + }, + + toJSON(message: PrimaryKeyDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.autoIncrement !== false) { + obj.autoIncrement = message.autoIncrement; + } + return obj; + }, + + create, I>>(base?: I): PrimaryKeyDescriptor { + return PrimaryKeyDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrimaryKeyDescriptor { + const message = createBasePrimaryKeyDescriptor(); + message.fields = object.fields ?? ""; + message.autoIncrement = object.autoIncrement ?? false; + return message; + }, +}; + +function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { + return { fields: "", id: 0, unique: false }; +} + +export const SecondaryIndexDescriptor: MessageFns = { + encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.id !== 0) { + writer.uint32(16).uint32(message.id); + } + if (message.unique !== false) { + writer.uint32(24).bool(message.unique); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecondaryIndexDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.fields = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.id = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.unique = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SecondaryIndexDescriptor { + return { + fields: isSet(object.fields) ? globalThis.String(object.fields) : "", + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + unique: isSet(object.unique) ? globalThis.Boolean(object.unique) : false, + }; + }, + + toJSON(message: SecondaryIndexDescriptor): unknown { + const obj: any = {}; + if (message.fields !== "") { + obj.fields = message.fields; + } + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.unique !== false) { + obj.unique = message.unique; + } + return obj; + }, + + create, I>>(base?: I): SecondaryIndexDescriptor { + return SecondaryIndexDescriptor.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: SingletonDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SingletonDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SingletonDescriptor { + return { id: isSet(object.id) ? globalThis.Number(object.id) : 0 }; + }, + + toJSON(message: SingletonDescriptor): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): SingletonDescriptor { + return SingletonDescriptor.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/v1alpha1/schema.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/v1alpha1/schema.ts new file mode 100644 index 00000000..e326c1bc --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/orm/v1alpha1/schema.ts @@ -0,0 +1,316 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/orm/v1alpha1/schema.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.orm.v1alpha1"; + +/** StorageType */ +export enum StorageType { + /** + * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent storage where all + * data is stored in the regular Merkle-tree backed KV-store. + */ + 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, + 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 -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.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptor { + schemaFile: 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. + */ + protoFileName: 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. + */ + storageType: StorageType; +} + +function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { + return { schemaFile: [], prefix: new Uint8Array(0) }; +} + +export const ModuleSchemaDescriptor: MessageFns = { + encode(message: ModuleSchemaDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.schemaFile) { + ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.schemaFile.push(ModuleSchemaDescriptor_FileEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.prefix = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor { + return { + schemaFile: globalThis.Array.isArray(object?.schemaFile) + ? object.schemaFile.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)) + : [], + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0), + }; + }, + + toJSON(message: ModuleSchemaDescriptor): unknown { + const obj: any = {}; + if (message.schemaFile?.length) { + obj.schemaFile = message.schemaFile.map((e) => ModuleSchemaDescriptor_FileEntry.toJSON(e)); + } + if (message.prefix.length !== 0) { + obj.prefix = base64FromBytes(message.prefix); + } + return obj; + }, + + create, I>>(base?: I): ModuleSchemaDescriptor { + return ModuleSchemaDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schemaFile = object.schemaFile?.map((e) => ModuleSchemaDescriptor_FileEntry.fromPartial(e)) || []; + message.prefix = object.prefix ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { + return { id: 0, protoFileName: "", storageType: 0 }; +} + +export const ModuleSchemaDescriptor_FileEntry: MessageFns = { + encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.protoFileName !== "") { + writer.uint32(18).string(message.protoFileName); + } + if (message.storageType !== 0) { + writer.uint32(24).int32(message.storageType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor_FileEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.protoFileName = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.storageType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor_FileEntry { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + protoFileName: isSet(object.protoFileName) ? globalThis.String(object.protoFileName) : "", + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : 0, + }; + }, + + toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.protoFileName !== "") { + obj.protoFileName = message.protoFileName; + } + if (message.storageType !== 0) { + obj.storageType = storageTypeToJSON(message.storageType); + } + return obj; + }, + + create, I>>( + base?: I, + ): ModuleSchemaDescriptor_FileEntry { + return ModuleSchemaDescriptor_FileEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + message.id = object.id ?? 0; + message.protoFileName = object.protoFileName ?? ""; + message.storageType = object.storageType ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/module/v1/module.ts new file mode 100644 index 00000000..731379ce --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.params.module.v1"; + +/** Module is the config object of the params module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/v1beta1/params.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/v1beta1/params.ts new file mode 100644 index 00000000..24070188 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/v1beta1/params.ts @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: MessageFns = { + encode(message: ParameterChangeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParameterChangeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changes.push(ParamChange.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParameterChangeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + changes: globalThis.Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [], + }; + }, + + toJSON(message: ParameterChangeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.changes?.length) { + obj.changes = message.changes.map((e) => ParamChange.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ParameterChangeProposal { + return ParameterChangeProposal.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ParamChange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ParamChange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParamChange { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: ParamChange): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ParamChange { + return ParamChange.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/v1beta1/query.ts new file mode 100644 index 00000000..d45f57cd --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/params/v1beta1/query.ts @@ -0,0 +1,433 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/params/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesRequest { +} + +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesResponse { + subspaces: Subspace[]; +} + +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface Subspace { + subspace: string; + keys: string[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { subspace: "", key: "" }; +} + +export const QueryParamsRequest: MessageFns = { + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.param !== undefined) { + ParamChange.encode(message.param, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.param = ParamChange.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.param !== undefined) { + obj.param = ParamChange.toJSON(message.param); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QuerySubspacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QuerySubspacesRequest { + return {}; + }, + + toJSON(_: QuerySubspacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QuerySubspacesRequest { + return QuerySubspacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, +}; + +function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { + return { subspaces: [] }; +} + +export const QuerySubspacesResponse: MessageFns = { + encode(message: QuerySubspacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.subspaces) { + Subspace.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspaces.push(Subspace.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySubspacesResponse { + return { + subspaces: globalThis.Array.isArray(object?.subspaces) + ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QuerySubspacesResponse): unknown { + const obj: any = {}; + if (message.subspaces?.length) { + obj.subspaces = message.subspaces.map((e) => Subspace.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QuerySubspacesResponse { + return QuerySubspacesResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Subspace, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + for (const v of message.keys) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Subspace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keys.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Subspace { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: Subspace): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.keys?.length) { + obj.keys = message.keys; + } + return obj; + }, + + create, I>>(base?: I): Subspace { + return Subspace.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + Subspaces(request: QuerySubspacesRequest): Promise; +} + +export const QueryServiceName = "cosmos.params.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/query/v1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/query/v1/query.ts new file mode 100644 index 00000000..bcdfc76d --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/query/v1/query.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/query/v1/query.proto + +/* eslint-disable */ + +export const protobufPackage = "cosmos.query.v1"; diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/reflection/v1/reflection.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/reflection/v1/reflection.ts new file mode 100644 index 00000000..0962d0d1 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/reflection/v1/reflection.ts @@ -0,0 +1,178 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/reflection/v1/reflection.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { FileDescriptorProto } from "../../../google/protobuf/descriptor"; + +export const protobufPackage = "cosmos.reflection.v1"; + +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequest { +} + +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponse { + /** files is the file descriptors. */ + files: FileDescriptorProto[]; +} + +function createBaseFileDescriptorsRequest(): FileDescriptorsRequest { + return {}; +} + +export const FileDescriptorsRequest: MessageFns = { + encode(_: FileDescriptorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): FileDescriptorsRequest { + return {}; + }, + + toJSON(_: FileDescriptorsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): FileDescriptorsRequest { + return FileDescriptorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): FileDescriptorsRequest { + const message = createBaseFileDescriptorsRequest(); + return message; + }, +}; + +function createBaseFileDescriptorsResponse(): FileDescriptorsResponse { + return { files: [] }; +} + +export const FileDescriptorsResponse: MessageFns = { + encode(message: FileDescriptorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.files) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.files.push(FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileDescriptorsResponse { + return { + files: globalThis.Array.isArray(object?.files) + ? object.files.map((e: any) => FileDescriptorProto.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileDescriptorsResponse): unknown { + const obj: any = {}; + if (message.files?.length) { + obj.files = message.files.map((e) => FileDescriptorProto.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FileDescriptorsResponse { + return FileDescriptorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileDescriptorsResponse { + const message = createBaseFileDescriptorsResponse(); + message.files = object.files?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +/** + * Package cosmos.reflection.v1 provides support for inspecting protobuf + * file descriptors. + */ +export interface ReflectionService { + /** + * FileDescriptors queries all the file descriptors in the app in order + * to enable easier generation of dynamic clients. + */ + FileDescriptors(request: FileDescriptorsRequest): Promise; +} + +export const ReflectionServiceServiceName = "cosmos.reflection.v1.ReflectionService"; +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ReflectionServiceServiceName; + this.rpc = rpc; + this.FileDescriptors = this.FileDescriptors.bind(this); + } + FileDescriptors(request: FileDescriptorsRequest): Promise { + const data = FileDescriptorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FileDescriptors", data); + return promise.then((data) => FileDescriptorsResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/module/v1/module.ts new file mode 100644 index 00000000..bf27cfd0 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.slashing.module.v1"; + +/** Module is the config object of the slashing module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts new file mode 100644 index 00000000..958b6870 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/genesis.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of the module. */ + params: + | Params + | undefined; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signingInfos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missedBlocks: 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. */ + validatorSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * 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. */ + missedBlocks: MissedBlock[]; +} + +/** MissedBlock contains height and missed status as boolean. */ +export interface MissedBlock { + /** index is the height at which the block was missed. */ + index: number; + /** missed is the missed status. */ + missed: boolean; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, signingInfos: [], missedBlocks: [] }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.signingInfos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.missedBlocks) { + ValidatorMissedBlocks.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signingInfos.push(SigningInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.missedBlocks.push(ValidatorMissedBlocks.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signingInfos: globalThis.Array.isArray(object?.signingInfos) + ? object.signingInfos.map((e: any) => SigningInfo.fromJSON(e)) + : [], + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.signingInfos?.length) { + obj.signingInfos = message.signingInfos.map((e) => SigningInfo.toJSON(e)); + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => ValidatorMissedBlocks.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) + ? Params.fromPartial(object.params) + : undefined; + message.signingInfos = object.signingInfos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missedBlocks = object.missedBlocks?.map((e) => ValidatorMissedBlocks.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningInfo(): SigningInfo { + return { address: "", validatorSigningInfo: undefined }; +} + +export const SigningInfo: MessageFns = { + encode(message: SigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.validatorSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.validatorSigningInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + validatorSigningInfo: isSet(object.validatorSigningInfo) + ? ValidatorSigningInfo.fromJSON(object.validatorSigningInfo) + : undefined, + }; + }, + + toJSON(message: SigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.validatorSigningInfo !== undefined) { + obj.validatorSigningInfo = ValidatorSigningInfo.toJSON(message.validatorSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): SigningInfo { + return SigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningInfo { + const message = createBaseSigningInfo(); + message.address = object.address ?? ""; + message.validatorSigningInfo = (object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.validatorSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { + return { address: "", missedBlocks: [] }; +} + +export const ValidatorMissedBlocks: MessageFns = { + encode(message: ValidatorMissedBlocks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.missedBlocks) { + MissedBlock.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorMissedBlocks { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.missedBlocks.push(MissedBlock.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlocks { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + missedBlocks: globalThis.Array.isArray(object?.missedBlocks) + ? object.missedBlocks.map((e: any) => MissedBlock.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorMissedBlocks): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.missedBlocks?.length) { + obj.missedBlocks = message.missedBlocks.map((e) => MissedBlock.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorMissedBlocks { + return ValidatorMissedBlocks.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorMissedBlocks { + const message = createBaseValidatorMissedBlocks(); + message.address = object.address ?? ""; + message.missedBlocks = object.missedBlocks?.map((e) => MissedBlock.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMissedBlock(): MissedBlock { + return { index: 0, missed: false }; +} + +export const MissedBlock: MessageFns = { + encode(message: MissedBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).int64(message.index); + } + if (message.missed !== false) { + writer.uint32(16).bool(message.missed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MissedBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.missed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MissedBlock { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + missed: isSet(object.missed) ? globalThis.Boolean(object.missed) : false, + }; + }, + + toJSON(message: MissedBlock): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.missed !== false) { + obj.missed = message.missed; + } + return obj; + }, + + create, I>>(base?: I): MissedBlock { + return MissedBlock.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 00000000..bc78c27e --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,481 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** + * QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoRequest { + /** cons_address is the address to query signing info of */ + consAddress: 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 */ + valSigningInfo: ValidatorSigningInfo | undefined; +} + +/** + * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosRequest { + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { + return { consAddress: "" }; +} + +export const QuerySigningInfoRequest: MessageFns = { + encode(message: QuerySigningInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consAddress !== "") { + writer.uint32(10).string(message.consAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.consAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoRequest { + return { consAddress: isSet(object.consAddress) ? globalThis.String(object.consAddress) : "" }; + }, + + toJSON(message: QuerySigningInfoRequest): unknown { + const obj: any = {}; + if (message.consAddress !== "") { + obj.consAddress = message.consAddress; + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoRequest { + return QuerySigningInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoRequest { + const message = createBaseQuerySigningInfoRequest(); + message.consAddress = object.consAddress ?? ""; + return message; + }, +}; + +function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { + return { valSigningInfo: undefined }; +} + +export const QuerySigningInfoResponse: MessageFns = { + encode(message: QuerySigningInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.valSigningInfo !== undefined) { + ValidatorSigningInfo.encode(message.valSigningInfo, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.valSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoResponse { + return { + valSigningInfo: isSet(object.valSigningInfo) ? ValidatorSigningInfo.fromJSON(object.valSigningInfo) : undefined, + }; + }, + + toJSON(message: QuerySigningInfoResponse): unknown { + const obj: any = {}; + if (message.valSigningInfo !== undefined) { + obj.valSigningInfo = ValidatorSigningInfo.toJSON(message.valSigningInfo); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoResponse { + return QuerySigningInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoResponse { + const message = createBaseQuerySigningInfoResponse(); + message.valSigningInfo = (object.valSigningInfo !== undefined && object.valSigningInfo !== null) + ? ValidatorSigningInfo.fromPartial(object.valSigningInfo) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { + return { pagination: undefined }; +} + +export const QuerySigningInfosRequest: MessageFns = { + encode(message: QuerySigningInfosRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QuerySigningInfosRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosRequest { + return QuerySigningInfosRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QuerySigningInfosResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.info) { + ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.info.push(ValidatorSigningInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosResponse { + return { + info: globalThis.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?.length) { + obj.info = message.info.map((e) => ValidatorSigningInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosResponse { + return QuerySigningInfosResponse.fromPartial(base ?? ({} as any)); + }, + 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 const QueryServiceName = "cosmos.slashing.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts new file mode 100644 index 00000000..06f87d05 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/slashing.ts @@ -0,0 +1,411 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/slashing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 un-jailed */ + startHeight: number; + /** + * Index which is incremented every time a validator is bonded in a block and + * _may_ have signed a pre-commit or not. This in conjunction with the + * signed_blocks_window param determines the index in the missed block bitmap. + */ + indexOffset: number; + /** Timestamp until which the validator is jailed due to liveness downtime. */ + jailedUntil: + | Date + | undefined; + /** + * 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 misbehavior. + */ + tombstoned: boolean; + /** + * A counter of missed (unsigned) blocks. It is used to avoid unnecessary + * reads in the missed block bitmap. + */ + missedBlocksCounter: number; +} + +/** Params represents the parameters used for by the slashing module. */ +export interface Params { + signedBlocksWindow: number; + minSignedPerWindow: Uint8Array; + downtimeJailDuration: Duration | undefined; + slashFractionDoubleSign: Uint8Array; + slashFractionDowntime: Uint8Array; +} + +function createBaseValidatorSigningInfo(): ValidatorSigningInfo { + return { + address: "", + startHeight: 0, + indexOffset: 0, + jailedUntil: undefined, + tombstoned: false, + missedBlocksCounter: 0, + }; +} + +export const ValidatorSigningInfo: MessageFns = { + encode(message: ValidatorSigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.startHeight !== 0) { + writer.uint32(16).int64(message.startHeight); + } + if (message.indexOffset !== 0) { + writer.uint32(24).int64(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + Timestamp.encode(toTimestamp(message.jailedUntil), writer.uint32(34).fork()).join(); + } + if (message.tombstoned !== false) { + writer.uint32(40).bool(message.tombstoned); + } + if (message.missedBlocksCounter !== 0) { + writer.uint32(48).int64(message.missedBlocksCounter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.indexOffset = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.jailedUntil = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.tombstoned = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.missedBlocksCounter = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + startHeight: isSet(object.startHeight) ? globalThis.Number(object.startHeight) : 0, + indexOffset: isSet(object.indexOffset) ? globalThis.Number(object.indexOffset) : 0, + jailedUntil: isSet(object.jailedUntil) ? fromJsonTimestamp(object.jailedUntil) : undefined, + tombstoned: isSet(object.tombstoned) ? globalThis.Boolean(object.tombstoned) : false, + missedBlocksCounter: isSet(object.missedBlocksCounter) ? globalThis.Number(object.missedBlocksCounter) : 0, + }; + }, + + toJSON(message: ValidatorSigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.startHeight !== 0) { + obj.startHeight = Math.round(message.startHeight); + } + if (message.indexOffset !== 0) { + obj.indexOffset = Math.round(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + obj.jailedUntil = message.jailedUntil.toISOString(); + } + if (message.tombstoned !== false) { + obj.tombstoned = message.tombstoned; + } + if (message.missedBlocksCounter !== 0) { + obj.missedBlocksCounter = Math.round(message.missedBlocksCounter); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSigningInfo { + return ValidatorSigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSigningInfo { + const message = createBaseValidatorSigningInfo(); + message.address = object.address ?? ""; + message.startHeight = object.startHeight ?? 0; + message.indexOffset = object.indexOffset ?? 0; + message.jailedUntil = object.jailedUntil ?? undefined; + message.tombstoned = object.tombstoned ?? false; + message.missedBlocksCounter = object.missedBlocksCounter ?? 0; + return message; + }, +}; + +function createBaseParams(): Params { + return { + signedBlocksWindow: 0, + minSignedPerWindow: new Uint8Array(0), + downtimeJailDuration: undefined, + slashFractionDoubleSign: new Uint8Array(0), + slashFractionDowntime: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedBlocksWindow !== 0) { + writer.uint32(8).int64(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + writer.uint32(18).bytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + Duration.encode(message.downtimeJailDuration, writer.uint32(26).fork()).join(); + } + if (message.slashFractionDoubleSign.length !== 0) { + writer.uint32(34).bytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + writer.uint32(42).bytes(message.slashFractionDowntime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.signedBlocksWindow = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minSignedPerWindow = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.downtimeJailDuration = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.slashFractionDoubleSign = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionDowntime = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + signedBlocksWindow: isSet(object.signedBlocksWindow) ? globalThis.Number(object.signedBlocksWindow) : 0, + minSignedPerWindow: isSet(object.minSignedPerWindow) + ? bytesFromBase64(object.minSignedPerWindow) + : new Uint8Array(0), + downtimeJailDuration: isSet(object.downtimeJailDuration) + ? Duration.fromJSON(object.downtimeJailDuration) + : undefined, + slashFractionDoubleSign: isSet(object.slashFractionDoubleSign) + ? bytesFromBase64(object.slashFractionDoubleSign) + : new Uint8Array(0), + slashFractionDowntime: isSet(object.slashFractionDowntime) + ? bytesFromBase64(object.slashFractionDowntime) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.signedBlocksWindow !== 0) { + obj.signedBlocksWindow = Math.round(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + obj.minSignedPerWindow = base64FromBytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + obj.downtimeJailDuration = Duration.toJSON(message.downtimeJailDuration); + } + if (message.slashFractionDoubleSign.length !== 0) { + obj.slashFractionDoubleSign = base64FromBytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + obj.slashFractionDowntime = base64FromBytes(message.slashFractionDowntime); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.signedBlocksWindow = object.signedBlocksWindow ?? 0; + message.minSignedPerWindow = object.minSignedPerWindow ?? new Uint8Array(0); + message.downtimeJailDuration = (object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null) + ? Duration.fromPartial(object.downtimeJailDuration) + : undefined; + message.slashFractionDoubleSign = object.slashFractionDoubleSign ?? new Uint8Array(0); + message.slashFractionDowntime = object.slashFractionDowntime ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/tx.ts new file mode 100644 index 00000000..54377079 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/slashing/v1beta1/tx.ts @@ -0,0 +1,333 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/slashing/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./slashing"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** MsgUnjail defines the Msg/Unjail request type */ +export interface MsgUnjail { + validatorAddr: string; +} + +/** MsgUnjailResponse defines the Msg/Unjail response type */ +export interface MsgUnjailResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/slashing parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUnjail(): MsgUnjail { + return { validatorAddr: "" }; +} + +export const MsgUnjail: MessageFns = { + encode(message: MsgUnjail, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjail { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnjail { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: MsgUnjail): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): MsgUnjail { + return MsgUnjail.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnjail { + const message = createBaseMsgUnjail(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseMsgUnjailResponse(): MsgUnjailResponse { + return {}; +} + +export const MsgUnjailResponse: MessageFns = { + encode(_: MsgUnjailResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjailResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjailResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnjailResponse { + return {}; + }, + + toJSON(_: MsgUnjailResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnjailResponse { + return MsgUnjailResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnjailResponse { + const message = createBaseMsgUnjailResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/slashing module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.slashing.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 || MsgServiceName; + this.rpc = rpc; + this.Unjail = this.Unjail.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/module/v1/module.ts new file mode 100644 index 00000000..7f8fe4b9 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/module/v1/module.ts @@ -0,0 +1,157 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.staking.module.v1"; + +/** Module is the config object of the staking module. */ +export interface Module { + /** + * hooks_order specifies the order of staking hooks and should be a list + * of module names which provide a staking hooks instance. If no order is + * provided, then hooks will be applied in alphabetical order of module names. + */ + hooksOrder: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** bech32_prefix_validator is the bech32 validator prefix for the app. */ + bech32PrefixValidator: string; + /** bech32_prefix_consensus is the bech32 consensus node prefix for the app. */ + bech32PrefixConsensus: string; +} + +function createBaseModule(): Module { + return { hooksOrder: [], authority: "", bech32PrefixValidator: "", bech32PrefixConsensus: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.hooksOrder) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + if (message.bech32PrefixValidator !== "") { + writer.uint32(26).string(message.bech32PrefixValidator); + } + if (message.bech32PrefixConsensus !== "") { + writer.uint32(34).string(message.bech32PrefixConsensus); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.hooksOrder.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bech32PrefixValidator = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bech32PrefixConsensus = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + hooksOrder: globalThis.Array.isArray(object?.hooksOrder) + ? object.hooksOrder.map((e: any) => globalThis.String(e)) + : [], + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + bech32PrefixValidator: isSet(object.bech32PrefixValidator) ? globalThis.String(object.bech32PrefixValidator) : "", + bech32PrefixConsensus: isSet(object.bech32PrefixConsensus) ? globalThis.String(object.bech32PrefixConsensus) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.hooksOrder?.length) { + obj.hooksOrder = message.hooksOrder; + } + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.bech32PrefixValidator !== "") { + obj.bech32PrefixValidator = message.bech32PrefixValidator; + } + if (message.bech32PrefixConsensus !== "") { + obj.bech32PrefixConsensus = message.bech32PrefixConsensus; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.hooksOrder = object.hooksOrder?.map((e) => e) || []; + message.authority = object.authority ?? ""; + message.bech32PrefixValidator = object.bech32PrefixValidator ?? ""; + message.bech32PrefixConsensus = object.bech32PrefixConsensus ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/authz.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 00000000..b989d692 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,301 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/authz.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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, + /** AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION - AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION defines an authorization type for Msg/MsgCancelUnbondingDelegation */ + AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION = 4, + 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 4: + case "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION": + return AuthorizationType.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION; + 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.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION: + return "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION"; + 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. + */ + maxTokens: + | Coin + | undefined; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allowList?: + | StakeAuthorization_Validators + | undefined; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + denyList?: + | StakeAuthorization_Validators + | undefined; + /** authorization_type defines one of AuthorizationType. */ + authorizationType: AuthorizationType; +} + +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_Validators { + address: string[]; +} + +function createBaseStakeAuthorization(): StakeAuthorization { + return { maxTokens: undefined, allowList: undefined, denyList: undefined, authorizationType: 0 }; +} + +export const StakeAuthorization: MessageFns = { + encode(message: StakeAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTokens !== undefined) { + Coin.encode(message.maxTokens, writer.uint32(10).fork()).join(); + } + if (message.allowList !== undefined) { + StakeAuthorization_Validators.encode(message.allowList, writer.uint32(18).fork()).join(); + } + if (message.denyList !== undefined) { + StakeAuthorization_Validators.encode(message.denyList, writer.uint32(26).fork()).join(); + } + if (message.authorizationType !== 0) { + writer.uint32(32).int32(message.authorizationType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.maxTokens = Coin.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.denyList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.authorizationType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization { + return { + maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, + allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, + denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, + authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : 0, + }; + }, + + toJSON(message: StakeAuthorization): unknown { + const obj: any = {}; + if (message.maxTokens !== undefined) { + obj.maxTokens = Coin.toJSON(message.maxTokens); + } + if (message.allowList !== undefined) { + obj.allowList = StakeAuthorization_Validators.toJSON(message.allowList); + } + if (message.denyList !== undefined) { + obj.denyList = StakeAuthorization_Validators.toJSON(message.denyList); + } + if (message.authorizationType !== 0) { + obj.authorizationType = authorizationTypeToJSON(message.authorizationType); + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization { + return StakeAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeAuthorization { + const message = createBaseStakeAuthorization(); + message.maxTokens = (object.maxTokens !== undefined && object.maxTokens !== null) + ? Coin.fromPartial(object.maxTokens) + : undefined; + message.allowList = (object.allowList !== undefined && object.allowList !== null) + ? StakeAuthorization_Validators.fromPartial(object.allowList) + : undefined; + message.denyList = (object.denyList !== undefined && object.denyList !== null) + ? StakeAuthorization_Validators.fromPartial(object.denyList) + : undefined; + message.authorizationType = object.authorizationType ?? 0; + return message; + }, +}; + +function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { + return { address: [] }; +} + +export const StakeAuthorization_Validators: MessageFns = { + encode(message: StakeAuthorization_Validators, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.address) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization_Validators { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization_Validators { + return { + address: globalThis.Array.isArray(object?.address) ? object.address.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: StakeAuthorization_Validators): unknown { + const obj: any = {}; + if (message.address?.length) { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization_Validators { + return StakeAuthorization_Validators.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/genesis.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 00000000..8c967ba2 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,367 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 parameters of related to deposit. */ + params: + | Params + | undefined; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + lastTotalPower: Uint8Array; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + lastValidatorPowers: LastValidatorPower[]; + /** validators 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. */ + unbondingDelegations: UnbondingDelegation[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: Redelegation[]; + /** exported defines a bool to identify whether the chain dealing with exported or initialized genesis. */ + 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: number; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + lastTotalPower: new Uint8Array(0), + lastValidatorPowers: [], + validators: [], + delegations: [], + unbondingDelegations: [], + redelegations: [], + exported: false, + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.lastTotalPower.length !== 0) { + writer.uint32(18).bytes(message.lastTotalPower); + } + for (const v of message.lastValidatorPowers) { + LastValidatorPower.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.delegations) { + Delegation.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.unbondingDelegations) { + UnbondingDelegation.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.redelegations) { + Redelegation.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.exported !== false) { + writer.uint32(64).bool(message.exported); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lastTotalPower = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.lastValidatorPowers.push(LastValidatorPower.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delegations.push(Delegation.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.unbondingDelegations.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.redelegations.push(Redelegation.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.exported = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + lastTotalPower: isSet(object.lastTotalPower) ? bytesFromBase64(object.lastTotalPower) : new Uint8Array(0), + lastValidatorPowers: globalThis.Array.isArray(object?.lastValidatorPowers) + ? object.lastValidatorPowers.map((e: any) => LastValidatorPower.fromJSON(e)) + : [], + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + delegations: globalThis.Array.isArray(object?.delegations) + ? object.delegations.map((e: any) => Delegation.fromJSON(e)) + : [], + unbondingDelegations: globalThis.Array.isArray(object?.unbondingDelegations) + ? object.unbondingDelegations.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + redelegations: globalThis.Array.isArray(object?.redelegations) + ? object.redelegations.map((e: any) => Redelegation.fromJSON(e)) + : [], + exported: isSet(object.exported) ? globalThis.Boolean(object.exported) : false, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.lastTotalPower.length !== 0) { + obj.lastTotalPower = base64FromBytes(message.lastTotalPower); + } + if (message.lastValidatorPowers?.length) { + obj.lastValidatorPowers = message.lastValidatorPowers.map((e) => LastValidatorPower.toJSON(e)); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.delegations?.length) { + obj.delegations = message.delegations.map((e) => Delegation.toJSON(e)); + } + if (message.unbondingDelegations?.length) { + obj.unbondingDelegations = message.unbondingDelegations.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.redelegations?.length) { + obj.redelegations = message.redelegations.map((e) => Redelegation.toJSON(e)); + } + if (message.exported !== false) { + obj.exported = message.exported; + } + 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) + ? Params.fromPartial(object.params) + : undefined; + message.lastTotalPower = object.lastTotalPower ?? new Uint8Array(0); + message.lastValidatorPowers = object.lastValidatorPowers?.map((e) => LastValidatorPower.fromPartial(e)) || []; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.delegations = object.delegations?.map((e) => Delegation.fromPartial(e)) || []; + message.unbondingDelegations = object.unbondingDelegations?.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: MessageFns = { + encode(message: LastValidatorPower, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LastValidatorPower { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LastValidatorPower { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: LastValidatorPower): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): LastValidatorPower { + return LastValidatorPower.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LastValidatorPower { + const message = createBaseLastValidatorPower(); + message.address = object.address ?? ""; + message.power = object.power ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/query.ts new file mode 100644 index 00000000..ef8f2dc7 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,2495 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; +} + +/** 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 | undefined; +} + +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponse { + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegationResponse: DelegationResponse | undefined; +} + +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond: UnbondingDelegation | undefined; +} + +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** src_validator_addr defines the validator address to redelegate from. */ + srcValidatorAddr: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dstValidatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponse { + redelegationResponses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} + +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponse { + /** validator defines the validator info. */ + validator: Validator | undefined; +} + +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: number; +} + +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist: HistoricalInfo | undefined; +} + +/** 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 | undefined; +} + +/** 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 | undefined; +} + +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { status: "", pagination: undefined }; +} + +export const QueryValidatorsRequest: MessageFns = { + encode(message: QueryValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.status = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsRequest { + return { + status: isSet(object.status) ? globalThis.String(object.status) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsRequest): unknown { + const obj: any = {}; + if (message.status !== "") { + obj.status = message.status; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsRequest { + return QueryValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsResponse { + return QueryValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "" }; +} + +export const QueryValidatorRequest: MessageFns = { + encode(message: QueryValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorRequest { + return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "" }; + }, + + toJSON(message: QueryValidatorRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorRequest { + return QueryValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { validator: undefined }; +} + +export const QueryValidatorResponse: MessageFns = { + encode(message: QueryValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorResponse { + return QueryValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorDelegationsRequest: MessageFns = { + encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryValidatorDelegationsResponse: MessageFns = { + encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { validatorAddr: "", pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { + return { + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegationRequest: MessageFns = { + encode(message: QueryDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRequest { + return QueryDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { delegationResponse: undefined }; +} + +export const QueryDelegationResponse: MessageFns = { + encode(message: QueryDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegationResponse !== undefined) { + DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponse = DelegationResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationResponse { + return { + delegationResponse: isSet(object.delegationResponse) + ? DelegationResponse.fromJSON(object.delegationResponse) + : undefined, + }; + }, + + toJSON(message: QueryDelegationResponse): unknown { + const obj: any = {}; + if (message.delegationResponse !== undefined) { + obj.delegationResponse = DelegationResponse.toJSON(message.delegationResponse); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationResponse { + return QueryDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegationResponse = (object.delegationResponse !== undefined && object.delegationResponse !== null) + ? DelegationResponse.fromPartial(object.delegationResponse) + : undefined; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryUnbondingDelegationRequest: MessageFns = { + encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryUnbondingDelegationRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { unbond: undefined }; +} + +export const QueryUnbondingDelegationResponse: MessageFns = { + encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbond = UnbondingDelegation.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationResponse { + return { unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined }; + }, + + toJSON(message: QueryUnbondingDelegationResponse): unknown { + const obj: any = {}; + if (message.unbond !== undefined) { + obj.unbond = UnbondingDelegation.toJSON(message.unbond); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { delegationResponses: [], pagination: undefined }; +} + +export const QueryDelegatorDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsResponse { + return { + delegationResponses: globalThis.Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegationResponses?.length) { + obj.delegationResponses = message.delegationResponses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsRequest: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { unbondingResponses: [], pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsResponse: MessageFns = { + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { + return { + unbondingResponses: globalThis.Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses?.length) { + obj.unbondingResponses = message.unbondingResponses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { delegatorAddr: "", srcValidatorAddr: "", dstValidatorAddr: "", pagination: undefined }; +} + +export const QueryRedelegationsRequest: MessageFns = { + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.srcValidatorAddr !== "") { + writer.uint32(18).string(message.srcValidatorAddr); + } + if (message.dstValidatorAddr !== "") { + writer.uint32(26).string(message.dstValidatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.srcValidatorAddr = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.dstValidatorAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + srcValidatorAddr: isSet(object.srcValidatorAddr) ? globalThis.String(object.srcValidatorAddr) : "", + dstValidatorAddr: isSet(object.dstValidatorAddr) ? globalThis.String(object.dstValidatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.srcValidatorAddr !== "") { + obj.srcValidatorAddr = message.srcValidatorAddr; + } + if (message.dstValidatorAddr !== "") { + obj.dstValidatorAddr = message.dstValidatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsRequest { + return QueryRedelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.srcValidatorAddr = object.srcValidatorAddr ?? ""; + message.dstValidatorAddr = object.dstValidatorAddr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { redelegationResponses: [], pagination: undefined }; +} + +export const QueryRedelegationsResponse: MessageFns = { + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.redelegationResponses) { + RedelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationResponses.push(RedelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsResponse { + return { + redelegationResponses: globalThis.Array.isArray(object?.redelegationResponses) + ? object.redelegationResponses.map((e: any) => RedelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsResponse): unknown { + const obj: any = {}; + if (message.redelegationResponses?.length) { + obj.redelegationResponses = message.redelegationResponses.map((e) => RedelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsResponse { + return QueryRedelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegationResponses?.map((e) => RedelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegatorAddr: "", pagination: undefined }; +} + +export const QueryDelegatorValidatorsRequest: MessageFns = { + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + 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: MessageFns = { + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.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?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddr: "", validatorAddr: "" }; +} + +export const QueryDelegatorValidatorRequest: MessageFns = { + encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorRequest { + return { + delegatorAddr: isSet(object.delegatorAddr) ? globalThis.String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : "", + }; + }, + + toJSON(message: QueryDelegatorValidatorRequest): unknown { + const obj: any = {}; + if (message.delegatorAddr !== "") { + obj.delegatorAddr = message.delegatorAddr; + } + if (message.validatorAddr !== "") { + obj.validatorAddr = message.validatorAddr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { validator: undefined }; +} + +export const QueryDelegatorValidatorResponse: MessageFns = { + encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryDelegatorValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryHistoricalInfoRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { hist: undefined }; +} + +export const QueryHistoricalInfoResponse: MessageFns = { + encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hist = HistoricalInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoResponse { + return { hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined }; + }, + + toJSON(message: QueryHistoricalInfoResponse): unknown { + const obj: any = {}; + if (message.hist !== undefined) { + obj.hist = HistoricalInfo.toJSON(message.hist); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(_: QueryPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPoolRequest { + return {}; + }, + + toJSON(_: QueryPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPoolRequest { + return QueryPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, +}; + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +export const QueryPoolResponse: MessageFns = { + encode(message: QueryPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pool = Pool.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + if (message.pool !== undefined) { + obj.pool = Pool.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) ? Pool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Validators(request: QueryValidatorsRequest): Promise; + /** Validator queries validator info for given validator address. */ + Validator(request: QueryValidatorRequest): Promise; + /** + * ValidatorDelegations queries delegate info for given validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + ValidatorDelegations(request: QueryValidatorDelegationsRequest): Promise; + /** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; + /** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + DelegatorUnbondingDelegations( + request: QueryDelegatorUnbondingDelegationsRequest, + ): Promise; + /** + * Redelegations queries redelegations of given address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + Redelegations(request: QueryRedelegationsRequest): Promise; + /** + * DelegatorValidators queries all validators info for given delegator + * address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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 const QueryServiceName = "cosmos.staking.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 || QueryServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/staking.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 00000000..7ea20d02 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,2506 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/staking.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { ValidatorUpdate } from "../../../tendermint/abci/types"; +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"; + } +} + +/** Infraction indicates the infraction a validator commited. */ +export enum Infraction { + /** INFRACTION_UNSPECIFIED - UNSPECIFIED defines an empty infraction. */ + INFRACTION_UNSPECIFIED = 0, + /** INFRACTION_DOUBLE_SIGN - DOUBLE_SIGN defines a validator that double-signs a block. */ + INFRACTION_DOUBLE_SIGN = 1, + /** INFRACTION_DOWNTIME - DOWNTIME defines a validator that missed signing too many blocks. */ + INFRACTION_DOWNTIME = 2, + UNRECOGNIZED = -1, +} + +export function infractionFromJSON(object: any): Infraction { + switch (object) { + case 0: + case "INFRACTION_UNSPECIFIED": + return Infraction.INFRACTION_UNSPECIFIED; + case 1: + case "INFRACTION_DOUBLE_SIGN": + return Infraction.INFRACTION_DOUBLE_SIGN; + case 2: + case "INFRACTION_DOWNTIME": + return Infraction.INFRACTION_DOWNTIME; + case -1: + case "UNRECOGNIZED": + default: + return Infraction.UNRECOGNIZED; + } +} + +export function infractionToJSON(object: Infraction): string { + switch (object) { + case Infraction.INFRACTION_UNSPECIFIED: + return "INFRACTION_UNSPECIFIED"; + case Infraction.INFRACTION_DOUBLE_SIGN: + return "INFRACTION_DOUBLE_SIGN"; + case Infraction.INFRACTION_DOWNTIME: + return "INFRACTION_DOWNTIME"; + case Infraction.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfo { + header: Header | undefined; + 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. */ + maxRate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + maxChangeRate: 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. */ + commissionRates: + | CommissionRates + | undefined; + /** update_time is the last time the commission rate was changed. */ + updateTime: Date | undefined; +} + +/** Description defines a validator description. */ +export interface Description { + /** moniker defines a human-readable name for the validator. */ + moniker: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity: string; + /** website defines an optional website link. */ + website: string; + /** security_contact defines an optional email for security contact. */ + securityContact: string; + /** details define other optional details. */ + details: string; +} + +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface Validator { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operatorAddress: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensusPubkey: + | Any + | undefined; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegatorShares: string; + /** description defines the description terms for the validator. */ + description: + | Description + | undefined; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbondingHeight: number; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbondingTime: + | Date + | undefined; + /** commission defines the commission parameters. */ + commission: + | Commission + | undefined; + /** + * min_self_delegation is the validator's self declared minimum self delegation. + * + * Since: cosmos-sdk 0.46 + */ + minSelfDelegation: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbondingIds: number[]; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: 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 encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** shares define the delegation shares received. */ + shares: string; +} + +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegation { + /** delegator_address is the encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} + +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; + /** completion_time is the unix time for unbonding completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initialBalance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creationHeight: number; + /** completion_time defines the unix time for redelegation completion. */ + completionTime: + | Date + | undefined; + /** initial_balance defines the initial balance when redelegation started. */ + initialBalance: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + sharesDst: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: number; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: number; +} + +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface Redelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegatorAddress: string; + /** validator_src_address is the validator redelegation source operator address. */ + validatorSrcAddress: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validatorDstAddress: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntry[]; +} + +/** Params defines the parameters for the x/staking module. */ +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbondingTime: + | Duration + | undefined; + /** max_validators is the maximum number of validators. */ + maxValidators: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + maxEntries: number; + /** historical_entries is the number of historical entries to persist. */ + historicalEntries: number; + /** bond_denom defines the bondable coin denomination. */ + bondDenom: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + minCommissionRate: string; +} + +/** + * 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 | undefined; + balance: Coin | undefined; +} + +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponse { + redelegationEntry: RedelegationEntry | undefined; + 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 | undefined; + entries: RedelegationEntryResponse[]; +} + +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface Pool { + notBondedTokens: string; + bondedTokens: string; +} + +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdates { + updates: ValidatorUpdate[]; +} + +function createBaseHistoricalInfo(): HistoricalInfo { + return { header: undefined, valset: [] }; +} + +export const HistoricalInfo: MessageFns = { + encode(message: HistoricalInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + for (const v of message.valset) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoricalInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.valset.push(Validator.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HistoricalInfo { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + valset: globalThis.Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [], + }; + }, + + toJSON(message: HistoricalInfo): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.valset?.length) { + obj.valset = message.valset.map((e) => Validator.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HistoricalInfo { + return HistoricalInfo.fromPartial(base ?? ({} as any)); + }, + 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: "", maxRate: "", maxChangeRate: "" }; +} + +export const CommissionRates: MessageFns = { + encode(message: CommissionRates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.maxRate !== "") { + writer.uint32(18).string(message.maxRate); + } + if (message.maxChangeRate !== "") { + writer.uint32(26).string(message.maxChangeRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rate = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxRate = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.maxChangeRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommissionRates { + return { + rate: isSet(object.rate) ? globalThis.String(object.rate) : "", + maxRate: isSet(object.maxRate) ? globalThis.String(object.maxRate) : "", + maxChangeRate: isSet(object.maxChangeRate) ? globalThis.String(object.maxChangeRate) : "", + }; + }, + + toJSON(message: CommissionRates): unknown { + const obj: any = {}; + if (message.rate !== "") { + obj.rate = message.rate; + } + if (message.maxRate !== "") { + obj.maxRate = message.maxRate; + } + if (message.maxChangeRate !== "") { + obj.maxChangeRate = message.maxChangeRate; + } + return obj; + }, + + create, I>>(base?: I): CommissionRates { + return CommissionRates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.maxRate = object.maxRate ?? ""; + message.maxChangeRate = object.maxChangeRate ?? ""; + return message; + }, +}; + +function createBaseCommission(): Commission { + return { commissionRates: undefined, updateTime: undefined }; +} + +export const Commission: MessageFns = { + encode(message: Commission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commissionRates !== undefined) { + CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).join(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commissionRates = CommissionRates.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commission { + return { + commissionRates: isSet(object.commissionRates) ? CommissionRates.fromJSON(object.commissionRates) : undefined, + updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, + }; + }, + + toJSON(message: Commission): unknown { + const obj: any = {}; + if (message.commissionRates !== undefined) { + obj.commissionRates = CommissionRates.toJSON(message.commissionRates); + } + if (message.updateTime !== undefined) { + obj.updateTime = message.updateTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Commission { + return Commission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commission { + const message = createBaseCommission(); + message.commissionRates = (object.commissionRates !== undefined && object.commissionRates !== null) + ? CommissionRates.fromPartial(object.commissionRates) + : undefined; + message.updateTime = object.updateTime ?? undefined; + return message; + }, +}; + +function createBaseDescription(): Description { + return { moniker: "", identity: "", website: "", securityContact: "", details: "" }; +} + +export const Description: MessageFns = { + encode(message: Description, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.securityContact !== "") { + writer.uint32(34).string(message.securityContact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Description { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moniker = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.website = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.securityContact = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.details = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Description { + return { + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + securityContact: isSet(object.securityContact) ? globalThis.String(object.securityContact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", + }; + }, + + toJSON(message: Description): unknown { + const obj: any = {}; + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.securityContact !== "") { + obj.securityContact = message.securityContact; + } + if (message.details !== "") { + obj.details = message.details; + } + return obj; + }, + + create, I>>(base?: I): Description { + return Description.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.securityContact = object.securityContact ?? ""; + message.details = object.details ?? ""; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { + operatorAddress: "", + consensusPubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegatorShares: "", + description: undefined, + unbondingHeight: 0, + unbondingTime: undefined, + commission: undefined, + minSelfDelegation: "", + unbondingOnHoldRefCount: 0, + unbondingIds: [], + }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + if (message.consensusPubkey !== undefined) { + Any.encode(message.consensusPubkey, writer.uint32(18).fork()).join(); + } + if (message.jailed !== false) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegatorShares !== "") { + writer.uint32(50).string(message.delegatorShares); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).join(); + } + if (message.unbondingHeight !== 0) { + writer.uint32(64).int64(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + Timestamp.encode(toTimestamp(message.unbondingTime), writer.uint32(74).fork()).join(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(90).string(message.minSelfDelegation); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(96).int64(message.unbondingOnHoldRefCount); + } + writer.uint32(106).fork(); + for (const v of message.unbondingIds) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.consensusPubkey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.jailed = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.status = reader.int32() as any; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.tokens = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.delegatorShares = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.unbondingHeight = longToNumber(reader.int64()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.unbondingTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.commission = Commission.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + case 13: + if (tag === 104) { + message.unbondingIds.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 106) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.unbondingIds.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + operatorAddress: isSet(object.operatorAddress) ? globalThis.String(object.operatorAddress) : "", + consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, + jailed: isSet(object.jailed) ? globalThis.Boolean(object.jailed) : false, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + tokens: isSet(object.tokens) ? globalThis.String(object.tokens) : "", + delegatorShares: isSet(object.delegatorShares) ? globalThis.String(object.delegatorShares) : "", + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + unbondingHeight: isSet(object.unbondingHeight) ? globalThis.Number(object.unbondingHeight) : 0, + unbondingTime: isSet(object.unbondingTime) ? fromJsonTimestamp(object.unbondingTime) : undefined, + commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + unbondingIds: globalThis.Array.isArray(object?.unbondingIds) + ? object.unbondingIds.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.consensusPubkey !== undefined) { + obj.consensusPubkey = Any.toJSON(message.consensusPubkey); + } + if (message.jailed !== false) { + obj.jailed = message.jailed; + } + if (message.status !== 0) { + obj.status = bondStatusToJSON(message.status); + } + if (message.tokens !== "") { + obj.tokens = message.tokens; + } + if (message.delegatorShares !== "") { + obj.delegatorShares = message.delegatorShares; + } + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.unbondingHeight !== 0) { + obj.unbondingHeight = Math.round(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + obj.unbondingTime = message.unbondingTime.toISOString(); + } + if (message.commission !== undefined) { + obj.commission = Commission.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + if (message.unbondingIds?.length) { + obj.unbondingIds = message.unbondingIds.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.operatorAddress = object.operatorAddress ?? ""; + message.consensusPubkey = (object.consensusPubkey !== undefined && object.consensusPubkey !== null) + ? Any.fromPartial(object.consensusPubkey) + : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegatorShares = object.delegatorShares ?? ""; + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.unbondingHeight = object.unbondingHeight ?? 0; + message.unbondingTime = object.unbondingTime ?? undefined; + message.commission = (object.commission !== undefined && object.commission !== null) + ? Commission.fromPartial(object.commission) + : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + message.unbondingIds = object.unbondingIds?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValAddresses(): ValAddresses { + return { addresses: [] }; +} + +export const ValAddresses: MessageFns = { + encode(message: ValAddresses, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addresses.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValAddresses { + return { + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValAddresses): unknown { + const obj: any = {}; + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + return obj; + }, + + create, I>>(base?: I): ValAddresses { + return ValAddresses.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDVPair(): DVPair { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const DVPair: MessageFns = { + encode(message: DVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPair { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + }; + }, + + toJSON(message: DVPair): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): DVPair { + return DVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPair { + const message = createBaseDVPair(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseDVPairs(): DVPairs { + return { pairs: [] }; +} + +export const DVPairs: MessageFns = { + encode(message: DVPairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pairs.push(DVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] }; + }, + + toJSON(message: DVPairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => DVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVPairs { + return DVPairs.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map((e) => DVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDVVTriplet(): DVVTriplet { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" }; +} + +export const DVVTriplet: MessageFns = { + encode(message: DVVTriplet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplet { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + }; + }, + + toJSON(message: DVVTriplet): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + return obj; + }, + + create, I>>(base?: I): DVVTriplet { + return DVVTriplet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + return message; + }, +}; + +function createBaseDVVTriplets(): DVVTriplets { + return { triplets: [] }; +} + +export const DVVTriplets: MessageFns = { + encode(message: DVVTriplets, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.triplets.push(DVVTriplet.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplets { + return { + triplets: globalThis.Array.isArray(object?.triplets) + ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DVVTriplets): unknown { + const obj: any = {}; + if (message.triplets?.length) { + obj.triplets = message.triplets.map((e) => DVVTriplet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVVTriplets { + return DVVTriplets.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map((e) => DVVTriplet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDelegation(): Delegation { + return { delegatorAddress: "", validatorAddress: "", shares: "" }; +} + +export const Delegation: MessageFns = { + encode(message: Delegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Delegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.shares = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Delegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + shares: isSet(object.shares) ? globalThis.String(object.shares) : "", + }; + }, + + toJSON(message: Delegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.shares !== "") { + obj.shares = message.shares; + } + return obj; + }, + + create, I>>(base?: I): Delegation { + return Delegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Delegation { + const message = createBaseDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.shares = object.shares ?? ""; + return message; + }, +}; + +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", entries: [] }; +} + +export const UnbondingDelegation: MessageFns = { + encode(message: UnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: UnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => UnbondingDelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegation { + return UnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + balance: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const UnbondingDelegationEntry: MessageFns = { + encode(message: UnbondingDelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: UnbondingDelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.balance !== "") { + obj.balance = message.balance; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegationEntry { + return UnbondingDelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.balance = object.balance ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegationEntry(): RedelegationEntry { + return { + creationHeight: 0, + completionTime: undefined, + initialBalance: "", + sharesDst: "", + unbondingId: 0, + unbondingOnHoldRefCount: 0, + }; +} + +export const RedelegationEntry: MessageFns = { + encode(message: RedelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creationHeight !== 0) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).join(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.sharesDst !== "") { + writer.uint32(34).string(message.sharesDst); + } + if (message.unbondingId !== 0) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initialBalance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sharesDst = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.unbondingId = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.unbondingOnHoldRefCount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + initialBalance: isSet(object.initialBalance) ? globalThis.String(object.initialBalance) : "", + sharesDst: isSet(object.sharesDst) ? globalThis.String(object.sharesDst) : "", + unbondingId: isSet(object.unbondingId) ? globalThis.Number(object.unbondingId) : 0, + unbondingOnHoldRefCount: isSet(object.unbondingOnHoldRefCount) + ? globalThis.Number(object.unbondingOnHoldRefCount) + : 0, + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.initialBalance !== "") { + obj.initialBalance = message.initialBalance; + } + if (message.sharesDst !== "") { + obj.sharesDst = message.sharesDst; + } + if (message.unbondingId !== 0) { + obj.unbondingId = Math.round(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== 0) { + obj.unbondingOnHoldRefCount = Math.round(message.unbondingOnHoldRefCount); + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntry { + return RedelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creationHeight = object.creationHeight ?? 0; + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.sharesDst = object.sharesDst ?? ""; + message.unbondingId = object.unbondingId ?? 0; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount ?? 0; + return message; + }, +}; + +function createBaseRedelegation(): Redelegation { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", entries: [] }; +} + +export const Redelegation: MessageFns = { + encode(message: Redelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Redelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Redelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Redelegation { + return Redelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Redelegation { + const message = createBaseRedelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.entries = object.entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + unbondingTime: undefined, + maxValidators: 0, + maxEntries: 0, + historicalEntries: 0, + bondDenom: "", + minCommissionRate: "", + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbondingTime !== undefined) { + Duration.encode(message.unbondingTime, writer.uint32(10).fork()).join(); + } + if (message.maxValidators !== 0) { + writer.uint32(16).uint32(message.maxValidators); + } + if (message.maxEntries !== 0) { + writer.uint32(24).uint32(message.maxEntries); + } + if (message.historicalEntries !== 0) { + writer.uint32(32).uint32(message.historicalEntries); + } + if (message.bondDenom !== "") { + writer.uint32(42).string(message.bondDenom); + } + if (message.minCommissionRate !== "") { + writer.uint32(50).string(message.minCommissionRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbondingTime = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxValidators = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxEntries = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.historicalEntries = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bondDenom = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.minCommissionRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbondingTime: isSet(object.unbondingTime) ? Duration.fromJSON(object.unbondingTime) : undefined, + maxValidators: isSet(object.maxValidators) ? globalThis.Number(object.maxValidators) : 0, + maxEntries: isSet(object.maxEntries) ? globalThis.Number(object.maxEntries) : 0, + historicalEntries: isSet(object.historicalEntries) ? globalThis.Number(object.historicalEntries) : 0, + bondDenom: isSet(object.bondDenom) ? globalThis.String(object.bondDenom) : "", + minCommissionRate: isSet(object.minCommissionRate) ? globalThis.String(object.minCommissionRate) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.unbondingTime !== undefined) { + obj.unbondingTime = Duration.toJSON(message.unbondingTime); + } + if (message.maxValidators !== 0) { + obj.maxValidators = Math.round(message.maxValidators); + } + if (message.maxEntries !== 0) { + obj.maxEntries = Math.round(message.maxEntries); + } + if (message.historicalEntries !== 0) { + obj.historicalEntries = Math.round(message.historicalEntries); + } + if (message.bondDenom !== "") { + obj.bondDenom = message.bondDenom; + } + if (message.minCommissionRate !== "") { + obj.minCommissionRate = message.minCommissionRate; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbondingTime = (object.unbondingTime !== undefined && object.unbondingTime !== null) + ? Duration.fromPartial(object.unbondingTime) + : undefined; + message.maxValidators = object.maxValidators ?? 0; + message.maxEntries = object.maxEntries ?? 0; + message.historicalEntries = object.historicalEntries ?? 0; + message.bondDenom = object.bondDenom ?? ""; + message.minCommissionRate = object.minCommissionRate ?? ""; + return message; + }, +}; + +function createBaseDelegationResponse(): DelegationResponse { + return { delegation: undefined, balance: undefined }; +} + +export const DelegationResponse: MessageFns = { + encode(message: DelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegation !== undefined) { + Delegation.encode(message.delegation, writer.uint32(10).fork()).join(); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegation = Delegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.delegation !== undefined) { + obj.delegation = Delegation.toJSON(message.delegation); + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DelegationResponse { + return DelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { redelegationEntry: undefined, balance: "" }; +} + +export const RedelegationEntryResponse: MessageFns = { + encode(message: RedelegationEntryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegationEntry !== undefined) { + RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).join(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegationEntry = RedelegationEntry.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntryResponse { + return { + redelegationEntry: isSet(object.redelegationEntry) + ? RedelegationEntry.fromJSON(object.redelegationEntry) + : undefined, + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + }; + }, + + toJSON(message: RedelegationEntryResponse): unknown { + const obj: any = {}; + if (message.redelegationEntry !== undefined) { + obj.redelegationEntry = RedelegationEntry.toJSON(message.redelegationEntry); + } + if (message.balance !== "") { + obj.balance = message.balance; + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntryResponse { + return RedelegationEntryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegationEntry = (object.redelegationEntry !== undefined && object.redelegationEntry !== null) + ? RedelegationEntry.fromPartial(object.redelegationEntry) + : undefined; + message.balance = object.balance ?? ""; + return message; + }, +}; + +function createBaseRedelegationResponse(): RedelegationResponse { + return { redelegation: undefined, entries: [] }; +} + +export const RedelegationResponse: MessageFns = { + encode(message: RedelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegation !== undefined) { + Redelegation.encode(message.redelegation, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + RedelegationEntryResponse.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegation = Redelegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(RedelegationEntryResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationResponse { + return { + redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RedelegationResponse): unknown { + const obj: any = {}; + if (message.redelegation !== undefined) { + obj.redelegation = Redelegation.toJSON(message.redelegation); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntryResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RedelegationResponse { + return RedelegationResponse.fromPartial(base ?? ({} as any)); + }, + 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 { notBondedTokens: "", bondedTokens: "" }; +} + +export const Pool: MessageFns = { + encode(message: Pool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.notBondedTokens !== "") { + writer.uint32(10).string(message.notBondedTokens); + } + if (message.bondedTokens !== "") { + writer.uint32(18).string(message.bondedTokens); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.notBondedTokens = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bondedTokens = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pool { + return { + notBondedTokens: isSet(object.notBondedTokens) ? globalThis.String(object.notBondedTokens) : "", + bondedTokens: isSet(object.bondedTokens) ? globalThis.String(object.bondedTokens) : "", + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + if (message.notBondedTokens !== "") { + obj.notBondedTokens = message.notBondedTokens; + } + if (message.bondedTokens !== "") { + obj.bondedTokens = message.bondedTokens; + } + return obj; + }, + + create, I>>(base?: I): Pool { + return Pool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.notBondedTokens = object.notBondedTokens ?? ""; + message.bondedTokens = object.bondedTokens ?? ""; + return message; + }, +}; + +function createBaseValidatorUpdates(): ValidatorUpdates { + return { updates: [] }; +} + +export const ValidatorUpdates: MessageFns = { + encode(message: ValidatorUpdates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdates { + return { + updates: globalThis.Array.isArray(object?.updates) + ? object.updates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorUpdates): unknown { + const obj: any = {}; + if (message.updates?.length) { + obj.updates = message.updates.map((e) => ValidatorUpdate.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdates { + return ValidatorUpdates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 00000000..06be4ca4 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,1403 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/staking/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { CommissionRates, Description, Params } from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidator { + description: Description | undefined; + commission: CommissionRates | undefined; + minSelfDelegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + * + * @deprecated + */ + delegatorAddress: string; + validatorAddress: string; + pubkey: Any | undefined; + value: Coin | undefined; +} + +/** 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 | undefined; + validatorAddress: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commissionRate: string; + minSelfDelegation: string; +} + +/** 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 { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** 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 { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; + amount: Coin | undefined; +} + +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponse { + completionTime: Date | undefined; +} + +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; +} + +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponse { + completionTime: + | Date + | undefined; + /** + * amount returns the amount of undelegated coins + * + * Since: cosmos-sdk 0.50 + */ + amount: Coin | undefined; +} + +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegation { + delegatorAddress: string; + validatorAddress: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: + | Coin + | undefined; + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; +} + +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: undefined, + commission: undefined, + minSelfDelegation: "", + delegatorAddress: "", + validatorAddress: "", + pubkey: undefined, + value: undefined, + }; +} + +export const MsgCreateValidator: MessageFns = { + encode(message: MsgCreateValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.commission !== undefined) { + CommissionRates.encode(message.commission, writer.uint32(18).fork()).join(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(26).string(message.minSelfDelegation); + } + if (message.delegatorAddress !== "") { + writer.uint32(34).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(42).string(message.validatorAddress); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(50).fork()).join(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commission = CommissionRates.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.pubkey = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + 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 = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.commission !== undefined) { + obj.commission = CommissionRates.toJSON(message.commission); + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.pubkey !== undefined) { + obj.pubkey = Any.toJSON(message.pubkey); + } + if (message.value !== undefined) { + obj.value = Coin.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateValidator { + return MsgCreateValidator.fromPartial(base ?? ({} as any)); + }, + 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.minSelfDelegation = object.minSelfDelegation ?? ""; + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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: MessageFns = { + encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateValidatorResponse { + return {}; + }, + + toJSON(_: MsgCreateValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, +}; + +function createBaseMsgEditValidator(): MsgEditValidator { + return { description: undefined, validatorAddress: "", commissionRate: "", minSelfDelegation: "" }; +} + +export const MsgEditValidator: MessageFns = { + encode(message: MsgEditValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.commissionRate !== "") { + writer.uint32(26).string(message.commissionRate); + } + if (message.minSelfDelegation !== "") { + writer.uint32(34).string(message.minSelfDelegation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commissionRate = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.minSelfDelegation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + commissionRate: isSet(object.commissionRate) ? globalThis.String(object.commissionRate) : "", + minSelfDelegation: isSet(object.minSelfDelegation) ? globalThis.String(object.minSelfDelegation) : "", + }; + }, + + toJSON(message: MsgEditValidator): unknown { + const obj: any = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.commissionRate !== "") { + obj.commissionRate = message.commissionRate; + } + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + return obj; + }, + + create, I>>(base?: I): MsgEditValidator { + return MsgEditValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.validatorAddress = object.validatorAddress ?? ""; + message.commissionRate = object.commissionRate ?? ""; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, +}; + +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} + +export const MsgEditValidatorResponse: MessageFns = { + encode(_: MsgEditValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgEditValidatorResponse { + return {}; + }, + + toJSON(_: MsgEditValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgEditValidatorResponse { + return MsgEditValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, +}; + +function createBaseMsgDelegate(): MsgDelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgDelegate: MessageFns = { + encode(message: MsgDelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgDelegate { + return MsgDelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +export const MsgDelegateResponse: MessageFns = { + encode(_: MsgDelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDelegateResponse { + return MsgDelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", amount: undefined }; +} + +export const MsgBeginRedelegate: MessageFns = { + encode(message: MsgBeginRedelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSrcAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorDstAddress = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? globalThis.String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? globalThis.String(object.validatorDstAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgBeginRedelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorSrcAddress !== "") { + obj.validatorSrcAddress = message.validatorSrcAddress; + } + if (message.validatorDstAddress !== "") { + obj.validatorDstAddress = message.validatorDstAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegate { + return MsgBeginRedelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { completionTime: undefined }; +} + +export const MsgBeginRedelegateResponse: MessageFns = { + encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegateResponse { + return { completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined }; + }, + + toJSON(message: MsgBeginRedelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + return message; + }, +}; + +function createBaseMsgUndelegate(): MsgUndelegate { + return { delegatorAddress: "", validatorAddress: "", amount: undefined }; +} + +export const MsgUndelegate: MessageFns = { + encode(message: MsgUndelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegate { + return MsgUndelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { completionTime: undefined, amount: undefined }; +} + +export const MsgUndelegateResponse: MessageFns = { + encode(message: MsgUndelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).join(); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegateResponse { + return { + completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined, + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegateResponse): unknown { + const obj: any = {}; + if (message.completionTime !== undefined) { + obj.completionTime = message.completionTime.toISOString(); + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegateResponse { + return MsgUndelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegation(): MsgCancelUnbondingDelegation { + return { delegatorAddress: "", validatorAddress: "", amount: undefined, creationHeight: 0 }; +} + +export const MsgCancelUnbondingDelegation: MessageFns = { + encode(message: MsgCancelUnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + if (message.creationHeight !== 0) { + writer.uint32(32).int64(message.creationHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.creationHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelUnbondingDelegation { + return { + delegatorAddress: isSet(object.delegatorAddress) ? globalThis.String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? globalThis.String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + creationHeight: isSet(object.creationHeight) ? globalThis.Number(object.creationHeight) : 0, + }; + }, + + toJSON(message: MsgCancelUnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + if (message.creationHeight !== 0) { + obj.creationHeight = Math.round(message.creationHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgCancelUnbondingDelegation { + return MsgCancelUnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCancelUnbondingDelegation { + const message = createBaseMsgCancelUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + message.creationHeight = object.creationHeight ?? 0; + return message; + }, +}; + +function createBaseMsgCancelUnbondingDelegationResponse(): MsgCancelUnbondingDelegationResponse { + return {}; +} + +export const MsgCancelUnbondingDelegationResponse: MessageFns = { + encode(_: MsgCancelUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelUnbondingDelegationResponse { + return {}; + }, + + toJSON(_: MsgCancelUnbondingDelegationResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCancelUnbondingDelegationResponse { + return MsgCancelUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCancelUnbondingDelegationResponse { + const message = createBaseMsgCancelUnbondingDelegationResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + 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; + /** + * CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + * and delegate back to previous validator. + * + * Since: cosmos-sdk 0.46 + */ + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise; + /** + * UpdateParams defines an operation for updating the x/staking module + * parameters. + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "cosmos.staking.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 || MsgServiceName; + 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); + this.CancelUnbondingDelegation = this.CancelUnbondingDelegation.bind(this); + this.UpdateParams = this.UpdateParams.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + CancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise { + const data = MsgCancelUnbondingDelegation.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelUnbondingDelegation", data); + return promise.then((data) => MsgCancelUnbondingDelegationResponse.decode(new BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts new file mode 100644 index 00000000..15cd0546 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/internal/kv/v1beta1/kv.ts @@ -0,0 +1,202 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/internal/kv/v1beta1/kv.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.internal.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: MessageFns = { + encode(message: Pairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + Pair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.pairs.push(Pair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => Pair.fromJSON(e)) : [] }; + }, + + toJSON(message: Pairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => Pair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Pairs { + return Pairs.fromPartial(base ?? ({} as any)); + }, + 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(0), value: new Uint8Array(0) }; +} + +export const Pair: MessageFns = { + encode(message: Pair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pair { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Pair): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Pair { + return Pair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pair { + const message = createBasePair(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts new file mode 100644 index 00000000..6763ba8c --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/snapshots/v1/snapshot.ts @@ -0,0 +1,728 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/snapshots/v1/snapshot.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.store.snapshots.v1"; + +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface Snapshot { + height: number; + format: number; + chunks: number; + hash: Uint8Array; + metadata: Metadata | undefined; +} + +/** Metadata contains SDK-specific snapshot metadata. */ +export interface Metadata { + /** SHA-256 chunk hashes */ + chunkHashes: Uint8Array[]; +} + +/** + * SnapshotItem is an item contained in a rootmulti.Store snapshot. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotItem { + store?: SnapshotStoreItem | undefined; + iavl?: SnapshotIAVLItem | undefined; + extension?: SnapshotExtensionMeta | undefined; + extensionPayload?: SnapshotExtensionPayload | undefined; +} + +/** + * SnapshotStoreItem contains metadata about a snapshotted store. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotStoreItem { + name: string; +} + +/** + * SnapshotIAVLItem is an exported IAVL node. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotIAVLItem { + key: Uint8Array; + value: Uint8Array; + /** version is block height */ + version: number; + /** height is depth of the tree. */ + height: number; +} + +/** + * SnapshotExtensionMeta contains metadata about an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionMeta { + name: string; + format: number; +} + +/** + * SnapshotExtensionPayload contains payloads of an external snapshotter. + * + * Since: cosmos-sdk 0.46 + */ +export interface SnapshotExtensionPayload { + payload: Uint8Array; +} + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: undefined }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { chunkHashes: [] }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.chunkHashes) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunkHashes.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + chunkHashes: globalThis.Array.isArray(object?.chunkHashes) + ? object.chunkHashes.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.chunkHashes?.length) { + obj.chunkHashes = message.chunkHashes.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.chunkHashes = object.chunkHashes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSnapshotItem(): SnapshotItem { + return { store: undefined, iavl: undefined, extension: undefined, extensionPayload: undefined }; +} + +export const SnapshotItem: MessageFns = { + encode(message: SnapshotItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.store !== undefined) { + SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).join(); + } + if (message.iavl !== undefined) { + SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).join(); + } + if (message.extension !== undefined) { + SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).join(); + } + if (message.extensionPayload !== undefined) { + SnapshotExtensionPayload.encode(message.extensionPayload, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.store = SnapshotStoreItem.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionPayload = SnapshotExtensionPayload.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + extensionPayload: isSet(object.extensionPayload) + ? SnapshotExtensionPayload.fromJSON(object.extensionPayload) + : undefined, + }; + }, + + toJSON(message: SnapshotItem): unknown { + const obj: any = {}; + if (message.store !== undefined) { + obj.store = SnapshotStoreItem.toJSON(message.store); + } + if (message.iavl !== undefined) { + obj.iavl = SnapshotIAVLItem.toJSON(message.iavl); + } + if (message.extension !== undefined) { + obj.extension = SnapshotExtensionMeta.toJSON(message.extension); + } + if (message.extensionPayload !== undefined) { + obj.extensionPayload = SnapshotExtensionPayload.toJSON(message.extensionPayload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotItem { + return SnapshotItem.fromPartial(base ?? ({} as any)); + }, + 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.extensionPayload = (object.extensionPayload !== undefined && object.extensionPayload !== null) + ? SnapshotExtensionPayload.fromPartial(object.extensionPayload) + : undefined; + return message; + }, +}; + +function createBaseSnapshotStoreItem(): SnapshotStoreItem { + return { name: "" }; +} + +export const SnapshotStoreItem: MessageFns = { + encode(message: SnapshotStoreItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotStoreItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotStoreItem { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: SnapshotStoreItem): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): SnapshotStoreItem { + return SnapshotStoreItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { + return { key: new Uint8Array(0), value: new Uint8Array(0), version: 0, height: 0 }; +} + +export const SnapshotIAVLItem: MessageFns = { + encode(message: SnapshotIAVLItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.version !== 0) { + writer.uint32(24).int64(message.version); + } + if (message.height !== 0) { + writer.uint32(32).int32(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotIAVLItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.height = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotIAVLItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: SnapshotIAVLItem): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): SnapshotIAVLItem { + return SnapshotIAVLItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.version = object.version ?? 0; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { + return { name: "", format: 0 }; +} + +export const SnapshotExtensionMeta: MessageFns = { + encode(message: SnapshotExtensionMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionMeta { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + }; + }, + + toJSON(message: SnapshotExtensionMeta): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionMeta { + return SnapshotExtensionMeta.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SnapshotExtensionPayload: MessageFns = { + encode(message: SnapshotExtensionPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.payload = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionPayload { + return { payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(0) }; + }, + + toJSON(message: SnapshotExtensionPayload): unknown { + const obj: any = {}; + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionPayload { + return SnapshotExtensionPayload.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + message.payload = object.payload ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/streaming/abci/grpc.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/streaming/abci/grpc.ts new file mode 100644 index 00000000..4e0a2d5d --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/streaming/abci/grpc.ts @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/streaming/abci/grpc.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../../tendermint/abci/types"; +import { StoreKVPair } from "../../v1beta1/listening"; + +export const protobufPackage = "cosmos.store.streaming.abci"; + +/** ListenEndBlockRequest is the request type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockRequest { + req: RequestFinalizeBlock | undefined; + res: ResponseFinalizeBlock | undefined; +} + +/** ListenEndBlockResponse is the response type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockResponse { +} + +/** ListenCommitRequest is the request type for the ListenCommit RPC method */ +export interface ListenCommitRequest { + /** explicitly pass in block height as ResponseCommit does not contain this info */ + blockHeight: number; + res: ResponseCommit | undefined; + changeSet: StoreKVPair[]; +} + +/** ListenCommitResponse is the response type for the ListenCommit RPC method */ +export interface ListenCommitResponse { +} + +function createBaseListenFinalizeBlockRequest(): ListenFinalizeBlockRequest { + return { req: undefined, res: undefined }; +} + +export const ListenFinalizeBlockRequest: MessageFns = { + encode(message: ListenFinalizeBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.req !== undefined) { + RequestFinalizeBlock.encode(message.req, writer.uint32(10).fork()).join(); + } + if (message.res !== undefined) { + ResponseFinalizeBlock.encode(message.res, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.req = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenFinalizeBlockRequest { + return { + req: isSet(object.req) ? RequestFinalizeBlock.fromJSON(object.req) : undefined, + res: isSet(object.res) ? ResponseFinalizeBlock.fromJSON(object.res) : undefined, + }; + }, + + toJSON(message: ListenFinalizeBlockRequest): unknown { + const obj: any = {}; + if (message.req !== undefined) { + obj.req = RequestFinalizeBlock.toJSON(message.req); + } + if (message.res !== undefined) { + obj.res = ResponseFinalizeBlock.toJSON(message.res); + } + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockRequest { + return ListenFinalizeBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenFinalizeBlockRequest { + const message = createBaseListenFinalizeBlockRequest(); + message.req = (object.req !== undefined && object.req !== null) + ? RequestFinalizeBlock.fromPartial(object.req) + : undefined; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseFinalizeBlock.fromPartial(object.res) + : undefined; + return message; + }, +}; + +function createBaseListenFinalizeBlockResponse(): ListenFinalizeBlockResponse { + return {}; +} + +export const ListenFinalizeBlockResponse: MessageFns = { + encode(_: ListenFinalizeBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenFinalizeBlockResponse { + return {}; + }, + + toJSON(_: ListenFinalizeBlockResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenFinalizeBlockResponse { + return ListenFinalizeBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenFinalizeBlockResponse { + const message = createBaseListenFinalizeBlockResponse(); + return message; + }, +}; + +function createBaseListenCommitRequest(): ListenCommitRequest { + return { blockHeight: 0, res: undefined, changeSet: [] }; +} + +export const ListenCommitRequest: MessageFns = { + encode(message: ListenCommitRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockHeight !== 0) { + writer.uint32(8).int64(message.blockHeight); + } + if (message.res !== undefined) { + ResponseCommit.encode(message.res, writer.uint32(18).fork()).join(); + } + for (const v of message.changeSet) { + StoreKVPair.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockHeight = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.res = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changeSet.push(StoreKVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListenCommitRequest { + return { + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + res: isSet(object.res) ? ResponseCommit.fromJSON(object.res) : undefined, + changeSet: globalThis.Array.isArray(object?.changeSet) + ? object.changeSet.map((e: any) => StoreKVPair.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListenCommitRequest): unknown { + const obj: any = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.res !== undefined) { + obj.res = ResponseCommit.toJSON(message.res); + } + if (message.changeSet?.length) { + obj.changeSet = message.changeSet.map((e) => StoreKVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListenCommitRequest { + return ListenCommitRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListenCommitRequest { + const message = createBaseListenCommitRequest(); + message.blockHeight = object.blockHeight ?? 0; + message.res = (object.res !== undefined && object.res !== null) + ? ResponseCommit.fromPartial(object.res) + : undefined; + message.changeSet = object.changeSet?.map((e) => StoreKVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListenCommitResponse(): ListenCommitResponse { + return {}; +} + +export const ListenCommitResponse: MessageFns = { + encode(_: ListenCommitResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListenCommitResponse { + return {}; + }, + + toJSON(_: ListenCommitResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListenCommitResponse { + return ListenCommitResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListenCommitResponse { + const message = createBaseListenCommitResponse(); + return message; + }, +}; + +/** ABCIListenerService is the service for the BaseApp ABCIListener interface */ +export interface ABCIListenerService { + /** ListenFinalizeBlock is the corresponding endpoint for ABCIListener.ListenEndBlock */ + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise; + /** ListenCommit is the corresponding endpoint for ABCIListener.ListenCommit */ + ListenCommit(request: ListenCommitRequest): Promise; +} + +export const ABCIListenerServiceServiceName = "cosmos.store.streaming.abci.ABCIListenerService"; +export class ABCIListenerServiceClientImpl implements ABCIListenerService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIListenerServiceServiceName; + this.rpc = rpc; + this.ListenFinalizeBlock = this.ListenFinalizeBlock.bind(this); + this.ListenCommit = this.ListenCommit.bind(this); + } + ListenFinalizeBlock(request: ListenFinalizeBlockRequest): Promise { + const data = ListenFinalizeBlockRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenFinalizeBlock", data); + return promise.then((data) => ListenFinalizeBlockResponse.decode(new BinaryReader(data))); + } + + ListenCommit(request: ListenCommitRequest): Promise { + const data = ListenCommitRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListenCommit", data); + return promise.then((data) => ListenCommitResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/v1beta1/commit_info.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/v1beta1/commit_info.ts new file mode 100644 index 00000000..17c74706 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/v1beta1/commit_info.ts @@ -0,0 +1,363 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/commit_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.store.v1beta1"; + +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfo { + version: number; + storeInfos: StoreInfo[]; + timestamp: Date | undefined; +} + +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfo { + name: string; + commitId: CommitID | undefined; +} + +/** + * CommitID defines the commitment information when a specific store is + * committed. + */ +export interface CommitID { + version: number; + hash: Uint8Array; +} + +function createBaseCommitInfo(): CommitInfo { + return { version: 0, storeInfos: [], timestamp: undefined }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== 0) { + writer.uint32(8).int64(message.version); + } + for (const v of message.storeInfos) { + StoreInfo.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.storeInfos.push(StoreInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + storeInfos: globalThis.Array.isArray(object?.storeInfos) + ? object.storeInfos.map((e: any) => StoreInfo.fromJSON(e)) + : [], + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.storeInfos?.length) { + obj.storeInfos = message.storeInfos.map((e) => StoreInfo.toJSON(e)); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.version = object.version ?? 0; + message.storeInfos = object.storeInfos?.map((e) => StoreInfo.fromPartial(e)) || []; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseStoreInfo(): StoreInfo { + return { name: "", commitId: undefined }; +} + +export const StoreInfo: MessageFns = { + encode(message: StoreInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.commitId !== undefined) { + CommitID.encode(message.commitId, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commitId = CommitID.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + commitId: isSet(object.commitId) ? CommitID.fromJSON(object.commitId) : undefined, + }; + }, + + toJSON(message: StoreInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.commitId !== undefined) { + obj.commitId = CommitID.toJSON(message.commitId); + } + return obj; + }, + + create, I>>(base?: I): StoreInfo { + return StoreInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreInfo { + const message = createBaseStoreInfo(); + message.name = object.name ?? ""; + message.commitId = (object.commitId !== undefined && object.commitId !== null) + ? CommitID.fromPartial(object.commitId) + : undefined; + return message; + }, +}; + +function createBaseCommitID(): CommitID { + return { version: 0, hash: new Uint8Array(0) }; +} + +export const CommitID: MessageFns = { + encode(message: CommitID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): CommitID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitID { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitID): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): CommitID { + return CommitID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitID { + const message = createBaseCommitID(); + message.version = object.version ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/v1beta1/listening.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/v1beta1/listening.ts new file mode 100644 index 00000000..73eb4288 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/store/v1beta1/listening.ts @@ -0,0 +1,294 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/store/v1beta1/listening.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RequestFinalizeBlock, ResponseCommit, ResponseFinalizeBlock } from "../../../tendermint/abci/types"; + +export const protobufPackage = "cosmos.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 */ + storeKey: string; + /** true indicates a delete operation, false indicates a set operation */ + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} + +/** + * BlockMetadata contains all the abci event data of a block + * the file streamer dump them into files together with the state changes. + */ +export interface BlockMetadata { + responseCommit: ResponseCommit | undefined; + requestFinalizeBlock: + | RequestFinalizeBlock + | undefined; + /** TODO: should we renumber this? */ + responseFinalizeBlock: ResponseFinalizeBlock | undefined; +} + +function createBaseStoreKVPair(): StoreKVPair { + return { storeKey: "", delete: false, key: new Uint8Array(0), value: new Uint8Array(0) }; +} + +export const StoreKVPair: MessageFns = { + encode(message: StoreKVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.storeKey !== "") { + writer.uint32(10).string(message.storeKey); + } + if (message.delete !== false) { + 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: BinaryReader | Uint8Array, length?: number): StoreKVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.storeKey = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.delete = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.key = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKVPair { + return { + storeKey: isSet(object.storeKey) ? globalThis.String(object.storeKey) : "", + delete: isSet(object.delete) ? globalThis.Boolean(object.delete) : false, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: StoreKVPair): unknown { + const obj: any = {}; + if (message.storeKey !== "") { + obj.storeKey = message.storeKey; + } + if (message.delete !== false) { + obj.delete = message.delete; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): StoreKVPair { + return StoreKVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKVPair { + const message = createBaseStoreKVPair(); + message.storeKey = object.storeKey ?? ""; + message.delete = object.delete ?? false; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseBlockMetadata(): BlockMetadata { + return { responseCommit: undefined, requestFinalizeBlock: undefined, responseFinalizeBlock: undefined }; +} + +export const BlockMetadata: MessageFns = { + encode(message: BlockMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.responseCommit !== undefined) { + ResponseCommit.encode(message.responseCommit, writer.uint32(50).fork()).join(); + } + if (message.requestFinalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.requestFinalizeBlock, writer.uint32(58).fork()).join(); + } + if (message.responseFinalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.responseFinalizeBlock, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + if (tag !== 50) { + break; + } + + message.responseCommit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestFinalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.responseFinalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMetadata { + return { + responseCommit: isSet(object.responseCommit) ? ResponseCommit.fromJSON(object.responseCommit) : undefined, + requestFinalizeBlock: isSet(object.requestFinalizeBlock) + ? RequestFinalizeBlock.fromJSON(object.requestFinalizeBlock) + : undefined, + responseFinalizeBlock: isSet(object.responseFinalizeBlock) + ? ResponseFinalizeBlock.fromJSON(object.responseFinalizeBlock) + : undefined, + }; + }, + + toJSON(message: BlockMetadata): unknown { + const obj: any = {}; + if (message.responseCommit !== undefined) { + obj.responseCommit = ResponseCommit.toJSON(message.responseCommit); + } + if (message.requestFinalizeBlock !== undefined) { + obj.requestFinalizeBlock = RequestFinalizeBlock.toJSON(message.requestFinalizeBlock); + } + if (message.responseFinalizeBlock !== undefined) { + obj.responseFinalizeBlock = ResponseFinalizeBlock.toJSON(message.responseFinalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): BlockMetadata { + return BlockMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMetadata { + const message = createBaseBlockMetadata(); + message.responseCommit = (object.responseCommit !== undefined && object.responseCommit !== null) + ? ResponseCommit.fromPartial(object.responseCommit) + : undefined; + message.requestFinalizeBlock = (object.requestFinalizeBlock !== undefined && object.requestFinalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.requestFinalizeBlock) + : undefined; + message.responseFinalizeBlock = + (object.responseFinalizeBlock !== undefined && object.responseFinalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.responseFinalizeBlock) + : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/config/v1/config.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/config/v1/config.ts new file mode 100644 index 00000000..aa780391 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/config/v1/config.ts @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/config/v1/config.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.tx.config.v1"; + +/** Config is the config object of the x/auth/tx package. */ +export interface Config { + /** + * skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipAnteHandler: boolean; + /** + * skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipPostHandler: boolean; +} + +function createBaseConfig(): Config { + return { skipAnteHandler: false, skipPostHandler: false }; +} + +export const Config: MessageFns = { + encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.skipAnteHandler !== false) { + writer.uint32(8).bool(message.skipAnteHandler); + } + if (message.skipPostHandler !== false) { + writer.uint32(16).bool(message.skipPostHandler); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.skipAnteHandler = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.skipPostHandler = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Config { + return { + skipAnteHandler: isSet(object.skipAnteHandler) ? globalThis.Boolean(object.skipAnteHandler) : false, + skipPostHandler: isSet(object.skipPostHandler) ? globalThis.Boolean(object.skipPostHandler) : false, + }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.skipAnteHandler !== false) { + obj.skipAnteHandler = message.skipAnteHandler; + } + if (message.skipPostHandler !== false) { + obj.skipPostHandler = message.skipPostHandler; + } + return obj; + }, + + create, I>>(base?: I): Config { + return Config.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.skipAnteHandler = object.skipAnteHandler ?? false; + message.skipPostHandler = object.skipPostHandler ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 00000000..35f6e628 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,620 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/signing/v1beta1/signing.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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. + * + * Since: cosmos-sdk 0.50 + */ + SIGN_MODE_TEXTUAL = 2, + /** + * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses + * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not + * require signers signing over other signers' `signer_info`. + * + * Since: cosmos-sdk 0.46 + */ + SIGN_MODE_DIRECT_AUX = 3, + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future. + */ + SIGN_MODE_LEGACY_AMINO_JSON = 127, + /** + * SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + * SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + * + * Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + * but is not implemented on the SDK by default. To enable EIP-191, you need + * to pass a custom `TxConfig` that has an implementation of + * `SignModeHandler` for EIP-191. The SDK may decide to fully support + * EIP-191 in the future. + * + * Since: cosmos-sdk 0.45.2 + */ + SIGN_MODE_EIP_191 = 191, + UNRECOGNIZED = -1, +} + +export function signModeFromJSON(object: any): SignMode { + switch (object) { + case 0: + case "SIGN_MODE_UNSPECIFIED": + return SignMode.SIGN_MODE_UNSPECIFIED; + case 1: + case "SIGN_MODE_DIRECT": + return SignMode.SIGN_MODE_DIRECT; + case 2: + case "SIGN_MODE_TEXTUAL": + return SignMode.SIGN_MODE_TEXTUAL; + case 3: + case "SIGN_MODE_DIRECT_AUX": + return SignMode.SIGN_MODE_DIRECT_AUX; + case 127: + case "SIGN_MODE_LEGACY_AMINO_JSON": + return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + case 191: + case "SIGN_MODE_EIP_191": + return SignMode.SIGN_MODE_EIP_191; + case -1: + case "UNRECOGNIZED": + default: + return SignMode.UNRECOGNIZED; + } +} + +export function signModeToJSON(object: SignMode): string { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return "SIGN_MODE_UNSPECIFIED"; + case SignMode.SIGN_MODE_DIRECT: + return "SIGN_MODE_DIRECT"; + case SignMode.SIGN_MODE_TEXTUAL: + return "SIGN_MODE_TEXTUAL"; + case SignMode.SIGN_MODE_DIRECT_AUX: + return "SIGN_MODE_DIRECT_AUX"; + case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: + return "SIGN_MODE_LEGACY_AMINO_JSON"; + case SignMode.SIGN_MODE_EIP_191: + return "SIGN_MODE_EIP_191"; + case SignMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} + +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + publicKey: Any | undefined; + data: + | SignatureDescriptor_Data + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_Data[]; +} + +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { signatures: [] }; +} + +export const SignatureDescriptors: MessageFns = { + encode(message: SignatureDescriptors, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptors(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptors { + return { + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptors): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptors { + return SignatureDescriptors.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map((e) => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { publicKey: undefined, data: undefined, sequence: 0 }; +} + +export const SignatureDescriptor: MessageFns = { + encode(message: SignatureDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + data: isSet(object.data) ? SignatureDescriptor_Data.fromJSON(object.data) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.data !== undefined) { + obj.data = SignatureDescriptor_Data.toJSON(message.data); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor { + return SignatureDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.data = (object.data !== undefined && object.data !== null) + ? SignatureDescriptor_Data.fromPartial(object.data) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { + return { single: undefined, multi: undefined }; +} + +export const SignatureDescriptor_Data: MessageFns = { + encode(message: SignatureDescriptor_Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = SignatureDescriptor_Data_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = SignatureDescriptor_Data_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data { + return SignatureDescriptor_Data.fromPartial(base ?? ({} as any)); + }, + 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(0) }; +} + +export const SignatureDescriptor_Data_Single: MessageFns = { + encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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(0), + }; + }, + + toJSON(message: SignatureDescriptor_Data_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { + return { bitarray: undefined, signatures: [] }; +} + +export const SignatureDescriptor_Data_Multi: MessageFns = { + encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.signatures) { + SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor_Data_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptor_Data_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor_Data.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/v1beta1/service.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/v1beta1/service.ts new file mode 100644 index 00000000..411f1dc2 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,1855 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 - DEPRECATED: use BROADCAST_MODE_SYNC instead, + * BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + * + * @deprecated + */ + 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. + * Deprecated post v0.47.x: use query instead, which should contain a valid + * events query. + * + * @deprecated + */ + events: string[]; + /** + * pagination defines a pagination for the request. + * Deprecated post v0.46.x: use page and limit instead. + * + * @deprecated + */ + pagination: PageRequest | undefined; + orderBy: OrderBy; + /** + * page is the page number to query, starts at 1. If not provided, will + * default to first page. + */ + page: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * query defines the transaction event query that is proxied to Tendermint's + * TxSearch RPC method. The query must be valid. + * + * Since cosmos-sdk 0.50 + */ + query: string; +} + +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponse { + /** txs is the list of queried transactions. */ + txs: Tx[]; + /** tx_responses is the list of queried TxResponses. */ + txResponses: TxResponse[]; + /** + * pagination defines a pagination for the response. + * Deprecated post v0.46.x: use total instead. + * + * @deprecated + */ + pagination: + | PageResponse + | undefined; + /** total is total number of results available */ + total: number; +} + +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; + mode: BroadcastMode; +} + +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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 + | undefined; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + txBytes: 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. */ + gasInfo: + | GasInfo + | undefined; + /** result is the result of the simulation. */ + result: Result | undefined; +} + +/** + * 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 + | undefined; + /** tx_response is the queried TxResponses. */ + txResponse: TxResponse | undefined; +} + +/** + * 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: number; + /** pagination defines a pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponse { + /** txs are the transactions in the block. */ + txs: Tx[]; + blockId: BlockID | undefined; + block: + | Block + | undefined; + /** pagination defines a pagination for the response. */ + pagination: PageResponse | undefined; +} + +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; +} + +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponse { + /** tx is the decoded transaction. */ + tx: Tx | undefined; +} + +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequest { + /** tx is the transaction to encode. */ + tx: Tx | undefined; +} + +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponse { + /** tx_bytes is the encoded transaction bytes. */ + txBytes: Uint8Array; +} + +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequest { + aminoJson: string; +} + +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponse { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequest { + aminoBinary: Uint8Array; +} + +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponse { + aminoJson: string; +} + +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { events: [], pagination: undefined, orderBy: 0, page: 0, limit: 0, query: "" }; +} + +export const GetTxsEventRequest: MessageFns = { + encode(message: GetTxsEventRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.orderBy !== 0) { + writer.uint32(24).int32(message.orderBy); + } + if (message.page !== 0) { + writer.uint32(32).uint64(message.page); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + if (message.query !== "") { + writer.uint32(50).string(message.query); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.orderBy = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.page = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventRequest { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0, + page: isSet(object.page) ? globalThis.Number(object.page) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + query: isSet(object.query) ? globalThis.String(object.query) : "", + }; + }, + + toJSON(message: GetTxsEventRequest): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.orderBy !== 0) { + obj.orderBy = orderByToJSON(message.orderBy); + } + if (message.page !== 0) { + obj.page = Math.round(message.page); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.query !== "") { + obj.query = message.query; + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventRequest { + return GetTxsEventRequest.fromPartial(base ?? ({} as any)); + }, + 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.orderBy = object.orderBy ?? 0; + message.page = object.page ?? 0; + message.limit = object.limit ?? 0; + message.query = object.query ?? ""; + return message; + }, +}; + +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { txs: [], txResponses: [], pagination: undefined, total: 0 }; +} + +export const GetTxsEventResponse: MessageFns = { + encode(message: GetTxsEventResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResponses) { + TxResponse.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + if (message.total !== 0) { + writer.uint32(32).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponses.push(TxResponse.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + txResponses: globalThis.Array.isArray(object?.txResponses) + ? object.txResponses.map((e: any) => TxResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: GetTxsEventResponse): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.txResponses?.length) { + obj.txResponses = message.txResponses.map((e) => TxResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventResponse { + return GetTxsEventResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.txResponses = object.txResponses?.map((e) => TxResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.total = object.total ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { txBytes: new Uint8Array(0), mode: 0 }; +} + +export const BroadcastTxRequest: MessageFns = { + encode(message: BroadcastTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxRequest { + return { + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0, + }; + }, + + toJSON(message: BroadcastTxRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + if (message.mode !== 0) { + obj.mode = broadcastModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxRequest { + return BroadcastTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + message.mode = object.mode ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { txResponse: undefined }; +} + +export const BroadcastTxResponse: MessageFns = { + encode(message: BroadcastTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxResponse { + return { txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined }; + }, + + toJSON(message: BroadcastTxResponse): unknown { + const obj: any = {}; + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxResponse { + return BroadcastTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseSimulateRequest(): SimulateRequest { + return { tx: undefined, txBytes: new Uint8Array(0) }; +} + +export const SimulateRequest: MessageFns = { + encode(message: SimulateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txBytes.length !== 0) { + writer.uint32(18).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateRequest { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0), + }; + }, + + toJSON(message: SimulateRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): SimulateRequest { + return SimulateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSimulateResponse(): SimulateResponse { + return { gasInfo: undefined, result: undefined }; +} + +export const SimulateResponse: MessageFns = { + encode(message: SimulateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateResponse { + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulateResponse): unknown { + const obj: any = {}; + if (message.gasInfo !== undefined) { + obj.gasInfo = GasInfo.toJSON(message.gasInfo); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulateResponse { + return SimulateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateResponse { + const message = createBaseSimulateResponse(); + message.gasInfo = (object.gasInfo !== undefined && object.gasInfo !== null) + ? GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseGetTxRequest(): GetTxRequest { + return { hash: "" }; +} + +export const GetTxRequest: MessageFns = { + encode(message: GetTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxRequest { + return { hash: isSet(object.hash) ? globalThis.String(object.hash) : "" }; + }, + + toJSON(message: GetTxRequest): unknown { + const obj: any = {}; + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): GetTxRequest { + return GetTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseGetTxResponse(): GetTxResponse { + return { tx: undefined, txResponse: undefined }; +} + +export const GetTxResponse: MessageFns = { + encode(message: GetTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResponse = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxResponse { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined, + }; + }, + + toJSON(message: GetTxResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.txResponse !== undefined) { + obj.txResponse = TxResponse.toJSON(message.txResponse); + } + return obj; + }, + + create, I>>(base?: I): GetTxResponse { + return GetTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.txResponse = (object.txResponse !== undefined && object.txResponse !== null) + ? TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; + +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { height: 0, pagination: undefined }; +} + +export const GetBlockWithTxsRequest: MessageFns = { + encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.fromPartial(base ?? ({} as any)); + }, + 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: [], blockId: undefined, block: undefined, pagination: undefined }; +} + +export const GetBlockWithTxsResponse: MessageFns = { + encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(18).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(26).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : 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?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseTxDecodeRequest(): TxDecodeRequest { + return { txBytes: new Uint8Array(0) }; +} + +export const TxDecodeRequest: MessageFns = { + encode(message: TxDecodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeRequest { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeRequest): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeRequest { + return TxDecodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeResponse(): TxDecodeResponse { + return { tx: undefined }; +} + +export const TxDecodeResponse: MessageFns = { + encode(message: TxDecodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeResponse { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxDecodeResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeResponse { + return TxDecodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeRequest(): TxEncodeRequest { + return { tx: undefined }; +} + +export const TxEncodeRequest: MessageFns = { + encode(message: TxEncodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeRequest { + return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: TxEncodeRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeRequest { + return TxEncodeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxEncodeResponse(): TxEncodeResponse { + return { txBytes: new Uint8Array(0) }; +} + +export const TxEncodeResponse: MessageFns = { + encode(message: TxEncodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txBytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeResponse { + return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeResponse): unknown { + const obj: any = {}; + if (message.txBytes.length !== 0) { + obj.txBytes = base64FromBytes(message.txBytes); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeResponse { + return TxEncodeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + message.txBytes = object.txBytes ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxEncodeAminoRequest(): TxEncodeAminoRequest { + return { aminoJson: "" }; +} + +export const TxEncodeAminoRequest: MessageFns = { + encode(message: TxEncodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoRequest { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxEncodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoRequest { + return TxEncodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, +}; + +function createBaseTxEncodeAminoResponse(): TxEncodeAminoResponse { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxEncodeAminoResponse: MessageFns = { + encode(message: TxEncodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxEncodeAminoResponse { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxEncodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxEncodeAminoResponse { + return TxEncodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoRequest(): TxDecodeAminoRequest { + return { aminoBinary: new Uint8Array(0) }; +} + +export const TxDecodeAminoRequest: MessageFns = { + encode(message: TxDecodeAminoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoBinary = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoRequest { + return { aminoBinary: isSet(object.aminoBinary) ? bytesFromBase64(object.aminoBinary) : new Uint8Array(0) }; + }, + + toJSON(message: TxDecodeAminoRequest): unknown { + const obj: any = {}; + if (message.aminoBinary.length !== 0) { + obj.aminoBinary = base64FromBytes(message.aminoBinary); + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoRequest { + return TxDecodeAminoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseTxDecodeAminoResponse(): TxDecodeAminoResponse { + return { aminoJson: "" }; +} + +export const TxDecodeAminoResponse: MessageFns = { + encode(message: TxDecodeAminoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aminoJson = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDecodeAminoResponse { + return { aminoJson: isSet(object.aminoJson) ? globalThis.String(object.aminoJson) : "" }; + }, + + toJSON(message: TxDecodeAminoResponse): unknown { + const obj: any = {}; + if (message.aminoJson !== "") { + obj.aminoJson = message.aminoJson; + } + return obj; + }, + + create, I>>(base?: I): TxDecodeAminoResponse { + return TxDecodeAminoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + message.aminoJson = object.aminoJson ?? ""; + 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; + /** + * TxDecode decodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxDecode(request: TxDecodeRequest): Promise; + /** + * TxEncode encodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + TxEncode(request: TxEncodeRequest): Promise; + /** + * TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. + * + * Since: cosmos-sdk 0.47 + */ + TxEncodeAmino(request: TxEncodeAminoRequest): Promise; + /** + * TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. + * + * Since: cosmos-sdk 0.47 + */ + TxDecodeAmino(request: TxDecodeAminoRequest): Promise; +} + +export const ServiceServiceName = "cosmos.tx.v1beta1.Service"; +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ServiceServiceName; + 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); + this.TxDecode = this.TxDecode.bind(this); + this.TxEncode = this.TxEncode.bind(this); + this.TxEncodeAmino = this.TxEncodeAmino.bind(this); + this.TxDecodeAmino = this.TxDecodeAmino.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + TxDecode(request: TxDecodeRequest): Promise { + const data = TxDecodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecode", data); + return promise.then((data) => TxDecodeResponse.decode(new BinaryReader(data))); + } + + TxEncode(request: TxEncodeRequest): Promise { + const data = TxEncodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncode", data); + return promise.then((data) => TxEncodeResponse.decode(new BinaryReader(data))); + } + + TxEncodeAmino(request: TxEncodeAminoRequest): Promise { + const data = TxEncodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxEncodeAmino", data); + return promise.then((data) => TxEncodeAminoResponse.decode(new BinaryReader(data))); + } + + TxDecodeAmino(request: TxDecodeAminoRequest): Promise { + const data = TxDecodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TxDecodeAmino", data); + return promise.then((data) => TxDecodeAminoResponse.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 00000000..f2c427d1 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,1615 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/tx/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 + | undefined; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + authInfo: + | AuthInfo + | undefined; + /** + * 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. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + authInfoBytes: Uint8Array; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} + +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDoc { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + authInfoBytes: Uint8Array; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chainId: string; + /** account_number is the account number of the account in state */ + accountNumber: number; +} + +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAux { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** public_key is the public key of the signing account. */ + publicKey: + | Any + | undefined; + /** + * chain_id is the identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker. + */ + chainId: string; + /** account_number is the account number of the account in state. */ + accountNumber: number; + /** sequence is the sequence number of the signing account. */ + sequence: number; + /** + * tips have been depreacted and should not be used + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBody { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages: Any[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeoutHeight: number; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extensionOptions: Any[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + nonCriticalExtensionOptions: Any[]; +} + +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfo { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signerInfos: SignerInfo[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee: + | Fee + | undefined; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + * + * Since: cosmos-sdk 0.46 + * + * @deprecated + */ + tip: Tip | undefined; +} + +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfo { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + publicKey: + | Any + | undefined; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + modeInfo: + | ModeInfo + | undefined; + /** + * 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: number; +} + +/** 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 + | undefined; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + modeInfos: 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 + */ + gasLimit: number; + /** + * 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 + * + * @deprecated + */ +export interface Tip { + /** amount is the amount of the tip */ + amount: Coin[]; + /** tipper is the address of the account paying for the tip */ + tipper: string; +} + +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerData { + /** + * address is the bech32-encoded address of the auxiliary signer. If using + * AuxSignerData across different chains, the bech32 prefix of the target + * chain (where the final transaction is broadcasted) should be used. + */ + address: string; + /** + * sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + * signs. Note: we use the same sign doc even if we're signing with + * LEGACY_AMINO_JSON. + */ + signDoc: + | SignDocDirectAux + | undefined; + /** 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, authInfo: undefined, signatures: [] }; +} + +export const Tx: MessageFns = { + encode(message: Tx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).join(); + } + if (message.authInfo !== undefined) { + AuthInfo.encode(message.authInfo, writer.uint32(18).fork()).join(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.body = TxBody.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfo = AuthInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tx { + return { + body: isSet(object.body) ? TxBody.fromJSON(object.body) : undefined, + authInfo: isSet(object.authInfo) ? AuthInfo.fromJSON(object.authInfo) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: Tx): unknown { + const obj: any = {}; + if (message.body !== undefined) { + obj.body = TxBody.toJSON(message.body); + } + if (message.authInfo !== undefined) { + obj.authInfo = AuthInfo.toJSON(message.authInfo); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Tx { + return Tx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Tx { + const message = createBaseTx(); + message.body = (object.body !== undefined && object.body !== null) ? TxBody.fromPartial(object.body) : undefined; + message.authInfo = (object.authInfo !== undefined && object.authInfo !== null) + ? AuthInfo.fromPartial(object.authInfo) + : undefined; + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTxRaw(): TxRaw { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), signatures: [] }; +} + +export const TxRaw: MessageFns = { + encode(message: TxRaw, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRaw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxRaw { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: TxRaw): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): TxRaw { + return TxRaw.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxRaw { + const message = createBaseTxRaw(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSignDoc(): SignDoc { + return { bodyBytes: new Uint8Array(0), authInfoBytes: new Uint8Array(0), chainId: "", accountNumber: 0 }; +} + +export const SignDoc: MessageFns = { + encode(message: SignDoc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDoc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authInfoBytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDoc { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(0), + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + }; + }, + + toJSON(message: SignDoc): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + obj.authInfoBytes = base64FromBytes(message.authInfoBytes); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + return obj; + }, + + create, I>>(base?: I): SignDoc { + return SignDoc.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDoc { + const message = createBaseSignDoc(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(0); + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 0; + return message; + }, +}; + +function createBaseSignDocDirectAux(): SignDocDirectAux { + return { + bodyBytes: new Uint8Array(0), + publicKey: undefined, + chainId: "", + accountNumber: 0, + sequence: 0, + tip: undefined, + }; +} + +export const SignDocDirectAux: MessageFns = { + encode(message: SignDocDirectAux, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(18).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== 0) { + writer.uint32(32).uint64(message.accountNumber); + } + if (message.sequence !== 0) { + writer.uint32(40).uint64(message.sequence); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDocDirectAux(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bodyBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chainId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.accountNumber = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDocDirectAux { + return { + bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(0), + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + accountNumber: isSet(object.accountNumber) ? globalThis.Number(object.accountNumber) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined, + }; + }, + + toJSON(message: SignDocDirectAux): unknown { + const obj: any = {}; + if (message.bodyBytes.length !== 0) { + obj.bodyBytes = base64FromBytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): SignDocDirectAux { + return SignDocDirectAux.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(0); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber ?? 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: "", timeoutHeight: 0, extensionOptions: [], nonCriticalExtensionOptions: [] }; +} + +export const TxBody: MessageFns = { + encode(message: TxBody, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (message.timeoutHeight !== 0) { + writer.uint32(24).uint64(message.timeoutHeight); + } + for (const v of message.extensionOptions) { + Any.encode(v!, writer.uint32(8186).fork()).join(); + } + for (const v of message.nonCriticalExtensionOptions) { + Any.encode(v!, writer.uint32(16378).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.memo = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.timeoutHeight = longToNumber(reader.uint64()); + continue; + case 1023: + if (tag !== 8186) { + break; + } + + message.extensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + case 2047: + if (tag !== 16378) { + break; + } + + message.nonCriticalExtensionOptions.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxBody { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + memo: isSet(object.memo) ? globalThis.String(object.memo) : "", + timeoutHeight: isSet(object.timeoutHeight) ? globalThis.Number(object.timeoutHeight) : 0, + extensionOptions: globalThis.Array.isArray(object?.extensionOptions) + ? object.extensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + nonCriticalExtensionOptions: globalThis.Array.isArray(object?.nonCriticalExtensionOptions) + ? object.nonCriticalExtensionOptions.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.memo !== "") { + obj.memo = message.memo; + } + if (message.timeoutHeight !== 0) { + obj.timeoutHeight = Math.round(message.timeoutHeight); + } + if (message.extensionOptions?.length) { + obj.extensionOptions = message.extensionOptions.map((e) => Any.toJSON(e)); + } + if (message.nonCriticalExtensionOptions?.length) { + obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxBody { + return TxBody.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeoutHeight = object.timeoutHeight ?? 0; + message.extensionOptions = object.extensionOptions?.map((e) => Any.fromPartial(e)) || []; + message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAuthInfo(): AuthInfo { + return { signerInfos: [], fee: undefined, tip: undefined }; +} + +export const AuthInfo: MessageFns = { + encode(message: AuthInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signerInfos) { + SignerInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fee !== undefined) { + Fee.encode(message.fee, writer.uint32(18).fork()).join(); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signerInfos.push(SignerInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fee = Fee.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tip = Tip.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthInfo { + return { + signerInfos: globalThis.Array.isArray(object?.signerInfos) + ? object.signerInfos.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.signerInfos?.length) { + obj.signerInfos = message.signerInfos.map((e) => SignerInfo.toJSON(e)); + } + if (message.fee !== undefined) { + obj.fee = Fee.toJSON(message.fee); + } + if (message.tip !== undefined) { + obj.tip = Tip.toJSON(message.tip); + } + return obj; + }, + + create, I>>(base?: I): AuthInfo { + return AuthInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signerInfos?.map((e) => SignerInfo.fromPartial(e)) || []; + message.fee = (object.fee !== undefined && object.fee !== null) ? Fee.fromPartial(object.fee) : undefined; + message.tip = (object.tip !== undefined && object.tip !== null) ? Tip.fromPartial(object.tip) : undefined; + return message; + }, +}; + +function createBaseSignerInfo(): SignerInfo { + return { publicKey: undefined, modeInfo: undefined, sequence: 0 }; +} + +export const SignerInfo: MessageFns = { + encode(message: SignerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).join(); + } + if (message.modeInfo !== undefined) { + ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfo = ModeInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignerInfo { + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + modeInfo: isSet(object.modeInfo) ? ModeInfo.fromJSON(object.modeInfo) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + if (message.publicKey !== undefined) { + obj.publicKey = Any.toJSON(message.publicKey); + } + if (message.modeInfo !== undefined) { + obj.modeInfo = ModeInfo.toJSON(message.modeInfo); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignerInfo { + return SignerInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignerInfo { + const message = createBaseSignerInfo(); + message.publicKey = (object.publicKey !== undefined && object.publicKey !== null) + ? Any.fromPartial(object.publicKey) + : undefined; + message.modeInfo = (object.modeInfo !== undefined && object.modeInfo !== null) + ? ModeInfo.fromPartial(object.modeInfo) + : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseModeInfo(): ModeInfo { + return { single: undefined, multi: undefined }; +} + +export const ModeInfo: MessageFns = { + encode(message: ModeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + ModeInfo_Multi.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = ModeInfo_Single.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = ModeInfo_Multi.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.single !== undefined) { + obj.single = ModeInfo_Single.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = ModeInfo_Multi.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo { + return ModeInfo.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ModeInfo_Single, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Single { + return { mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; + }, + + toJSON(message: ModeInfo_Single): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Single { + return ModeInfo_Single.fromPartial(base ?? ({} as any)); + }, + 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, modeInfos: [] }; +} + +export const ModeInfo_Multi: MessageFns = { + encode(message: ModeInfo_Multi, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.modeInfos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.modeInfos.push(ModeInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + modeInfos: globalThis.Array.isArray(object?.modeInfos) + ? object.modeInfos.map((e: any) => ModeInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModeInfo_Multi): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.modeInfos?.length) { + obj.modeInfos = message.modeInfos.map((e) => ModeInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo_Multi { + return ModeInfo_Multi.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + message.bitarray = (object.bitarray !== undefined && object.bitarray !== null) + ? CompactBitArray.fromPartial(object.bitarray) + : undefined; + message.modeInfos = object.modeInfos?.map((e) => ModeInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFee(): Fee { + return { amount: [], gasLimit: 0, payer: "", granter: "" }; +} + +export const Fee: MessageFns = { + encode(message: Fee, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.gasLimit !== 0) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasLimit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.payer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.granter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Fee { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + gasLimit: isSet(object.gasLimit) ? globalThis.Number(object.gasLimit) : 0, + payer: isSet(object.payer) ? globalThis.String(object.payer) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + }; + }, + + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.gasLimit !== 0) { + obj.gasLimit = Math.round(message.gasLimit); + } + if (message.payer !== "") { + obj.payer = message.payer; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + return obj; + }, + + create, I>>(base?: I): Fee { + return Fee.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.gasLimit = object.gasLimit ?? 0; + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, +}; + +function createBaseTip(): Tip { + return { amount: [], tipper: "" }; +} + +export const Tip: MessageFns = { + encode(message: Tip, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.tipper !== "") { + writer.uint32(18).string(message.tipper); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tip { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTip(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tipper = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tip { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + tipper: isSet(object.tipper) ? globalThis.String(object.tipper) : "", + }; + }, + + toJSON(message: Tip): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.tipper !== "") { + obj.tipper = message.tipper; + } + return obj; + }, + + create, I>>(base?: I): Tip { + return Tip.fromPartial(base ?? ({} as any)); + }, + 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: "", signDoc: undefined, mode: 0, sig: new Uint8Array(0) }; +} + +export const AuxSignerData: MessageFns = { + encode(message: AuxSignerData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.signDoc !== undefined) { + SignDocDirectAux.encode(message.signDoc, writer.uint32(18).fork()).join(); + } + if (message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + if (message.sig.length !== 0) { + writer.uint32(34).bytes(message.sig); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuxSignerData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signDoc = SignDocDirectAux.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sig = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuxSignerData { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array(0), + }; + }, + + toJSON(message: AuxSignerData): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.signDoc !== undefined) { + obj.signDoc = SignDocDirectAux.toJSON(message.signDoc); + } + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.sig.length !== 0) { + obj.sig = base64FromBytes(message.sig); + } + return obj; + }, + + create, I>>(base?: I): AuxSignerData { + return AuxSignerData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuxSignerData { + const message = createBaseAuxSignerData(); + message.address = object.address ?? ""; + message.signDoc = (object.signDoc !== undefined && object.signDoc !== null) + ? SignDocDirectAux.fromPartial(object.signDoc) + : undefined; + message.mode = object.mode ?? 0; + message.sig = object.sig ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/module/v1/module.ts new file mode 100644 index 00000000..2bec3886 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/module/v1/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.upgrade.module.v1"; + +/** Module is the config object of the upgrade module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/query.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/query.ts index 428fbf3c..39cddba7 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/query.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/query.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { ModuleVersion, Plan } from "./upgrade"; export const protobufPackage = "cosmos.upgrade.v1beta1"; @@ -111,13 +116,13 @@ function createBaseQueryCurrentPlanRequest(): QueryCurrentPlanRequest { return {}; } -export const QueryCurrentPlanRequest = { - encode(_: QueryCurrentPlanRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryCurrentPlanRequest: MessageFns = { + encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentPlanRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryCurrentPlanRequest(); while (reader.pos < end) { @@ -127,7 +132,7 @@ export const QueryCurrentPlanRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -154,16 +159,16 @@ function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { return { plan: undefined }; } -export const QueryCurrentPlanResponse = { - encode(message: QueryCurrentPlanResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryCurrentPlanResponse: MessageFns = { + encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.plan !== undefined) { - Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); + Plan.encode(message.plan, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentPlanResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryCurrentPlanResponse(); while (reader.pos < end) { @@ -180,7 +185,7 @@ export const QueryCurrentPlanResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -211,16 +216,16 @@ function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { return { name: "" }; } -export const QueryAppliedPlanRequest = { - encode(message: QueryAppliedPlanRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAppliedPlanRequest: MessageFns = { + encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAppliedPlanRequest(); while (reader.pos < end) { @@ -237,13 +242,13 @@ export const QueryAppliedPlanRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAppliedPlanRequest { - return { name: isSet(object.name) ? String(object.name) : "" }; + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; }, toJSON(message: QueryAppliedPlanRequest): unknown { @@ -268,16 +273,16 @@ function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { return { height: 0 }; } -export const QueryAppliedPlanResponse = { - encode(message: QueryAppliedPlanResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAppliedPlanResponse: MessageFns = { + encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAppliedPlanResponse(); while (reader.pos < end) { @@ -288,19 +293,19 @@ export const QueryAppliedPlanResponse = { break; } - message.height = longToNumber(reader.int64() as Long); + message.height = longToNumber(reader.int64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAppliedPlanResponse { - return { height: isSet(object.height) ? Number(object.height) : 0 }; + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; }, toJSON(message: QueryAppliedPlanResponse): unknown { @@ -325,16 +330,16 @@ function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusS return { lastHeight: 0 }; } -export const QueryUpgradedConsensusStateRequest = { - encode(message: QueryUpgradedConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryUpgradedConsensusStateRequest: MessageFns = { + encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.lastHeight !== 0) { writer.uint32(8).int64(message.lastHeight); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUpgradedConsensusStateRequest(); while (reader.pos < end) { @@ -345,19 +350,19 @@ export const QueryUpgradedConsensusStateRequest = { break; } - message.lastHeight = longToNumber(reader.int64() as Long); + message.lastHeight = longToNumber(reader.int64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryUpgradedConsensusStateRequest { - return { lastHeight: isSet(object.lastHeight) ? Number(object.lastHeight) : 0 }; + return { lastHeight: isSet(object.lastHeight) ? globalThis.Number(object.lastHeight) : 0 }; }, toJSON(message: QueryUpgradedConsensusStateRequest): unknown { @@ -386,16 +391,16 @@ function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensus return { upgradedConsensusState: new Uint8Array(0) }; } -export const QueryUpgradedConsensusStateResponse = { - encode(message: QueryUpgradedConsensusStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryUpgradedConsensusStateResponse: MessageFns = { + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.upgradedConsensusState.length !== 0) { writer.uint32(18).bytes(message.upgradedConsensusState); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUpgradedConsensusStateResponse(); while (reader.pos < end) { @@ -412,7 +417,7 @@ export const QueryUpgradedConsensusStateResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -451,16 +456,16 @@ function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { return { moduleName: "" }; } -export const QueryModuleVersionsRequest = { - encode(message: QueryModuleVersionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryModuleVersionsRequest: MessageFns = { + encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.moduleName !== "") { writer.uint32(10).string(message.moduleName); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleVersionsRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryModuleVersionsRequest(); while (reader.pos < end) { @@ -477,13 +482,13 @@ export const QueryModuleVersionsRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryModuleVersionsRequest { - return { moduleName: isSet(object.moduleName) ? String(object.moduleName) : "" }; + return { moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "" }; }, toJSON(message: QueryModuleVersionsRequest): unknown { @@ -508,16 +513,16 @@ function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { return { moduleVersions: [] }; } -export const QueryModuleVersionsResponse = { - encode(message: QueryModuleVersionsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryModuleVersionsResponse: MessageFns = { + encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.moduleVersions) { - ModuleVersion.encode(v!, writer.uint32(10).fork()).ldelim(); + ModuleVersion.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleVersionsResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryModuleVersionsResponse(); while (reader.pos < end) { @@ -534,14 +539,14 @@ export const QueryModuleVersionsResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryModuleVersionsResponse { return { - moduleVersions: Array.isArray(object?.moduleVersions) + moduleVersions: globalThis.Array.isArray(object?.moduleVersions) ? object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)) : [], }; @@ -569,13 +574,13 @@ function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { return {}; } -export const QueryAuthorityRequest = { - encode(_: QueryAuthorityRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAuthorityRequest: MessageFns = { + encode(_: QueryAuthorityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAuthorityRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAuthorityRequest(); while (reader.pos < end) { @@ -585,7 +590,7 @@ export const QueryAuthorityRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -612,16 +617,16 @@ function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { return { address: "" }; } -export const QueryAuthorityResponse = { - encode(message: QueryAuthorityResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAuthorityResponse: MessageFns = { + encode(message: QueryAuthorityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAuthorityResponse(); while (reader.pos < end) { @@ -638,13 +643,13 @@ export const QueryAuthorityResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAuthorityResponse { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryAuthorityResponse): unknown { @@ -712,31 +717,31 @@ export class QueryClientImpl implements Query { 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(_m0.Reader.create(data))); + return promise.then((data) => QueryCurrentPlanResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryAppliedPlanResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryUpgradedConsensusStateResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryModuleVersionsResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => QueryAuthorityResponse.decode(new BinaryReader(data))); } } @@ -744,30 +749,11 @@ interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -777,21 +763,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -799,18 +786,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts index 7411b264..48e7cf58 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/tx.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/tx.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Plan } from "./upgrade"; export const protobufPackage = "cosmos.upgrade.v1beta1"; @@ -48,19 +54,19 @@ function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { return { authority: "", plan: undefined }; } -export const MsgSoftwareUpgrade = { - encode(message: MsgSoftwareUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSoftwareUpgrade: MessageFns = { + encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); } if (message.plan !== undefined) { - Plan.encode(message.plan, writer.uint32(18).fork()).ldelim(); + Plan.encode(message.plan, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgrade { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSoftwareUpgrade(); while (reader.pos < end) { @@ -84,14 +90,14 @@ export const MsgSoftwareUpgrade = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgSoftwareUpgrade { return { - authority: isSet(object.authority) ? String(object.authority) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, }; }, @@ -122,13 +128,13 @@ function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { return {}; } -export const MsgSoftwareUpgradeResponse = { - encode(_: MsgSoftwareUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSoftwareUpgradeResponse: MessageFns = { + encode(_: MsgSoftwareUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSoftwareUpgradeResponse(); while (reader.pos < end) { @@ -138,7 +144,7 @@ export const MsgSoftwareUpgradeResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -165,16 +171,16 @@ function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { return { authority: "" }; } -export const MsgCancelUpgrade = { - encode(message: MsgCancelUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgCancelUpgrade: MessageFns = { + encode(message: MsgCancelUpgrade, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCancelUpgrade(); while (reader.pos < end) { @@ -191,13 +197,13 @@ export const MsgCancelUpgrade = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgCancelUpgrade { - return { authority: isSet(object.authority) ? String(object.authority) : "" }; + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; }, toJSON(message: MsgCancelUpgrade): unknown { @@ -222,13 +228,13 @@ function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { return {}; } -export const MsgCancelUpgradeResponse = { - encode(_: MsgCancelUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgCancelUpgradeResponse: MessageFns = { + encode(_: MsgCancelUpgradeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelUpgradeResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCancelUpgradeResponse(); while (reader.pos < end) { @@ -238,7 +244,7 @@ export const MsgCancelUpgradeResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -291,13 +297,13 @@ export class MsgClientImpl implements Msg { 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(_m0.Reader.create(data))); + return promise.then((data) => MsgSoftwareUpgradeResponse.decode(new BinaryReader(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(_m0.Reader.create(data))); + return promise.then((data) => MsgCancelUpgradeResponse.decode(new BinaryReader(data))); } } @@ -308,7 +314,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; @@ -319,3 +326,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts index 9c265d6a..30096c1f 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/upgrade/v1beta1/upgrade.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Any } from "../../../google/protobuf/any"; import { Timestamp } from "../../../google/protobuf/timestamp"; @@ -93,13 +98,13 @@ function createBasePlan(): Plan { return { name: "", time: undefined, height: 0, info: "", upgradedClientState: undefined }; } -export const Plan = { - encode(message: Plan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Plan: MessageFns = { + encode(message: Plan, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.time !== undefined) { - Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); } if (message.height !== 0) { writer.uint32(24).int64(message.height); @@ -108,13 +113,13 @@ export const Plan = { writer.uint32(34).string(message.info); } if (message.upgradedClientState !== undefined) { - Any.encode(message.upgradedClientState, writer.uint32(42).fork()).ldelim(); + Any.encode(message.upgradedClientState, writer.uint32(42).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Plan { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Plan { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePlan(); while (reader.pos < end) { @@ -139,7 +144,7 @@ export const Plan = { break; } - message.height = longToNumber(reader.int64() as Long); + message.height = longToNumber(reader.int64()); continue; case 4: if (tag !== 34) { @@ -159,17 +164,17 @@ export const Plan = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Plan { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, - height: isSet(object.height) ? Number(object.height) : 0, - info: isSet(object.info) ? String(object.info) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + info: isSet(object.info) ? globalThis.String(object.info) : "", upgradedClientState: isSet(object.upgradedClientState) ? Any.fromJSON(object.upgradedClientState) : undefined, }; }, @@ -214,8 +219,8 @@ function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { return { title: "", description: "", plan: undefined }; } -export const SoftwareUpgradeProposal = { - encode(message: SoftwareUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SoftwareUpgradeProposal: MessageFns = { + encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); } @@ -223,13 +228,13 @@ export const SoftwareUpgradeProposal = { writer.uint32(18).string(message.description); } if (message.plan !== undefined) { - Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); + Plan.encode(message.plan, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SoftwareUpgradeProposal { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSoftwareUpgradeProposal(); while (reader.pos < end) { @@ -260,15 +265,15 @@ export const SoftwareUpgradeProposal = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SoftwareUpgradeProposal { return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, }; }, @@ -303,8 +308,8 @@ function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposa return { title: "", description: "" }; } -export const CancelSoftwareUpgradeProposal = { - encode(message: CancelSoftwareUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CancelSoftwareUpgradeProposal: MessageFns = { + encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); } @@ -314,8 +319,8 @@ export const CancelSoftwareUpgradeProposal = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCancelSoftwareUpgradeProposal(); while (reader.pos < end) { @@ -339,15 +344,15 @@ export const CancelSoftwareUpgradeProposal = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): CancelSoftwareUpgradeProposal { return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", }; }, @@ -379,8 +384,8 @@ function createBaseModuleVersion(): ModuleVersion { return { name: "", version: 0 }; } -export const ModuleVersion = { - encode(message: ModuleVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ModuleVersion: MessageFns = { + encode(message: ModuleVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -390,8 +395,8 @@ export const ModuleVersion = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ModuleVersion { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModuleVersion(); while (reader.pos < end) { @@ -409,21 +414,21 @@ export const ModuleVersion = { break; } - message.version = longToNumber(reader.uint64() as Long); + message.version = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ModuleVersion { return { - name: isSet(object.name) ? String(object.name) : "", - version: isSet(object.version) ? Number(object.version) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, }; }, @@ -449,29 +454,11 @@ export const ModuleVersion = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -480,7 +467,7 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; function toTimestamp(date: Date): Timestamp { - const seconds = date.getTime() / 1_000; + const seconds = Math.trunc(date.getTime() / 1_000); const nanos = (date.getTime() % 1_000) * 1_000_000; return { seconds, nanos }; } @@ -488,31 +475,39 @@ function toTimestamp(date: Date): Timestamp { function fromTimestamp(t: Timestamp): Date { let millis = (t.seconds || 0) * 1_000; millis += (t.nanos || 0) / 1_000_000; - return new Date(millis); + 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)); } } -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/module/v1/module.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/module/v1/module.ts new file mode 100644 index 00000000..99609e8c --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/module/v1/module.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/module/v1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.vesting.module.v1"; + +/** Module is the config object of the vesting module. */ +export interface Module { +} + +function createBaseModule(): Module { + return {}; +} + +export const Module: MessageFns = { + encode(_: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Module { + return {}; + }, + + toJSON(_: Module): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Module { + const message = createBaseModule(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/v1beta1/tx.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 00000000..034b0314 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,628 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + fromAddress: string; + toAddress: string; + amount: Coin[]; + /** end of vesting as unix time (in seconds). */ + endTime: number; + delayed: boolean; +} + +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponse { +} + +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; +} + +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponse { +} + +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccount { + fromAddress: string; + toAddress: string; + /** start of vesting as unix time (in seconds). */ + startTime: number; + vestingPeriods: Period[]; +} + +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponse { +} + +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { fromAddress: "", toAddress: "", amount: [], endTime: 0, delayed: false }; +} + +export const MsgCreateVestingAccount: MessageFns = { + encode(message: MsgCreateVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(32).int64(message.endTime); + } + if (message.delayed !== false) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.delayed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + delayed: isSet(object.delayed) ? globalThis.Boolean(object.delayed) : false, + }; + }, + + toJSON(message: MsgCreateVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + if (message.delayed !== false) { + obj.delayed = message.delayed; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccount { + return MsgCreateVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + message.delayed = object.delayed ?? false; + return message; + }, +}; + +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} + +export const MsgCreateVestingAccountResponse: MessageFns = { + encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreateVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { + return { fromAddress: "", toAddress: "", amount: [] }; +} + +export const MsgCreatePermanentLockedAccount: MessageFns = { + encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePermanentLockedAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCreatePermanentLockedAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { + return {}; +} + +export const MsgCreatePermanentLockedAccountResponse: MessageFns = { + encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePermanentLockedAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { + return { fromAddress: "", toAddress: "", startTime: 0, vestingPeriods: [] }; +} + +export const MsgCreatePeriodicVestingAccount: MessageFns = { + encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + if (message.startTime !== 0) { + writer.uint32(24).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddress = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreatePeriodicVestingAccount { + return { + fromAddress: isSet(object.fromAddress) ? globalThis.String(object.fromAddress) : "", + toAddress: isSet(object.toAddress) ? globalThis.String(object.toAddress) : "", + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreatePeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.fromAddress !== "") { + obj.fromAddress = message.fromAddress; + } + if (message.toAddress !== "") { + obj.toAddress = message.toAddress; + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { + return {}; +} + +export const MsgCreatePeriodicVestingAccountResponse: MessageFns = { + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePeriodicVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + 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. + * + * Since: cosmos-sdk 0.46 + */ + CreatePermanentLockedAccount( + request: MsgCreatePermanentLockedAccount, + ): Promise; + /** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * + * Since: cosmos-sdk 0.46 + */ + CreatePeriodicVestingAccount( + request: MsgCreatePeriodicVestingAccount, + ): Promise; +} + +export const MsgServiceName = "cosmos.vesting.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 || MsgServiceName; + 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 BinaryReader(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 BinaryReader(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 BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 00000000..0fe13459 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,610 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/vesting/v1beta1/vesting.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 { + baseAccount: BaseAccount | undefined; + originalVesting: Coin[]; + delegatedFree: Coin[]; + delegatedVesting: Coin[]; + /** Vesting end time, as unix timestamp (in seconds). */ + endTime: number; +} + +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccount { + baseVestingAccount: + | BaseVestingAccount + | undefined; + /** Vesting start time, as unix timestamp (in seconds). */ + startTime: number; +} + +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; +} + +/** Period defines a length of time and amount of coins that will vest. */ +export interface Period { + /** Period duration in seconds. */ + length: number; + amount: Coin[]; +} + +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccount { + baseVestingAccount: BaseVestingAccount | undefined; + startTime: number; + vestingPeriods: 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 { + baseVestingAccount: BaseVestingAccount | undefined; +} + +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { baseAccount: undefined, originalVesting: [], delegatedFree: [], delegatedVesting: [], endTime: 0 }; +} + +export const BaseVestingAccount: MessageFns = { + encode(message: BaseVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).join(); + } + for (const v of message.originalVesting) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.delegatedFree) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.delegatedVesting) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.endTime !== 0) { + writer.uint32(40).int64(message.endTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.originalVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatedFree.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegatedVesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.endTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseVestingAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + originalVesting: globalThis.Array.isArray(object?.originalVesting) + ? object.originalVesting.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedFree: globalThis.Array.isArray(object?.delegatedFree) + ? object.delegatedFree.map((e: any) => Coin.fromJSON(e)) + : [], + delegatedVesting: globalThis.Array.isArray(object?.delegatedVesting) + ? object.delegatedVesting.map((e: any) => Coin.fromJSON(e)) + : [], + endTime: isSet(object.endTime) ? globalThis.Number(object.endTime) : 0, + }; + }, + + toJSON(message: BaseVestingAccount): unknown { + const obj: any = {}; + if (message.baseAccount !== undefined) { + obj.baseAccount = BaseAccount.toJSON(message.baseAccount); + } + if (message.originalVesting?.length) { + obj.originalVesting = message.originalVesting.map((e) => Coin.toJSON(e)); + } + if (message.delegatedFree?.length) { + obj.delegatedFree = message.delegatedFree.map((e) => Coin.toJSON(e)); + } + if (message.delegatedVesting?.length) { + obj.delegatedVesting = message.delegatedVesting.map((e) => Coin.toJSON(e)); + } + if (message.endTime !== 0) { + obj.endTime = Math.round(message.endTime); + } + return obj; + }, + + create, I>>(base?: I): BaseVestingAccount { + return BaseVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.originalVesting = object.originalVesting?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedFree = object.delegatedFree?.map((e) => Coin.fromPartial(e)) || []; + message.delegatedVesting = object.delegatedVesting?.map((e) => Coin.fromPartial(e)) || []; + message.endTime = object.endTime ?? 0; + return message; + }, +}; + +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { baseVestingAccount: undefined, startTime: 0 }; +} + +export const ContinuousVestingAccount: MessageFns = { + encode(message: ContinuousVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContinuousVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + }; + }, + + toJSON(message: ContinuousVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + return obj; + }, + + create, I>>(base?: I): ContinuousVestingAccount { + return ContinuousVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + return message; + }, +}; + +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { baseVestingAccount: undefined }; +} + +export const DelayedVestingAccount: MessageFns = { + encode(message: DelayedVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelayedVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: DelayedVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): DelayedVestingAccount { + return DelayedVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +function createBasePeriod(): Period { + return { length: 0, amount: [] }; +} + +export const Period: MessageFns = { + encode(message: Period, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.length !== 0) { + writer.uint32(8).int64(message.length); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Period { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.length = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Period { + return { + length: isSet(object.length) ? globalThis.Number(object.length) : 0, + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Period): unknown { + const obj: any = {}; + if (message.length !== 0) { + obj.length = Math.round(message.length); + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Period { + return Period.fromPartial(base ?? ({} as any)); + }, + 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 { baseVestingAccount: undefined, startTime: 0, vestingPeriods: [] }; +} + +export const PeriodicVestingAccount: MessageFns = { + encode(message: PeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + if (message.startTime !== 0) { + writer.uint32(16).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startTime = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeriodicVestingAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: isSet(object.startTime) ? globalThis.Number(object.startTime) : 0, + vestingPeriods: globalThis.Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + if (message.startTime !== 0) { + obj.startTime = Math.round(message.startTime); + } + if (message.vestingPeriods?.length) { + obj.vestingPeriods = message.vestingPeriods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PeriodicVestingAccount { + return PeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = object.startTime ?? 0; + message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { baseVestingAccount: undefined }; +} + +export const PermanentLockedAccount: MessageFns = { + encode(message: PermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PermanentLockedAccount { + return { + baseVestingAccount: isSet(object.baseVestingAccount) + ? BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + + toJSON(message: PermanentLockedAccount): unknown { + const obj: any = {}; + if (message.baseVestingAccount !== undefined) { + obj.baseVestingAccount = BaseVestingAccount.toJSON(message.baseVestingAccount); + } + return obj; + }, + + create, I>>(base?: I): PermanentLockedAccount { + return PermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.baseVestingAccount = (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) + ? BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.upgrade.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.upgrade.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.upgrade.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.upgrade.v1beta1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/google/api/annotations.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.upgrade.v1beta1/types/google/api/http.ts b/ts-client/cosmos.upgrade.v1beta1/types/google/api/http.ts index 9010600b..d3390802 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/google/api/http.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,94 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} + * This enables an HTTP REST to gRPC mapping as below: * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: - * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` - * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` - * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. - * - * For HTTP method kinds which allow a request body, the `body` field + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +134,10 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +147,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +159,14 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC + * HTTP | gRPC * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +188,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC + * HTTP | gRPC * -----|----- * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` - * - * # Rules for HTTP mapping - * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: - * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. - * - * The syntax of the path template is as follows: + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +224,115 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +346,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +383,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +419,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +438,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +470,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +491,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +500,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +586,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +668,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +679,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +704,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +741,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; @@ -673,3 +753,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/any.ts b/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/any.ts index f4abfdf9..24b86540 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/any.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/any.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/any.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -28,6 +34,10 @@ 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. * @@ -111,7 +121,8 @@ export interface Any { * * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. * * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. @@ -125,8 +136,8 @@ function createBaseAny(): Any { return { typeUrl: "", value: new Uint8Array(0) }; } -export const Any = { - encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Any: MessageFns = { + encode(message: Any, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.typeUrl !== "") { writer.uint32(10).string(message.typeUrl); } @@ -136,8 +147,8 @@ export const Any = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Any { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAny(); while (reader.pos < end) { @@ -161,14 +172,14 @@ export const Any = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Any { return { - typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), }; }, @@ -195,30 +206,11 @@ export const Any = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -228,21 +220,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -253,3 +246,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..b7d4af33 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,106 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +112,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +133,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +142,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +178,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +193,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,33 +312,40 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** @@ -163,7 +371,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +398,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +529,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +544,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +561,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +573,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +607,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +657,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +667,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,13 +678,17 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** * 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 @@ -469,8 +697,10 @@ export interface FileOptions { * However, an extension field still accepts non-UTF-8 byte sequences. * This option has no effect on when used with the lite runtime. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +708,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +723,83 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: boolean | undefined; + phpGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,21 +871,31 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** + * 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. + * * Whether the message is an automatically generated map entry type for the * maps field. * @@ -647,12 +913,31 @@ export interface MessageOptions { * 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. + */ + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. * - * 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. + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated */ - mapEntry: boolean; + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -661,18 +946,26 @@ 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release -- sorry, we'll try to include + * other types in a future version! */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +979,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -715,17 +1010,46 @@ export interface FieldOptions { * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. + * + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1057,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1144,150 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1297,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1337,39 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1381,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1453,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,51 +1474,341 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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. +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + NONE = 1, + VERIFY = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 1: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: Edition | undefined; + features?: FeatureSet | undefined; +} + +/** + * 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. @@ -1010,8 +1822,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition occurs. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1879,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1900,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1925,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2020,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2063,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2082,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2226,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) + : [], + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2309,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2339,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2359,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2394,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2475,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2571,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2617,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2664,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2700,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2737,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2771,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2821,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,6 +2839,134 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; + return message; + }, +}; + +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; +} + +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; return message; }, }; @@ -1915,46 +2987,46 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { }; } -export const FieldDescriptorProto = { - encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(24).int32(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { writer.uint32(32).int32(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { writer.uint32(40).int32(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { writer.uint32(50).string(message.typeName); } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { writer.uint32(18).string(message.extendee); } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { writer.uint32(58).string(message.defaultValue); } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { writer.uint32(72).int32(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3113,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3198,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3234,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3274,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3294,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3340,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3402,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3438,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3480,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3526,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3571,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3617,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3671,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3747,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2736,7 +3817,7 @@ function createBaseFileOptions(): FileOptions { pyGenericServices: false, phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3825,84 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { writer.uint32(336).bool(message.phpGenericServices); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2963,6 +4048,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4066,37 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + phpGenericServices: isSet(object.phpGenericServices) ? globalThis.Boolean(object.phpGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4104,69 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined && message.phpGenericServices !== false) { obj.phpGenericServices = message.phpGenericServices; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3094,7 +4190,7 @@ export const FileOptions = { message.pyGenericServices = object.pyGenericServices ?? false; message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4198,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4212,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4281,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4306,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4333,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4368,81 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4476,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4497,51 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4553,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4561,22 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4584,42 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,32 +4635,124 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; +} + +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptions_EditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: FieldOptions_EditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; + return message; + }, +}; + function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; + return { features: undefined, uninterpretedOption: [] }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3417,14 +4764,15 @@ export const OneofOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3432,6 +4780,9 @@ export const OneofOptions = { toJSON(message: OneofOptions): unknown { const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3443,31 +4794,48 @@ export const OneofOptions = { }, fromPartial, I>>(object: I): OneofOptions { const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { writer.uint32(16).bool(message.allowAlias); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumOptions(); while (reader.pos < end) { @@ -3487,6 +4855,20 @@ export const EnumOptions = { message.deprecated = reader.bool(); continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3498,16 +4880,20 @@ export const EnumOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumOptions { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3515,12 +4901,20 @@ export const EnumOptions = { toJSON(message: EnumOptions): unknown { const obj: any = {}; - if (message.allowAlias === true) { + if (message.allowAlias !== undefined && message.allowAlias !== false) { obj.allowAlias = message.allowAlias; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3534,28 +4928,38 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { deprecated: false, features: undefined, debugRedact: false, uninterpretedOption: [] }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +4972,20 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +4997,17 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5015,15 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5036,47 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5095,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5112,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5129,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5139,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5180,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5198,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5218,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5240,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5260,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5312,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5346,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5370,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5411,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5447,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5464,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5481,337 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, features: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +5828,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +5863,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +5887,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +5953,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +5978,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6008,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6034,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6066,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6136,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6167,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6191,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6210,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6233,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/timestamp.ts b/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/timestamp.ts index 560af8a4..c7ff7f50 100644 --- a/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/timestamp.ts +++ b/ts-client/cosmos.upgrade.v1beta1/types/google/protobuf/timestamp.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/timestamp.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -92,7 +97,7 @@ export const protobufPackage = "google.protobuf"; * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use * the Joda Time's [`ISODateTimeFormat.dateTime()`]( - * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() * ) to obtain a formatter capable of generating timestamps in this format. */ export interface Timestamp { @@ -115,8 +120,8 @@ function createBaseTimestamp(): Timestamp { return { seconds: 0, nanos: 0 }; } -export const Timestamp = { - encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Timestamp: MessageFns = { + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -126,8 +131,8 @@ export const Timestamp = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTimestamp(); while (reader.pos < end) { @@ -138,7 +143,7 @@ export const Timestamp = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -151,15 +156,15 @@ export const Timestamp = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Timestamp { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -185,29 +190,11 @@ export const Timestamp = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -215,18 +202,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/route-name.eta b/ts-client/cosmos.upgrade.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/abci/types.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/abci/types.ts new file mode 100644 index 00000000..c4e0902e --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/abci/types.ts @@ -0,0 +1,5925 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/abci/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { ConsensusParams } from "../types/params"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON } from "../types/validator"; + +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 MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1, +} + +export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} + +export function misbehaviorTypeToJSON(object: MisbehaviorType): string { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Request { + echo?: RequestEcho | undefined; + flush?: RequestFlush | undefined; + info?: RequestInfo | undefined; + initChain?: RequestInitChain | undefined; + query?: RequestQuery | undefined; + checkTx?: RequestCheckTx | undefined; + commit?: RequestCommit | undefined; + listSnapshots?: RequestListSnapshots | undefined; + offerSnapshot?: RequestOfferSnapshot | undefined; + loadSnapshotChunk?: RequestLoadSnapshotChunk | undefined; + applySnapshotChunk?: RequestApplySnapshotChunk | undefined; + prepareProposal?: RequestPrepareProposal | undefined; + processProposal?: RequestProcessProposal | undefined; + extendVote?: RequestExtendVote | undefined; + verifyVoteExtension?: RequestVerifyVoteExtension | undefined; + finalizeBlock?: RequestFinalizeBlock | undefined; +} + +export interface RequestEcho { + message: string; +} + +export interface RequestFlush { +} + +export interface RequestInfo { + version: string; + blockVersion: number; + p2pVersion: number; + abciVersion: string; +} + +export interface RequestInitChain { + time: Date | undefined; + chainId: string; + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appStateBytes: Uint8Array; + initialHeight: number; +} + +export interface RequestQuery { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} + +export interface RequestCommit { +} + +/** lists available snapshots */ +export interface RequestListSnapshots { +} + +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot: + | Snapshot + | undefined; + /** light client-verified app hash for snapshot height */ + appHash: Uint8Array; +} + +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: number; + format: number; + chunk: number; +} + +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} + +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: number; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit: ExtendedCommitInfo | undefined; + misbehavior: Misbehavior[]; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} + +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Extends a vote with application-injected data */ +export interface RequestExtendVote { + /** the hash of the block that this vote may be referring to */ + hash: Uint8Array; + /** the height of the extended vote */ + height: number; + /** info of the block that this vote may be referring to */ + time: Date | undefined; + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +/** Verify the vote extension */ +export interface RequestVerifyVoteExtension { + /** the hash of the block that this received vote corresponds to */ + hash: Uint8Array; + /** the validator that signed the vote extension */ + validatorAddress: Uint8Array; + height: number; + voteExtension: Uint8Array; +} + +export interface RequestFinalizeBlock { + txs: Uint8Array[]; + decidedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the decided block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} + +export interface Response { + exception?: ResponseException | undefined; + echo?: ResponseEcho | undefined; + flush?: ResponseFlush | undefined; + info?: ResponseInfo | undefined; + initChain?: ResponseInitChain | undefined; + query?: ResponseQuery | undefined; + checkTx?: ResponseCheckTx | undefined; + commit?: ResponseCommit | undefined; + listSnapshots?: ResponseListSnapshots | undefined; + offerSnapshot?: ResponseOfferSnapshot | undefined; + loadSnapshotChunk?: ResponseLoadSnapshotChunk | undefined; + applySnapshotChunk?: ResponseApplySnapshotChunk | undefined; + prepareProposal?: ResponsePrepareProposal | undefined; + processProposal?: ResponseProcessProposal | undefined; + extendVote?: ResponseExtendVote | undefined; + verifyVoteExtension?: ResponseVerifyVoteExtension | undefined; + finalizeBlock?: ResponseFinalizeBlock | undefined; +} + +/** nondeterministic */ +export interface ResponseException { + error: string; +} + +export interface ResponseEcho { + message: string; +} + +export interface ResponseFlush { +} + +export interface ResponseInfo { + data: string; + version: string; + appVersion: number; + lastBlockHeight: number; + lastBlockAppHash: Uint8Array; +} + +export interface ResponseInitChain { + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appHash: Uint8Array; +} + +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} + +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + events: Event[]; + codespace: string; +} + +export interface ResponseCommit { + retainHeight: number; +} + +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 */ + refetchChunks: number[]; + /** Chunk senders to reject and ban */ + rejectSenders: 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"; + } +} + +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} + +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} + +export enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} + +export function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseExtendVote { + voteExtension: Uint8Array; +} + +export interface ResponseVerifyVoteExtension { + status: ResponseVerifyVoteExtension_VerifyStatus; +} + +export enum ResponseVerifyVoteExtension_VerifyStatus { + UNKNOWN = 0, + ACCEPT = 1, + /** + * REJECT - Rejecting the vote extension will reject the entire precommit by the sender. + * Incorrectly implementing this thus has liveness implications as it may affect + * CometBFT's ability to receive 2/3+ valid votes to finalize the block. + * Honest nodes should never be rejected. + */ + REJECT = 2, + UNRECOGNIZED = -1, +} + +export function responseVerifyVoteExtension_VerifyStatusFromJSON( + object: any, +): ResponseVerifyVoteExtension_VerifyStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseVerifyVoteExtension_VerifyStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseVerifyVoteExtension_VerifyStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED; + } +} + +export function responseVerifyVoteExtension_VerifyStatusToJSON( + object: ResponseVerifyVoteExtension_VerifyStatus, +): string { + switch (object) { + case ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseVerifyVoteExtension_VerifyStatus.ACCEPT: + return "ACCEPT"; + case ResponseVerifyVoteExtension_VerifyStatus.REJECT: + return "REJECT"; + case ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ResponseFinalizeBlock { + /** set of block events emmitted as part of executing the block */ + events: Event[]; + /** + * the result of executing each transaction including the events + * the particular transction emitted. This should match the order + * of the transactions delivered in the block itself + */ + txResults: ExecTxResult[]; + /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ + validatorUpdates: ValidatorUpdate[]; + /** updates to the consensus params, if any. */ + consensusParamUpdates: + | ConsensusParams + | undefined; + /** + * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + * deterministic. It is up to the application to decide which algorithm to use. + */ + appHash: Uint8Array; +} + +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} + +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} + +/** + * Event allows application developers to attach additional information to + * ResponseFinalizeBlock and ResponseCheckTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} + +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} + +/** + * ExecTxResult contains results of executing one individual transaction. + * + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted + */ +export interface ExecTxResult { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + /** nondeterministic */ + events: Event[]; + codespace: string; +} + +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: number; + index: number; + tx: Uint8Array; + result: ExecTxResult | undefined; +} + +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: number; +} + +export interface ValidatorUpdate { + pubKey: PublicKey | undefined; + power: number; +} + +export interface VoteInfo { + validator: Validator | undefined; + blockIdFlag: BlockIDFlag; +} + +export interface ExtendedVoteInfo { + /** The validator that sent the vote. */ + validator: + | Validator + | undefined; + /** Non-deterministic extension provided by the sending validator's application. */ + voteExtension: Uint8Array; + /** Vote extension signature created by CometBFT */ + extensionSignature: Uint8Array; + /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ + blockIdFlag: BlockIDFlag; +} + +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator: + | Validator + | undefined; + /** The height when the offense occurred */ + height: number; + /** The corresponding time where the offense occurred */ + time: + | Date + | undefined; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + totalVotingPower: number; +} + +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: number; + /** 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, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Request: MessageFns = { + encode(message: Request, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.echo !== undefined) { + RequestEcho.encode(message.echo, writer.uint32(10).fork()).join(); + } + if (message.flush !== undefined) { + RequestFlush.encode(message.flush, writer.uint32(18).fork()).join(); + } + if (message.info !== undefined) { + RequestInfo.encode(message.info, writer.uint32(26).fork()).join(); + } + if (message.initChain !== undefined) { + RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).join(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).join(); + } + if (message.checkTx !== undefined) { + RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).join(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).join(); + } + if (message.listSnapshots !== undefined) { + RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.prepareProposal !== undefined) { + RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).join(); + } + if (message.processProposal !== undefined) { + RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).join(); + } + if (message.extendVote !== undefined) { + RequestExtendVote.encode(message.extendVote, writer.uint32(146).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + RequestVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(154).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.finalizeBlock, writer.uint32(162).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Request { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.echo = RequestEcho.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.flush = RequestFlush.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.info = RequestInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.initChain = RequestInitChain.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = RequestQuery.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.commit = RequestCommit.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.extendVote = RequestExtendVote.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.verifyVoteExtension = RequestVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.finalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? RequestInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? RequestCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? RequestListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? RequestOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? RequestPrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? RequestProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? RequestExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? RequestVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? RequestFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Request): unknown { + const obj: any = {}; + if (message.echo !== undefined) { + obj.echo = RequestEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = RequestFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = RequestInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = RequestInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = RequestQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = RequestCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = RequestCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = RequestListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = RequestOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = RequestPrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = RequestProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = RequestExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = RequestVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = RequestFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Request { + return Request.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? RequestInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? RequestQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? RequestCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? RequestCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? RequestListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? RequestPrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? RequestProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? RequestExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? RequestVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? RequestFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseRequestEcho(): RequestEcho { + return { message: "" }; +} + +export const RequestEcho: MessageFns = { + encode(message: RequestEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: RequestEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): RequestEcho { + return RequestEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseRequestFlush(): RequestFlush { + return {}; +} + +export const RequestFlush: MessageFns = { + encode(_: RequestFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestFlush { + return {}; + }, + + toJSON(_: RequestFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestFlush { + return RequestFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, +}; + +function createBaseRequestInfo(): RequestInfo { + return { version: "", blockVersion: 0, p2pVersion: 0, abciVersion: "" }; +} + +export const RequestInfo: MessageFns = { + encode(message: RequestInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.blockVersion !== 0) { + writer.uint32(16).uint64(message.blockVersion); + } + if (message.p2pVersion !== 0) { + writer.uint32(24).uint64(message.p2pVersion); + } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockVersion = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.p2pVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.abciVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo { + return { + version: isSet(object.version) ? globalThis.String(object.version) : "", + blockVersion: isSet(object.blockVersion) ? globalThis.Number(object.blockVersion) : 0, + p2pVersion: isSet(object.p2pVersion) ? globalThis.Number(object.p2pVersion) : 0, + abciVersion: isSet(object.abciVersion) ? globalThis.String(object.abciVersion) : "", + }; + }, + + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + if (message.version !== "") { + obj.version = message.version; + } + if (message.blockVersion !== 0) { + obj.blockVersion = Math.round(message.blockVersion); + } + if (message.p2pVersion !== 0) { + obj.p2pVersion = Math.round(message.p2pVersion); + } + if (message.abciVersion !== "") { + obj.abciVersion = message.abciVersion; + } + return obj; + }, + + create, I>>(base?: I): RequestInfo { + return RequestInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = object.blockVersion ?? 0; + message.p2pVersion = object.p2pVersion ?? 0; + message.abciVersion = object.abciVersion ?? ""; + return message; + }, +}; + +function createBaseRequestInitChain(): RequestInitChain { + return { + time: undefined, + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(0), + initialHeight: 0, + }; +} + +export const RequestInitChain: MessageFns = { + encode(message: RequestInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appStateBytes = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.initialHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInitChain { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appStateBytes: isSet(object.appStateBytes) ? bytesFromBase64(object.appStateBytes) : new Uint8Array(0), + initialHeight: isSet(object.initialHeight) ? globalThis.Number(object.initialHeight) : 0, + }; + }, + + toJSON(message: RequestInitChain): unknown { + const obj: any = {}; + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appStateBytes.length !== 0) { + obj.appStateBytes = base64FromBytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + obj.initialHeight = Math.round(message.initialHeight); + } + return obj; + }, + + create, I>>(base?: I): RequestInitChain { + return RequestInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(0); + message.initialHeight = object.initialHeight ?? 0; + return message; + }, +}; + +function createBaseRequestQuery(): RequestQuery { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +export const RequestQuery: MessageFns = { + encode(message: RequestQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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 !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestQuery { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: RequestQuery): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): RequestQuery { + return RequestQuery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseRequestCheckTx(): RequestCheckTx { + return { tx: new Uint8Array(0), type: 0 }; +} + +export const RequestCheckTx: MessageFns = { + encode(message: RequestCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestCheckTx { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + + toJSON(message: RequestCheckTx): unknown { + const obj: any = {}; + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.type !== 0) { + obj.type = checkTxTypeToJSON(message.type); + } + return obj; + }, + + create, I>>(base?: I): RequestCheckTx { + return RequestCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(0); + message.type = object.type ?? 0; + return message; + }, +}; + +function createBaseRequestCommit(): RequestCommit { + return {}; +} + +export const RequestCommit: MessageFns = { + encode(_: RequestCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestCommit { + return {}; + }, + + toJSON(_: RequestCommit): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestCommit { + return RequestCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, +}; + +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} + +export const RequestListSnapshots: MessageFns = { + encode(_: RequestListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestListSnapshots { + return {}; + }, + + toJSON(_: RequestListSnapshots): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestListSnapshots { + return RequestListSnapshots.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; + +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { snapshot: undefined, appHash: new Uint8Array(0) }; +} + +export const RequestOfferSnapshot: MessageFns = { + encode(message: RequestOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshot = Snapshot.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestOfferSnapshot { + return { + snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestOfferSnapshot): unknown { + const obj: any = {}; + if (message.snapshot !== undefined) { + obj.snapshot = Snapshot.toJSON(message.snapshot); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): RequestOfferSnapshot { + return RequestOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) + ? Snapshot.fromPartial(object.snapshot) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { height: 0, format: 0, chunk: 0 }; +} + +export const RequestLoadSnapshotChunk: MessageFns = { + encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunk = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestLoadSnapshotChunk { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunk: isSet(object.chunk) ? globalThis.Number(object.chunk) : 0, + }; + }, + + toJSON(message: RequestLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunk !== 0) { + obj.chunk = Math.round(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + 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(0), sender: "" }; +} + +export const RequestApplySnapshotChunk: MessageFns = { + encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chunk = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestApplySnapshotChunk { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0), + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + }; + }, + + toJSON(message: RequestApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + if (message.sender !== "") { + obj.sender = message.sender; + } + return obj; + }, + + create, I>>(base?: I): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(0); + message.sender = object.sender ?? ""; + return message; + }, +}; + +function createBaseRequestPrepareProposal(): RequestPrepareProposal { + return { + maxTxBytes: 0, + txs: [], + localLastCommit: undefined, + misbehavior: [], + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestPrepareProposal: MessageFns = { + encode(message: RequestPrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxTxBytes !== 0) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v!); + } + if (message.localLastCommit !== undefined) { + ExtendedCommitInfo.encode(message.localLastCommit, writer.uint32(26).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxTxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.localLastCommit = ExtendedCommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrepareProposal { + return { + maxTxBytes: isSet(object.maxTxBytes) ? globalThis.Number(object.maxTxBytes) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + localLastCommit: isSet(object.localLastCommit) ? ExtendedCommitInfo.fromJSON(object.localLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestPrepareProposal): unknown { + const obj: any = {}; + if (message.maxTxBytes !== 0) { + obj.maxTxBytes = Math.round(message.maxTxBytes); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.localLastCommit !== undefined) { + obj.localLastCommit = ExtendedCommitInfo.toJSON(message.localLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestPrepareProposal { + return RequestPrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = object.maxTxBytes ?? 0; + message.txs = object.txs?.map((e) => e) || []; + message.localLastCommit = (object.localLastCommit !== undefined && object.localLastCommit !== null) + ? ExtendedCommitInfo.fromPartial(object.localLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestProcessProposal(): RequestProcessProposal { + return { + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestProcessProposal: MessageFns = { + encode(message: RequestProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestProcessProposal { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestProcessProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestProcessProposal { + return RequestProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestExtendVote(): RequestExtendVote { + return { + hash: new Uint8Array(0), + height: 0, + time: undefined, + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestExtendVote: MessageFns = { + encode(message: RequestExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(26).fork()).join(); + } + for (const v of message.txs) { + writer.uint32(34).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(42).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestExtendVote { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposedLastCommit: isSet(object.proposedLastCommit) ? CommitInfo.fromJSON(object.proposedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestExtendVote): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposedLastCommit !== undefined) { + obj.proposedLastCommit = CommitInfo.toJSON(message.proposedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestExtendVote { + return RequestExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestExtendVote { + const message = createBaseRequestExtendVote(); + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = (object.proposedLastCommit !== undefined && object.proposedLastCommit !== null) + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestVerifyVoteExtension(): RequestVerifyVoteExtension { + return { hash: new Uint8Array(0), validatorAddress: new Uint8Array(0), height: 0, voteExtension: new Uint8Array(0) }; +} + +export const RequestVerifyVoteExtension: MessageFns = { + encode(message: RequestVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.voteExtension.length !== 0) { + writer.uint32(34).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestVerifyVoteExtension { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + message.hash = object.hash ?? new Uint8Array(0); + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseRequestFinalizeBlock(): RequestFinalizeBlock { + return { + txs: [], + decidedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const RequestFinalizeBlock: MessageFns = { + encode(message: RequestFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.decidedLastCommit !== undefined) { + CommitInfo.encode(message.decidedLastCommit, writer.uint32(18).fork()).join(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decidedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestFinalizeBlock { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + decidedLastCommit: isSet(object.decidedLastCommit) ? CommitInfo.fromJSON(object.decidedLastCommit) : undefined, + misbehavior: globalThis.Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestFinalizeBlock): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.decidedLastCommit !== undefined) { + obj.decidedLastCommit = CommitInfo.toJSON(message.decidedLastCommit); + } + if (message.misbehavior?.length) { + obj.misbehavior = message.misbehavior.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): RequestFinalizeBlock { + return RequestFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map((e) => e) || []; + message.decidedLastCommit = (object.decidedLastCommit !== undefined && object.decidedLastCommit !== null) + ? CommitInfo.fromPartial(object.decidedLastCommit) + : undefined; + message.misbehavior = object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined, + }; +} + +export const Response: MessageFns = { + encode(message: Response, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).join(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).join(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).join(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + if (message.initChain !== undefined) { + ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).join(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).join(); + } + if (message.checkTx !== undefined) { + ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).join(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).join(); + } + if (message.listSnapshots !== undefined) { + ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).join(); + } + if (message.offerSnapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).join(); + } + if (message.loadSnapshotChunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).join(); + } + if (message.applySnapshotChunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).join(); + } + if (message.prepareProposal !== undefined) { + ResponsePrepareProposal.encode(message.prepareProposal, writer.uint32(138).fork()).join(); + } + if (message.processProposal !== undefined) { + ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).join(); + } + if (message.extendVote !== undefined) { + ResponseExtendVote.encode(message.extendVote, writer.uint32(154).fork()).join(); + } + if (message.verifyVoteExtension !== undefined) { + ResponseVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(162).fork()).join(); + } + if (message.finalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.finalizeBlock, writer.uint32(170).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exception = ResponseException.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.echo = ResponseEcho.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.flush = ResponseFlush.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = ResponseInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.initChain = ResponseInitChain.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.query = ResponseQuery.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.commit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.listSnapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.offerSnapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.applySnapshotChunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.prepareProposal = ResponsePrepareProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.processProposal = ResponseProcessProposal.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.extendVote = ResponseExtendVote.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.verifyVoteExtension = ResponseVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.finalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + initChain: isSet(object.initChain) ? ResponseInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? ResponseQuery.fromJSON(object.query) : undefined, + checkTx: isSet(object.checkTx) ? ResponseCheckTx.fromJSON(object.checkTx) : undefined, + commit: isSet(object.commit) ? ResponseCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? ResponseListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? ResponseOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? ResponsePrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? ResponseProcessProposal.fromJSON(object.processProposal) + : undefined, + extendVote: isSet(object.extendVote) ? ResponseExtendVote.fromJSON(object.extendVote) : undefined, + verifyVoteExtension: isSet(object.verifyVoteExtension) + ? ResponseVerifyVoteExtension.fromJSON(object.verifyVoteExtension) + : undefined, + finalizeBlock: isSet(object.finalizeBlock) ? ResponseFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + if (message.exception !== undefined) { + obj.exception = ResponseException.toJSON(message.exception); + } + if (message.echo !== undefined) { + obj.echo = ResponseEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = ResponseFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = ResponseInfo.toJSON(message.info); + } + if (message.initChain !== undefined) { + obj.initChain = ResponseInitChain.toJSON(message.initChain); + } + if (message.query !== undefined) { + obj.query = ResponseQuery.toJSON(message.query); + } + if (message.checkTx !== undefined) { + obj.checkTx = ResponseCheckTx.toJSON(message.checkTx); + } + if (message.commit !== undefined) { + obj.commit = ResponseCommit.toJSON(message.commit); + } + if (message.listSnapshots !== undefined) { + obj.listSnapshots = ResponseListSnapshots.toJSON(message.listSnapshots); + } + if (message.offerSnapshot !== undefined) { + obj.offerSnapshot = ResponseOfferSnapshot.toJSON(message.offerSnapshot); + } + if (message.loadSnapshotChunk !== undefined) { + obj.loadSnapshotChunk = ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); + } + if (message.applySnapshotChunk !== undefined) { + obj.applySnapshotChunk = ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk); + } + if (message.prepareProposal !== undefined) { + obj.prepareProposal = ResponsePrepareProposal.toJSON(message.prepareProposal); + } + if (message.processProposal !== undefined) { + obj.processProposal = ResponseProcessProposal.toJSON(message.processProposal); + } + if (message.extendVote !== undefined) { + obj.extendVote = ResponseExtendVote.toJSON(message.extendVote); + } + if (message.verifyVoteExtension !== undefined) { + obj.verifyVoteExtension = ResponseVerifyVoteExtension.toJSON(message.verifyVoteExtension); + } + if (message.finalizeBlock !== undefined) { + obj.finalizeBlock = ResponseFinalizeBlock.toJSON(message.finalizeBlock); + } + return obj; + }, + + create, I>>(base?: I): Response { + return Response.fromPartial(base ?? ({} as any)); + }, + 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.initChain = (object.initChain !== undefined && object.initChain !== null) + ? ResponseInitChain.fromPartial(object.initChain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ResponseQuery.fromPartial(object.query) + : undefined; + message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) + ? ResponseCheckTx.fromPartial(object.checkTx) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? ResponseCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) + ? ResponseListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) + ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) + ? ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) + ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) + ? ResponsePrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) + ? ResponseProcessProposal.fromPartial(object.processProposal) + : undefined; + message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) + ? ResponseExtendVote.fromPartial(object.extendVote) + : undefined; + message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) + ? ResponseVerifyVoteExtension.fromPartial(object.verifyVoteExtension) + : undefined; + message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) + ? ResponseFinalizeBlock.fromPartial(object.finalizeBlock) + : undefined; + return message; + }, +}; + +function createBaseResponseException(): ResponseException { + return { error: "" }; +} + +export const ResponseException: MessageFns = { + encode(message: ResponseException, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.error = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseException { + return { error: isSet(object.error) ? globalThis.String(object.error) : "" }; + }, + + toJSON(message: ResponseException): unknown { + const obj: any = {}; + if (message.error !== "") { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): ResponseException { + return ResponseException.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; + +function createBaseResponseEcho(): ResponseEcho { + return { message: "" }; +} + +export const ResponseEcho: MessageFns = { + encode(message: ResponseEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: ResponseEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ResponseEcho { + return ResponseEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseResponseFlush(): ResponseFlush { + return {}; +} + +export const ResponseFlush: MessageFns = { + encode(_: ResponseFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ResponseFlush { + return {}; + }, + + toJSON(_: ResponseFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ResponseFlush { + return ResponseFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, +}; + +function createBaseResponseInfo(): ResponseInfo { + return { data: "", version: "", appVersion: 0, lastBlockHeight: 0, lastBlockAppHash: new Uint8Array(0) }; +} + +export const ResponseInfo: MessageFns = { + encode(message: ResponseInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.appVersion !== 0) { + writer.uint32(24).uint64(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.appVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.lastBlockHeight = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockAppHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInfo { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + appVersion: isSet(object.appVersion) ? globalThis.Number(object.appVersion) : 0, + lastBlockHeight: isSet(object.lastBlockHeight) ? globalThis.Number(object.lastBlockHeight) : 0, + lastBlockAppHash: isSet(object.lastBlockAppHash) ? bytesFromBase64(object.lastBlockAppHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInfo): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.appVersion !== 0) { + obj.appVersion = Math.round(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + obj.lastBlockHeight = Math.round(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + obj.lastBlockAppHash = base64FromBytes(message.lastBlockAppHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInfo { + return ResponseInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = object.appVersion ?? 0; + message.lastBlockHeight = object.lastBlockHeight ?? 0; + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseInitChain(): ResponseInitChain { + return { consensusParams: undefined, validators: [], appHash: new Uint8Array(0) }; +} + +export const ResponseInitChain: MessageFns = { + encode(message: ResponseInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInitChain { + return { + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInitChain): unknown { + const obj: any = {}; + if (message.consensusParams !== undefined) { + obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInitChain { + return ResponseInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proofOps: undefined, + height: 0, + codespace: "", + }; +} + +export const ResponseQuery: MessageFns = { + encode(message: ResponseQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseQuery { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseQuery): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proofOps !== undefined) { + obj.proofOps = ProofOps.toJSON(message.proofOps); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseQuery { + return ResponseQuery.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.value = object.value ?? new Uint8Array(0); + message.proofOps = (object.proofOps !== undefined && object.proofOps !== null) + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCheckTx(): ResponseCheckTx { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ResponseCheckTx: MessageFns = { + encode(message: ResponseCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCheckTx { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseCheckTx): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseCheckTx { + return ResponseCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseCommit(): ResponseCommit { + return { retainHeight: 0 }; +} + +export const ResponseCommit: MessageFns = { + encode(message: ResponseCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.retainHeight !== 0) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.retainHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCommit { + return { retainHeight: isSet(object.retainHeight) ? globalThis.Number(object.retainHeight) : 0 }; + }, + + toJSON(message: ResponseCommit): unknown { + const obj: any = {}; + if (message.retainHeight !== 0) { + obj.retainHeight = Math.round(message.retainHeight); + } + return obj; + }, + + create, I>>(base?: I): ResponseCommit { + return ResponseCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCommit { + const message = createBaseResponseCommit(); + message.retainHeight = object.retainHeight ?? 0; + return message; + }, +}; + +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { snapshots: [] }; +} + +export const ResponseListSnapshots: MessageFns = { + encode(message: ResponseListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshots.push(Snapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseListSnapshots { + return { + snapshots: globalThis.Array.isArray(object?.snapshots) + ? object.snapshots.map((e: any) => Snapshot.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ResponseListSnapshots): unknown { + const obj: any = {}; + if (message.snapshots?.length) { + obj.snapshots = message.snapshots.map((e) => Snapshot.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponseListSnapshots { + return ResponseListSnapshots.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: ResponseOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseOfferSnapshot { + return { result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: ResponseOfferSnapshot): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseOfferSnapshot_ResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { chunk: new Uint8Array(0) }; +} + +export const ResponseLoadSnapshotChunk: MessageFns = { + encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunk = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseLoadSnapshotChunk { + return { chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { result: 0, refetchChunks: [], rejectSenders: [] }; +} + +export const ResponseApplySnapshotChunk: MessageFns = { + encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.join(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + case 2: + if (tag === 16) { + message.refetchChunks.push(reader.uint32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + + continue; + } + + break; + case 3: + if (tag !== 26) { + break; + } + + message.rejectSenders.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseApplySnapshotChunk { + return { + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + refetchChunks: globalThis.Array.isArray(object?.refetchChunks) + ? object.refetchChunks.map((e: any) => globalThis.Number(e)) + : [], + rejectSenders: globalThis.Array.isArray(object?.rejectSenders) + ? object.rejectSenders.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ResponseApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + } + if (message.refetchChunks?.length) { + obj.refetchChunks = message.refetchChunks.map((e) => Math.round(e)); + } + if (message.rejectSenders?.length) { + obj.rejectSenders = message.rejectSenders; + } + return obj; + }, + + create, I>>(base?: I): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map((e) => e) || []; + message.rejectSenders = object.rejectSenders?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponsePrepareProposal(): ResponsePrepareProposal { + return { txs: [] }; +} + +export const ResponsePrepareProposal: MessageFns = { + encode(message: ResponsePrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponsePrepareProposal { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: ResponsePrepareProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponsePrepareProposal { + return ResponsePrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { status: 0 }; +} + +export const ResponseProcessProposal: MessageFns = { + encode(message: ResponseProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseProcessProposal { + return { status: isSet(object.status) ? responseProcessProposal_ProposalStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseProcessProposal): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseProcessProposal_ProposalStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseProcessProposal { + return ResponseProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseExtendVote(): ResponseExtendVote { + return { voteExtension: new Uint8Array(0) }; +} + +export const ResponseExtendVote: MessageFns = { + encode(message: ResponseExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtension.length !== 0) { + writer.uint32(10).bytes(message.voteExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseExtendVote { + return { voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseExtendVote): unknown { + const obj: any = {}; + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + return obj; + }, + + create, I>>(base?: I): ResponseExtendVote { + return ResponseExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseResponseVerifyVoteExtension(): ResponseVerifyVoteExtension { + return { status: 0 }; +} + +export const ResponseVerifyVoteExtension: MessageFns = { + encode(message: ResponseVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseVerifyVoteExtension { + return { status: isSet(object.status) ? responseVerifyVoteExtension_VerifyStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseVerifyVoteExtension_VerifyStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseResponseFinalizeBlock(): ResponseFinalizeBlock { + return { + events: [], + txResults: [], + validatorUpdates: [], + consensusParamUpdates: undefined, + appHash: new Uint8Array(0), + }; +} + +export const ResponseFinalizeBlock: MessageFns = { + encode(message: ResponseFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.txResults) { + ExecTxResult.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.validatorUpdates) { + ValidatorUpdate.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.consensusParamUpdates !== undefined) { + ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(34).fork()).join(); + } + if (message.appHash.length !== 0) { + writer.uint32(42).bytes(message.appHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txResults.push(ExecTxResult.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseFinalizeBlock { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + txResults: globalThis.Array.isArray(object?.txResults) + ? object.txResults.map((e: any) => ExecTxResult.fromJSON(e)) + : [], + validatorUpdates: globalThis.Array.isArray(object?.validatorUpdates) + ? object.validatorUpdates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + consensusParamUpdates: isSet(object.consensusParamUpdates) + ? ConsensusParams.fromJSON(object.consensusParamUpdates) + : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseFinalizeBlock): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.txResults?.length) { + obj.txResults = message.txResults.map((e) => ExecTxResult.toJSON(e)); + } + if (message.validatorUpdates?.length) { + obj.validatorUpdates = message.validatorUpdates.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.consensusParamUpdates !== undefined) { + obj.consensusParamUpdates = ConsensusParams.toJSON(message.consensusParamUpdates); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + return obj; + }, + + create, I>>(base?: I): ResponseFinalizeBlock { + return ResponseFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.txResults = object.txResults?.map((e) => ExecTxResult.fromPartial(e)) || []; + message.validatorUpdates = object.validatorUpdates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = + (object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null) + ? ConsensusParams.fromPartial(object.consensusParamUpdates) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommitInfo(): CommitInfo { + return { round: 0, votes: [] }; +} + +export const CommitInfo: MessageFns = { + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + VoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(VoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => VoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitInfo(): ExtendedCommitInfo { + return { round: 0, votes: [] }; +} + +export const ExtendedCommitInfo: MessageFns = { + encode(message: ExtendedCommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + ExtendedVoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => ExtendedVoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ExtendedCommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => ExtendedVoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitInfo { + return ExtendedCommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEvent(): Event { + return { type: "", attributes: [] }; +} + +export const Event: MessageFns = { + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + EventAttribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(EventAttribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Event { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => EventAttribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => EventAttribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + 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: "", value: "", index: false }; +} + +export const EventAttribute: MessageFns = { + encode(message: EventAttribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index !== false) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.index = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventAttribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + index: isSet(object.index) ? globalThis.Boolean(object.index) : false, + }; + }, + + toJSON(message: EventAttribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.index !== false) { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): EventAttribute { + return EventAttribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, +}; + +function createBaseExecTxResult(): ExecTxResult { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gasWanted: 0, gasUsed: 0, events: [], codespace: "" }; +} + +export const ExecTxResult: MessageFns = { + encode(message: ExecTxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecTxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecTxResult { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ExecTxResult): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gasWanted !== 0) { + obj.gas_wanted = Math.round(message.gasWanted); + } + if (message.gasUsed !== 0) { + obj.gas_used = Math.round(message.gasUsed); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ExecTxResult { + return ExecTxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecTxResult { + const message = createBaseExecTxResult(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseTxResult(): TxResult { + return { height: 0, index: 0, tx: new Uint8Array(0), result: undefined }; +} + +export const TxResult: MessageFns = { + encode(message: TxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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) { + ExecTxResult.encode(message.result, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tx = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.result = ExecTxResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + result: isSet(object.result) ? ExecTxResult.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.result !== undefined) { + obj.result = ExecTxResult.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): TxResult { + return TxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.height = object.height ?? 0; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(0); + message.result = (object.result !== undefined && object.result !== null) + ? ExecTxResult.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), power: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseValidatorUpdate(): ValidatorUpdate { + return { pubKey: undefined, power: 0 }; +} + +export const ValidatorUpdate: MessageFns = { + encode(message: ValidatorUpdate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdate { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: ValidatorUpdate): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdate { + return ValidatorUpdate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseVoteInfo(): VoteInfo { + return { validator: undefined, blockIdFlag: 0 }; +} + +export const VoteInfo: MessageFns = { + encode(message: VoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.blockIdFlag !== 0) { + writer.uint32(24).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: VoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): VoteInfo { + return VoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseExtendedVoteInfo(): ExtendedVoteInfo { + return { + validator: undefined, + voteExtension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + blockIdFlag: 0, + }; +} + +export const ExtendedVoteInfo: MessageFns = { + encode(message: ExtendedVoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(34).bytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + writer.uint32(40).int32(message.blockIdFlag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedVoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.voteExtension = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedVoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + voteExtension: isSet(object.voteExtension) ? bytesFromBase64(object.voteExtension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + }; + }, + + toJSON(message: ExtendedVoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.voteExtension.length !== 0) { + obj.voteExtension = base64FromBytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + return obj; + }, + + create, I>>(base?: I): ExtendedVoteInfo { + return ExtendedVoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.voteExtension = object.voteExtension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, +}; + +function createBaseMisbehavior(): Misbehavior { + return { type: 0, validator: undefined, height: 0, time: undefined, totalVotingPower: 0 }; +} + +export const Misbehavior: MessageFns = { + encode(message: Misbehavior, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Misbehavior { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Misbehavior { + return { + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: Misbehavior): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = misbehaviorTypeToJSON(message.type); + } + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): Misbehavior { + return Misbehavior.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Misbehavior { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: new Uint8Array(0) }; +} + +export const Snapshot: MessageFns = { + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? bytesFromBase64(object.metadata) : new Uint8Array(0), + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata.length !== 0) { + obj.metadata = base64FromBytes(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + 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(0); + message.metadata = object.metadata ?? new Uint8Array(0); + return message; + }, +}; + +export interface ABCI { + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; + PrepareProposal(request: RequestPrepareProposal): Promise; + ProcessProposal(request: RequestProcessProposal): Promise; + ExtendVote(request: RequestExtendVote): Promise; + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise; + FinalizeBlock(request: RequestFinalizeBlock): Promise; +} + +export const ABCIServiceName = "tendermint.abci.ABCI"; +export class ABCIClientImpl implements ABCI { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || ABCIServiceName; + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.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.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + this.PrepareProposal = this.PrepareProposal.bind(this); + this.ProcessProposal = this.ProcessProposal.bind(this); + this.ExtendVote = this.ExtendVote.bind(this); + this.VerifyVoteExtension = this.VerifyVoteExtension.bind(this); + this.FinalizeBlock = this.FinalizeBlock.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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(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 BinaryReader(data))); + } + + PrepareProposal(request: RequestPrepareProposal): Promise { + const data = RequestPrepareProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrepareProposal", data); + return promise.then((data) => ResponsePrepareProposal.decode(new BinaryReader(data))); + } + + ProcessProposal(request: RequestProcessProposal): Promise { + const data = RequestProcessProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "ProcessProposal", data); + return promise.then((data) => ResponseProcessProposal.decode(new BinaryReader(data))); + } + + ExtendVote(request: RequestExtendVote): Promise { + const data = RequestExtendVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExtendVote", data); + return promise.then((data) => ResponseExtendVote.decode(new BinaryReader(data))); + } + + VerifyVoteExtension(request: RequestVerifyVoteExtension): Promise { + const data = RequestVerifyVoteExtension.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifyVoteExtension", data); + return promise.then((data) => ResponseVerifyVoteExtension.decode(new BinaryReader(data))); + } + + FinalizeBlock(request: RequestFinalizeBlock): Promise { + const data = RequestFinalizeBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizeBlock", data); + return promise.then((data) => ResponseFinalizeBlock.decode(new BinaryReader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/crypto/keys.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/crypto/keys.ts new file mode 100644 index 00000000..f30b6751 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/crypto/keys.ts @@ -0,0 +1,140 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/keys.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKey { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; +} + +function createBasePublicKey(): PublicKey { + return { ed25519: undefined, secp256k1: undefined }; +} + +export const PublicKey: MessageFns = { + encode(message: PublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ed25519 = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.secp256k1 = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.ed25519 !== undefined) { + obj.ed25519 = base64FromBytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + obj.secp256k1 = base64FromBytes(message.secp256k1); + } + return obj; + }, + + create, I>>(base?: I): PublicKey { + return PublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/crypto/proof.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/crypto/proof.ts new file mode 100644 index 00000000..2b470701 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/crypto/proof.ts @@ -0,0 +1,520 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/crypto/proof.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.crypto"; + +export interface Proof { + total: number; + index: number; + leafHash: Uint8Array; + aunts: Uint8Array[]; +} + +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof: Proof | undefined; +} + +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, leafHash: new Uint8Array(0), aunts: [] }; +} + +export const Proof: MessageFns = { + encode(message: Proof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).int64(message.total); + } + if (message.index !== 0) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.leafHash = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aunts.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proof { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + leafHash: isSet(object.leafHash) ? bytesFromBase64(object.leafHash) : new Uint8Array(0), + aunts: globalThis.Array.isArray(object?.aunts) ? object.aunts.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Proof): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.leafHash.length !== 0) { + obj.leafHash = base64FromBytes(message.leafHash); + } + if (message.aunts?.length) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Proof { + return Proof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proof { + const message = createBaseProof(); + message.total = object.total ?? 0; + message.index = object.index ?? 0; + message.leafHash = object.leafHash ?? new Uint8Array(0); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValueOp(): ValueOp { + return { key: new Uint8Array(0), proof: undefined }; +} + +export const ValueOp: MessageFns = { + encode(message: ValueOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValueOp { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: ValueOp): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): ValueOp { + return ValueOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValueOp { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(0); + 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: MessageFns = { + encode(message: DominoOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.input = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.output = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DominoOp { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + input: isSet(object.input) ? globalThis.String(object.input) : "", + output: isSet(object.output) ? globalThis.String(object.output) : "", + }; + }, + + toJSON(message: DominoOp): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.input !== "") { + obj.input = message.input; + } + if (message.output !== "") { + obj.output = message.output; + } + return obj; + }, + + create, I>>(base?: I): DominoOp { + return DominoOp.fromPartial(base ?? ({} as any)); + }, + 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(0), data: new Uint8Array(0) }; +} + +export const ProofOp: MessageFns = { + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps: MessageFns = { + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/libs/bits/types.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/libs/bits/types.ts new file mode 100644 index 00000000..e8ec9685 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/libs/bits/types.ts @@ -0,0 +1,137 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/libs/bits/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.libs.bits"; + +export interface BitArray { + bits: number; + elems: number[]; +} + +function createBaseBitArray(): BitArray { + return { bits: 0, elems: [] }; +} + +export const BitArray: MessageFns = { + encode(message: BitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bits !== 0) { + writer.uint32(8).int64(message.bits); + } + writer.uint32(18).fork(); + for (const v of message.elems) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.bits = longToNumber(reader.int64()); + continue; + case 2: + if (tag === 16) { + message.elems.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.elems.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BitArray { + return { + bits: isSet(object.bits) ? globalThis.Number(object.bits) : 0, + elems: globalThis.Array.isArray(object?.elems) ? object.elems.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: BitArray): unknown { + const obj: any = {}; + if (message.bits !== 0) { + obj.bits = Math.round(message.bits); + } + if (message.elems?.length) { + obj.elems = message.elems.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): BitArray { + return BitArray.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/p2p/types.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/p2p/types.ts new file mode 100644 index 00000000..4ea8187a --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/p2p/types.ts @@ -0,0 +1,528 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/p2p/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "tendermint.p2p"; + +export interface NetAddress { + id: string; + ip: string; + port: number; +} + +export interface ProtocolVersion { + p2p: number; + block: number; + app: number; +} + +export interface DefaultNodeInfo { + protocolVersion: ProtocolVersion | undefined; + defaultNodeId: string; + listenAddr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other: DefaultNodeInfoOther | undefined; +} + +export interface DefaultNodeInfoOther { + txIndex: string; + rpcAddress: string; +} + +function createBaseNetAddress(): NetAddress { + return { id: "", ip: "", port: 0 }; +} + +export const NetAddress: MessageFns = { + encode(message: NetAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.ip !== "") { + writer.uint32(18).string(message.ip); + } + if (message.port !== 0) { + writer.uint32(24).uint32(message.port); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.ip = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.port = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NetAddress { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + ip: isSet(object.ip) ? globalThis.String(object.ip) : "", + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + }; + }, + + toJSON(message: NetAddress): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.ip !== "") { + obj.ip = message.ip; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + + create, I>>(base?: I): NetAddress { + return NetAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetAddress { + const message = createBaseNetAddress(); + message.id = object.id ?? ""; + message.ip = object.ip ?? ""; + message.port = object.port ?? 0; + return message; + }, +}; + +function createBaseProtocolVersion(): ProtocolVersion { + return { p2p: 0, block: 0, app: 0 }; +} + +export const ProtocolVersion: MessageFns = { + encode(message: ProtocolVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ProtocolVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 8) { + break; + } + + message.p2p = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProtocolVersion { + return { + p2p: isSet(object.p2p) ? globalThis.Number(object.p2p) : 0, + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: ProtocolVersion): unknown { + const obj: any = {}; + if (message.p2p !== 0) { + obj.p2p = Math.round(message.p2p); + } + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): ProtocolVersion { + return ProtocolVersion.fromPartial(base ?? ({} as any)); + }, + 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 createBaseDefaultNodeInfo(): DefaultNodeInfo { + return { + protocolVersion: undefined, + defaultNodeId: "", + listenAddr: "", + network: "", + version: "", + channels: new Uint8Array(0), + moniker: "", + other: undefined, + }; +} + +export const DefaultNodeInfo: MessageFns = { + encode(message: DefaultNodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocolVersion !== undefined) { + ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).join(); + } + if (message.defaultNodeId !== "") { + writer.uint32(18).string(message.defaultNodeId); + } + if (message.listenAddr !== "") { + writer.uint32(26).string(message.listenAddr); + } + 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) { + DefaultNodeInfoOther.encode(message.other, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protocolVersion = ProtocolVersion.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.defaultNodeId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.listenAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.network = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.version = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.channels = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.moniker = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.other = DefaultNodeInfoOther.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfo { + return { + protocolVersion: isSet(object.protocolVersion) ? ProtocolVersion.fromJSON(object.protocolVersion) : undefined, + defaultNodeId: isSet(object.defaultNodeId) ? globalThis.String(object.defaultNodeId) : "", + listenAddr: isSet(object.listenAddr) ? globalThis.String(object.listenAddr) : "", + network: isSet(object.network) ? globalThis.String(object.network) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + channels: isSet(object.channels) ? bytesFromBase64(object.channels) : new Uint8Array(0), + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + other: isSet(object.other) ? DefaultNodeInfoOther.fromJSON(object.other) : undefined, + }; + }, + + toJSON(message: DefaultNodeInfo): unknown { + const obj: any = {}; + if (message.protocolVersion !== undefined) { + obj.protocolVersion = ProtocolVersion.toJSON(message.protocolVersion); + } + if (message.defaultNodeId !== "") { + obj.defaultNodeId = message.defaultNodeId; + } + if (message.listenAddr !== "") { + obj.listenAddr = message.listenAddr; + } + if (message.network !== "") { + obj.network = message.network; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.channels.length !== 0) { + obj.channels = base64FromBytes(message.channels); + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.other !== undefined) { + obj.other = DefaultNodeInfoOther.toJSON(message.other); + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfo { + return DefaultNodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfo { + const message = createBaseDefaultNodeInfo(); + message.protocolVersion = (object.protocolVersion !== undefined && object.protocolVersion !== null) + ? ProtocolVersion.fromPartial(object.protocolVersion) + : undefined; + message.defaultNodeId = object.defaultNodeId ?? ""; + message.listenAddr = object.listenAddr ?? ""; + message.network = object.network ?? ""; + message.version = object.version ?? ""; + message.channels = object.channels ?? new Uint8Array(0); + message.moniker = object.moniker ?? ""; + message.other = (object.other !== undefined && object.other !== null) + ? DefaultNodeInfoOther.fromPartial(object.other) + : undefined; + return message; + }, +}; + +function createBaseDefaultNodeInfoOther(): DefaultNodeInfoOther { + return { txIndex: "", rpcAddress: "" }; +} + +export const DefaultNodeInfoOther: MessageFns = { + encode(message: DefaultNodeInfoOther, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.txIndex !== "") { + writer.uint32(10).string(message.txIndex); + } + if (message.rpcAddress !== "") { + writer.uint32(18).string(message.rpcAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfoOther { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfoOther(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txIndex = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpcAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DefaultNodeInfoOther { + return { + txIndex: isSet(object.txIndex) ? globalThis.String(object.txIndex) : "", + rpcAddress: isSet(object.rpcAddress) ? globalThis.String(object.rpcAddress) : "", + }; + }, + + toJSON(message: DefaultNodeInfoOther): unknown { + const obj: any = {}; + if (message.txIndex !== "") { + obj.txIndex = message.txIndex; + } + if (message.rpcAddress !== "") { + obj.rpcAddress = message.rpcAddress; + } + return obj; + }, + + create, I>>(base?: I): DefaultNodeInfoOther { + return DefaultNodeInfoOther.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DefaultNodeInfoOther { + const message = createBaseDefaultNodeInfoOther(); + message.txIndex = object.txIndex ?? ""; + message.rpcAddress = object.rpcAddress ?? ""; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/block.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/block.ts new file mode 100644 index 00000000..4fbb3c13 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/block.ts @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/block.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { EvidenceList } from "./evidence"; +import { Commit, Data, Header } from "./types"; + +export const protobufPackage = "tendermint.types"; + +export interface Block { + header: Header | undefined; + data: Data | undefined; + evidence: EvidenceList | undefined; + lastCommit: Commit | undefined; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, lastCommit: undefined }; +} + +export const Block: MessageFns = { + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.lastCommit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.lastCommit !== undefined) { + obj.lastCommit = Commit.toJSON(message.lastCommit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + 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.lastCommit = (object.lastCommit !== undefined && object.lastCommit !== null) + ? Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/evidence.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/evidence.ts new file mode 100644 index 00000000..9a2fc48b --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/evidence.ts @@ -0,0 +1,489 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/evidence.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { LightBlock, Vote } from "./types"; +import { Validator } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +export interface Evidence { + duplicateVoteEvidence?: DuplicateVoteEvidence | undefined; + lightClientAttackEvidence?: LightClientAttackEvidence | undefined; +} + +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidence { + voteA: Vote | undefined; + voteB: Vote | undefined; + totalVotingPower: number; + validatorPower: number; + timestamp: Date | undefined; +} + +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidence { + conflictingBlock: LightBlock | undefined; + commonHeight: number; + byzantineValidators: Validator[]; + totalVotingPower: number; + timestamp: Date | undefined; +} + +export interface EvidenceList { + evidence: Evidence[]; +} + +function createBaseEvidence(): Evidence { + return { duplicateVoteEvidence: undefined, lightClientAttackEvidence: undefined }; +} + +export const Evidence: MessageFns = { + encode(message: Evidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.duplicateVoteEvidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).join(); + } + if (message.lightClientAttackEvidence !== undefined) { + LightClientAttackEvidence.encode(message.lightClientAttackEvidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.duplicateVoteEvidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lightClientAttackEvidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + duplicateVoteEvidence: isSet(object.duplicateVoteEvidence) + ? DuplicateVoteEvidence.fromJSON(object.duplicateVoteEvidence) + : undefined, + lightClientAttackEvidence: isSet(object.lightClientAttackEvidence) + ? LightClientAttackEvidence.fromJSON(object.lightClientAttackEvidence) + : undefined, + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + if (message.duplicateVoteEvidence !== undefined) { + obj.duplicateVoteEvidence = DuplicateVoteEvidence.toJSON(message.duplicateVoteEvidence); + } + if (message.lightClientAttackEvidence !== undefined) { + obj.lightClientAttackEvidence = LightClientAttackEvidence.toJSON(message.lightClientAttackEvidence); + } + return obj; + }, + + create, I>>(base?: I): Evidence { + return Evidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.duplicateVoteEvidence = + (object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null) + ? DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) + : undefined; + message.lightClientAttackEvidence = + (object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null) + ? LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) + : undefined; + return message; + }, +}; + +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { voteA: undefined, voteB: undefined, totalVotingPower: 0, validatorPower: 0, timestamp: undefined }; +} + +export const DuplicateVoteEvidence: MessageFns = { + encode(message: DuplicateVoteEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteA !== undefined) { + Vote.encode(message.voteA, writer.uint32(10).fork()).join(); + } + if (message.voteB !== undefined) { + Vote.encode(message.voteB, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + writer.uint32(32).int64(message.validatorPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuplicateVoteEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteA = Vote.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voteB = Vote.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.validatorPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DuplicateVoteEvidence { + return { + voteA: isSet(object.voteA) ? Vote.fromJSON(object.voteA) : undefined, + voteB: isSet(object.voteB) ? Vote.fromJSON(object.voteB) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + validatorPower: isSet(object.validatorPower) ? globalThis.Number(object.validatorPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: DuplicateVoteEvidence): unknown { + const obj: any = {}; + if (message.voteA !== undefined) { + obj.voteA = Vote.toJSON(message.voteA); + } + if (message.voteB !== undefined) { + obj.voteB = Vote.toJSON(message.voteB); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.validatorPower !== 0) { + obj.validatorPower = Math.round(message.validatorPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.voteA = (object.voteA !== undefined && object.voteA !== null) ? Vote.fromPartial(object.voteA) : undefined; + message.voteB = (object.voteB !== undefined && object.voteB !== null) ? Vote.fromPartial(object.voteB) : undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.validatorPower = object.validatorPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflictingBlock: undefined, + commonHeight: 0, + byzantineValidators: [], + totalVotingPower: 0, + timestamp: undefined, + }; +} + +export const LightClientAttackEvidence: MessageFns = { + encode(message: LightClientAttackEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.conflictingBlock !== undefined) { + LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).join(); + } + if (message.commonHeight !== 0) { + writer.uint32(16).int64(message.commonHeight); + } + for (const v of message.byzantineValidators) { + Validator.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(32).int64(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightClientAttackEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.conflictingBlock = LightBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.commonHeight = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.byzantineValidators.push(Validator.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightClientAttackEvidence { + return { + conflictingBlock: isSet(object.conflictingBlock) ? LightBlock.fromJSON(object.conflictingBlock) : undefined, + commonHeight: isSet(object.commonHeight) ? globalThis.Number(object.commonHeight) : 0, + byzantineValidators: globalThis.Array.isArray(object?.byzantineValidators) + ? object.byzantineValidators.map((e: any) => Validator.fromJSON(e)) + : [], + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: LightClientAttackEvidence): unknown { + const obj: any = {}; + if (message.conflictingBlock !== undefined) { + obj.conflictingBlock = LightBlock.toJSON(message.conflictingBlock); + } + if (message.commonHeight !== 0) { + obj.commonHeight = Math.round(message.commonHeight); + } + if (message.byzantineValidators?.length) { + obj.byzantineValidators = message.byzantineValidators.map((e) => Validator.toJSON(e)); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): LightClientAttackEvidence { + return LightClientAttackEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflictingBlock = (object.conflictingBlock !== undefined && object.conflictingBlock !== null) + ? LightBlock.fromPartial(object.conflictingBlock) + : undefined; + message.commonHeight = object.commonHeight ?? 0; + message.byzantineValidators = object.byzantineValidators?.map((e) => Validator.fromPartial(e)) || []; + message.totalVotingPower = object.totalVotingPower ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseEvidenceList(): EvidenceList { + return { evidence: [] }; +} + +export const EvidenceList: MessageFns = { + encode(message: EvidenceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence.push(Evidence.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceList { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Evidence.fromJSON(e)) : [], + }; + }, + + toJSON(message: EvidenceList): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Evidence.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EvidenceList { + return EvidenceList.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/params.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/params.ts new file mode 100644 index 00000000..d4cc2b8a --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/params.ts @@ -0,0 +1,686 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +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 | undefined; + evidence: EvidenceParams | undefined; + validator: ValidatorParams | undefined; + version: VersionParams | undefined; + abci: ABCIParams | undefined; +} + +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + maxBytes: number; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + maxGas: number; +} + +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + maxAgeNumBlocks: number; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + maxAgeDuration: + | Duration + | undefined; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + maxBytes: number; +} + +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pubKeyTypes: string[]; +} + +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app: number; +} + +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + blockMaxBytes: number; + blockMaxGas: number; +} + +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParams { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + voteExtensionsEnableHeight: number; +} + +function createBaseConsensusParams(): ConsensusParams { + return { block: undefined, evidence: undefined, validator: undefined, version: undefined, abci: undefined }; +} + +export const ConsensusParams: MessageFns = { + encode(message: ConsensusParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(10).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(26).fork()).join(); + } + if (message.version !== undefined) { + VersionParams.encode(message.version, writer.uint32(34).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.version = VersionParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.version !== undefined) { + obj.version = VersionParams.toJSON(message.version); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + return obj; + }, + + create, I>>(base?: I): ConsensusParams { + return ConsensusParams.fromPartial(base ?? ({} as any)); + }, + 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; + message.abci = (object.abci !== undefined && object.abci !== null) + ? ABCIParams.fromPartial(object.abci) + : undefined; + return message; + }, +}; + +function createBaseBlockParams(): BlockParams { + return { maxBytes: 0, maxGas: 0 }; +} + +export const BlockParams: MessageFns = { + encode(message: BlockParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxBytes !== 0) { + writer.uint32(8).int64(message.maxBytes); + } + if (message.maxGas !== 0) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.maxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + maxGas: isSet(object.maxGas) ? globalThis.Number(object.maxGas) : 0, + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxGas !== 0) { + obj.maxGas = Math.round(message.maxGas); + } + return obj; + }, + + create, I>>(base?: I): BlockParams { + return BlockParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes ?? 0; + message.maxGas = object.maxGas ?? 0; + return message; + }, +}; + +function createBaseEvidenceParams(): EvidenceParams { + return { maxAgeNumBlocks: 0, maxAgeDuration: undefined, maxBytes: 0 }; +} + +export const EvidenceParams: MessageFns = { + encode(message: EvidenceParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxAgeNumBlocks !== 0) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).join(); + } + if (message.maxBytes !== 0) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxAgeNumBlocks = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.maxAgeDuration = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxBytes = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceParams { + return { + maxAgeNumBlocks: isSet(object.maxAgeNumBlocks) ? globalThis.Number(object.maxAgeNumBlocks) : 0, + maxAgeDuration: isSet(object.maxAgeDuration) ? Duration.fromJSON(object.maxAgeDuration) : undefined, + maxBytes: isSet(object.maxBytes) ? globalThis.Number(object.maxBytes) : 0, + }; + }, + + toJSON(message: EvidenceParams): unknown { + const obj: any = {}; + if (message.maxAgeNumBlocks !== 0) { + obj.maxAgeNumBlocks = Math.round(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + obj.maxAgeDuration = Duration.toJSON(message.maxAgeDuration); + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + return obj; + }, + + create, I>>(base?: I): EvidenceParams { + return EvidenceParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EvidenceParams { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = object.maxAgeNumBlocks ?? 0; + message.maxAgeDuration = (object.maxAgeDuration !== undefined && object.maxAgeDuration !== null) + ? Duration.fromPartial(object.maxAgeDuration) + : undefined; + message.maxBytes = object.maxBytes ?? 0; + return message; + }, +}; + +function createBaseValidatorParams(): ValidatorParams { + return { pubKeyTypes: [] }; +} + +export const ValidatorParams: MessageFns = { + encode(message: ValidatorParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKeyTypes.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorParams { + return { + pubKeyTypes: globalThis.Array.isArray(object?.pubKeyTypes) + ? object.pubKeyTypes.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValidatorParams): unknown { + const obj: any = {}; + if (message.pubKeyTypes?.length) { + obj.pubKeyTypes = message.pubKeyTypes; + } + return obj; + }, + + create, I>>(base?: I): ValidatorParams { + return ValidatorParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVersionParams(): VersionParams { + return { app: 0 }; +} + +export const VersionParams: MessageFns = { + encode(message: VersionParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.app !== 0) { + writer.uint32(8).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionParams { + return { app: isSet(object.app) ? globalThis.Number(object.app) : 0 }; + }, + + toJSON(message: VersionParams): unknown { + const obj: any = {}; + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): VersionParams { + return VersionParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionParams { + const message = createBaseVersionParams(); + message.app = object.app ?? 0; + return message; + }, +}; + +function createBaseHashedParams(): HashedParams { + return { blockMaxBytes: 0, blockMaxGas: 0 }; +} + +export const HashedParams: MessageFns = { + encode(message: HashedParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockMaxBytes !== 0) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockMaxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockMaxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashedParams { + return { + blockMaxBytes: isSet(object.blockMaxBytes) ? globalThis.Number(object.blockMaxBytes) : 0, + blockMaxGas: isSet(object.blockMaxGas) ? globalThis.Number(object.blockMaxGas) : 0, + }; + }, + + toJSON(message: HashedParams): unknown { + const obj: any = {}; + if (message.blockMaxBytes !== 0) { + obj.blockMaxBytes = Math.round(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + obj.blockMaxGas = Math.round(message.blockMaxGas); + } + return obj; + }, + + create, I>>(base?: I): HashedParams { + return HashedParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HashedParams { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes ?? 0; + message.blockMaxGas = object.blockMaxGas ?? 0; + return message; + }, +}; + +function createBaseABCIParams(): ABCIParams { + return { voteExtensionsEnableHeight: 0 }; +} + +export const ABCIParams: MessageFns = { + encode(message: ABCIParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voteExtensionsEnableHeight !== 0) { + writer.uint32(8).int64(message.voteExtensionsEnableHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.voteExtensionsEnableHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIParams { + return { + voteExtensionsEnableHeight: isSet(object.voteExtensionsEnableHeight) + ? globalThis.Number(object.voteExtensionsEnableHeight) + : 0, + }; + }, + + toJSON(message: ABCIParams): unknown { + const obj: any = {}; + if (message.voteExtensionsEnableHeight !== 0) { + obj.voteExtensionsEnableHeight = Math.round(message.voteExtensionsEnableHeight); + } + return obj; + }, + + create, I>>(base?: I): ABCIParams { + return ABCIParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIParams { + const message = createBaseABCIParams(); + message.voteExtensionsEnableHeight = object.voteExtensionsEnableHeight ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/types.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/types.ts new file mode 100644 index 00000000..85454a42 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/types.ts @@ -0,0 +1,2065 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON, ValidatorSet } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +/** 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 | undefined; +} + +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + partSetHeader: PartSetHeader | undefined; +} + +/** Header defines the structure of a block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: + | Date + | undefined; + /** prev block info */ + lastBlockId: + | BlockID + | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** original proposer of the block */ + proposerAddress: Uint8Array; +} + +/** 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 or precommit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: number; + round: number; + /** zero if vote is nil. */ + blockId: BlockID | undefined; + timestamp: Date | undefined; + validatorAddress: Uint8Array; + validatorIndex: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ + signature: Uint8Array; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension: Uint8Array; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. + * Only valid for precommit messages. + */ + extensionSignature: Uint8Array; +} + +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: number; + round: number; + blockId: BlockID | undefined; + signatures: CommitSig[]; +} + +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface ExtendedCommit { + height: number; + round: number; + blockId: BlockID | undefined; + extendedSignatures: ExtendedCommitSig[]; +} + +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; + /** Vote extension data */ + extension: Uint8Array; + /** Vote extension signature */ + extensionSignature: Uint8Array; +} + +export interface Proposal { + type: SignedMsgType; + height: number; + round: number; + polRound: number; + blockId: BlockID | undefined; + timestamp: Date | undefined; + signature: Uint8Array; +} + +export interface SignedHeader { + header: Header | undefined; + commit: Commit | undefined; +} + +export interface LightBlock { + signedHeader: SignedHeader | undefined; + validatorSet: ValidatorSet | undefined; +} + +export interface BlockMeta { + blockId: BlockID | undefined; + blockSize: number; + header: Header | undefined; + numTxs: number; +} + +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + rootHash: Uint8Array; + data: Uint8Array; + proof: Proof | undefined; +} + +function createBasePartSetHeader(): PartSetHeader { + return { total: 0, hash: new Uint8Array(0) }; +} + +export const PartSetHeader: MessageFns = { + encode(message: PartSetHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PartSetHeader { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: PartSetHeader): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): PartSetHeader { + return PartSetHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePart(): Part { + return { index: 0, bytes: new Uint8Array(0), proof: undefined }; +} + +export const Part: MessageFns = { + encode(message: Part, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Part { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Part { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: Part): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.bytes.length !== 0) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): Part { + return Part.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Part { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function createBaseBlockID(): BlockID { + return { hash: new Uint8Array(0), partSetHeader: undefined }; +} + +export const BlockID: MessageFns = { + encode(message: BlockID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.partSetHeader = PartSetHeader.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockID { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + partSetHeader: isSet(object.partSetHeader) ? PartSetHeader.fromJSON(object.partSetHeader) : undefined, + }; + }, + + toJSON(message: BlockID): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.partSetHeader !== undefined) { + obj.partSetHeader = PartSetHeader.toJSON(message.partSetHeader); + } + return obj; + }, + + create, I>>(base?: I): BlockID { + return BlockID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(0); + message.partSetHeader = (object.partSetHeader !== undefined && object.partSetHeader !== null) + ? PartSetHeader.fromPartial(object.partSetHeader) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(0), + dataHash: new Uint8Array(0), + validatorsHash: new Uint8Array(0), + nextValidatorsHash: new Uint8Array(0), + consensusHash: new Uint8Array(0), + appHash: new Uint8Array(0), + lastResultsHash: new Uint8Array(0), + evidenceHash: new Uint8Array(0), + proposerAddress: new Uint8Array(0), + }; +} + +export const Header: MessageFns
= { + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).join(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(0), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(0), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(0), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(0), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(0), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(0), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(0), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(0), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chainId !== "") { + obj.chainId = message.chainId; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.lastBlockId !== undefined) { + obj.lastBlockId = BlockID.toJSON(message.lastBlockId); + } + if (message.lastCommitHash.length !== 0) { + obj.lastCommitHash = base64FromBytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + obj.validatorsHash = base64FromBytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + obj.consensusHash = base64FromBytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + obj.appHash = base64FromBytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + obj.lastResultsHash = base64FromBytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + obj.evidenceHash = base64FromBytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + obj.proposerAddress = base64FromBytes(message.proposerAddress); + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null) + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(0); + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(0); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(0); + message.consensusHash = object.consensusHash ?? new Uint8Array(0); + message.appHash = object.appHash ?? new Uint8Array(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(0); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(0); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseData(): Data { + return { txs: [] }; +} + +export const Data: MessageFns = { + encode(message: Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Data { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: Data): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Data { + return Data.fromPartial(base ?? ({} as any)); + }, + 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, + blockId: undefined, + timestamp: undefined, + validatorAddress: new Uint8Array(0), + validatorIndex: 0, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const Vote: MessageFns = { + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(74).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(82).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.validatorIndex = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.signature = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.extension = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + validatorIndex: isSet(object.validatorIndex) ? globalThis.Number(object.validatorIndex) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + obj.validatorIndex = Math.round(message.validatorIndex); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommit(): Commit { + return { height: 0, round: 0, blockId: undefined, signatures: [] }; +} + +export const Commit: MessageFns = { + encode(message: Commit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signatures.push(CommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => CommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Commit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => CommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Commit { + return Commit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commit { + const message = createBaseCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.signatures = object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommitSig(): CommitSig { + return { blockIdFlag: 0, validatorAddress: new Uint8Array(0), timestamp: undefined, signature: new Uint8Array(0) }; +} + +export const CommitSig: MessageFns = { + encode(message: CommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): CommitSig { + return CommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitSig { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseExtendedCommit(): ExtendedCommit { + return { height: 0, round: 0, blockId: undefined, extendedSignatures: [] }; +} + +export const ExtendedCommit: MessageFns = { + encode(message: ExtendedCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).join(); + } + for (const v of message.extendedSignatures) { + ExtendedCommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extendedSignatures.push(ExtendedCommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + extendedSignatures: globalThis.Array.isArray(object?.extendedSignatures) + ? object.extendedSignatures.map((e: any) => ExtendedCommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ExtendedCommit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.extendedSignatures?.length) { + obj.extendedSignatures = message.extendedSignatures.map((e) => ExtendedCommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommit { + return ExtendedCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommit { + const message = createBaseExtendedCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.extendedSignatures = object.extendedSignatures?.map((e) => ExtendedCommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExtendedCommitSig(): ExtendedCommitSig { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(0), + timestamp: undefined, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extensionSignature: new Uint8Array(0), + }; +} + +export const ExtendedCommitSig: MessageFns = { + encode(message: ExtendedCommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(42).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(50).bytes(message.extensionSignature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.blockIdFlag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.extension = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.extensionSignature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitSig { + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extensionSignature: isSet(object.extensionSignature) + ? bytesFromBase64(object.extensionSignature) + : new Uint8Array(0), + }; + }, + + toJSON(message: ExtendedCommitSig): unknown { + const obj: any = {}; + if (message.blockIdFlag !== 0) { + obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + obj.validatorAddress = base64FromBytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + obj.extensionSignature = base64FromBytes(message.extensionSignature); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitSig { + return ExtendedCommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + type: 0, + height: 0, + round: 0, + polRound: 0, + blockId: undefined, + timestamp: undefined, + signature: new Uint8Array(0), + }; +} + +export const Proposal: MessageFns = { + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(42).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.polRound = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + polRound: isSet(object.polRound) ? globalThis.Number(object.polRound) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.polRound !== 0) { + obj.polRound = Math.round(message.polRound); + } + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSignedHeader(): SignedHeader { + return { header: undefined, commit: undefined }; +} + +export const SignedHeader: MessageFns = { + encode(message: SignedHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.commit !== undefined) { + Commit.encode(message.commit, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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 = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.commit !== undefined) { + obj.commit = Commit.toJSON(message.commit); + } + return obj; + }, + + create, I>>(base?: I): SignedHeader { + return SignedHeader.fromPartial(base ?? ({} as any)); + }, + 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 { signedHeader: undefined, validatorSet: undefined }; +} + +export const LightBlock: MessageFns = { + encode(message: LightBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signedHeader !== undefined) { + SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).join(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightBlock { + return { + signedHeader: isSet(object.signedHeader) ? SignedHeader.fromJSON(object.signedHeader) : undefined, + validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined, + }; + }, + + toJSON(message: LightBlock): unknown { + const obj: any = {}; + if (message.signedHeader !== undefined) { + obj.signedHeader = SignedHeader.toJSON(message.signedHeader); + } + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): LightBlock { + return LightBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightBlock { + const message = createBaseLightBlock(); + message.signedHeader = (object.signedHeader !== undefined && object.signedHeader !== null) + ? SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseBlockMeta(): BlockMeta { + return { blockId: undefined, blockSize: 0, header: undefined, numTxs: 0 }; +} + +export const BlockMeta: MessageFns = { + encode(message: BlockMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).join(); + } + if (message.blockSize !== 0) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).join(); + } + if (message.numTxs !== 0) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockSize = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numTxs = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMeta { + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + blockSize: isSet(object.blockSize) ? globalThis.Number(object.blockSize) : 0, + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + numTxs: isSet(object.numTxs) ? globalThis.Number(object.numTxs) : 0, + }; + }, + + toJSON(message: BlockMeta): unknown { + const obj: any = {}; + if (message.blockId !== undefined) { + obj.blockId = BlockID.toJSON(message.blockId); + } + if (message.blockSize !== 0) { + obj.blockSize = Math.round(message.blockSize); + } + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.numTxs !== 0) { + obj.numTxs = Math.round(message.numTxs); + } + return obj; + }, + + create, I>>(base?: I): BlockMeta { + return BlockMeta.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMeta { + const message = createBaseBlockMeta(); + message.blockId = (object.blockId !== undefined && object.blockId !== null) + ? BlockID.fromPartial(object.blockId) + : undefined; + message.blockSize = object.blockSize ?? 0; + message.header = (object.header !== undefined && object.header !== null) + ? Header.fromPartial(object.header) + : undefined; + message.numTxs = object.numTxs ?? 0; + return message; + }, +}; + +function createBaseTxProof(): TxProof { + return { rootHash: new Uint8Array(0), data: new Uint8Array(0), proof: undefined }; +} + +export const TxProof: MessageFns = { + encode(message: TxProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rootHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxProof { + return { + rootHash: isSet(object.rootHash) ? bytesFromBase64(object.rootHash) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: TxProof): unknown { + const obj: any = {}; + if (message.rootHash.length !== 0) { + obj.rootHash = base64FromBytes(message.rootHash); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): TxProof { + return TxProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxProof { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (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 globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/validator.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/validator.ts new file mode 100644 index 00000000..623b14d8 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/types/validator.ts @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/types/validator.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PublicKey } from "../crypto/keys"; + +export const protobufPackage = "tendermint.types"; + +/** BlockIdFlag indicates which BlockID the signature is for */ +export enum BlockIDFlag { + /** BLOCK_ID_FLAG_UNKNOWN - indicates an error condition */ + BLOCK_ID_FLAG_UNKNOWN = 0, + /** BLOCK_ID_FLAG_ABSENT - the vote was not received */ + BLOCK_ID_FLAG_ABSENT = 1, + /** BLOCK_ID_FLAG_COMMIT - voted for the block that received the majority */ + BLOCK_ID_FLAG_COMMIT = 2, + /** BLOCK_ID_FLAG_NIL - voted for nil */ + 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"; + } +} + +export interface ValidatorSet { + validators: Validator[]; + proposer: Validator | undefined; + totalVotingPower: number; +} + +export interface Validator { + address: Uint8Array; + pubKey: PublicKey | undefined; + votingPower: number; + proposerPriority: number; +} + +export interface SimpleValidator { + pubKey: PublicKey | undefined; + votingPower: number; +} + +function createBaseValidatorSet(): ValidatorSet { + return { validators: [], proposer: undefined, totalVotingPower: 0 }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.proposer !== undefined) { + Validator.encode(message.proposer, writer.uint32(18).fork()).join(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + validators: globalThis.Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? globalThis.Number(object.totalVotingPower) : 0, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.proposer !== undefined) { + obj.proposer = Validator.toJSON(message.proposer); + } + if (message.totalVotingPower !== 0) { + obj.totalVotingPower = Math.round(message.totalVotingPower); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + 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.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} + +export const Validator: MessageFns = { + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(18).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? globalThis.Number(object.proposerPriority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + if (message.proposerPriority !== 0) { + obj.proposerPriority = Math.round(message.proposerPriority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; + +function createBaseSimpleValidator(): SimpleValidator { + return { pubKey: undefined, votingPower: 0 }; +} + +export const SimpleValidator: MessageFns = { + encode(message: SimpleValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).join(); + } + if (message.votingPower !== 0) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.votingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimpleValidator { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0, + }; + }, + + toJSON(message: SimpleValidator): unknown { + const obj: any = {}; + if (message.pubKey !== undefined) { + obj.pubKey = PublicKey.toJSON(message.pubKey); + } + if (message.votingPower !== 0) { + obj.votingPower = Math.round(message.votingPower); + } + return obj; + }, + + create, I>>(base?: I): SimpleValidator { + return SimpleValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.upgrade.v1beta1/types/tendermint/version/types.ts b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/version/types.ts new file mode 100644 index 00000000..7a4b2fa4 --- /dev/null +++ b/ts-client/cosmos.upgrade.v1beta1/types/tendermint/version/types.ts @@ -0,0 +1,214 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: tendermint/version/types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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: number; + 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: number; + app: number; +} + +function createBaseApp(): App { + return { protocol: 0, software: "" }; +} + +export const App: MessageFns = { + encode(message: App, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocol !== 0) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): App { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.protocol = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.software = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): App { + return { + protocol: isSet(object.protocol) ? globalThis.Number(object.protocol) : 0, + software: isSet(object.software) ? globalThis.String(object.software) : "", + }; + }, + + toJSON(message: App): unknown { + const obj: any = {}; + if (message.protocol !== 0) { + obj.protocol = Math.round(message.protocol); + } + if (message.software !== "") { + obj.software = message.software; + } + return obj; + }, + + create, I>>(base?: I): App { + return App.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: Consensus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== 0) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== 0) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Consensus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Consensus { + return { + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: Consensus): unknown { + const obj: any = {}; + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): Consensus { + return Consensus.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/module.ts b/ts-client/cosmos.vesting.v1beta1/module.ts index 37322da1..7a5eed49 100755 --- a/ts-client/cosmos.vesting.v1beta1/module.ts +++ b/ts-client/cosmos.vesting.v1beta1/module.ts @@ -6,36 +6,36 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { BaseVestingAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { MsgCreatePeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/tx"; -import { ContinuousVestingAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { DelayedVestingAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { MsgCreateVestingAccount } from "./types/cosmos/vesting/v1beta1/tx"; -import { MsgCreatePermanentLockedAccount } from "./types/cosmos/vesting/v1beta1/tx"; -import { MsgCreatePermanentLockedAccountResponse } from "./types/cosmos/vesting/v1beta1/tx"; -import { MsgCreatePeriodicVestingAccountResponse } from "./types/cosmos/vesting/v1beta1/tx"; -import { Period } from "./types/cosmos/vesting/v1beta1/vesting"; -import { PeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { PermanentLockedAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { MsgCreateVestingAccountResponse } from "./types/cosmos/vesting/v1beta1/tx"; - - -export { BaseVestingAccount, MsgCreatePeriodicVestingAccount, ContinuousVestingAccount, DelayedVestingAccount, MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountResponse, MsgCreatePeriodicVestingAccountResponse, Period, PeriodicVestingAccount, PermanentLockedAccount, MsgCreateVestingAccountResponse }; +import { MsgCreatePeriodicVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { MsgCreatePeriodicVestingAccountResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { PeriodicVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { DelayedVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { Period } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { MsgCreateVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { MsgCreatePermanentLockedAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { MsgCreatePermanentLockedAccountResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { BaseVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { ContinuousVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { PermanentLockedAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { MsgCreateVestingAccountResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; + + +export { MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountResponse, PeriodicVestingAccount, DelayedVestingAccount, Period, MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountResponse, BaseVestingAccount, ContinuousVestingAccount, PermanentLockedAccount, MsgCreateVestingAccountResponse }; -type sendBaseVestingAccountParams = { - value: BaseVestingAccount, +type sendMsgCreatePeriodicVestingAccountParams = { + value: MsgCreatePeriodicVestingAccount, fee?: StdFee, memo?: string }; -type sendMsgCreatePeriodicVestingAccountParams = { - value: MsgCreatePeriodicVestingAccount, +type sendMsgCreatePeriodicVestingAccountResponseParams = { + value: MsgCreatePeriodicVestingAccountResponse, fee?: StdFee, memo?: string }; -type sendContinuousVestingAccountParams = { - value: ContinuousVestingAccount, +type sendPeriodicVestingAccountParams = { + value: PeriodicVestingAccount, fee?: StdFee, memo?: string }; @@ -46,6 +46,12 @@ type sendDelayedVestingAccountParams = { memo?: string }; +type sendPeriodParams = { + value: Period, + fee?: StdFee, + memo?: string +}; + type sendMsgCreateVestingAccountParams = { value: MsgCreateVestingAccount, fee?: StdFee, @@ -64,20 +70,14 @@ type sendMsgCreatePermanentLockedAccountResponseParams = { memo?: string }; -type sendMsgCreatePeriodicVestingAccountResponseParams = { - value: MsgCreatePeriodicVestingAccountResponse, - fee?: StdFee, - memo?: string -}; - -type sendPeriodParams = { - value: Period, +type sendBaseVestingAccountParams = { + value: BaseVestingAccount, fee?: StdFee, memo?: string }; -type sendPeriodicVestingAccountParams = { - value: PeriodicVestingAccount, +type sendContinuousVestingAccountParams = { + value: ContinuousVestingAccount, fee?: StdFee, memo?: string }; @@ -95,22 +95,26 @@ type sendMsgCreateVestingAccountResponseParams = { }; -type baseVestingAccountParams = { - value: BaseVestingAccount, -}; - type msgCreatePeriodicVestingAccountParams = { value: MsgCreatePeriodicVestingAccount, }; -type continuousVestingAccountParams = { - value: ContinuousVestingAccount, +type msgCreatePeriodicVestingAccountResponseParams = { + value: MsgCreatePeriodicVestingAccountResponse, +}; + +type periodicVestingAccountParams = { + value: PeriodicVestingAccount, }; type delayedVestingAccountParams = { value: DelayedVestingAccount, }; +type periodParams = { + value: Period, +}; + type msgCreateVestingAccountParams = { value: MsgCreateVestingAccount, }; @@ -123,16 +127,12 @@ type msgCreatePermanentLockedAccountResponseParams = { value: MsgCreatePermanentLockedAccountResponse, }; -type msgCreatePeriodicVestingAccountResponseParams = { - value: MsgCreatePeriodicVestingAccountResponse, -}; - -type periodParams = { - value: Period, +type baseVestingAccountParams = { + value: BaseVestingAccount, }; -type periodicVestingAccountParams = { - value: PeriodicVestingAccount, +type continuousVestingAccountParams = { + value: ContinuousVestingAccount, }; type permanentLockedAccountParams = { @@ -173,45 +173,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendBaseVestingAccount({ value, fee, memo }: sendBaseVestingAccountParams): Promise { + async sendMsgCreatePeriodicVestingAccount({ value, fee, memo }: sendMsgCreatePeriodicVestingAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendBaseVestingAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreatePeriodicVestingAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.baseVestingAccount({ value: BaseVestingAccount.fromPartial(value) }) + let msg = this.msgCreatePeriodicVestingAccount({ value: MsgCreatePeriodicVestingAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendBaseVestingAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreatePeriodicVestingAccount: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreatePeriodicVestingAccount({ value, fee, memo }: sendMsgCreatePeriodicVestingAccountParams): Promise { + async sendMsgCreatePeriodicVestingAccountResponse({ value, fee, memo }: sendMsgCreatePeriodicVestingAccountResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreatePeriodicVestingAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreatePeriodicVestingAccountResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreatePeriodicVestingAccount({ value: MsgCreatePeriodicVestingAccount.fromPartial(value) }) + let msg = this.msgCreatePeriodicVestingAccountResponse({ value: MsgCreatePeriodicVestingAccountResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreatePeriodicVestingAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreatePeriodicVestingAccountResponse: Could not broadcast Tx: '+ e.message) } }, - async sendContinuousVestingAccount({ value, fee, memo }: sendContinuousVestingAccountParams): Promise { + async sendPeriodicVestingAccount({ value, fee, memo }: sendPeriodicVestingAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendContinuousVestingAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPeriodicVestingAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.continuousVestingAccount({ value: ContinuousVestingAccount.fromPartial(value) }) + let msg = this.periodicVestingAccount({ value: PeriodicVestingAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendContinuousVestingAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPeriodicVestingAccount: Could not broadcast Tx: '+ e.message) } }, @@ -229,6 +229,20 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, + async sendPeriod({ value, fee, memo }: sendPeriodParams): Promise { + if (!signer) { + throw new Error('TxClient:sendPeriod: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.period({ value: Period.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendPeriod: Could not broadcast Tx: '+ e.message) + } + }, + async sendMsgCreateVestingAccount({ value, fee, memo }: sendMsgCreateVestingAccountParams): Promise { if (!signer) { throw new Error('TxClient:sendMsgCreateVestingAccount: Unable to sign Tx. Signer is not present.') @@ -271,45 +285,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgCreatePeriodicVestingAccountResponse({ value, fee, memo }: sendMsgCreatePeriodicVestingAccountResponseParams): Promise { - if (!signer) { - throw new Error('TxClient:sendMsgCreatePeriodicVestingAccountResponse: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreatePeriodicVestingAccountResponse({ value: MsgCreatePeriodicVestingAccountResponse.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendMsgCreatePeriodicVestingAccountResponse: Could not broadcast Tx: '+ e.message) - } - }, - - async sendPeriod({ value, fee, memo }: sendPeriodParams): Promise { + async sendBaseVestingAccount({ value, fee, memo }: sendBaseVestingAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendPeriod: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendBaseVestingAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.period({ value: Period.fromPartial(value) }) + let msg = this.baseVestingAccount({ value: BaseVestingAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPeriod: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendBaseVestingAccount: Could not broadcast Tx: '+ e.message) } }, - async sendPeriodicVestingAccount({ value, fee, memo }: sendPeriodicVestingAccountParams): Promise { + async sendContinuousVestingAccount({ value, fee, memo }: sendContinuousVestingAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendPeriodicVestingAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendContinuousVestingAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.periodicVestingAccount({ value: PeriodicVestingAccount.fromPartial(value) }) + let msg = this.continuousVestingAccount({ value: ContinuousVestingAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPeriodicVestingAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendContinuousVestingAccount: Could not broadcast Tx: '+ e.message) } }, @@ -342,27 +342,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht }, - baseVestingAccount({ value }: baseVestingAccountParams): EncodeObject { + msgCreatePeriodicVestingAccount({ value }: msgCreatePeriodicVestingAccountParams): EncodeObject { try { - return { typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", value: BaseVestingAccount.fromPartial( value ) } + return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", value: MsgCreatePeriodicVestingAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:BaseVestingAccount: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreatePeriodicVestingAccount: Could not create message: ' + e.message) } }, - msgCreatePeriodicVestingAccount({ value }: msgCreatePeriodicVestingAccountParams): EncodeObject { + msgCreatePeriodicVestingAccountResponse({ value }: msgCreatePeriodicVestingAccountResponseParams): EncodeObject { try { - return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", value: MsgCreatePeriodicVestingAccount.fromPartial( value ) } + return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", value: MsgCreatePeriodicVestingAccountResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreatePeriodicVestingAccount: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreatePeriodicVestingAccountResponse: Could not create message: ' + e.message) } }, - continuousVestingAccount({ value }: continuousVestingAccountParams): EncodeObject { + periodicVestingAccount({ value }: periodicVestingAccountParams): EncodeObject { try { - return { typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", value: ContinuousVestingAccount.fromPartial( value ) } + return { typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", value: PeriodicVestingAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ContinuousVestingAccount: Could not create message: ' + e.message) + throw new Error('TxClient:PeriodicVestingAccount: Could not create message: ' + e.message) } }, @@ -374,6 +374,14 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, + period({ value }: periodParams): EncodeObject { + try { + return { typeUrl: "/cosmos.vesting.v1beta1.Period", value: Period.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:Period: Could not create message: ' + e.message) + } + }, + msgCreateVestingAccount({ value }: msgCreateVestingAccountParams): EncodeObject { try { return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", value: MsgCreateVestingAccount.fromPartial( value ) } @@ -398,27 +406,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgCreatePeriodicVestingAccountResponse({ value }: msgCreatePeriodicVestingAccountResponseParams): EncodeObject { - try { - return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", value: MsgCreatePeriodicVestingAccountResponse.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgCreatePeriodicVestingAccountResponse: Could not create message: ' + e.message) - } - }, - - period({ value }: periodParams): EncodeObject { + baseVestingAccount({ value }: baseVestingAccountParams): EncodeObject { try { - return { typeUrl: "/cosmos.vesting.v1beta1.Period", value: Period.fromPartial( value ) } + return { typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", value: BaseVestingAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Period: Could not create message: ' + e.message) + throw new Error('TxClient:BaseVestingAccount: Could not create message: ' + e.message) } }, - periodicVestingAccount({ value }: periodicVestingAccountParams): EncodeObject { + continuousVestingAccount({ value }: continuousVestingAccountParams): EncodeObject { try { - return { typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", value: PeriodicVestingAccount.fromPartial( value ) } + return { typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", value: ContinuousVestingAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:PeriodicVestingAccount: Could not create message: ' + e.message) + throw new Error('TxClient:ContinuousVestingAccount: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmos.vesting.v1beta1/registry.ts b/ts-client/cosmos.vesting.v1beta1/registry.ts index 9d35d9c3..0648fc46 100755 --- a/ts-client/cosmos.vesting.v1beta1/registry.ts +++ b/ts-client/cosmos.vesting.v1beta1/registry.ts @@ -1,28 +1,28 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { BaseVestingAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { MsgCreatePeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/tx"; -import { ContinuousVestingAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { DelayedVestingAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { MsgCreateVestingAccount } from "./types/cosmos/vesting/v1beta1/tx"; -import { MsgCreatePermanentLockedAccount } from "./types/cosmos/vesting/v1beta1/tx"; -import { MsgCreatePermanentLockedAccountResponse } from "./types/cosmos/vesting/v1beta1/tx"; -import { MsgCreatePeriodicVestingAccountResponse } from "./types/cosmos/vesting/v1beta1/tx"; -import { Period } from "./types/cosmos/vesting/v1beta1/vesting"; -import { PeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { PermanentLockedAccount } from "./types/cosmos/vesting/v1beta1/vesting"; -import { MsgCreateVestingAccountResponse } from "./types/cosmos/vesting/v1beta1/tx"; +import { MsgCreatePeriodicVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { MsgCreatePeriodicVestingAccountResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { PeriodicVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { DelayedVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { Period } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { MsgCreateVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { MsgCreatePermanentLockedAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { MsgCreatePermanentLockedAccountResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; +import { BaseVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { ContinuousVestingAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { PermanentLockedAccount } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/vesting"; +import { MsgCreateVestingAccountResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/cosmos-sdk@v0.50.8-fairyring-1/proto/cosmos/vesting/v1beta1/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmos.vesting.v1beta1.BaseVestingAccount", BaseVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount], - ["/cosmos.vesting.v1beta1.ContinuousVestingAccount", ContinuousVestingAccount], + ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", MsgCreatePeriodicVestingAccountResponse], + ["/cosmos.vesting.v1beta1.PeriodicVestingAccount", PeriodicVestingAccount], ["/cosmos.vesting.v1beta1.DelayedVestingAccount", DelayedVestingAccount], + ["/cosmos.vesting.v1beta1.Period", Period], ["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", MsgCreatePermanentLockedAccountResponse], - ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", MsgCreatePeriodicVestingAccountResponse], - ["/cosmos.vesting.v1beta1.Period", Period], - ["/cosmos.vesting.v1beta1.PeriodicVestingAccount", PeriodicVestingAccount], + ["/cosmos.vesting.v1beta1.BaseVestingAccount", BaseVestingAccount], + ["/cosmos.vesting.v1beta1.ContinuousVestingAccount", ContinuousVestingAccount], ["/cosmos.vesting.v1beta1.PermanentLockedAccount", PermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", MsgCreateVestingAccountResponse], diff --git a/ts-client/cosmos.vesting.v1beta1/types/amino/amino.ts b/ts-client/cosmos.vesting.v1beta1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmos.vesting.v1beta1/types/amino/amino.ts +++ b/ts-client/cosmos.vesting.v1beta1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmos.vesting.v1beta1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmos.vesting.v1beta1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmos.vesting.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..effd5449 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} + +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + 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(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: 0 }; +} + +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmos.vesting.v1beta1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/cosmos.vesting.v1beta1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmos.vesting.v1beta1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmos.vesting.v1beta1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmos.vesting.v1beta1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmos.vesting.v1beta1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmos.vesting.v1beta1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmos.vesting.v1beta1/types/cosmos_proto/cosmos.ts b/ts-client/cosmos.vesting.v1beta1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmos.vesting.v1beta1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmos.vesting.v1beta1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/common/shared_types.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/packet.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/params.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/query.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/tx.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/genesis.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/module/module.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/params.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/query.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/request_id.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/tx.ts b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/gogoproto/gogo.ts b/ts-client/cosmos.vesting.v1beta1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmos.vesting.v1beta1/types/gogoproto/gogo.ts +++ b/ts-client/cosmos.vesting.v1beta1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmos.vesting.v1beta1/types/google/api/annotations.ts b/ts-client/cosmos.vesting.v1beta1/types/google/api/annotations.ts new file mode 100644 index 00000000..d089209b --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/google/api/annotations.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + +/* eslint-disable */ + +export const protobufPackage = "google.api"; diff --git a/ts-client/cosmos.vesting.v1beta1/types/google/api/http.ts b/ts-client/cosmos.vesting.v1beta1/types/google/api/http.ts new file mode 100644 index 00000000..9ee09880 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/google/api/http.ts @@ -0,0 +1,756 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.api"; + +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface Http { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRule[]; + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fullyDecodeReservedExpansion: boolean; +} + +/** + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * The following HTTP JSON to RPC mapping is enabled: + * + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` + * + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` + * + * Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRule { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + */ + selector: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: + | string + | undefined; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: + | string + | undefined; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: + | string + | undefined; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: + | string + | undefined; + /** Maps to HTTP PATCH. Used for updating a resource. */ + patch?: + | string + | undefined; + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + */ + custom?: + | CustomHttpPattern + | undefined; + /** + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} + +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} + +function createBaseHttp(): Http { + return { rules: [], fullyDecodeReservedExpansion: false }; +} + +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fullyDecodeReservedExpansion !== false) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rules.push(HttpRule.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.fullyDecodeReservedExpansion = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Http { + return { + rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) + : false, + }; + }, + + toJSON(message: Http): unknown { + const obj: any = {}; + if (message.rules?.length) { + obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); + } + if (message.fullyDecodeReservedExpansion !== false) { + obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + } + 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)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, +}; + +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [], + }; +} + +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.selector = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.get = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.put = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.post = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delete = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.patch = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.body = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.responseBody = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HttpRule { + return { + 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) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) + ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HttpRule): unknown { + const obj: any = {}; + 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.responseBody !== "") { + obj.responseBody = message.responseBody; + } + if (message.additionalBindings?.length) { + obj.additionalBindings = message.additionalBindings.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 ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = (object.custom !== undefined && object.custom !== null) + ? CustomHttpPattern.fromPartial(object.custom) + : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { kind: "", path: "" }; +} + +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CustomHttpPattern { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + path: isSet(object.path) ? globalThis.String(object.path) : "", + }; + }, + + toJSON(message: CustomHttpPattern): unknown { + const obj: any = {}; + 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 ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/google/protobuf/descriptor.ts b/ts-client/cosmos.vesting.v1beta1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmos.vesting.v1beta1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmos.vesting.v1beta1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/google/protobuf/duration.ts b/ts-client/cosmos.vesting.v1beta1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmos.vesting.v1beta1/types/route-name.eta b/ts-client/cosmos.vesting.v1beta1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmos.vesting.v1beta1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/cosmwasm.wasm.v1/module.ts b/ts-client/cosmwasm.wasm.v1/module.ts index b8c84497..b9e1ee15 100755 --- a/ts-client/cosmwasm.wasm.v1/module.ts +++ b/ts-client/cosmwasm.wasm.v1/module.ts @@ -6,326 +6,314 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgInstantiateContract2 } from "./types/cosmwasm/wasm/v1/tx"; -import { CodeInfo } from "./types/cosmwasm/wasm/v1/types"; -import { QueryParamsResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgUpdateParamsResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { QueryContractsByCodeRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryContractsByCodeResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgRemoveCodeUploadParamsAddresses } from "./types/cosmwasm/wasm/v1/tx"; -import { AcceptedMessageKeysFilter } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryRawContractStateResponse } from "./types/cosmwasm/wasm/v1/query"; -import { AccessTypeParam } from "./types/cosmwasm/wasm/v1/types"; -import { Model } from "./types/cosmwasm/wasm/v1/types"; -import { QueryParamsRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgExecuteContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUpdateInstantiateConfig } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgSudoContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgPinCodes } from "./types/cosmwasm/wasm/v1/tx"; -import { QueryAllContractStateRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgIBCSendResponse } from "./types/cosmwasm/wasm/v1/ibc"; -import { MaxFundsLimit } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryContractHistoryRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgPinCodesResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgIBCCloseChannel } from "./types/cosmwasm/wasm/v1/ibc"; -import { MaxCallsLimit } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryBuildAddressRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgUpdateContractLabelResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { QueryCodesResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgStoreCodeResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUpdateAdmin } from "./types/cosmwasm/wasm/v1/tx"; -import { InstantiateContract2Proposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { QueryContractsByCreatorResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgAddCodeUploadParamsAddresses } from "./types/cosmwasm/wasm/v1/tx"; -import { ContractInfo } from "./types/cosmwasm/wasm/v1/types"; -import { StoreCodeProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { CodeGrant } from "./types/cosmwasm/wasm/v1/authz"; -import { MsgUpdateAdminResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { CombinedLimit } from "./types/cosmwasm/wasm/v1/authz"; -import { MsgStoreAndMigrateContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUpdateContractLabel } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgIBCSend } from "./types/cosmwasm/wasm/v1/ibc"; -import { PinCodesProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { MsgUnpinCodesResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { AcceptedMessagesFilter } from "./types/cosmwasm/wasm/v1/authz"; -import { Contract } from "./types/cosmwasm/wasm/v1/genesis"; -import { MsgInstantiateContract2Response } from "./types/cosmwasm/wasm/v1/tx"; -import { QueryContractInfoRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryAllContractStateResponse } from "./types/cosmwasm/wasm/v1/query"; -import { QueryCodesRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgAddCodeUploadParamsAddressesResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgMigrateContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgClearAdminResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgStoreAndInstantiateContract } from "./types/cosmwasm/wasm/v1/tx"; -import { ContractCodeHistoryEntry } from "./types/cosmwasm/wasm/v1/types"; -import { ContractExecutionAuthorization } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryContractsByCreatorRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryCodeRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgClearAdmin } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgRemoveCodeUploadParamsAddressesResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { Sequence } from "./types/cosmwasm/wasm/v1/genesis"; -import { MsgStoreAndMigrateContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { AbsoluteTxPosition } from "./types/cosmwasm/wasm/v1/types"; -import { MsgMigrateContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { ContractMigrationAuthorization } from "./types/cosmwasm/wasm/v1/authz"; -import { Code } from "./types/cosmwasm/wasm/v1/genesis"; -import { QueryContractInfoResponse } from "./types/cosmwasm/wasm/v1/query"; -import { QueryContractHistoryResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgExecuteContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUnpinCodes } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgStoreAndInstantiateContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { StoreCodeAuthorization } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryCodeResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgInstantiateContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgStoreCode } from "./types/cosmwasm/wasm/v1/tx"; -import { UpdateInstantiateConfigProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { AccessConfigUpdate } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { QueryPinnedCodesRequest } from "./types/cosmwasm/wasm/v1/query"; -import { AllowAllMessagesFilter } from "./types/cosmwasm/wasm/v1/authz"; -import { MsgInstantiateContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUpdateInstantiateConfigResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgSudoContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { StoreAndInstantiateContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { ExecuteContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { ContractGrant } from "./types/cosmwasm/wasm/v1/authz"; -import { SudoContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { ClearAdminProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { UnpinCodesProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { QuerySmartContractStateResponse } from "./types/cosmwasm/wasm/v1/query"; -import { CodeInfoResponse } from "./types/cosmwasm/wasm/v1/query"; -import { AccessConfig } from "./types/cosmwasm/wasm/v1/types"; -import { MsgUpdateParams } from "./types/cosmwasm/wasm/v1/tx"; -import { MigrateContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { GenesisState } from "./types/cosmwasm/wasm/v1/genesis"; -import { QueryRawContractStateRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryBuildAddressResponse } from "./types/cosmwasm/wasm/v1/query"; -import { Params } from "./types/cosmwasm/wasm/v1/types"; -import { InstantiateContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { UpdateAdminProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { QuerySmartContractStateRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryPinnedCodesResponse } from "./types/cosmwasm/wasm/v1/query"; - - -export { MsgInstantiateContract2, CodeInfo, QueryParamsResponse, MsgUpdateParamsResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse, MsgRemoveCodeUploadParamsAddresses, AcceptedMessageKeysFilter, QueryRawContractStateResponse, AccessTypeParam, Model, QueryParamsRequest, MsgExecuteContractResponse, MsgUpdateInstantiateConfig, MsgSudoContract, MsgPinCodes, QueryAllContractStateRequest, MsgIBCSendResponse, MaxFundsLimit, QueryContractHistoryRequest, MsgPinCodesResponse, MsgIBCCloseChannel, MaxCallsLimit, QueryBuildAddressRequest, MsgUpdateContractLabelResponse, QueryCodesResponse, MsgStoreCodeResponse, MsgUpdateAdmin, InstantiateContract2Proposal, QueryContractsByCreatorResponse, MsgAddCodeUploadParamsAddresses, ContractInfo, StoreCodeProposal, CodeGrant, MsgUpdateAdminResponse, CombinedLimit, MsgStoreAndMigrateContract, MsgUpdateContractLabel, MsgIBCSend, PinCodesProposal, MsgUnpinCodesResponse, AcceptedMessagesFilter, Contract, MsgInstantiateContract2Response, QueryContractInfoRequest, QueryAllContractStateResponse, QueryCodesRequest, MsgAddCodeUploadParamsAddressesResponse, MsgMigrateContract, MsgClearAdminResponse, MsgStoreAndInstantiateContract, ContractCodeHistoryEntry, ContractExecutionAuthorization, QueryContractsByCreatorRequest, QueryCodeRequest, MsgClearAdmin, MsgRemoveCodeUploadParamsAddressesResponse, Sequence, MsgStoreAndMigrateContractResponse, AbsoluteTxPosition, MsgMigrateContractResponse, ContractMigrationAuthorization, Code, QueryContractInfoResponse, QueryContractHistoryResponse, MsgExecuteContract, MsgUnpinCodes, MsgStoreAndInstantiateContractResponse, StoreCodeAuthorization, QueryCodeResponse, MsgInstantiateContract, MsgStoreCode, UpdateInstantiateConfigProposal, AccessConfigUpdate, QueryPinnedCodesRequest, AllowAllMessagesFilter, MsgInstantiateContractResponse, MsgUpdateInstantiateConfigResponse, MsgSudoContractResponse, StoreAndInstantiateContractProposal, ExecuteContractProposal, ContractGrant, SudoContractProposal, ClearAdminProposal, UnpinCodesProposal, QuerySmartContractStateResponse, CodeInfoResponse, AccessConfig, MsgUpdateParams, MigrateContractProposal, GenesisState, QueryRawContractStateRequest, QueryBuildAddressResponse, Params, InstantiateContractProposal, UpdateAdminProposal, QuerySmartContractStateRequest, QueryPinnedCodesResponse }; +import { QueryPinnedCodesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryContractsByCreatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryContractHistoryRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { AccessConfig } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { UpdateInstantiateConfigProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MsgUpdateInstantiateConfigResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ExecuteContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QueryContractsByCodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryCodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { ContractCodeHistoryEntry } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { AllowAllMessagesFilter } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { MsgUpdateContractLabelResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { StoreCodeProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QueryContractInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgInstantiateContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ContractInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { StoreCodeAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { MsgRemoveCodeUploadParamsAddresses } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ClearAdminProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { Code } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/genesis"; +import { QueryRawContractStateRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgMigrateContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgStoreAndInstantiateContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { StoreAndInstantiateContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { UnpinCodesProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QuerySmartContractStateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryCodeRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryBuildAddressRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgAddCodeUploadParamsAddressesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { PinCodesProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MsgIBCSend } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/ibc"; +import { QueryCodesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgUpdateAdmin } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUpdateContractLabel } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { MsgMigrateContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgStoreAndMigrateContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { AccessTypeParam } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { QueryPinnedCodesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgStoreAndMigrateContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { Model } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { SudoContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { CodeInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgStoreCode } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgInstantiateContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgClearAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgSudoContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { QueryContractHistoryResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgExecuteContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgSudoContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUnpinCodesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { AbsoluteTxPosition } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { MsgPinCodes } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ContractExecutionAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { AccessConfigUpdate } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QueryRawContractStateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { ContractGrant } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { CombinedLimit } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { AcceptedMessagesFilter } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgExecuteContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgInstantiateContract2Response } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUpdateInstantiateConfig } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ContractMigrationAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { Contract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/genesis"; +import { InstantiateContract2Proposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QueryCodesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryAllContractStateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgRemoveCodeUploadParamsAddressesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { CodeInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { MsgIBCCloseChannel } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/ibc"; +import { MsgUnpinCodes } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { CodeGrant } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { InstantiateContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MigrateContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MsgInstantiateContract2 } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgAddCodeUploadParamsAddresses } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { QueryContractInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QuerySmartContractStateRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgClearAdmin } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { UpdateAdminProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MaxCallsLimit } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { MaxFundsLimit } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { MsgStoreAndInstantiateContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { QueryContractsByCodeRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgStoreCodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { AcceptedMessageKeysFilter } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { QueryContractsByCreatorRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryBuildAddressResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/genesis"; +import { QueryAllContractStateRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgUpdateAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgPinCodesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgIBCSendResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/ibc"; +import { Sequence } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/genesis"; + + +export { QueryPinnedCodesRequest, QueryContractsByCreatorResponse, QueryContractHistoryRequest, AccessConfig, UpdateInstantiateConfigProposal, MsgUpdateInstantiateConfigResponse, MsgUpdateParams, ExecuteContractProposal, QueryContractsByCodeResponse, QueryCodeResponse, ContractCodeHistoryEntry, AllowAllMessagesFilter, MsgUpdateContractLabelResponse, StoreCodeProposal, QueryContractInfoRequest, MsgInstantiateContract, ContractInfo, StoreCodeAuthorization, MsgRemoveCodeUploadParamsAddresses, ClearAdminProposal, Code, QueryRawContractStateRequest, MsgMigrateContract, MsgStoreAndInstantiateContract, StoreAndInstantiateContractProposal, UnpinCodesProposal, QuerySmartContractStateResponse, QueryCodeRequest, QueryBuildAddressRequest, MsgAddCodeUploadParamsAddressesResponse, PinCodesProposal, MsgIBCSend, QueryCodesResponse, QueryParamsRequest, MsgUpdateAdmin, MsgUpdateContractLabel, Params, MsgMigrateContractResponse, MsgStoreAndMigrateContract, AccessTypeParam, QueryPinnedCodesResponse, MsgStoreAndMigrateContractResponse, Model, SudoContractProposal, CodeInfoResponse, MsgStoreCode, MsgInstantiateContractResponse, MsgClearAdminResponse, MsgUpdateParamsResponse, MsgSudoContract, QueryContractHistoryResponse, MsgExecuteContract, MsgSudoContractResponse, MsgUnpinCodesResponse, AbsoluteTxPosition, MsgPinCodes, ContractExecutionAuthorization, AccessConfigUpdate, QueryRawContractStateResponse, ContractGrant, CombinedLimit, AcceptedMessagesFilter, QueryParamsResponse, MsgExecuteContractResponse, MsgInstantiateContract2Response, MsgUpdateInstantiateConfig, ContractMigrationAuthorization, Contract, InstantiateContract2Proposal, QueryCodesRequest, QueryAllContractStateResponse, MsgRemoveCodeUploadParamsAddressesResponse, CodeInfo, MsgIBCCloseChannel, MsgUnpinCodes, CodeGrant, InstantiateContractProposal, MigrateContractProposal, MsgInstantiateContract2, MsgAddCodeUploadParamsAddresses, QueryContractInfoResponse, QuerySmartContractStateRequest, MsgClearAdmin, UpdateAdminProposal, MaxCallsLimit, MaxFundsLimit, MsgStoreAndInstantiateContractResponse, QueryContractsByCodeRequest, MsgStoreCodeResponse, AcceptedMessageKeysFilter, QueryContractsByCreatorRequest, QueryBuildAddressResponse, GenesisState, QueryAllContractStateRequest, MsgUpdateAdminResponse, MsgPinCodesResponse, MsgIBCSendResponse, Sequence }; -type sendMsgInstantiateContract2Params = { - value: MsgInstantiateContract2, - fee?: StdFee, - memo?: string -}; - -type sendCodeInfoParams = { - value: CodeInfo, - fee?: StdFee, - memo?: string -}; - -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendQueryPinnedCodesRequestParams = { + value: QueryPinnedCodesRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendQueryContractsByCreatorResponseParams = { + value: QueryContractsByCreatorResponse, fee?: StdFee, memo?: string }; -type sendQueryContractsByCodeRequestParams = { - value: QueryContractsByCodeRequest, +type sendQueryContractHistoryRequestParams = { + value: QueryContractHistoryRequest, fee?: StdFee, memo?: string }; -type sendQueryContractsByCodeResponseParams = { - value: QueryContractsByCodeResponse, +type sendAccessConfigParams = { + value: AccessConfig, fee?: StdFee, memo?: string }; -type sendMsgRemoveCodeUploadParamsAddressesParams = { - value: MsgRemoveCodeUploadParamsAddresses, +type sendUpdateInstantiateConfigProposalParams = { + value: UpdateInstantiateConfigProposal, fee?: StdFee, memo?: string }; -type sendAcceptedMessageKeysFilterParams = { - value: AcceptedMessageKeysFilter, +type sendMsgUpdateInstantiateConfigResponseParams = { + value: MsgUpdateInstantiateConfigResponse, fee?: StdFee, memo?: string }; -type sendQueryRawContractStateResponseParams = { - value: QueryRawContractStateResponse, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendAccessTypeParamParams = { - value: AccessTypeParam, +type sendExecuteContractProposalParams = { + value: ExecuteContractProposal, fee?: StdFee, memo?: string }; -type sendModelParams = { - value: Model, +type sendQueryContractsByCodeResponseParams = { + value: QueryContractsByCodeResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendQueryCodeResponseParams = { + value: QueryCodeResponse, fee?: StdFee, memo?: string }; -type sendMsgExecuteContractResponseParams = { - value: MsgExecuteContractResponse, +type sendContractCodeHistoryEntryParams = { + value: ContractCodeHistoryEntry, fee?: StdFee, memo?: string }; -type sendMsgUpdateInstantiateConfigParams = { - value: MsgUpdateInstantiateConfig, +type sendAllowAllMessagesFilterParams = { + value: AllowAllMessagesFilter, fee?: StdFee, memo?: string }; -type sendMsgSudoContractParams = { - value: MsgSudoContract, +type sendMsgUpdateContractLabelResponseParams = { + value: MsgUpdateContractLabelResponse, fee?: StdFee, memo?: string }; -type sendMsgPinCodesParams = { - value: MsgPinCodes, +type sendStoreCodeProposalParams = { + value: StoreCodeProposal, fee?: StdFee, memo?: string }; -type sendQueryAllContractStateRequestParams = { - value: QueryAllContractStateRequest, +type sendQueryContractInfoRequestParams = { + value: QueryContractInfoRequest, fee?: StdFee, memo?: string }; -type sendMsgIBCSendResponseParams = { - value: MsgIBCSendResponse, +type sendMsgInstantiateContractParams = { + value: MsgInstantiateContract, fee?: StdFee, memo?: string }; -type sendMaxFundsLimitParams = { - value: MaxFundsLimit, +type sendContractInfoParams = { + value: ContractInfo, fee?: StdFee, memo?: string }; -type sendQueryContractHistoryRequestParams = { - value: QueryContractHistoryRequest, +type sendStoreCodeAuthorizationParams = { + value: StoreCodeAuthorization, fee?: StdFee, memo?: string }; -type sendMsgPinCodesResponseParams = { - value: MsgPinCodesResponse, +type sendMsgRemoveCodeUploadParamsAddressesParams = { + value: MsgRemoveCodeUploadParamsAddresses, fee?: StdFee, memo?: string }; -type sendMsgIBCCloseChannelParams = { - value: MsgIBCCloseChannel, +type sendClearAdminProposalParams = { + value: ClearAdminProposal, fee?: StdFee, memo?: string }; -type sendMaxCallsLimitParams = { - value: MaxCallsLimit, +type sendCodeParams = { + value: Code, fee?: StdFee, memo?: string }; -type sendQueryBuildAddressRequestParams = { - value: QueryBuildAddressRequest, +type sendQueryRawContractStateRequestParams = { + value: QueryRawContractStateRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateContractLabelResponseParams = { - value: MsgUpdateContractLabelResponse, +type sendMsgMigrateContractParams = { + value: MsgMigrateContract, fee?: StdFee, memo?: string }; -type sendQueryCodesResponseParams = { - value: QueryCodesResponse, +type sendMsgStoreAndInstantiateContractParams = { + value: MsgStoreAndInstantiateContract, fee?: StdFee, memo?: string }; -type sendMsgStoreCodeResponseParams = { - value: MsgStoreCodeResponse, +type sendStoreAndInstantiateContractProposalParams = { + value: StoreAndInstantiateContractProposal, fee?: StdFee, memo?: string }; -type sendMsgUpdateAdminParams = { - value: MsgUpdateAdmin, +type sendUnpinCodesProposalParams = { + value: UnpinCodesProposal, fee?: StdFee, memo?: string }; -type sendInstantiateContract2ProposalParams = { - value: InstantiateContract2Proposal, +type sendQuerySmartContractStateResponseParams = { + value: QuerySmartContractStateResponse, fee?: StdFee, memo?: string }; -type sendQueryContractsByCreatorResponseParams = { - value: QueryContractsByCreatorResponse, +type sendQueryCodeRequestParams = { + value: QueryCodeRequest, fee?: StdFee, memo?: string }; -type sendMsgAddCodeUploadParamsAddressesParams = { - value: MsgAddCodeUploadParamsAddresses, +type sendQueryBuildAddressRequestParams = { + value: QueryBuildAddressRequest, fee?: StdFee, memo?: string }; -type sendContractInfoParams = { - value: ContractInfo, +type sendMsgAddCodeUploadParamsAddressesResponseParams = { + value: MsgAddCodeUploadParamsAddressesResponse, fee?: StdFee, memo?: string }; -type sendStoreCodeProposalParams = { - value: StoreCodeProposal, +type sendPinCodesProposalParams = { + value: PinCodesProposal, fee?: StdFee, memo?: string }; -type sendCodeGrantParams = { - value: CodeGrant, +type sendMsgIBCSendParams = { + value: MsgIBCSend, fee?: StdFee, memo?: string }; -type sendMsgUpdateAdminResponseParams = { - value: MsgUpdateAdminResponse, +type sendQueryCodesResponseParams = { + value: QueryCodesResponse, fee?: StdFee, memo?: string }; -type sendCombinedLimitParams = { - value: CombinedLimit, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendMsgStoreAndMigrateContractParams = { - value: MsgStoreAndMigrateContract, +type sendMsgUpdateAdminParams = { + value: MsgUpdateAdmin, fee?: StdFee, memo?: string }; @@ -336,68 +324,68 @@ type sendMsgUpdateContractLabelParams = { memo?: string }; -type sendMsgIBCSendParams = { - value: MsgIBCSend, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendPinCodesProposalParams = { - value: PinCodesProposal, +type sendMsgMigrateContractResponseParams = { + value: MsgMigrateContractResponse, fee?: StdFee, memo?: string }; -type sendMsgUnpinCodesResponseParams = { - value: MsgUnpinCodesResponse, +type sendMsgStoreAndMigrateContractParams = { + value: MsgStoreAndMigrateContract, fee?: StdFee, memo?: string }; -type sendAcceptedMessagesFilterParams = { - value: AcceptedMessagesFilter, +type sendAccessTypeParamParams = { + value: AccessTypeParam, fee?: StdFee, memo?: string }; -type sendContractParams = { - value: Contract, +type sendQueryPinnedCodesResponseParams = { + value: QueryPinnedCodesResponse, fee?: StdFee, memo?: string }; -type sendMsgInstantiateContract2ResponseParams = { - value: MsgInstantiateContract2Response, +type sendMsgStoreAndMigrateContractResponseParams = { + value: MsgStoreAndMigrateContractResponse, fee?: StdFee, memo?: string }; -type sendQueryContractInfoRequestParams = { - value: QueryContractInfoRequest, +type sendModelParams = { + value: Model, fee?: StdFee, memo?: string }; -type sendQueryAllContractStateResponseParams = { - value: QueryAllContractStateResponse, +type sendSudoContractProposalParams = { + value: SudoContractProposal, fee?: StdFee, memo?: string }; -type sendQueryCodesRequestParams = { - value: QueryCodesRequest, +type sendCodeInfoResponseParams = { + value: CodeInfoResponse, fee?: StdFee, memo?: string }; -type sendMsgAddCodeUploadParamsAddressesResponseParams = { - value: MsgAddCodeUploadParamsAddressesResponse, +type sendMsgStoreCodeParams = { + value: MsgStoreCode, fee?: StdFee, memo?: string }; -type sendMsgMigrateContractParams = { - value: MsgMigrateContract, +type sendMsgInstantiateContractResponseParams = { + value: MsgInstantiateContractResponse, fee?: StdFee, memo?: string }; @@ -408,254 +396,260 @@ type sendMsgClearAdminResponseParams = { memo?: string }; -type sendMsgStoreAndInstantiateContractParams = { - value: MsgStoreAndInstantiateContract, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendContractCodeHistoryEntryParams = { - value: ContractCodeHistoryEntry, +type sendMsgSudoContractParams = { + value: MsgSudoContract, fee?: StdFee, memo?: string }; -type sendContractExecutionAuthorizationParams = { - value: ContractExecutionAuthorization, +type sendQueryContractHistoryResponseParams = { + value: QueryContractHistoryResponse, fee?: StdFee, memo?: string }; -type sendQueryContractsByCreatorRequestParams = { - value: QueryContractsByCreatorRequest, +type sendMsgExecuteContractParams = { + value: MsgExecuteContract, fee?: StdFee, memo?: string }; -type sendQueryCodeRequestParams = { - value: QueryCodeRequest, +type sendMsgSudoContractResponseParams = { + value: MsgSudoContractResponse, fee?: StdFee, memo?: string }; -type sendMsgClearAdminParams = { - value: MsgClearAdmin, +type sendMsgUnpinCodesResponseParams = { + value: MsgUnpinCodesResponse, fee?: StdFee, memo?: string }; -type sendMsgRemoveCodeUploadParamsAddressesResponseParams = { - value: MsgRemoveCodeUploadParamsAddressesResponse, +type sendAbsoluteTxPositionParams = { + value: AbsoluteTxPosition, fee?: StdFee, memo?: string }; -type sendSequenceParams = { - value: Sequence, +type sendMsgPinCodesParams = { + value: MsgPinCodes, fee?: StdFee, memo?: string }; -type sendMsgStoreAndMigrateContractResponseParams = { - value: MsgStoreAndMigrateContractResponse, +type sendContractExecutionAuthorizationParams = { + value: ContractExecutionAuthorization, fee?: StdFee, memo?: string }; -type sendAbsoluteTxPositionParams = { - value: AbsoluteTxPosition, +type sendAccessConfigUpdateParams = { + value: AccessConfigUpdate, fee?: StdFee, memo?: string }; -type sendMsgMigrateContractResponseParams = { - value: MsgMigrateContractResponse, +type sendQueryRawContractStateResponseParams = { + value: QueryRawContractStateResponse, fee?: StdFee, memo?: string }; -type sendContractMigrationAuthorizationParams = { - value: ContractMigrationAuthorization, +type sendContractGrantParams = { + value: ContractGrant, fee?: StdFee, memo?: string }; -type sendCodeParams = { - value: Code, +type sendCombinedLimitParams = { + value: CombinedLimit, fee?: StdFee, memo?: string }; -type sendQueryContractInfoResponseParams = { - value: QueryContractInfoResponse, +type sendAcceptedMessagesFilterParams = { + value: AcceptedMessagesFilter, fee?: StdFee, memo?: string }; -type sendQueryContractHistoryResponseParams = { - value: QueryContractHistoryResponse, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendMsgExecuteContractParams = { - value: MsgExecuteContract, +type sendMsgExecuteContractResponseParams = { + value: MsgExecuteContractResponse, fee?: StdFee, memo?: string }; -type sendMsgUnpinCodesParams = { - value: MsgUnpinCodes, +type sendMsgInstantiateContract2ResponseParams = { + value: MsgInstantiateContract2Response, fee?: StdFee, memo?: string }; -type sendMsgStoreAndInstantiateContractResponseParams = { - value: MsgStoreAndInstantiateContractResponse, +type sendMsgUpdateInstantiateConfigParams = { + value: MsgUpdateInstantiateConfig, fee?: StdFee, memo?: string }; -type sendStoreCodeAuthorizationParams = { - value: StoreCodeAuthorization, +type sendContractMigrationAuthorizationParams = { + value: ContractMigrationAuthorization, fee?: StdFee, memo?: string }; -type sendQueryCodeResponseParams = { - value: QueryCodeResponse, +type sendContractParams = { + value: Contract, fee?: StdFee, memo?: string }; -type sendMsgInstantiateContractParams = { - value: MsgInstantiateContract, +type sendInstantiateContract2ProposalParams = { + value: InstantiateContract2Proposal, fee?: StdFee, memo?: string }; -type sendMsgStoreCodeParams = { - value: MsgStoreCode, +type sendQueryCodesRequestParams = { + value: QueryCodesRequest, fee?: StdFee, memo?: string }; -type sendUpdateInstantiateConfigProposalParams = { - value: UpdateInstantiateConfigProposal, +type sendQueryAllContractStateResponseParams = { + value: QueryAllContractStateResponse, fee?: StdFee, memo?: string }; -type sendAccessConfigUpdateParams = { - value: AccessConfigUpdate, +type sendMsgRemoveCodeUploadParamsAddressesResponseParams = { + value: MsgRemoveCodeUploadParamsAddressesResponse, fee?: StdFee, memo?: string }; -type sendQueryPinnedCodesRequestParams = { - value: QueryPinnedCodesRequest, +type sendCodeInfoParams = { + value: CodeInfo, fee?: StdFee, memo?: string }; -type sendAllowAllMessagesFilterParams = { - value: AllowAllMessagesFilter, +type sendMsgIBCCloseChannelParams = { + value: MsgIBCCloseChannel, fee?: StdFee, memo?: string }; -type sendMsgInstantiateContractResponseParams = { - value: MsgInstantiateContractResponse, +type sendMsgUnpinCodesParams = { + value: MsgUnpinCodes, fee?: StdFee, memo?: string }; -type sendMsgUpdateInstantiateConfigResponseParams = { - value: MsgUpdateInstantiateConfigResponse, +type sendCodeGrantParams = { + value: CodeGrant, fee?: StdFee, memo?: string }; -type sendMsgSudoContractResponseParams = { - value: MsgSudoContractResponse, +type sendInstantiateContractProposalParams = { + value: InstantiateContractProposal, fee?: StdFee, memo?: string }; -type sendStoreAndInstantiateContractProposalParams = { - value: StoreAndInstantiateContractProposal, +type sendMigrateContractProposalParams = { + value: MigrateContractProposal, fee?: StdFee, memo?: string }; -type sendExecuteContractProposalParams = { - value: ExecuteContractProposal, +type sendMsgInstantiateContract2Params = { + value: MsgInstantiateContract2, fee?: StdFee, memo?: string }; -type sendContractGrantParams = { - value: ContractGrant, +type sendMsgAddCodeUploadParamsAddressesParams = { + value: MsgAddCodeUploadParamsAddresses, fee?: StdFee, memo?: string }; -type sendSudoContractProposalParams = { - value: SudoContractProposal, +type sendQueryContractInfoResponseParams = { + value: QueryContractInfoResponse, fee?: StdFee, memo?: string }; -type sendClearAdminProposalParams = { - value: ClearAdminProposal, +type sendQuerySmartContractStateRequestParams = { + value: QuerySmartContractStateRequest, fee?: StdFee, memo?: string }; -type sendUnpinCodesProposalParams = { - value: UnpinCodesProposal, +type sendMsgClearAdminParams = { + value: MsgClearAdmin, fee?: StdFee, memo?: string }; -type sendQuerySmartContractStateResponseParams = { - value: QuerySmartContractStateResponse, +type sendUpdateAdminProposalParams = { + value: UpdateAdminProposal, fee?: StdFee, memo?: string }; -type sendCodeInfoResponseParams = { - value: CodeInfoResponse, +type sendMaxCallsLimitParams = { + value: MaxCallsLimit, fee?: StdFee, memo?: string }; -type sendAccessConfigParams = { - value: AccessConfig, +type sendMaxFundsLimitParams = { + value: MaxFundsLimit, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendMsgStoreAndInstantiateContractResponseParams = { + value: MsgStoreAndInstantiateContractResponse, fee?: StdFee, memo?: string }; -type sendMigrateContractProposalParams = { - value: MigrateContractProposal, +type sendQueryContractsByCodeRequestParams = { + value: QueryContractsByCodeRequest, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendMsgStoreCodeResponseParams = { + value: MsgStoreCodeResponse, fee?: StdFee, memo?: string }; -type sendQueryRawContractStateRequestParams = { - value: QueryRawContractStateRequest, +type sendAcceptedMessageKeysFilterParams = { + value: AcceptedMessageKeysFilter, + fee?: StdFee, + memo?: string +}; + +type sendQueryContractsByCreatorRequestParams = { + value: QueryContractsByCreatorRequest, fee?: StdFee, memo?: string }; @@ -666,427 +660,433 @@ type sendQueryBuildAddressResponseParams = { memo?: string }; -type sendParamsParams = { - value: Params, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendInstantiateContractProposalParams = { - value: InstantiateContractProposal, +type sendQueryAllContractStateRequestParams = { + value: QueryAllContractStateRequest, fee?: StdFee, memo?: string }; -type sendUpdateAdminProposalParams = { - value: UpdateAdminProposal, +type sendMsgUpdateAdminResponseParams = { + value: MsgUpdateAdminResponse, fee?: StdFee, memo?: string }; -type sendQuerySmartContractStateRequestParams = { - value: QuerySmartContractStateRequest, +type sendMsgPinCodesResponseParams = { + value: MsgPinCodesResponse, fee?: StdFee, memo?: string }; -type sendQueryPinnedCodesResponseParams = { - value: QueryPinnedCodesResponse, +type sendMsgIBCSendResponseParams = { + value: MsgIBCSendResponse, fee?: StdFee, memo?: string }; - -type msgInstantiateContract2Params = { - value: MsgInstantiateContract2, +type sendSequenceParams = { + value: Sequence, + fee?: StdFee, + memo?: string }; -type codeInfoParams = { - value: CodeInfo, -}; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type queryPinnedCodesRequestParams = { + value: QueryPinnedCodesRequest, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type queryContractsByCreatorResponseParams = { + value: QueryContractsByCreatorResponse, }; -type queryContractsByCodeRequestParams = { - value: QueryContractsByCodeRequest, +type queryContractHistoryRequestParams = { + value: QueryContractHistoryRequest, }; -type queryContractsByCodeResponseParams = { - value: QueryContractsByCodeResponse, +type accessConfigParams = { + value: AccessConfig, }; -type msgRemoveCodeUploadParamsAddressesParams = { - value: MsgRemoveCodeUploadParamsAddresses, +type updateInstantiateConfigProposalParams = { + value: UpdateInstantiateConfigProposal, }; -type acceptedMessageKeysFilterParams = { - value: AcceptedMessageKeysFilter, +type msgUpdateInstantiateConfigResponseParams = { + value: MsgUpdateInstantiateConfigResponse, }; -type queryRawContractStateResponseParams = { - value: QueryRawContractStateResponse, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type accessTypeParamParams = { - value: AccessTypeParam, +type executeContractProposalParams = { + value: ExecuteContractProposal, }; -type modelParams = { - value: Model, +type queryContractsByCodeResponseParams = { + value: QueryContractsByCodeResponse, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type queryCodeResponseParams = { + value: QueryCodeResponse, }; -type msgExecuteContractResponseParams = { - value: MsgExecuteContractResponse, +type contractCodeHistoryEntryParams = { + value: ContractCodeHistoryEntry, }; -type msgUpdateInstantiateConfigParams = { - value: MsgUpdateInstantiateConfig, +type allowAllMessagesFilterParams = { + value: AllowAllMessagesFilter, }; -type msgSudoContractParams = { - value: MsgSudoContract, +type msgUpdateContractLabelResponseParams = { + value: MsgUpdateContractLabelResponse, }; -type msgPinCodesParams = { - value: MsgPinCodes, +type storeCodeProposalParams = { + value: StoreCodeProposal, }; -type queryAllContractStateRequestParams = { - value: QueryAllContractStateRequest, +type queryContractInfoRequestParams = { + value: QueryContractInfoRequest, }; -type msgIbcsendResponseParams = { - value: MsgIBCSendResponse, +type msgInstantiateContractParams = { + value: MsgInstantiateContract, }; -type maxFundsLimitParams = { - value: MaxFundsLimit, +type contractInfoParams = { + value: ContractInfo, }; -type queryContractHistoryRequestParams = { - value: QueryContractHistoryRequest, +type storeCodeAuthorizationParams = { + value: StoreCodeAuthorization, }; -type msgPinCodesResponseParams = { - value: MsgPinCodesResponse, +type msgRemoveCodeUploadParamsAddressesParams = { + value: MsgRemoveCodeUploadParamsAddresses, }; -type msgIbccloseChannelParams = { - value: MsgIBCCloseChannel, +type clearAdminProposalParams = { + value: ClearAdminProposal, }; -type maxCallsLimitParams = { - value: MaxCallsLimit, +type codeParams = { + value: Code, }; -type queryBuildAddressRequestParams = { - value: QueryBuildAddressRequest, +type queryRawContractStateRequestParams = { + value: QueryRawContractStateRequest, }; -type msgUpdateContractLabelResponseParams = { - value: MsgUpdateContractLabelResponse, +type msgMigrateContractParams = { + value: MsgMigrateContract, }; -type queryCodesResponseParams = { - value: QueryCodesResponse, +type msgStoreAndInstantiateContractParams = { + value: MsgStoreAndInstantiateContract, }; -type msgStoreCodeResponseParams = { - value: MsgStoreCodeResponse, +type storeAndInstantiateContractProposalParams = { + value: StoreAndInstantiateContractProposal, }; -type msgUpdateAdminParams = { - value: MsgUpdateAdmin, +type unpinCodesProposalParams = { + value: UnpinCodesProposal, }; -type instantiateContract2ProposalParams = { - value: InstantiateContract2Proposal, +type querySmartContractStateResponseParams = { + value: QuerySmartContractStateResponse, }; -type queryContractsByCreatorResponseParams = { - value: QueryContractsByCreatorResponse, +type queryCodeRequestParams = { + value: QueryCodeRequest, }; -type msgAddCodeUploadParamsAddressesParams = { - value: MsgAddCodeUploadParamsAddresses, +type queryBuildAddressRequestParams = { + value: QueryBuildAddressRequest, }; -type contractInfoParams = { - value: ContractInfo, +type msgAddCodeUploadParamsAddressesResponseParams = { + value: MsgAddCodeUploadParamsAddressesResponse, }; -type storeCodeProposalParams = { - value: StoreCodeProposal, +type pinCodesProposalParams = { + value: PinCodesProposal, }; -type codeGrantParams = { - value: CodeGrant, +type msgIbcsendParams = { + value: MsgIBCSend, }; -type msgUpdateAdminResponseParams = { - value: MsgUpdateAdminResponse, +type queryCodesResponseParams = { + value: QueryCodesResponse, }; -type combinedLimitParams = { - value: CombinedLimit, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; -type msgStoreAndMigrateContractParams = { - value: MsgStoreAndMigrateContract, +type msgUpdateAdminParams = { + value: MsgUpdateAdmin, }; type msgUpdateContractLabelParams = { value: MsgUpdateContractLabel, }; -type msgIbcsendParams = { - value: MsgIBCSend, +type paramsParams = { + value: Params, }; -type pinCodesProposalParams = { - value: PinCodesProposal, +type msgMigrateContractResponseParams = { + value: MsgMigrateContractResponse, }; -type msgUnpinCodesResponseParams = { - value: MsgUnpinCodesResponse, +type msgStoreAndMigrateContractParams = { + value: MsgStoreAndMigrateContract, }; -type acceptedMessagesFilterParams = { - value: AcceptedMessagesFilter, +type accessTypeParamParams = { + value: AccessTypeParam, }; -type contractParams = { - value: Contract, +type queryPinnedCodesResponseParams = { + value: QueryPinnedCodesResponse, }; -type msgInstantiateContract2ResponseParams = { - value: MsgInstantiateContract2Response, +type msgStoreAndMigrateContractResponseParams = { + value: MsgStoreAndMigrateContractResponse, }; -type queryContractInfoRequestParams = { - value: QueryContractInfoRequest, +type modelParams = { + value: Model, }; -type queryAllContractStateResponseParams = { - value: QueryAllContractStateResponse, +type sudoContractProposalParams = { + value: SudoContractProposal, }; -type queryCodesRequestParams = { - value: QueryCodesRequest, +type codeInfoResponseParams = { + value: CodeInfoResponse, }; -type msgAddCodeUploadParamsAddressesResponseParams = { - value: MsgAddCodeUploadParamsAddressesResponse, +type msgStoreCodeParams = { + value: MsgStoreCode, }; -type msgMigrateContractParams = { - value: MsgMigrateContract, +type msgInstantiateContractResponseParams = { + value: MsgInstantiateContractResponse, }; type msgClearAdminResponseParams = { value: MsgClearAdminResponse, }; -type msgStoreAndInstantiateContractParams = { - value: MsgStoreAndInstantiateContract, +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; -type contractCodeHistoryEntryParams = { - value: ContractCodeHistoryEntry, +type msgSudoContractParams = { + value: MsgSudoContract, }; -type contractExecutionAuthorizationParams = { - value: ContractExecutionAuthorization, +type queryContractHistoryResponseParams = { + value: QueryContractHistoryResponse, }; -type queryContractsByCreatorRequestParams = { - value: QueryContractsByCreatorRequest, +type msgExecuteContractParams = { + value: MsgExecuteContract, }; -type queryCodeRequestParams = { - value: QueryCodeRequest, +type msgSudoContractResponseParams = { + value: MsgSudoContractResponse, }; -type msgClearAdminParams = { - value: MsgClearAdmin, +type msgUnpinCodesResponseParams = { + value: MsgUnpinCodesResponse, }; -type msgRemoveCodeUploadParamsAddressesResponseParams = { - value: MsgRemoveCodeUploadParamsAddressesResponse, +type absoluteTxPositionParams = { + value: AbsoluteTxPosition, }; -type sequenceParams = { - value: Sequence, +type msgPinCodesParams = { + value: MsgPinCodes, }; -type msgStoreAndMigrateContractResponseParams = { - value: MsgStoreAndMigrateContractResponse, +type contractExecutionAuthorizationParams = { + value: ContractExecutionAuthorization, +}; + +type accessConfigUpdateParams = { + value: AccessConfigUpdate, }; -type absoluteTxPositionParams = { - value: AbsoluteTxPosition, +type queryRawContractStateResponseParams = { + value: QueryRawContractStateResponse, }; -type msgMigrateContractResponseParams = { - value: MsgMigrateContractResponse, +type contractGrantParams = { + value: ContractGrant, }; -type contractMigrationAuthorizationParams = { - value: ContractMigrationAuthorization, +type combinedLimitParams = { + value: CombinedLimit, }; -type codeParams = { - value: Code, +type acceptedMessagesFilterParams = { + value: AcceptedMessagesFilter, }; -type queryContractInfoResponseParams = { - value: QueryContractInfoResponse, +type queryParamsResponseParams = { + value: QueryParamsResponse, }; -type queryContractHistoryResponseParams = { - value: QueryContractHistoryResponse, +type msgExecuteContractResponseParams = { + value: MsgExecuteContractResponse, }; -type msgExecuteContractParams = { - value: MsgExecuteContract, +type msgInstantiateContract2ResponseParams = { + value: MsgInstantiateContract2Response, }; -type msgUnpinCodesParams = { - value: MsgUnpinCodes, +type msgUpdateInstantiateConfigParams = { + value: MsgUpdateInstantiateConfig, }; -type msgStoreAndInstantiateContractResponseParams = { - value: MsgStoreAndInstantiateContractResponse, +type contractMigrationAuthorizationParams = { + value: ContractMigrationAuthorization, }; -type storeCodeAuthorizationParams = { - value: StoreCodeAuthorization, +type contractParams = { + value: Contract, }; -type queryCodeResponseParams = { - value: QueryCodeResponse, +type instantiateContract2ProposalParams = { + value: InstantiateContract2Proposal, }; -type msgInstantiateContractParams = { - value: MsgInstantiateContract, +type queryCodesRequestParams = { + value: QueryCodesRequest, }; -type msgStoreCodeParams = { - value: MsgStoreCode, +type queryAllContractStateResponseParams = { + value: QueryAllContractStateResponse, }; -type updateInstantiateConfigProposalParams = { - value: UpdateInstantiateConfigProposal, +type msgRemoveCodeUploadParamsAddressesResponseParams = { + value: MsgRemoveCodeUploadParamsAddressesResponse, }; -type accessConfigUpdateParams = { - value: AccessConfigUpdate, +type codeInfoParams = { + value: CodeInfo, }; -type queryPinnedCodesRequestParams = { - value: QueryPinnedCodesRequest, +type msgIbccloseChannelParams = { + value: MsgIBCCloseChannel, }; -type allowAllMessagesFilterParams = { - value: AllowAllMessagesFilter, +type msgUnpinCodesParams = { + value: MsgUnpinCodes, }; -type msgInstantiateContractResponseParams = { - value: MsgInstantiateContractResponse, +type codeGrantParams = { + value: CodeGrant, }; -type msgUpdateInstantiateConfigResponseParams = { - value: MsgUpdateInstantiateConfigResponse, +type instantiateContractProposalParams = { + value: InstantiateContractProposal, }; -type msgSudoContractResponseParams = { - value: MsgSudoContractResponse, +type migrateContractProposalParams = { + value: MigrateContractProposal, }; -type storeAndInstantiateContractProposalParams = { - value: StoreAndInstantiateContractProposal, +type msgInstantiateContract2Params = { + value: MsgInstantiateContract2, }; -type executeContractProposalParams = { - value: ExecuteContractProposal, +type msgAddCodeUploadParamsAddressesParams = { + value: MsgAddCodeUploadParamsAddresses, }; -type contractGrantParams = { - value: ContractGrant, +type queryContractInfoResponseParams = { + value: QueryContractInfoResponse, }; -type sudoContractProposalParams = { - value: SudoContractProposal, +type querySmartContractStateRequestParams = { + value: QuerySmartContractStateRequest, }; -type clearAdminProposalParams = { - value: ClearAdminProposal, +type msgClearAdminParams = { + value: MsgClearAdmin, }; -type unpinCodesProposalParams = { - value: UnpinCodesProposal, +type updateAdminProposalParams = { + value: UpdateAdminProposal, }; -type querySmartContractStateResponseParams = { - value: QuerySmartContractStateResponse, +type maxCallsLimitParams = { + value: MaxCallsLimit, }; -type codeInfoResponseParams = { - value: CodeInfoResponse, +type maxFundsLimitParams = { + value: MaxFundsLimit, }; -type accessConfigParams = { - value: AccessConfig, +type msgStoreAndInstantiateContractResponseParams = { + value: MsgStoreAndInstantiateContractResponse, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type queryContractsByCodeRequestParams = { + value: QueryContractsByCodeRequest, }; -type migrateContractProposalParams = { - value: MigrateContractProposal, +type msgStoreCodeResponseParams = { + value: MsgStoreCodeResponse, }; -type genesisStateParams = { - value: GenesisState, +type acceptedMessageKeysFilterParams = { + value: AcceptedMessageKeysFilter, }; -type queryRawContractStateRequestParams = { - value: QueryRawContractStateRequest, +type queryContractsByCreatorRequestParams = { + value: QueryContractsByCreatorRequest, }; type queryBuildAddressResponseParams = { value: QueryBuildAddressResponse, }; -type paramsParams = { - value: Params, +type genesisStateParams = { + value: GenesisState, }; -type instantiateContractProposalParams = { - value: InstantiateContractProposal, +type queryAllContractStateRequestParams = { + value: QueryAllContractStateRequest, }; -type updateAdminProposalParams = { - value: UpdateAdminProposal, +type msgUpdateAdminResponseParams = { + value: MsgUpdateAdminResponse, }; -type querySmartContractStateRequestParams = { - value: QuerySmartContractStateRequest, +type msgPinCodesResponseParams = { + value: MsgPinCodesResponse, }; -type queryPinnedCodesResponseParams = { - value: QueryPinnedCodesResponse, +type msgIbcsendResponseParams = { + value: MsgIBCSendResponse, +}; + +type sequenceParams = { + value: Sequence, }; @@ -1119,1291 +1119,1277 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgInstantiateContract2({ value, fee, memo }: sendMsgInstantiateContract2Params): Promise { - if (!signer) { - throw new Error('TxClient:sendMsgInstantiateContract2: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgInstantiateContract2({ value: MsgInstantiateContract2.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendMsgInstantiateContract2: Could not broadcast Tx: '+ e.message) - } - }, - - async sendCodeInfo({ value, fee, memo }: sendCodeInfoParams): Promise { + async sendQueryPinnedCodesRequest({ value, fee, memo }: sendQueryPinnedCodesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendCodeInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPinnedCodesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.codeInfo({ value: CodeInfo.fromPartial(value) }) + let msg = this.queryPinnedCodesRequest({ value: QueryPinnedCodesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCodeInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPinnedCodesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendQueryContractsByCreatorResponse({ value, fee, memo }: sendQueryContractsByCreatorResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryContractsByCreatorResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.queryContractsByCreatorResponse({ value: QueryContractsByCreatorResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryContractsByCreatorResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendQueryContractHistoryRequest({ value, fee, memo }: sendQueryContractHistoryRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryContractHistoryRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.queryContractHistoryRequest({ value: QueryContractHistoryRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryContractHistoryRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryContractsByCodeRequest({ value, fee, memo }: sendQueryContractsByCodeRequestParams): Promise { + async sendAccessConfig({ value, fee, memo }: sendAccessConfigParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryContractsByCodeRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAccessConfig: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryContractsByCodeRequest({ value: QueryContractsByCodeRequest.fromPartial(value) }) + let msg = this.accessConfig({ value: AccessConfig.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryContractsByCodeRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAccessConfig: Could not broadcast Tx: '+ e.message) } }, - async sendQueryContractsByCodeResponse({ value, fee, memo }: sendQueryContractsByCodeResponseParams): Promise { + async sendUpdateInstantiateConfigProposal({ value, fee, memo }: sendUpdateInstantiateConfigProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryContractsByCodeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendUpdateInstantiateConfigProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryContractsByCodeResponse({ value: QueryContractsByCodeResponse.fromPartial(value) }) + let msg = this.updateInstantiateConfigProposal({ value: UpdateInstantiateConfigProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryContractsByCodeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendUpdateInstantiateConfigProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRemoveCodeUploadParamsAddresses({ value, fee, memo }: sendMsgRemoveCodeUploadParamsAddressesParams): Promise { + async sendMsgUpdateInstantiateConfigResponse({ value, fee, memo }: sendMsgUpdateInstantiateConfigResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRemoveCodeUploadParamsAddresses: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateInstantiateConfigResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRemoveCodeUploadParamsAddresses({ value: MsgRemoveCodeUploadParamsAddresses.fromPartial(value) }) + let msg = this.msgUpdateInstantiateConfigResponse({ value: MsgUpdateInstantiateConfigResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRemoveCodeUploadParamsAddresses: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateInstantiateConfigResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAcceptedMessageKeysFilter({ value, fee, memo }: sendAcceptedMessageKeysFilterParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendAcceptedMessageKeysFilter: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.acceptedMessageKeysFilter({ value: AcceptedMessageKeysFilter.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAcceptedMessageKeysFilter: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryRawContractStateResponse({ value, fee, memo }: sendQueryRawContractStateResponseParams): Promise { + async sendExecuteContractProposal({ value, fee, memo }: sendExecuteContractProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryRawContractStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendExecuteContractProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryRawContractStateResponse({ value: QueryRawContractStateResponse.fromPartial(value) }) + let msg = this.executeContractProposal({ value: ExecuteContractProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryRawContractStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendExecuteContractProposal: Could not broadcast Tx: '+ e.message) } }, - async sendAccessTypeParam({ value, fee, memo }: sendAccessTypeParamParams): Promise { + async sendQueryContractsByCodeResponse({ value, fee, memo }: sendQueryContractsByCodeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendAccessTypeParam: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryContractsByCodeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.accessTypeParam({ value: AccessTypeParam.fromPartial(value) }) + let msg = this.queryContractsByCodeResponse({ value: QueryContractsByCodeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAccessTypeParam: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryContractsByCodeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendModel({ value, fee, memo }: sendModelParams): Promise { + async sendQueryCodeResponse({ value, fee, memo }: sendQueryCodeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendModel: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCodeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.model({ value: Model.fromPartial(value) }) + let msg = this.queryCodeResponse({ value: QueryCodeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendModel: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCodeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendContractCodeHistoryEntry({ value, fee, memo }: sendContractCodeHistoryEntryParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendContractCodeHistoryEntry: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.contractCodeHistoryEntry({ value: ContractCodeHistoryEntry.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendContractCodeHistoryEntry: Could not broadcast Tx: '+ e.message) } }, - async sendMsgExecuteContractResponse({ value, fee, memo }: sendMsgExecuteContractResponseParams): Promise { + async sendAllowAllMessagesFilter({ value, fee, memo }: sendAllowAllMessagesFilterParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgExecuteContractResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAllowAllMessagesFilter: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgExecuteContractResponse({ value: MsgExecuteContractResponse.fromPartial(value) }) + let msg = this.allowAllMessagesFilter({ value: AllowAllMessagesFilter.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgExecuteContractResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAllowAllMessagesFilter: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateInstantiateConfig({ value, fee, memo }: sendMsgUpdateInstantiateConfigParams): Promise { + async sendMsgUpdateContractLabelResponse({ value, fee, memo }: sendMsgUpdateContractLabelResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateInstantiateConfig: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateContractLabelResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateInstantiateConfig({ value: MsgUpdateInstantiateConfig.fromPartial(value) }) + let msg = this.msgUpdateContractLabelResponse({ value: MsgUpdateContractLabelResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateInstantiateConfig: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateContractLabelResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSudoContract({ value, fee, memo }: sendMsgSudoContractParams): Promise { + async sendStoreCodeProposal({ value, fee, memo }: sendStoreCodeProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSudoContract: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendStoreCodeProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSudoContract({ value: MsgSudoContract.fromPartial(value) }) + let msg = this.storeCodeProposal({ value: StoreCodeProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSudoContract: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendStoreCodeProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPinCodes({ value, fee, memo }: sendMsgPinCodesParams): Promise { + async sendQueryContractInfoRequest({ value, fee, memo }: sendQueryContractInfoRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPinCodes: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryContractInfoRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPinCodes({ value: MsgPinCodes.fromPartial(value) }) + let msg = this.queryContractInfoRequest({ value: QueryContractInfoRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPinCodes: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryContractInfoRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllContractStateRequest({ value, fee, memo }: sendQueryAllContractStateRequestParams): Promise { + async sendMsgInstantiateContract({ value, fee, memo }: sendMsgInstantiateContractParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllContractStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgInstantiateContract: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllContractStateRequest({ value: QueryAllContractStateRequest.fromPartial(value) }) + let msg = this.msgInstantiateContract({ value: MsgInstantiateContract.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllContractStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgInstantiateContract: Could not broadcast Tx: '+ e.message) } }, - async sendMsgIBCSendResponse({ value, fee, memo }: sendMsgIBCSendResponseParams): Promise { + async sendContractInfo({ value, fee, memo }: sendContractInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgIBCSendResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendContractInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgIbcsendResponse({ value: MsgIBCSendResponse.fromPartial(value) }) + let msg = this.contractInfo({ value: ContractInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgIBCSendResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendContractInfo: Could not broadcast Tx: '+ e.message) } }, - async sendMaxFundsLimit({ value, fee, memo }: sendMaxFundsLimitParams): Promise { + async sendStoreCodeAuthorization({ value, fee, memo }: sendStoreCodeAuthorizationParams): Promise { if (!signer) { - throw new Error('TxClient:sendMaxFundsLimit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendStoreCodeAuthorization: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.maxFundsLimit({ value: MaxFundsLimit.fromPartial(value) }) + let msg = this.storeCodeAuthorization({ value: StoreCodeAuthorization.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMaxFundsLimit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendStoreCodeAuthorization: Could not broadcast Tx: '+ e.message) } }, - async sendQueryContractHistoryRequest({ value, fee, memo }: sendQueryContractHistoryRequestParams): Promise { + async sendMsgRemoveCodeUploadParamsAddresses({ value, fee, memo }: sendMsgRemoveCodeUploadParamsAddressesParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryContractHistoryRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRemoveCodeUploadParamsAddresses: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryContractHistoryRequest({ value: QueryContractHistoryRequest.fromPartial(value) }) + let msg = this.msgRemoveCodeUploadParamsAddresses({ value: MsgRemoveCodeUploadParamsAddresses.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryContractHistoryRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRemoveCodeUploadParamsAddresses: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPinCodesResponse({ value, fee, memo }: sendMsgPinCodesResponseParams): Promise { + async sendClearAdminProposal({ value, fee, memo }: sendClearAdminProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPinCodesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendClearAdminProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPinCodesResponse({ value: MsgPinCodesResponse.fromPartial(value) }) + let msg = this.clearAdminProposal({ value: ClearAdminProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPinCodesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendClearAdminProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgIBCCloseChannel({ value, fee, memo }: sendMsgIBCCloseChannelParams): Promise { + async sendCode({ value, fee, memo }: sendCodeParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgIBCCloseChannel: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCode: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgIbccloseChannel({ value: MsgIBCCloseChannel.fromPartial(value) }) + let msg = this.code({ value: Code.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgIBCCloseChannel: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCode: Could not broadcast Tx: '+ e.message) } }, - async sendMaxCallsLimit({ value, fee, memo }: sendMaxCallsLimitParams): Promise { + async sendQueryRawContractStateRequest({ value, fee, memo }: sendQueryRawContractStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMaxCallsLimit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryRawContractStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.maxCallsLimit({ value: MaxCallsLimit.fromPartial(value) }) + let msg = this.queryRawContractStateRequest({ value: QueryRawContractStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMaxCallsLimit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryRawContractStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryBuildAddressRequest({ value, fee, memo }: sendQueryBuildAddressRequestParams): Promise { + async sendMsgMigrateContract({ value, fee, memo }: sendMsgMigrateContractParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryBuildAddressRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgMigrateContract: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryBuildAddressRequest({ value: QueryBuildAddressRequest.fromPartial(value) }) + let msg = this.msgMigrateContract({ value: MsgMigrateContract.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryBuildAddressRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgMigrateContract: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateContractLabelResponse({ value, fee, memo }: sendMsgUpdateContractLabelResponseParams): Promise { + async sendMsgStoreAndInstantiateContract({ value, fee, memo }: sendMsgStoreAndInstantiateContractParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateContractLabelResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgStoreAndInstantiateContract: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateContractLabelResponse({ value: MsgUpdateContractLabelResponse.fromPartial(value) }) + let msg = this.msgStoreAndInstantiateContract({ value: MsgStoreAndInstantiateContract.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateContractLabelResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgStoreAndInstantiateContract: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCodesResponse({ value, fee, memo }: sendQueryCodesResponseParams): Promise { + async sendStoreAndInstantiateContractProposal({ value, fee, memo }: sendStoreAndInstantiateContractProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCodesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendStoreAndInstantiateContractProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCodesResponse({ value: QueryCodesResponse.fromPartial(value) }) + let msg = this.storeAndInstantiateContractProposal({ value: StoreAndInstantiateContractProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCodesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendStoreAndInstantiateContractProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgStoreCodeResponse({ value, fee, memo }: sendMsgStoreCodeResponseParams): Promise { + async sendUnpinCodesProposal({ value, fee, memo }: sendUnpinCodesProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgStoreCodeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendUnpinCodesProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgStoreCodeResponse({ value: MsgStoreCodeResponse.fromPartial(value) }) + let msg = this.unpinCodesProposal({ value: UnpinCodesProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgStoreCodeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendUnpinCodesProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateAdmin({ value, fee, memo }: sendMsgUpdateAdminParams): Promise { + async sendQuerySmartContractStateResponse({ value, fee, memo }: sendQuerySmartContractStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateAdmin: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySmartContractStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateAdmin({ value: MsgUpdateAdmin.fromPartial(value) }) + let msg = this.querySmartContractStateResponse({ value: QuerySmartContractStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateAdmin: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySmartContractStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendInstantiateContract2Proposal({ value, fee, memo }: sendInstantiateContract2ProposalParams): Promise { + async sendQueryCodeRequest({ value, fee, memo }: sendQueryCodeRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendInstantiateContract2Proposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCodeRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.instantiateContract2Proposal({ value: InstantiateContract2Proposal.fromPartial(value) }) + let msg = this.queryCodeRequest({ value: QueryCodeRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendInstantiateContract2Proposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCodeRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryContractsByCreatorResponse({ value, fee, memo }: sendQueryContractsByCreatorResponseParams): Promise { + async sendQueryBuildAddressRequest({ value, fee, memo }: sendQueryBuildAddressRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryContractsByCreatorResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryBuildAddressRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryContractsByCreatorResponse({ value: QueryContractsByCreatorResponse.fromPartial(value) }) + let msg = this.queryBuildAddressRequest({ value: QueryBuildAddressRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryContractsByCreatorResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryBuildAddressRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAddCodeUploadParamsAddresses({ value, fee, memo }: sendMsgAddCodeUploadParamsAddressesParams): Promise { + async sendMsgAddCodeUploadParamsAddressesResponse({ value, fee, memo }: sendMsgAddCodeUploadParamsAddressesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAddCodeUploadParamsAddresses: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAddCodeUploadParamsAddressesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgAddCodeUploadParamsAddresses({ value: MsgAddCodeUploadParamsAddresses.fromPartial(value) }) + let msg = this.msgAddCodeUploadParamsAddressesResponse({ value: MsgAddCodeUploadParamsAddressesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAddCodeUploadParamsAddresses: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAddCodeUploadParamsAddressesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendContractInfo({ value, fee, memo }: sendContractInfoParams): Promise { + async sendPinCodesProposal({ value, fee, memo }: sendPinCodesProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendContractInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPinCodesProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.contractInfo({ value: ContractInfo.fromPartial(value) }) + let msg = this.pinCodesProposal({ value: PinCodesProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendContractInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPinCodesProposal: Could not broadcast Tx: '+ e.message) } }, - async sendStoreCodeProposal({ value, fee, memo }: sendStoreCodeProposalParams): Promise { + async sendMsgIBCSend({ value, fee, memo }: sendMsgIBCSendParams): Promise { if (!signer) { - throw new Error('TxClient:sendStoreCodeProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgIBCSend: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.storeCodeProposal({ value: StoreCodeProposal.fromPartial(value) }) + let msg = this.msgIbcsend({ value: MsgIBCSend.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendStoreCodeProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgIBCSend: Could not broadcast Tx: '+ e.message) } }, - async sendCodeGrant({ value, fee, memo }: sendCodeGrantParams): Promise { + async sendQueryCodesResponse({ value, fee, memo }: sendQueryCodesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendCodeGrant: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCodesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.codeGrant({ value: CodeGrant.fromPartial(value) }) + let msg = this.queryCodesResponse({ value: QueryCodesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCodeGrant: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCodesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateAdminResponse({ value, fee, memo }: sendMsgUpdateAdminResponseParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateAdminResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateAdminResponse({ value: MsgUpdateAdminResponse.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateAdminResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendCombinedLimit({ value, fee, memo }: sendCombinedLimitParams): Promise { + async sendMsgUpdateAdmin({ value, fee, memo }: sendMsgUpdateAdminParams): Promise { if (!signer) { - throw new Error('TxClient:sendCombinedLimit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateAdmin: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.combinedLimit({ value: CombinedLimit.fromPartial(value) }) + let msg = this.msgUpdateAdmin({ value: MsgUpdateAdmin.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCombinedLimit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateAdmin: Could not broadcast Tx: '+ e.message) } }, - async sendMsgStoreAndMigrateContract({ value, fee, memo }: sendMsgStoreAndMigrateContractParams): Promise { + async sendMsgUpdateContractLabel({ value, fee, memo }: sendMsgUpdateContractLabelParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgStoreAndMigrateContract: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateContractLabel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgStoreAndMigrateContract({ value: MsgStoreAndMigrateContract.fromPartial(value) }) + let msg = this.msgUpdateContractLabel({ value: MsgUpdateContractLabel.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgStoreAndMigrateContract: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateContractLabel: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateContractLabel({ value, fee, memo }: sendMsgUpdateContractLabelParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateContractLabel: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateContractLabel({ value: MsgUpdateContractLabel.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateContractLabel: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgIBCSend({ value, fee, memo }: sendMsgIBCSendParams): Promise { + async sendMsgMigrateContractResponse({ value, fee, memo }: sendMsgMigrateContractResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgIBCSend: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgMigrateContractResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgIbcsend({ value: MsgIBCSend.fromPartial(value) }) + let msg = this.msgMigrateContractResponse({ value: MsgMigrateContractResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgIBCSend: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgMigrateContractResponse: Could not broadcast Tx: '+ e.message) } }, - async sendPinCodesProposal({ value, fee, memo }: sendPinCodesProposalParams): Promise { + async sendMsgStoreAndMigrateContract({ value, fee, memo }: sendMsgStoreAndMigrateContractParams): Promise { if (!signer) { - throw new Error('TxClient:sendPinCodesProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgStoreAndMigrateContract: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.pinCodesProposal({ value: PinCodesProposal.fromPartial(value) }) + let msg = this.msgStoreAndMigrateContract({ value: MsgStoreAndMigrateContract.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPinCodesProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgStoreAndMigrateContract: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUnpinCodesResponse({ value, fee, memo }: sendMsgUnpinCodesResponseParams): Promise { + async sendAccessTypeParam({ value, fee, memo }: sendAccessTypeParamParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUnpinCodesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAccessTypeParam: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUnpinCodesResponse({ value: MsgUnpinCodesResponse.fromPartial(value) }) + let msg = this.accessTypeParam({ value: AccessTypeParam.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUnpinCodesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAccessTypeParam: Could not broadcast Tx: '+ e.message) } }, - async sendAcceptedMessagesFilter({ value, fee, memo }: sendAcceptedMessagesFilterParams): Promise { + async sendQueryPinnedCodesResponse({ value, fee, memo }: sendQueryPinnedCodesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendAcceptedMessagesFilter: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPinnedCodesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.acceptedMessagesFilter({ value: AcceptedMessagesFilter.fromPartial(value) }) + let msg = this.queryPinnedCodesResponse({ value: QueryPinnedCodesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAcceptedMessagesFilter: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPinnedCodesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendContract({ value, fee, memo }: sendContractParams): Promise { + async sendMsgStoreAndMigrateContractResponse({ value, fee, memo }: sendMsgStoreAndMigrateContractResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendContract: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgStoreAndMigrateContractResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.contract({ value: Contract.fromPartial(value) }) + let msg = this.msgStoreAndMigrateContractResponse({ value: MsgStoreAndMigrateContractResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendContract: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgStoreAndMigrateContractResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgInstantiateContract2Response({ value, fee, memo }: sendMsgInstantiateContract2ResponseParams): Promise { + async sendModel({ value, fee, memo }: sendModelParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgInstantiateContract2Response: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendModel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgInstantiateContract2Response({ value: MsgInstantiateContract2Response.fromPartial(value) }) + let msg = this.model({ value: Model.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgInstantiateContract2Response: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendModel: Could not broadcast Tx: '+ e.message) } }, - async sendQueryContractInfoRequest({ value, fee, memo }: sendQueryContractInfoRequestParams): Promise { + async sendSudoContractProposal({ value, fee, memo }: sendSudoContractProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryContractInfoRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendSudoContractProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryContractInfoRequest({ value: QueryContractInfoRequest.fromPartial(value) }) + let msg = this.sudoContractProposal({ value: SudoContractProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryContractInfoRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendSudoContractProposal: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllContractStateResponse({ value, fee, memo }: sendQueryAllContractStateResponseParams): Promise { + async sendCodeInfoResponse({ value, fee, memo }: sendCodeInfoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllContractStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCodeInfoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllContractStateResponse({ value: QueryAllContractStateResponse.fromPartial(value) }) + let msg = this.codeInfoResponse({ value: CodeInfoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllContractStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCodeInfoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCodesRequest({ value, fee, memo }: sendQueryCodesRequestParams): Promise { + async sendMsgStoreCode({ value, fee, memo }: sendMsgStoreCodeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCodesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgStoreCode: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCodesRequest({ value: QueryCodesRequest.fromPartial(value) }) + let msg = this.msgStoreCode({ value: MsgStoreCode.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCodesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgStoreCode: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAddCodeUploadParamsAddressesResponse({ value, fee, memo }: sendMsgAddCodeUploadParamsAddressesResponseParams): Promise { + async sendMsgInstantiateContractResponse({ value, fee, memo }: sendMsgInstantiateContractResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAddCodeUploadParamsAddressesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgInstantiateContractResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgAddCodeUploadParamsAddressesResponse({ value: MsgAddCodeUploadParamsAddressesResponse.fromPartial(value) }) + let msg = this.msgInstantiateContractResponse({ value: MsgInstantiateContractResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAddCodeUploadParamsAddressesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgInstantiateContractResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgMigrateContract({ value, fee, memo }: sendMsgMigrateContractParams): Promise { + async sendMsgClearAdminResponse({ value, fee, memo }: sendMsgClearAdminResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgMigrateContract: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgClearAdminResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgMigrateContract({ value: MsgMigrateContract.fromPartial(value) }) + let msg = this.msgClearAdminResponse({ value: MsgClearAdminResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgMigrateContract: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgClearAdminResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgClearAdminResponse({ value, fee, memo }: sendMsgClearAdminResponseParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgClearAdminResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgClearAdminResponse({ value: MsgClearAdminResponse.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgClearAdminResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgStoreAndInstantiateContract({ value, fee, memo }: sendMsgStoreAndInstantiateContractParams): Promise { + async sendMsgSudoContract({ value, fee, memo }: sendMsgSudoContractParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgStoreAndInstantiateContract: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSudoContract: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgStoreAndInstantiateContract({ value: MsgStoreAndInstantiateContract.fromPartial(value) }) + let msg = this.msgSudoContract({ value: MsgSudoContract.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgStoreAndInstantiateContract: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSudoContract: Could not broadcast Tx: '+ e.message) } }, - async sendContractCodeHistoryEntry({ value, fee, memo }: sendContractCodeHistoryEntryParams): Promise { + async sendQueryContractHistoryResponse({ value, fee, memo }: sendQueryContractHistoryResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendContractCodeHistoryEntry: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryContractHistoryResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.contractCodeHistoryEntry({ value: ContractCodeHistoryEntry.fromPartial(value) }) + let msg = this.queryContractHistoryResponse({ value: QueryContractHistoryResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendContractCodeHistoryEntry: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryContractHistoryResponse: Could not broadcast Tx: '+ e.message) } }, - async sendContractExecutionAuthorization({ value, fee, memo }: sendContractExecutionAuthorizationParams): Promise { + async sendMsgExecuteContract({ value, fee, memo }: sendMsgExecuteContractParams): Promise { if (!signer) { - throw new Error('TxClient:sendContractExecutionAuthorization: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgExecuteContract: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.contractExecutionAuthorization({ value: ContractExecutionAuthorization.fromPartial(value) }) + let msg = this.msgExecuteContract({ value: MsgExecuteContract.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendContractExecutionAuthorization: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgExecuteContract: Could not broadcast Tx: '+ e.message) } }, - async sendQueryContractsByCreatorRequest({ value, fee, memo }: sendQueryContractsByCreatorRequestParams): Promise { + async sendMsgSudoContractResponse({ value, fee, memo }: sendMsgSudoContractResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryContractsByCreatorRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSudoContractResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryContractsByCreatorRequest({ value: QueryContractsByCreatorRequest.fromPartial(value) }) + let msg = this.msgSudoContractResponse({ value: MsgSudoContractResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryContractsByCreatorRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSudoContractResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCodeRequest({ value, fee, memo }: sendQueryCodeRequestParams): Promise { + async sendMsgUnpinCodesResponse({ value, fee, memo }: sendMsgUnpinCodesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCodeRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUnpinCodesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCodeRequest({ value: QueryCodeRequest.fromPartial(value) }) + let msg = this.msgUnpinCodesResponse({ value: MsgUnpinCodesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCodeRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUnpinCodesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgClearAdmin({ value, fee, memo }: sendMsgClearAdminParams): Promise { + async sendAbsoluteTxPosition({ value, fee, memo }: sendAbsoluteTxPositionParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgClearAdmin: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAbsoluteTxPosition: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgClearAdmin({ value: MsgClearAdmin.fromPartial(value) }) + let msg = this.absoluteTxPosition({ value: AbsoluteTxPosition.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgClearAdmin: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAbsoluteTxPosition: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRemoveCodeUploadParamsAddressesResponse({ value, fee, memo }: sendMsgRemoveCodeUploadParamsAddressesResponseParams): Promise { + async sendMsgPinCodes({ value, fee, memo }: sendMsgPinCodesParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRemoveCodeUploadParamsAddressesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPinCodes: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRemoveCodeUploadParamsAddressesResponse({ value: MsgRemoveCodeUploadParamsAddressesResponse.fromPartial(value) }) + let msg = this.msgPinCodes({ value: MsgPinCodes.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRemoveCodeUploadParamsAddressesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPinCodes: Could not broadcast Tx: '+ e.message) } }, - async sendSequence({ value, fee, memo }: sendSequenceParams): Promise { + async sendContractExecutionAuthorization({ value, fee, memo }: sendContractExecutionAuthorizationParams): Promise { if (!signer) { - throw new Error('TxClient:sendSequence: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendContractExecutionAuthorization: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.sequence({ value: Sequence.fromPartial(value) }) + let msg = this.contractExecutionAuthorization({ value: ContractExecutionAuthorization.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSequence: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendContractExecutionAuthorization: Could not broadcast Tx: '+ e.message) } }, - async sendMsgStoreAndMigrateContractResponse({ value, fee, memo }: sendMsgStoreAndMigrateContractResponseParams): Promise { + async sendAccessConfigUpdate({ value, fee, memo }: sendAccessConfigUpdateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgStoreAndMigrateContractResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAccessConfigUpdate: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgStoreAndMigrateContractResponse({ value: MsgStoreAndMigrateContractResponse.fromPartial(value) }) + let msg = this.accessConfigUpdate({ value: AccessConfigUpdate.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgStoreAndMigrateContractResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAccessConfigUpdate: Could not broadcast Tx: '+ e.message) } }, - async sendAbsoluteTxPosition({ value, fee, memo }: sendAbsoluteTxPositionParams): Promise { + async sendQueryRawContractStateResponse({ value, fee, memo }: sendQueryRawContractStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendAbsoluteTxPosition: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryRawContractStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.absoluteTxPosition({ value: AbsoluteTxPosition.fromPartial(value) }) + let msg = this.queryRawContractStateResponse({ value: QueryRawContractStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAbsoluteTxPosition: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryRawContractStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgMigrateContractResponse({ value, fee, memo }: sendMsgMigrateContractResponseParams): Promise { + async sendContractGrant({ value, fee, memo }: sendContractGrantParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgMigrateContractResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendContractGrant: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgMigrateContractResponse({ value: MsgMigrateContractResponse.fromPartial(value) }) + let msg = this.contractGrant({ value: ContractGrant.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgMigrateContractResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendContractGrant: Could not broadcast Tx: '+ e.message) } }, - async sendContractMigrationAuthorization({ value, fee, memo }: sendContractMigrationAuthorizationParams): Promise { + async sendCombinedLimit({ value, fee, memo }: sendCombinedLimitParams): Promise { if (!signer) { - throw new Error('TxClient:sendContractMigrationAuthorization: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCombinedLimit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.contractMigrationAuthorization({ value: ContractMigrationAuthorization.fromPartial(value) }) + let msg = this.combinedLimit({ value: CombinedLimit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendContractMigrationAuthorization: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCombinedLimit: Could not broadcast Tx: '+ e.message) } }, - async sendCode({ value, fee, memo }: sendCodeParams): Promise { + async sendAcceptedMessagesFilter({ value, fee, memo }: sendAcceptedMessagesFilterParams): Promise { if (!signer) { - throw new Error('TxClient:sendCode: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAcceptedMessagesFilter: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.code({ value: Code.fromPartial(value) }) + let msg = this.acceptedMessagesFilter({ value: AcceptedMessagesFilter.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCode: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAcceptedMessagesFilter: Could not broadcast Tx: '+ e.message) } }, - async sendQueryContractInfoResponse({ value, fee, memo }: sendQueryContractInfoResponseParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryContractInfoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryContractInfoResponse({ value: QueryContractInfoResponse.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryContractInfoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryContractHistoryResponse({ value, fee, memo }: sendQueryContractHistoryResponseParams): Promise { + async sendMsgExecuteContractResponse({ value, fee, memo }: sendMsgExecuteContractResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryContractHistoryResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgExecuteContractResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryContractHistoryResponse({ value: QueryContractHistoryResponse.fromPartial(value) }) + let msg = this.msgExecuteContractResponse({ value: MsgExecuteContractResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryContractHistoryResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgExecuteContractResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgExecuteContract({ value, fee, memo }: sendMsgExecuteContractParams): Promise { + async sendMsgInstantiateContract2Response({ value, fee, memo }: sendMsgInstantiateContract2ResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgExecuteContract: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgInstantiateContract2Response: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgExecuteContract({ value: MsgExecuteContract.fromPartial(value) }) + let msg = this.msgInstantiateContract2Response({ value: MsgInstantiateContract2Response.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgExecuteContract: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgInstantiateContract2Response: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUnpinCodes({ value, fee, memo }: sendMsgUnpinCodesParams): Promise { + async sendMsgUpdateInstantiateConfig({ value, fee, memo }: sendMsgUpdateInstantiateConfigParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUnpinCodes: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateInstantiateConfig: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUnpinCodes({ value: MsgUnpinCodes.fromPartial(value) }) + let msg = this.msgUpdateInstantiateConfig({ value: MsgUpdateInstantiateConfig.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUnpinCodes: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateInstantiateConfig: Could not broadcast Tx: '+ e.message) } }, - async sendMsgStoreAndInstantiateContractResponse({ value, fee, memo }: sendMsgStoreAndInstantiateContractResponseParams): Promise { + async sendContractMigrationAuthorization({ value, fee, memo }: sendContractMigrationAuthorizationParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgStoreAndInstantiateContractResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendContractMigrationAuthorization: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgStoreAndInstantiateContractResponse({ value: MsgStoreAndInstantiateContractResponse.fromPartial(value) }) + let msg = this.contractMigrationAuthorization({ value: ContractMigrationAuthorization.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgStoreAndInstantiateContractResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendContractMigrationAuthorization: Could not broadcast Tx: '+ e.message) } }, - async sendStoreCodeAuthorization({ value, fee, memo }: sendStoreCodeAuthorizationParams): Promise { + async sendContract({ value, fee, memo }: sendContractParams): Promise { if (!signer) { - throw new Error('TxClient:sendStoreCodeAuthorization: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendContract: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.storeCodeAuthorization({ value: StoreCodeAuthorization.fromPartial(value) }) + let msg = this.contract({ value: Contract.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendStoreCodeAuthorization: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendContract: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCodeResponse({ value, fee, memo }: sendQueryCodeResponseParams): Promise { + async sendInstantiateContract2Proposal({ value, fee, memo }: sendInstantiateContract2ProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCodeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendInstantiateContract2Proposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCodeResponse({ value: QueryCodeResponse.fromPartial(value) }) + let msg = this.instantiateContract2Proposal({ value: InstantiateContract2Proposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCodeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendInstantiateContract2Proposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgInstantiateContract({ value, fee, memo }: sendMsgInstantiateContractParams): Promise { + async sendQueryCodesRequest({ value, fee, memo }: sendQueryCodesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgInstantiateContract: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCodesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgInstantiateContract({ value: MsgInstantiateContract.fromPartial(value) }) + let msg = this.queryCodesRequest({ value: QueryCodesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgInstantiateContract: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCodesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgStoreCode({ value, fee, memo }: sendMsgStoreCodeParams): Promise { + async sendQueryAllContractStateResponse({ value, fee, memo }: sendQueryAllContractStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgStoreCode: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllContractStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgStoreCode({ value: MsgStoreCode.fromPartial(value) }) + let msg = this.queryAllContractStateResponse({ value: QueryAllContractStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgStoreCode: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllContractStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendUpdateInstantiateConfigProposal({ value, fee, memo }: sendUpdateInstantiateConfigProposalParams): Promise { + async sendMsgRemoveCodeUploadParamsAddressesResponse({ value, fee, memo }: sendMsgRemoveCodeUploadParamsAddressesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendUpdateInstantiateConfigProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRemoveCodeUploadParamsAddressesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.updateInstantiateConfigProposal({ value: UpdateInstantiateConfigProposal.fromPartial(value) }) + let msg = this.msgRemoveCodeUploadParamsAddressesResponse({ value: MsgRemoveCodeUploadParamsAddressesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendUpdateInstantiateConfigProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRemoveCodeUploadParamsAddressesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAccessConfigUpdate({ value, fee, memo }: sendAccessConfigUpdateParams): Promise { + async sendCodeInfo({ value, fee, memo }: sendCodeInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendAccessConfigUpdate: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCodeInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.accessConfigUpdate({ value: AccessConfigUpdate.fromPartial(value) }) + let msg = this.codeInfo({ value: CodeInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAccessConfigUpdate: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCodeInfo: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPinnedCodesRequest({ value, fee, memo }: sendQueryPinnedCodesRequestParams): Promise { + async sendMsgIBCCloseChannel({ value, fee, memo }: sendMsgIBCCloseChannelParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPinnedCodesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgIBCCloseChannel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPinnedCodesRequest({ value: QueryPinnedCodesRequest.fromPartial(value) }) + let msg = this.msgIbccloseChannel({ value: MsgIBCCloseChannel.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPinnedCodesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgIBCCloseChannel: Could not broadcast Tx: '+ e.message) } }, - async sendAllowAllMessagesFilter({ value, fee, memo }: sendAllowAllMessagesFilterParams): Promise { + async sendMsgUnpinCodes({ value, fee, memo }: sendMsgUnpinCodesParams): Promise { if (!signer) { - throw new Error('TxClient:sendAllowAllMessagesFilter: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUnpinCodes: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.allowAllMessagesFilter({ value: AllowAllMessagesFilter.fromPartial(value) }) + let msg = this.msgUnpinCodes({ value: MsgUnpinCodes.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAllowAllMessagesFilter: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUnpinCodes: Could not broadcast Tx: '+ e.message) } }, - async sendMsgInstantiateContractResponse({ value, fee, memo }: sendMsgInstantiateContractResponseParams): Promise { + async sendCodeGrant({ value, fee, memo }: sendCodeGrantParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgInstantiateContractResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCodeGrant: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgInstantiateContractResponse({ value: MsgInstantiateContractResponse.fromPartial(value) }) + let msg = this.codeGrant({ value: CodeGrant.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgInstantiateContractResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCodeGrant: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateInstantiateConfigResponse({ value, fee, memo }: sendMsgUpdateInstantiateConfigResponseParams): Promise { + async sendInstantiateContractProposal({ value, fee, memo }: sendInstantiateContractProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateInstantiateConfigResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendInstantiateContractProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateInstantiateConfigResponse({ value: MsgUpdateInstantiateConfigResponse.fromPartial(value) }) + let msg = this.instantiateContractProposal({ value: InstantiateContractProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateInstantiateConfigResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendInstantiateContractProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSudoContractResponse({ value, fee, memo }: sendMsgSudoContractResponseParams): Promise { + async sendMigrateContractProposal({ value, fee, memo }: sendMigrateContractProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSudoContractResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMigrateContractProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSudoContractResponse({ value: MsgSudoContractResponse.fromPartial(value) }) + let msg = this.migrateContractProposal({ value: MigrateContractProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSudoContractResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMigrateContractProposal: Could not broadcast Tx: '+ e.message) } }, - async sendStoreAndInstantiateContractProposal({ value, fee, memo }: sendStoreAndInstantiateContractProposalParams): Promise { + async sendMsgInstantiateContract2({ value, fee, memo }: sendMsgInstantiateContract2Params): Promise { if (!signer) { - throw new Error('TxClient:sendStoreAndInstantiateContractProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgInstantiateContract2: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.storeAndInstantiateContractProposal({ value: StoreAndInstantiateContractProposal.fromPartial(value) }) + let msg = this.msgInstantiateContract2({ value: MsgInstantiateContract2.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendStoreAndInstantiateContractProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgInstantiateContract2: Could not broadcast Tx: '+ e.message) } }, - async sendExecuteContractProposal({ value, fee, memo }: sendExecuteContractProposalParams): Promise { + async sendMsgAddCodeUploadParamsAddresses({ value, fee, memo }: sendMsgAddCodeUploadParamsAddressesParams): Promise { if (!signer) { - throw new Error('TxClient:sendExecuteContractProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAddCodeUploadParamsAddresses: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.executeContractProposal({ value: ExecuteContractProposal.fromPartial(value) }) + let msg = this.msgAddCodeUploadParamsAddresses({ value: MsgAddCodeUploadParamsAddresses.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendExecuteContractProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAddCodeUploadParamsAddresses: Could not broadcast Tx: '+ e.message) } }, - async sendContractGrant({ value, fee, memo }: sendContractGrantParams): Promise { + async sendQueryContractInfoResponse({ value, fee, memo }: sendQueryContractInfoResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendContractGrant: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryContractInfoResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.contractGrant({ value: ContractGrant.fromPartial(value) }) + let msg = this.queryContractInfoResponse({ value: QueryContractInfoResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendContractGrant: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryContractInfoResponse: Could not broadcast Tx: '+ e.message) } }, - async sendSudoContractProposal({ value, fee, memo }: sendSudoContractProposalParams): Promise { + async sendQuerySmartContractStateRequest({ value, fee, memo }: sendQuerySmartContractStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendSudoContractProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQuerySmartContractStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.sudoContractProposal({ value: SudoContractProposal.fromPartial(value) }) + let msg = this.querySmartContractStateRequest({ value: QuerySmartContractStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendSudoContractProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQuerySmartContractStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendClearAdminProposal({ value, fee, memo }: sendClearAdminProposalParams): Promise { + async sendMsgClearAdmin({ value, fee, memo }: sendMsgClearAdminParams): Promise { if (!signer) { - throw new Error('TxClient:sendClearAdminProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgClearAdmin: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.clearAdminProposal({ value: ClearAdminProposal.fromPartial(value) }) + let msg = this.msgClearAdmin({ value: MsgClearAdmin.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendClearAdminProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgClearAdmin: Could not broadcast Tx: '+ e.message) } }, - async sendUnpinCodesProposal({ value, fee, memo }: sendUnpinCodesProposalParams): Promise { + async sendUpdateAdminProposal({ value, fee, memo }: sendUpdateAdminProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendUnpinCodesProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendUpdateAdminProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.unpinCodesProposal({ value: UnpinCodesProposal.fromPartial(value) }) + let msg = this.updateAdminProposal({ value: UpdateAdminProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendUnpinCodesProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendUpdateAdminProposal: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySmartContractStateResponse({ value, fee, memo }: sendQuerySmartContractStateResponseParams): Promise { + async sendMaxCallsLimit({ value, fee, memo }: sendMaxCallsLimitParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySmartContractStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMaxCallsLimit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySmartContractStateResponse({ value: QuerySmartContractStateResponse.fromPartial(value) }) + let msg = this.maxCallsLimit({ value: MaxCallsLimit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySmartContractStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMaxCallsLimit: Could not broadcast Tx: '+ e.message) } }, - async sendCodeInfoResponse({ value, fee, memo }: sendCodeInfoResponseParams): Promise { + async sendMaxFundsLimit({ value, fee, memo }: sendMaxFundsLimitParams): Promise { if (!signer) { - throw new Error('TxClient:sendCodeInfoResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMaxFundsLimit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.codeInfoResponse({ value: CodeInfoResponse.fromPartial(value) }) + let msg = this.maxFundsLimit({ value: MaxFundsLimit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCodeInfoResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMaxFundsLimit: Could not broadcast Tx: '+ e.message) } }, - async sendAccessConfig({ value, fee, memo }: sendAccessConfigParams): Promise { + async sendMsgStoreAndInstantiateContractResponse({ value, fee, memo }: sendMsgStoreAndInstantiateContractResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendAccessConfig: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgStoreAndInstantiateContractResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.accessConfig({ value: AccessConfig.fromPartial(value) }) + let msg = this.msgStoreAndInstantiateContractResponse({ value: MsgStoreAndInstantiateContractResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAccessConfig: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgStoreAndInstantiateContractResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendQueryContractsByCodeRequest({ value, fee, memo }: sendQueryContractsByCodeRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryContractsByCodeRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.queryContractsByCodeRequest({ value: QueryContractsByCodeRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryContractsByCodeRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMigrateContractProposal({ value, fee, memo }: sendMigrateContractProposalParams): Promise { + async sendMsgStoreCodeResponse({ value, fee, memo }: sendMsgStoreCodeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMigrateContractProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgStoreCodeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.migrateContractProposal({ value: MigrateContractProposal.fromPartial(value) }) + let msg = this.msgStoreCodeResponse({ value: MsgStoreCodeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMigrateContractProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgStoreCodeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendAcceptedMessageKeysFilter({ value, fee, memo }: sendAcceptedMessageKeysFilterParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAcceptedMessageKeysFilter: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.acceptedMessageKeysFilter({ value: AcceptedMessageKeysFilter.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAcceptedMessageKeysFilter: Could not broadcast Tx: '+ e.message) } }, - async sendQueryRawContractStateRequest({ value, fee, memo }: sendQueryRawContractStateRequestParams): Promise { + async sendQueryContractsByCreatorRequest({ value, fee, memo }: sendQueryContractsByCreatorRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryRawContractStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryContractsByCreatorRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryRawContractStateRequest({ value: QueryRawContractStateRequest.fromPartial(value) }) + let msg = this.queryContractsByCreatorRequest({ value: QueryContractsByCreatorRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryRawContractStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryContractsByCreatorRequest: Could not broadcast Tx: '+ e.message) } }, @@ -2421,370 +2407,368 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendInstantiateContractProposal({ value, fee, memo }: sendInstantiateContractProposalParams): Promise { + async sendQueryAllContractStateRequest({ value, fee, memo }: sendQueryAllContractStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendInstantiateContractProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAllContractStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.instantiateContractProposal({ value: InstantiateContractProposal.fromPartial(value) }) + let msg = this.queryAllContractStateRequest({ value: QueryAllContractStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendInstantiateContractProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAllContractStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendUpdateAdminProposal({ value, fee, memo }: sendUpdateAdminProposalParams): Promise { + async sendMsgUpdateAdminResponse({ value, fee, memo }: sendMsgUpdateAdminResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendUpdateAdminProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateAdminResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.updateAdminProposal({ value: UpdateAdminProposal.fromPartial(value) }) + let msg = this.msgUpdateAdminResponse({ value: MsgUpdateAdminResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendUpdateAdminProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateAdminResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQuerySmartContractStateRequest({ value, fee, memo }: sendQuerySmartContractStateRequestParams): Promise { + async sendMsgPinCodesResponse({ value, fee, memo }: sendMsgPinCodesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQuerySmartContractStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPinCodesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.querySmartContractStateRequest({ value: QuerySmartContractStateRequest.fromPartial(value) }) + let msg = this.msgPinCodesResponse({ value: MsgPinCodesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQuerySmartContractStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPinCodesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPinnedCodesResponse({ value, fee, memo }: sendQueryPinnedCodesResponseParams): Promise { + async sendMsgIBCSendResponse({ value, fee, memo }: sendMsgIBCSendResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPinnedCodesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgIBCSendResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPinnedCodesResponse({ value: QueryPinnedCodesResponse.fromPartial(value) }) + let msg = this.msgIbcsendResponse({ value: MsgIBCSendResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPinnedCodesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgIBCSendResponse: Could not broadcast Tx: '+ e.message) } }, - - msgInstantiateContract2({ value }: msgInstantiateContract2Params): EncodeObject { - try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2", value: MsgInstantiateContract2.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgInstantiateContract2: Could not create message: ' + e.message) + async sendSequence({ value, fee, memo }: sendSequenceParams): Promise { + if (!signer) { + throw new Error('TxClient:sendSequence: Unable to sign Tx. Signer is not present.') } - }, - - codeInfo({ value }: codeInfoParams): EncodeObject { - try { - return { typeUrl: "/cosmwasm.wasm.v1.CodeInfo", value: CodeInfo.fromPartial( value ) } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.sequence({ value: Sequence.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:CodeInfo: Could not create message: ' + e.message) + throw new Error('TxClient:sendSequence: Could not broadcast Tx: '+ e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + + queryPinnedCodesRequest({ value }: queryPinnedCodesRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", value: QueryPinnedCodesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPinnedCodesRequest: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + queryContractsByCreatorResponse({ value }: queryContractsByCreatorResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorResponse", value: QueryContractsByCreatorResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryContractsByCreatorResponse: Could not create message: ' + e.message) } }, - queryContractsByCodeRequest({ value }: queryContractsByCodeRequestParams): EncodeObject { + queryContractHistoryRequest({ value }: queryContractHistoryRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", value: QueryContractsByCodeRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", value: QueryContractHistoryRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryContractsByCodeRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryContractHistoryRequest: Could not create message: ' + e.message) } }, - queryContractsByCodeResponse({ value }: queryContractsByCodeResponseParams): EncodeObject { + accessConfig({ value }: accessConfigParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", value: QueryContractsByCodeResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.AccessConfig", value: AccessConfig.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryContractsByCodeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:AccessConfig: Could not create message: ' + e.message) } }, - msgRemoveCodeUploadParamsAddresses({ value }: msgRemoveCodeUploadParamsAddressesParams): EncodeObject { + updateInstantiateConfigProposal({ value }: updateInstantiateConfigProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", value: MsgRemoveCodeUploadParamsAddresses.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", value: UpdateInstantiateConfigProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRemoveCodeUploadParamsAddresses: Could not create message: ' + e.message) + throw new Error('TxClient:UpdateInstantiateConfigProposal: Could not create message: ' + e.message) } }, - acceptedMessageKeysFilter({ value }: acceptedMessageKeysFilterParams): EncodeObject { + msgUpdateInstantiateConfigResponse({ value }: msgUpdateInstantiateConfigResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", value: AcceptedMessageKeysFilter.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse", value: MsgUpdateInstantiateConfigResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AcceptedMessageKeysFilter: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateInstantiateConfigResponse: Could not create message: ' + e.message) } }, - queryRawContractStateResponse({ value }: queryRawContractStateResponseParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", value: QueryRawContractStateResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryRawContractStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - accessTypeParam({ value }: accessTypeParamParams): EncodeObject { + executeContractProposal({ value }: executeContractProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", value: AccessTypeParam.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", value: ExecuteContractProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AccessTypeParam: Could not create message: ' + e.message) + throw new Error('TxClient:ExecuteContractProposal: Could not create message: ' + e.message) } }, - model({ value }: modelParams): EncodeObject { + queryContractsByCodeResponse({ value }: queryContractsByCodeResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.Model", value: Model.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", value: QueryContractsByCodeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Model: Could not create message: ' + e.message) + throw new Error('TxClient:QueryContractsByCodeResponse: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + queryCodeResponse({ value }: queryCodeResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", value: QueryCodeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCodeResponse: Could not create message: ' + e.message) } }, - msgExecuteContractResponse({ value }: msgExecuteContractResponseParams): EncodeObject { + contractCodeHistoryEntry({ value }: contractCodeHistoryEntryParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", value: MsgExecuteContractResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", value: ContractCodeHistoryEntry.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgExecuteContractResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ContractCodeHistoryEntry: Could not create message: ' + e.message) } }, - msgUpdateInstantiateConfig({ value }: msgUpdateInstantiateConfigParams): EncodeObject { + allowAllMessagesFilter({ value }: allowAllMessagesFilterParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", value: MsgUpdateInstantiateConfig.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter", value: AllowAllMessagesFilter.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateInstantiateConfig: Could not create message: ' + e.message) + throw new Error('TxClient:AllowAllMessagesFilter: Could not create message: ' + e.message) } }, - msgSudoContract({ value }: msgSudoContractParams): EncodeObject { + msgUpdateContractLabelResponse({ value }: msgUpdateContractLabelResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract", value: MsgSudoContract.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse", value: MsgUpdateContractLabelResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSudoContract: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateContractLabelResponse: Could not create message: ' + e.message) } }, - msgPinCodes({ value }: msgPinCodesParams): EncodeObject { + storeCodeProposal({ value }: storeCodeProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes", value: MsgPinCodes.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", value: StoreCodeProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPinCodes: Could not create message: ' + e.message) + throw new Error('TxClient:StoreCodeProposal: Could not create message: ' + e.message) } }, - queryAllContractStateRequest({ value }: queryAllContractStateRequestParams): EncodeObject { + queryContractInfoRequest({ value }: queryContractInfoRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", value: QueryAllContractStateRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", value: QueryContractInfoRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllContractStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryContractInfoRequest: Could not create message: ' + e.message) } }, - msgIbcsendResponse({ value }: msgIbcsendResponseParams): EncodeObject { + msgInstantiateContract({ value }: msgInstantiateContractParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSendResponse", value: MsgIBCSendResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", value: MsgInstantiateContract.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgIBCSendResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgInstantiateContract: Could not create message: ' + e.message) } }, - maxFundsLimit({ value }: maxFundsLimitParams): EncodeObject { + contractInfo({ value }: contractInfoParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit", value: MaxFundsLimit.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.ContractInfo", value: ContractInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MaxFundsLimit: Could not create message: ' + e.message) + throw new Error('TxClient:ContractInfo: Could not create message: ' + e.message) } }, - queryContractHistoryRequest({ value }: queryContractHistoryRequestParams): EncodeObject { + storeCodeAuthorization({ value }: storeCodeAuthorizationParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", value: QueryContractHistoryRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.StoreCodeAuthorization", value: StoreCodeAuthorization.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryContractHistoryRequest: Could not create message: ' + e.message) + throw new Error('TxClient:StoreCodeAuthorization: Could not create message: ' + e.message) } }, - msgPinCodesResponse({ value }: msgPinCodesResponseParams): EncodeObject { + msgRemoveCodeUploadParamsAddresses({ value }: msgRemoveCodeUploadParamsAddressesParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgPinCodesResponse", value: MsgPinCodesResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", value: MsgRemoveCodeUploadParamsAddresses.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPinCodesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRemoveCodeUploadParamsAddresses: Could not create message: ' + e.message) } }, - msgIbccloseChannel({ value }: msgIbccloseChannelParams): EncodeObject { + clearAdminProposal({ value }: clearAdminProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", value: MsgIBCCloseChannel.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", value: ClearAdminProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgIBCCloseChannel: Could not create message: ' + e.message) + throw new Error('TxClient:ClearAdminProposal: Could not create message: ' + e.message) } }, - maxCallsLimit({ value }: maxCallsLimitParams): EncodeObject { + code({ value }: codeParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit", value: MaxCallsLimit.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.Code", value: Code.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MaxCallsLimit: Could not create message: ' + e.message) + throw new Error('TxClient:Code: Could not create message: ' + e.message) } }, - queryBuildAddressRequest({ value }: queryBuildAddressRequestParams): EncodeObject { + queryRawContractStateRequest({ value }: queryRawContractStateRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryBuildAddressRequest", value: QueryBuildAddressRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", value: QueryRawContractStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryBuildAddressRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryRawContractStateRequest: Could not create message: ' + e.message) } }, - msgUpdateContractLabelResponse({ value }: msgUpdateContractLabelResponseParams): EncodeObject { + msgMigrateContract({ value }: msgMigrateContractParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse", value: MsgUpdateContractLabelResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", value: MsgMigrateContract.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateContractLabelResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgMigrateContract: Could not create message: ' + e.message) } }, - queryCodesResponse({ value }: queryCodesResponseParams): EncodeObject { + msgStoreAndInstantiateContract({ value }: msgStoreAndInstantiateContractParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", value: QueryCodesResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", value: MsgStoreAndInstantiateContract.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCodesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgStoreAndInstantiateContract: Could not create message: ' + e.message) } }, - msgStoreCodeResponse({ value }: msgStoreCodeResponseParams): EncodeObject { + storeAndInstantiateContractProposal({ value }: storeAndInstantiateContractProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", value: MsgStoreCodeResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", value: StoreAndInstantiateContractProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgStoreCodeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:StoreAndInstantiateContractProposal: Could not create message: ' + e.message) } }, - msgUpdateAdmin({ value }: msgUpdateAdminParams): EncodeObject { + unpinCodesProposal({ value }: unpinCodesProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", value: MsgUpdateAdmin.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", value: UnpinCodesProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateAdmin: Could not create message: ' + e.message) + throw new Error('TxClient:UnpinCodesProposal: Could not create message: ' + e.message) } }, - instantiateContract2Proposal({ value }: instantiateContract2ProposalParams): EncodeObject { + querySmartContractStateResponse({ value }: querySmartContractStateResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.InstantiateContract2Proposal", value: InstantiateContract2Proposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", value: QuerySmartContractStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:InstantiateContract2Proposal: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySmartContractStateResponse: Could not create message: ' + e.message) } }, - queryContractsByCreatorResponse({ value }: queryContractsByCreatorResponseParams): EncodeObject { + queryCodeRequest({ value }: queryCodeRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorResponse", value: QueryContractsByCreatorResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", value: QueryCodeRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryContractsByCreatorResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCodeRequest: Could not create message: ' + e.message) } }, - msgAddCodeUploadParamsAddresses({ value }: msgAddCodeUploadParamsAddressesParams): EncodeObject { + queryBuildAddressRequest({ value }: queryBuildAddressRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", value: MsgAddCodeUploadParamsAddresses.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryBuildAddressRequest", value: QueryBuildAddressRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAddCodeUploadParamsAddresses: Could not create message: ' + e.message) + throw new Error('TxClient:QueryBuildAddressRequest: Could not create message: ' + e.message) } }, - contractInfo({ value }: contractInfoParams): EncodeObject { + msgAddCodeUploadParamsAddressesResponse({ value }: msgAddCodeUploadParamsAddressesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.ContractInfo", value: ContractInfo.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse", value: MsgAddCodeUploadParamsAddressesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ContractInfo: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAddCodeUploadParamsAddressesResponse: Could not create message: ' + e.message) } }, - storeCodeProposal({ value }: storeCodeProposalParams): EncodeObject { + pinCodesProposal({ value }: pinCodesProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", value: StoreCodeProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", value: PinCodesProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:StoreCodeProposal: Could not create message: ' + e.message) + throw new Error('TxClient:PinCodesProposal: Could not create message: ' + e.message) } }, - codeGrant({ value }: codeGrantParams): EncodeObject { + msgIbcsend({ value }: msgIbcsendParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.CodeGrant", value: CodeGrant.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", value: MsgIBCSend.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:CodeGrant: Could not create message: ' + e.message) + throw new Error('TxClient:MsgIBCSend: Could not create message: ' + e.message) } }, - msgUpdateAdminResponse({ value }: msgUpdateAdminResponseParams): EncodeObject { + queryCodesResponse({ value }: queryCodesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", value: MsgUpdateAdminResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", value: QueryCodesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateAdminResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCodesResponse: Could not create message: ' + e.message) } }, - combinedLimit({ value }: combinedLimitParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.CombinedLimit", value: CombinedLimit.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:CombinedLimit: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - msgStoreAndMigrateContract({ value }: msgStoreAndMigrateContractParams): EncodeObject { + msgUpdateAdmin({ value }: msgUpdateAdminParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", value: MsgStoreAndMigrateContract.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", value: MsgUpdateAdmin.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgStoreAndMigrateContract: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateAdmin: Could not create message: ' + e.message) } }, @@ -2796,91 +2780,91 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgIbcsend({ value }: msgIbcsendParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", value: MsgIBCSend.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgIBCSend: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - pinCodesProposal({ value }: pinCodesProposalParams): EncodeObject { + msgMigrateContractResponse({ value }: msgMigrateContractResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", value: PinCodesProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", value: MsgMigrateContractResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:PinCodesProposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgMigrateContractResponse: Could not create message: ' + e.message) } }, - msgUnpinCodesResponse({ value }: msgUnpinCodesResponseParams): EncodeObject { + msgStoreAndMigrateContract({ value }: msgStoreAndMigrateContractParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodesResponse", value: MsgUnpinCodesResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", value: MsgStoreAndMigrateContract.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUnpinCodesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgStoreAndMigrateContract: Could not create message: ' + e.message) } }, - acceptedMessagesFilter({ value }: acceptedMessagesFilterParams): EncodeObject { + accessTypeParam({ value }: accessTypeParamParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter", value: AcceptedMessagesFilter.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", value: AccessTypeParam.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AcceptedMessagesFilter: Could not create message: ' + e.message) + throw new Error('TxClient:AccessTypeParam: Could not create message: ' + e.message) } }, - contract({ value }: contractParams): EncodeObject { + queryPinnedCodesResponse({ value }: queryPinnedCodesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.Contract", value: Contract.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", value: QueryPinnedCodesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Contract: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPinnedCodesResponse: Could not create message: ' + e.message) } }, - msgInstantiateContract2Response({ value }: msgInstantiateContract2ResponseParams): EncodeObject { + msgStoreAndMigrateContractResponse({ value }: msgStoreAndMigrateContractResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2Response", value: MsgInstantiateContract2Response.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse", value: MsgStoreAndMigrateContractResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgInstantiateContract2Response: Could not create message: ' + e.message) + throw new Error('TxClient:MsgStoreAndMigrateContractResponse: Could not create message: ' + e.message) } }, - queryContractInfoRequest({ value }: queryContractInfoRequestParams): EncodeObject { + model({ value }: modelParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", value: QueryContractInfoRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.Model", value: Model.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryContractInfoRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Model: Could not create message: ' + e.message) } }, - queryAllContractStateResponse({ value }: queryAllContractStateResponseParams): EncodeObject { + sudoContractProposal({ value }: sudoContractProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", value: QueryAllContractStateResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", value: SudoContractProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllContractStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:SudoContractProposal: Could not create message: ' + e.message) } }, - queryCodesRequest({ value }: queryCodesRequestParams): EncodeObject { + codeInfoResponse({ value }: codeInfoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", value: QueryCodesRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", value: CodeInfoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCodesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:CodeInfoResponse: Could not create message: ' + e.message) } }, - msgAddCodeUploadParamsAddressesResponse({ value }: msgAddCodeUploadParamsAddressesResponseParams): EncodeObject { + msgStoreCode({ value }: msgStoreCodeParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse", value: MsgAddCodeUploadParamsAddressesResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: MsgStoreCode.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAddCodeUploadParamsAddressesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgStoreCode: Could not create message: ' + e.message) } }, - msgMigrateContract({ value }: msgMigrateContractParams): EncodeObject { + msgInstantiateContractResponse({ value }: msgInstantiateContractResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", value: MsgMigrateContract.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", value: MsgInstantiateContractResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgMigrateContract: Could not create message: ' + e.message) + throw new Error('TxClient:MsgInstantiateContractResponse: Could not create message: ' + e.message) } }, @@ -2892,339 +2876,347 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgStoreAndInstantiateContract({ value }: msgStoreAndInstantiateContractParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", value: MsgStoreAndInstantiateContract.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgStoreAndInstantiateContract: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - contractCodeHistoryEntry({ value }: contractCodeHistoryEntryParams): EncodeObject { + msgSudoContract({ value }: msgSudoContractParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", value: ContractCodeHistoryEntry.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract", value: MsgSudoContract.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ContractCodeHistoryEntry: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSudoContract: Could not create message: ' + e.message) } }, - contractExecutionAuthorization({ value }: contractExecutionAuthorizationParams): EncodeObject { + queryContractHistoryResponse({ value }: queryContractHistoryResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization", value: ContractExecutionAuthorization.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", value: QueryContractHistoryResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ContractExecutionAuthorization: Could not create message: ' + e.message) + throw new Error('TxClient:QueryContractHistoryResponse: Could not create message: ' + e.message) } }, - queryContractsByCreatorRequest({ value }: queryContractsByCreatorRequestParams): EncodeObject { + msgExecuteContract({ value }: msgExecuteContractParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorRequest", value: QueryContractsByCreatorRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryContractsByCreatorRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgExecuteContract: Could not create message: ' + e.message) } }, - queryCodeRequest({ value }: queryCodeRequestParams): EncodeObject { + msgSudoContractResponse({ value }: msgSudoContractResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", value: QueryCodeRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgSudoContractResponse", value: MsgSudoContractResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCodeRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSudoContractResponse: Could not create message: ' + e.message) } }, - msgClearAdmin({ value }: msgClearAdminParams): EncodeObject { + msgUnpinCodesResponse({ value }: msgUnpinCodesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", value: MsgClearAdmin.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodesResponse", value: MsgUnpinCodesResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgUnpinCodesResponse: Could not create message: ' + e.message) + } + }, + + absoluteTxPosition({ value }: absoluteTxPositionParams): EncodeObject { + try { + return { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", value: AbsoluteTxPosition.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgClearAdmin: Could not create message: ' + e.message) + throw new Error('TxClient:AbsoluteTxPosition: Could not create message: ' + e.message) } }, - msgRemoveCodeUploadParamsAddressesResponse({ value }: msgRemoveCodeUploadParamsAddressesResponseParams): EncodeObject { + msgPinCodes({ value }: msgPinCodesParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse", value: MsgRemoveCodeUploadParamsAddressesResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes", value: MsgPinCodes.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRemoveCodeUploadParamsAddressesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPinCodes: Could not create message: ' + e.message) } }, - sequence({ value }: sequenceParams): EncodeObject { + contractExecutionAuthorization({ value }: contractExecutionAuthorizationParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.Sequence", value: Sequence.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization", value: ContractExecutionAuthorization.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Sequence: Could not create message: ' + e.message) + throw new Error('TxClient:ContractExecutionAuthorization: Could not create message: ' + e.message) } }, - msgStoreAndMigrateContractResponse({ value }: msgStoreAndMigrateContractResponseParams): EncodeObject { + accessConfigUpdate({ value }: accessConfigUpdateParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse", value: MsgStoreAndMigrateContractResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.AccessConfigUpdate", value: AccessConfigUpdate.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgStoreAndMigrateContractResponse: Could not create message: ' + e.message) + throw new Error('TxClient:AccessConfigUpdate: Could not create message: ' + e.message) } }, - absoluteTxPosition({ value }: absoluteTxPositionParams): EncodeObject { + queryRawContractStateResponse({ value }: queryRawContractStateResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", value: AbsoluteTxPosition.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", value: QueryRawContractStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AbsoluteTxPosition: Could not create message: ' + e.message) + throw new Error('TxClient:QueryRawContractStateResponse: Could not create message: ' + e.message) } }, - msgMigrateContractResponse({ value }: msgMigrateContractResponseParams): EncodeObject { + contractGrant({ value }: contractGrantParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", value: MsgMigrateContractResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.ContractGrant", value: ContractGrant.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgMigrateContractResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ContractGrant: Could not create message: ' + e.message) } }, - contractMigrationAuthorization({ value }: contractMigrationAuthorizationParams): EncodeObject { + combinedLimit({ value }: combinedLimitParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization", value: ContractMigrationAuthorization.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.CombinedLimit", value: CombinedLimit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ContractMigrationAuthorization: Could not create message: ' + e.message) + throw new Error('TxClient:CombinedLimit: Could not create message: ' + e.message) } }, - code({ value }: codeParams): EncodeObject { + acceptedMessagesFilter({ value }: acceptedMessagesFilterParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.Code", value: Code.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter", value: AcceptedMessagesFilter.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Code: Could not create message: ' + e.message) + throw new Error('TxClient:AcceptedMessagesFilter: Could not create message: ' + e.message) } }, - queryContractInfoResponse({ value }: queryContractInfoResponseParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", value: QueryContractInfoResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryContractInfoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - queryContractHistoryResponse({ value }: queryContractHistoryResponseParams): EncodeObject { + msgExecuteContractResponse({ value }: msgExecuteContractResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", value: QueryContractHistoryResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", value: MsgExecuteContractResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryContractHistoryResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgExecuteContractResponse: Could not create message: ' + e.message) } }, - msgExecuteContract({ value }: msgExecuteContractParams): EncodeObject { + msgInstantiateContract2Response({ value }: msgInstantiateContract2ResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2Response", value: MsgInstantiateContract2Response.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgExecuteContract: Could not create message: ' + e.message) + throw new Error('TxClient:MsgInstantiateContract2Response: Could not create message: ' + e.message) } }, - msgUnpinCodes({ value }: msgUnpinCodesParams): EncodeObject { + msgUpdateInstantiateConfig({ value }: msgUpdateInstantiateConfigParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes", value: MsgUnpinCodes.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", value: MsgUpdateInstantiateConfig.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUnpinCodes: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateInstantiateConfig: Could not create message: ' + e.message) } }, - msgStoreAndInstantiateContractResponse({ value }: msgStoreAndInstantiateContractResponseParams): EncodeObject { + contractMigrationAuthorization({ value }: contractMigrationAuthorizationParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse", value: MsgStoreAndInstantiateContractResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization", value: ContractMigrationAuthorization.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgStoreAndInstantiateContractResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ContractMigrationAuthorization: Could not create message: ' + e.message) } }, - storeCodeAuthorization({ value }: storeCodeAuthorizationParams): EncodeObject { + contract({ value }: contractParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.StoreCodeAuthorization", value: StoreCodeAuthorization.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.Contract", value: Contract.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:StoreCodeAuthorization: Could not create message: ' + e.message) + throw new Error('TxClient:Contract: Could not create message: ' + e.message) } }, - queryCodeResponse({ value }: queryCodeResponseParams): EncodeObject { + instantiateContract2Proposal({ value }: instantiateContract2ProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", value: QueryCodeResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.InstantiateContract2Proposal", value: InstantiateContract2Proposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCodeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:InstantiateContract2Proposal: Could not create message: ' + e.message) } }, - msgInstantiateContract({ value }: msgInstantiateContractParams): EncodeObject { + queryCodesRequest({ value }: queryCodesRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", value: MsgInstantiateContract.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", value: QueryCodesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgInstantiateContract: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCodesRequest: Could not create message: ' + e.message) } }, - msgStoreCode({ value }: msgStoreCodeParams): EncodeObject { + queryAllContractStateResponse({ value }: queryAllContractStateResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: MsgStoreCode.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", value: QueryAllContractStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgStoreCode: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAllContractStateResponse: Could not create message: ' + e.message) } }, - updateInstantiateConfigProposal({ value }: updateInstantiateConfigProposalParams): EncodeObject { + msgRemoveCodeUploadParamsAddressesResponse({ value }: msgRemoveCodeUploadParamsAddressesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", value: UpdateInstantiateConfigProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse", value: MsgRemoveCodeUploadParamsAddressesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:UpdateInstantiateConfigProposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRemoveCodeUploadParamsAddressesResponse: Could not create message: ' + e.message) } }, - accessConfigUpdate({ value }: accessConfigUpdateParams): EncodeObject { + codeInfo({ value }: codeInfoParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.AccessConfigUpdate", value: AccessConfigUpdate.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.CodeInfo", value: CodeInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AccessConfigUpdate: Could not create message: ' + e.message) + throw new Error('TxClient:CodeInfo: Could not create message: ' + e.message) } }, - queryPinnedCodesRequest({ value }: queryPinnedCodesRequestParams): EncodeObject { + msgIbccloseChannel({ value }: msgIbccloseChannelParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", value: QueryPinnedCodesRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", value: MsgIBCCloseChannel.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPinnedCodesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgIBCCloseChannel: Could not create message: ' + e.message) } }, - allowAllMessagesFilter({ value }: allowAllMessagesFilterParams): EncodeObject { + msgUnpinCodes({ value }: msgUnpinCodesParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter", value: AllowAllMessagesFilter.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes", value: MsgUnpinCodes.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AllowAllMessagesFilter: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUnpinCodes: Could not create message: ' + e.message) } }, - msgInstantiateContractResponse({ value }: msgInstantiateContractResponseParams): EncodeObject { + codeGrant({ value }: codeGrantParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", value: MsgInstantiateContractResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.CodeGrant", value: CodeGrant.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgInstantiateContractResponse: Could not create message: ' + e.message) + throw new Error('TxClient:CodeGrant: Could not create message: ' + e.message) } }, - msgUpdateInstantiateConfigResponse({ value }: msgUpdateInstantiateConfigResponseParams): EncodeObject { + instantiateContractProposal({ value }: instantiateContractProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse", value: MsgUpdateInstantiateConfigResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", value: InstantiateContractProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateInstantiateConfigResponse: Could not create message: ' + e.message) + throw new Error('TxClient:InstantiateContractProposal: Could not create message: ' + e.message) } }, - msgSudoContractResponse({ value }: msgSudoContractResponseParams): EncodeObject { + migrateContractProposal({ value }: migrateContractProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgSudoContractResponse", value: MsgSudoContractResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", value: MigrateContractProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSudoContractResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MigrateContractProposal: Could not create message: ' + e.message) } }, - storeAndInstantiateContractProposal({ value }: storeAndInstantiateContractProposalParams): EncodeObject { + msgInstantiateContract2({ value }: msgInstantiateContract2Params): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", value: StoreAndInstantiateContractProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2", value: MsgInstantiateContract2.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:StoreAndInstantiateContractProposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgInstantiateContract2: Could not create message: ' + e.message) } }, - executeContractProposal({ value }: executeContractProposalParams): EncodeObject { + msgAddCodeUploadParamsAddresses({ value }: msgAddCodeUploadParamsAddressesParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", value: ExecuteContractProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", value: MsgAddCodeUploadParamsAddresses.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ExecuteContractProposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAddCodeUploadParamsAddresses: Could not create message: ' + e.message) } }, - contractGrant({ value }: contractGrantParams): EncodeObject { + queryContractInfoResponse({ value }: queryContractInfoResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.ContractGrant", value: ContractGrant.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", value: QueryContractInfoResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ContractGrant: Could not create message: ' + e.message) + throw new Error('TxClient:QueryContractInfoResponse: Could not create message: ' + e.message) } }, - sudoContractProposal({ value }: sudoContractProposalParams): EncodeObject { + querySmartContractStateRequest({ value }: querySmartContractStateRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", value: SudoContractProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", value: QuerySmartContractStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:SudoContractProposal: Could not create message: ' + e.message) + throw new Error('TxClient:QuerySmartContractStateRequest: Could not create message: ' + e.message) } }, - clearAdminProposal({ value }: clearAdminProposalParams): EncodeObject { + msgClearAdmin({ value }: msgClearAdminParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", value: ClearAdminProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", value: MsgClearAdmin.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ClearAdminProposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgClearAdmin: Could not create message: ' + e.message) } }, - unpinCodesProposal({ value }: unpinCodesProposalParams): EncodeObject { + updateAdminProposal({ value }: updateAdminProposalParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", value: UnpinCodesProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", value: UpdateAdminProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:UnpinCodesProposal: Could not create message: ' + e.message) + throw new Error('TxClient:UpdateAdminProposal: Could not create message: ' + e.message) } }, - querySmartContractStateResponse({ value }: querySmartContractStateResponseParams): EncodeObject { + maxCallsLimit({ value }: maxCallsLimitParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", value: QuerySmartContractStateResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit", value: MaxCallsLimit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySmartContractStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MaxCallsLimit: Could not create message: ' + e.message) } }, - codeInfoResponse({ value }: codeInfoResponseParams): EncodeObject { + maxFundsLimit({ value }: maxFundsLimitParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", value: CodeInfoResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit", value: MaxFundsLimit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:CodeInfoResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MaxFundsLimit: Could not create message: ' + e.message) } }, - accessConfig({ value }: accessConfigParams): EncodeObject { + msgStoreAndInstantiateContractResponse({ value }: msgStoreAndInstantiateContractResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.AccessConfig", value: AccessConfig.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse", value: MsgStoreAndInstantiateContractResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AccessConfig: Could not create message: ' + e.message) + throw new Error('TxClient:MsgStoreAndInstantiateContractResponse: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + queryContractsByCodeRequest({ value }: queryContractsByCodeRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", value: QueryContractsByCodeRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:QueryContractsByCodeRequest: Could not create message: ' + e.message) } }, - migrateContractProposal({ value }: migrateContractProposalParams): EncodeObject { + msgStoreCodeResponse({ value }: msgStoreCodeResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", value: MigrateContractProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", value: MsgStoreCodeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MigrateContractProposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgStoreCodeResponse: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + acceptedMessageKeysFilter({ value }: acceptedMessageKeysFilterParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", value: AcceptedMessageKeysFilter.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:AcceptedMessageKeysFilter: Could not create message: ' + e.message) } }, - queryRawContractStateRequest({ value }: queryRawContractStateRequestParams): EncodeObject { + queryContractsByCreatorRequest({ value }: queryContractsByCreatorRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", value: QueryRawContractStateRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorRequest", value: QueryContractsByCreatorRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryRawContractStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryContractsByCreatorRequest: Could not create message: ' + e.message) } }, @@ -3236,43 +3228,51 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - params({ value }: paramsParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - instantiateContractProposal({ value }: instantiateContractProposalParams): EncodeObject { + queryAllContractStateRequest({ value }: queryAllContractStateRequestParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", value: InstantiateContractProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", value: QueryAllContractStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:InstantiateContractProposal: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAllContractStateRequest: Could not create message: ' + e.message) } }, - updateAdminProposal({ value }: updateAdminProposalParams): EncodeObject { + msgUpdateAdminResponse({ value }: msgUpdateAdminResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", value: UpdateAdminProposal.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", value: MsgUpdateAdminResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:UpdateAdminProposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateAdminResponse: Could not create message: ' + e.message) } }, - querySmartContractStateRequest({ value }: querySmartContractStateRequestParams): EncodeObject { + msgPinCodesResponse({ value }: msgPinCodesResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", value: QuerySmartContractStateRequest.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgPinCodesResponse", value: MsgPinCodesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QuerySmartContractStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPinCodesResponse: Could not create message: ' + e.message) } }, - queryPinnedCodesResponse({ value }: queryPinnedCodesResponseParams): EncodeObject { + msgIbcsendResponse({ value }: msgIbcsendResponseParams): EncodeObject { try { - return { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", value: QueryPinnedCodesResponse.fromPartial( value ) } + return { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSendResponse", value: MsgIBCSendResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPinnedCodesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgIBCSendResponse: Could not create message: ' + e.message) + } + }, + + sequence({ value }: sequenceParams): EncodeObject { + try { + return { typeUrl: "/cosmwasm.wasm.v1.Sequence", value: Sequence.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:Sequence: Could not create message: ' + e.message) } }, diff --git a/ts-client/cosmwasm.wasm.v1/registry.ts b/ts-client/cosmwasm.wasm.v1/registry.ts index 9403e7ba..432bff9f 100755 --- a/ts-client/cosmwasm.wasm.v1/registry.ts +++ b/ts-client/cosmwasm.wasm.v1/registry.ts @@ -1,202 +1,202 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgInstantiateContract2 } from "./types/cosmwasm/wasm/v1/tx"; -import { CodeInfo } from "./types/cosmwasm/wasm/v1/types"; -import { QueryParamsResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgUpdateParamsResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { QueryContractsByCodeRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryContractsByCodeResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgRemoveCodeUploadParamsAddresses } from "./types/cosmwasm/wasm/v1/tx"; -import { AcceptedMessageKeysFilter } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryRawContractStateResponse } from "./types/cosmwasm/wasm/v1/query"; -import { AccessTypeParam } from "./types/cosmwasm/wasm/v1/types"; -import { Model } from "./types/cosmwasm/wasm/v1/types"; -import { QueryParamsRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgExecuteContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUpdateInstantiateConfig } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgSudoContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgPinCodes } from "./types/cosmwasm/wasm/v1/tx"; -import { QueryAllContractStateRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgIBCSendResponse } from "./types/cosmwasm/wasm/v1/ibc"; -import { MaxFundsLimit } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryContractHistoryRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgPinCodesResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgIBCCloseChannel } from "./types/cosmwasm/wasm/v1/ibc"; -import { MaxCallsLimit } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryBuildAddressRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgUpdateContractLabelResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { QueryCodesResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgStoreCodeResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUpdateAdmin } from "./types/cosmwasm/wasm/v1/tx"; -import { InstantiateContract2Proposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { QueryContractsByCreatorResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgAddCodeUploadParamsAddresses } from "./types/cosmwasm/wasm/v1/tx"; -import { ContractInfo } from "./types/cosmwasm/wasm/v1/types"; -import { StoreCodeProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { CodeGrant } from "./types/cosmwasm/wasm/v1/authz"; -import { MsgUpdateAdminResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { CombinedLimit } from "./types/cosmwasm/wasm/v1/authz"; -import { MsgStoreAndMigrateContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUpdateContractLabel } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgIBCSend } from "./types/cosmwasm/wasm/v1/ibc"; -import { PinCodesProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { MsgUnpinCodesResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { AcceptedMessagesFilter } from "./types/cosmwasm/wasm/v1/authz"; -import { Contract } from "./types/cosmwasm/wasm/v1/genesis"; -import { MsgInstantiateContract2Response } from "./types/cosmwasm/wasm/v1/tx"; -import { QueryContractInfoRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryAllContractStateResponse } from "./types/cosmwasm/wasm/v1/query"; -import { QueryCodesRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgAddCodeUploadParamsAddressesResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgMigrateContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgClearAdminResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgStoreAndInstantiateContract } from "./types/cosmwasm/wasm/v1/tx"; -import { ContractCodeHistoryEntry } from "./types/cosmwasm/wasm/v1/types"; -import { ContractExecutionAuthorization } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryContractsByCreatorRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryCodeRequest } from "./types/cosmwasm/wasm/v1/query"; -import { MsgClearAdmin } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgRemoveCodeUploadParamsAddressesResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { Sequence } from "./types/cosmwasm/wasm/v1/genesis"; -import { MsgStoreAndMigrateContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { AbsoluteTxPosition } from "./types/cosmwasm/wasm/v1/types"; -import { MsgMigrateContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { ContractMigrationAuthorization } from "./types/cosmwasm/wasm/v1/authz"; -import { Code } from "./types/cosmwasm/wasm/v1/genesis"; -import { QueryContractInfoResponse } from "./types/cosmwasm/wasm/v1/query"; -import { QueryContractHistoryResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgExecuteContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUnpinCodes } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgStoreAndInstantiateContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { StoreCodeAuthorization } from "./types/cosmwasm/wasm/v1/authz"; -import { QueryCodeResponse } from "./types/cosmwasm/wasm/v1/query"; -import { MsgInstantiateContract } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgStoreCode } from "./types/cosmwasm/wasm/v1/tx"; -import { UpdateInstantiateConfigProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { AccessConfigUpdate } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { QueryPinnedCodesRequest } from "./types/cosmwasm/wasm/v1/query"; -import { AllowAllMessagesFilter } from "./types/cosmwasm/wasm/v1/authz"; -import { MsgInstantiateContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgUpdateInstantiateConfigResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { MsgSudoContractResponse } from "./types/cosmwasm/wasm/v1/tx"; -import { StoreAndInstantiateContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { ExecuteContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { ContractGrant } from "./types/cosmwasm/wasm/v1/authz"; -import { SudoContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { ClearAdminProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { UnpinCodesProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { QuerySmartContractStateResponse } from "./types/cosmwasm/wasm/v1/query"; -import { CodeInfoResponse } from "./types/cosmwasm/wasm/v1/query"; -import { AccessConfig } from "./types/cosmwasm/wasm/v1/types"; -import { MsgUpdateParams } from "./types/cosmwasm/wasm/v1/tx"; -import { MigrateContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { GenesisState } from "./types/cosmwasm/wasm/v1/genesis"; -import { QueryRawContractStateRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryBuildAddressResponse } from "./types/cosmwasm/wasm/v1/query"; -import { Params } from "./types/cosmwasm/wasm/v1/types"; -import { InstantiateContractProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { UpdateAdminProposal } from "./types/cosmwasm/wasm/v1/proposal_legacy"; -import { QuerySmartContractStateRequest } from "./types/cosmwasm/wasm/v1/query"; -import { QueryPinnedCodesResponse } from "./types/cosmwasm/wasm/v1/query"; +import { QueryPinnedCodesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryContractsByCreatorResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryContractHistoryRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { AccessConfig } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { UpdateInstantiateConfigProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MsgUpdateInstantiateConfigResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ExecuteContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QueryContractsByCodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryCodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { ContractCodeHistoryEntry } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { AllowAllMessagesFilter } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { MsgUpdateContractLabelResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { StoreCodeProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QueryContractInfoRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgInstantiateContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ContractInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { StoreCodeAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { MsgRemoveCodeUploadParamsAddresses } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ClearAdminProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { Code } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/genesis"; +import { QueryRawContractStateRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgMigrateContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgStoreAndInstantiateContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { StoreAndInstantiateContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { UnpinCodesProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QuerySmartContractStateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryCodeRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryBuildAddressRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgAddCodeUploadParamsAddressesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { PinCodesProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MsgIBCSend } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/ibc"; +import { QueryCodesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgUpdateAdmin } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUpdateContractLabel } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { MsgMigrateContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgStoreAndMigrateContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { AccessTypeParam } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { QueryPinnedCodesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgStoreAndMigrateContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { Model } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { SudoContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { CodeInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgStoreCode } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgInstantiateContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgClearAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgSudoContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { QueryContractHistoryResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgExecuteContract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgSudoContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUnpinCodesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { AbsoluteTxPosition } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { MsgPinCodes } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ContractExecutionAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { AccessConfigUpdate } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QueryRawContractStateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { ContractGrant } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { CombinedLimit } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { AcceptedMessagesFilter } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgExecuteContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgInstantiateContract2Response } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgUpdateInstantiateConfig } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { ContractMigrationAuthorization } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { Contract } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/genesis"; +import { InstantiateContract2Proposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { QueryCodesRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryAllContractStateResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgRemoveCodeUploadParamsAddressesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { CodeInfo } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/types"; +import { MsgIBCCloseChannel } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/ibc"; +import { MsgUnpinCodes } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { CodeGrant } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { InstantiateContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MigrateContractProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MsgInstantiateContract2 } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgAddCodeUploadParamsAddresses } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { QueryContractInfoResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QuerySmartContractStateRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgClearAdmin } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { UpdateAdminProposal } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/proposal_legacy"; +import { MaxCallsLimit } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { MaxFundsLimit } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { MsgStoreAndInstantiateContractResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { QueryContractsByCodeRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgStoreCodeResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { AcceptedMessageKeysFilter } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/authz"; +import { QueryContractsByCreatorRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { QueryBuildAddressResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/genesis"; +import { QueryAllContractStateRequest } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/query"; +import { MsgUpdateAdminResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgPinCodesResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/tx"; +import { MsgIBCSendResponse } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/ibc"; +import { Sequence } from "./types/../../../../../pkg/mod/github.com/!fairblock/wasmd@v0.50.6-fairyring/proto/cosmwasm/wasm/v1/genesis"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/cosmwasm.wasm.v1.MsgInstantiateContract2", MsgInstantiateContract2], - ["/cosmwasm.wasm.v1.CodeInfo", CodeInfo], - ["/cosmwasm.wasm.v1.QueryParamsResponse", QueryParamsResponse], - ["/cosmwasm.wasm.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/cosmwasm.wasm.v1.QueryContractsByCodeRequest", QueryContractsByCodeRequest], - ["/cosmwasm.wasm.v1.QueryContractsByCodeResponse", QueryContractsByCodeResponse], - ["/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", MsgRemoveCodeUploadParamsAddresses], - ["/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", AcceptedMessageKeysFilter], - ["/cosmwasm.wasm.v1.QueryRawContractStateResponse", QueryRawContractStateResponse], - ["/cosmwasm.wasm.v1.AccessTypeParam", AccessTypeParam], - ["/cosmwasm.wasm.v1.Model", Model], - ["/cosmwasm.wasm.v1.QueryParamsRequest", QueryParamsRequest], - ["/cosmwasm.wasm.v1.MsgExecuteContractResponse", MsgExecuteContractResponse], - ["/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", MsgUpdateInstantiateConfig], - ["/cosmwasm.wasm.v1.MsgSudoContract", MsgSudoContract], - ["/cosmwasm.wasm.v1.MsgPinCodes", MsgPinCodes], - ["/cosmwasm.wasm.v1.QueryAllContractStateRequest", QueryAllContractStateRequest], - ["/cosmwasm.wasm.v1.MsgIBCSendResponse", MsgIBCSendResponse], - ["/cosmwasm.wasm.v1.MaxFundsLimit", MaxFundsLimit], + ["/cosmwasm.wasm.v1.QueryPinnedCodesRequest", QueryPinnedCodesRequest], + ["/cosmwasm.wasm.v1.QueryContractsByCreatorResponse", QueryContractsByCreatorResponse], ["/cosmwasm.wasm.v1.QueryContractHistoryRequest", QueryContractHistoryRequest], - ["/cosmwasm.wasm.v1.MsgPinCodesResponse", MsgPinCodesResponse], - ["/cosmwasm.wasm.v1.MsgIBCCloseChannel", MsgIBCCloseChannel], - ["/cosmwasm.wasm.v1.MaxCallsLimit", MaxCallsLimit], - ["/cosmwasm.wasm.v1.QueryBuildAddressRequest", QueryBuildAddressRequest], + ["/cosmwasm.wasm.v1.AccessConfig", AccessConfig], + ["/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", UpdateInstantiateConfigProposal], + ["/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse", MsgUpdateInstantiateConfigResponse], + ["/cosmwasm.wasm.v1.MsgUpdateParams", MsgUpdateParams], + ["/cosmwasm.wasm.v1.ExecuteContractProposal", ExecuteContractProposal], + ["/cosmwasm.wasm.v1.QueryContractsByCodeResponse", QueryContractsByCodeResponse], + ["/cosmwasm.wasm.v1.QueryCodeResponse", QueryCodeResponse], + ["/cosmwasm.wasm.v1.ContractCodeHistoryEntry", ContractCodeHistoryEntry], + ["/cosmwasm.wasm.v1.AllowAllMessagesFilter", AllowAllMessagesFilter], ["/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse", MsgUpdateContractLabelResponse], - ["/cosmwasm.wasm.v1.QueryCodesResponse", QueryCodesResponse], - ["/cosmwasm.wasm.v1.MsgStoreCodeResponse", MsgStoreCodeResponse], - ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], - ["/cosmwasm.wasm.v1.InstantiateContract2Proposal", InstantiateContract2Proposal], - ["/cosmwasm.wasm.v1.QueryContractsByCreatorResponse", QueryContractsByCreatorResponse], - ["/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", MsgAddCodeUploadParamsAddresses], - ["/cosmwasm.wasm.v1.ContractInfo", ContractInfo], ["/cosmwasm.wasm.v1.StoreCodeProposal", StoreCodeProposal], - ["/cosmwasm.wasm.v1.CodeGrant", CodeGrant], - ["/cosmwasm.wasm.v1.MsgUpdateAdminResponse", MsgUpdateAdminResponse], - ["/cosmwasm.wasm.v1.CombinedLimit", CombinedLimit], - ["/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", MsgStoreAndMigrateContract], - ["/cosmwasm.wasm.v1.MsgUpdateContractLabel", MsgUpdateContractLabel], - ["/cosmwasm.wasm.v1.MsgIBCSend", MsgIBCSend], - ["/cosmwasm.wasm.v1.PinCodesProposal", PinCodesProposal], - ["/cosmwasm.wasm.v1.MsgUnpinCodesResponse", MsgUnpinCodesResponse], - ["/cosmwasm.wasm.v1.AcceptedMessagesFilter", AcceptedMessagesFilter], - ["/cosmwasm.wasm.v1.Contract", Contract], - ["/cosmwasm.wasm.v1.MsgInstantiateContract2Response", MsgInstantiateContract2Response], ["/cosmwasm.wasm.v1.QueryContractInfoRequest", QueryContractInfoRequest], - ["/cosmwasm.wasm.v1.QueryAllContractStateResponse", QueryAllContractStateResponse], - ["/cosmwasm.wasm.v1.QueryCodesRequest", QueryCodesRequest], - ["/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse", MsgAddCodeUploadParamsAddressesResponse], + ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], + ["/cosmwasm.wasm.v1.ContractInfo", ContractInfo], + ["/cosmwasm.wasm.v1.StoreCodeAuthorization", StoreCodeAuthorization], + ["/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", MsgRemoveCodeUploadParamsAddresses], + ["/cosmwasm.wasm.v1.ClearAdminProposal", ClearAdminProposal], + ["/cosmwasm.wasm.v1.Code", Code], + ["/cosmwasm.wasm.v1.QueryRawContractStateRequest", QueryRawContractStateRequest], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], - ["/cosmwasm.wasm.v1.MsgClearAdminResponse", MsgClearAdminResponse], ["/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", MsgStoreAndInstantiateContract], - ["/cosmwasm.wasm.v1.ContractCodeHistoryEntry", ContractCodeHistoryEntry], - ["/cosmwasm.wasm.v1.ContractExecutionAuthorization", ContractExecutionAuthorization], - ["/cosmwasm.wasm.v1.QueryContractsByCreatorRequest", QueryContractsByCreatorRequest], + ["/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", StoreAndInstantiateContractProposal], + ["/cosmwasm.wasm.v1.UnpinCodesProposal", UnpinCodesProposal], + ["/cosmwasm.wasm.v1.QuerySmartContractStateResponse", QuerySmartContractStateResponse], ["/cosmwasm.wasm.v1.QueryCodeRequest", QueryCodeRequest], - ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin], - ["/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse", MsgRemoveCodeUploadParamsAddressesResponse], - ["/cosmwasm.wasm.v1.Sequence", Sequence], - ["/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse", MsgStoreAndMigrateContractResponse], - ["/cosmwasm.wasm.v1.AbsoluteTxPosition", AbsoluteTxPosition], + ["/cosmwasm.wasm.v1.QueryBuildAddressRequest", QueryBuildAddressRequest], + ["/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse", MsgAddCodeUploadParamsAddressesResponse], + ["/cosmwasm.wasm.v1.PinCodesProposal", PinCodesProposal], + ["/cosmwasm.wasm.v1.MsgIBCSend", MsgIBCSend], + ["/cosmwasm.wasm.v1.QueryCodesResponse", QueryCodesResponse], + ["/cosmwasm.wasm.v1.QueryParamsRequest", QueryParamsRequest], + ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], + ["/cosmwasm.wasm.v1.MsgUpdateContractLabel", MsgUpdateContractLabel], + ["/cosmwasm.wasm.v1.Params", Params], ["/cosmwasm.wasm.v1.MsgMigrateContractResponse", MsgMigrateContractResponse], - ["/cosmwasm.wasm.v1.ContractMigrationAuthorization", ContractMigrationAuthorization], - ["/cosmwasm.wasm.v1.Code", Code], - ["/cosmwasm.wasm.v1.QueryContractInfoResponse", QueryContractInfoResponse], - ["/cosmwasm.wasm.v1.QueryContractHistoryResponse", QueryContractHistoryResponse], - ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], - ["/cosmwasm.wasm.v1.MsgUnpinCodes", MsgUnpinCodes], - ["/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse", MsgStoreAndInstantiateContractResponse], - ["/cosmwasm.wasm.v1.StoreCodeAuthorization", StoreCodeAuthorization], - ["/cosmwasm.wasm.v1.QueryCodeResponse", QueryCodeResponse], - ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], + ["/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", MsgStoreAndMigrateContract], + ["/cosmwasm.wasm.v1.AccessTypeParam", AccessTypeParam], + ["/cosmwasm.wasm.v1.QueryPinnedCodesResponse", QueryPinnedCodesResponse], + ["/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse", MsgStoreAndMigrateContractResponse], + ["/cosmwasm.wasm.v1.Model", Model], + ["/cosmwasm.wasm.v1.SudoContractProposal", SudoContractProposal], + ["/cosmwasm.wasm.v1.CodeInfoResponse", CodeInfoResponse], ["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], - ["/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", UpdateInstantiateConfigProposal], - ["/cosmwasm.wasm.v1.AccessConfigUpdate", AccessConfigUpdate], - ["/cosmwasm.wasm.v1.QueryPinnedCodesRequest", QueryPinnedCodesRequest], - ["/cosmwasm.wasm.v1.AllowAllMessagesFilter", AllowAllMessagesFilter], ["/cosmwasm.wasm.v1.MsgInstantiateContractResponse", MsgInstantiateContractResponse], - ["/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse", MsgUpdateInstantiateConfigResponse], + ["/cosmwasm.wasm.v1.MsgClearAdminResponse", MsgClearAdminResponse], + ["/cosmwasm.wasm.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], + ["/cosmwasm.wasm.v1.MsgSudoContract", MsgSudoContract], + ["/cosmwasm.wasm.v1.QueryContractHistoryResponse", QueryContractHistoryResponse], + ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgSudoContractResponse", MsgSudoContractResponse], - ["/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", StoreAndInstantiateContractProposal], - ["/cosmwasm.wasm.v1.ExecuteContractProposal", ExecuteContractProposal], + ["/cosmwasm.wasm.v1.MsgUnpinCodesResponse", MsgUnpinCodesResponse], + ["/cosmwasm.wasm.v1.AbsoluteTxPosition", AbsoluteTxPosition], + ["/cosmwasm.wasm.v1.MsgPinCodes", MsgPinCodes], + ["/cosmwasm.wasm.v1.ContractExecutionAuthorization", ContractExecutionAuthorization], + ["/cosmwasm.wasm.v1.AccessConfigUpdate", AccessConfigUpdate], + ["/cosmwasm.wasm.v1.QueryRawContractStateResponse", QueryRawContractStateResponse], ["/cosmwasm.wasm.v1.ContractGrant", ContractGrant], - ["/cosmwasm.wasm.v1.SudoContractProposal", SudoContractProposal], - ["/cosmwasm.wasm.v1.ClearAdminProposal", ClearAdminProposal], - ["/cosmwasm.wasm.v1.UnpinCodesProposal", UnpinCodesProposal], - ["/cosmwasm.wasm.v1.QuerySmartContractStateResponse", QuerySmartContractStateResponse], - ["/cosmwasm.wasm.v1.CodeInfoResponse", CodeInfoResponse], - ["/cosmwasm.wasm.v1.AccessConfig", AccessConfig], - ["/cosmwasm.wasm.v1.MsgUpdateParams", MsgUpdateParams], - ["/cosmwasm.wasm.v1.MigrateContractProposal", MigrateContractProposal], - ["/cosmwasm.wasm.v1.GenesisState", GenesisState], - ["/cosmwasm.wasm.v1.QueryRawContractStateRequest", QueryRawContractStateRequest], - ["/cosmwasm.wasm.v1.QueryBuildAddressResponse", QueryBuildAddressResponse], - ["/cosmwasm.wasm.v1.Params", Params], + ["/cosmwasm.wasm.v1.CombinedLimit", CombinedLimit], + ["/cosmwasm.wasm.v1.AcceptedMessagesFilter", AcceptedMessagesFilter], + ["/cosmwasm.wasm.v1.QueryParamsResponse", QueryParamsResponse], + ["/cosmwasm.wasm.v1.MsgExecuteContractResponse", MsgExecuteContractResponse], + ["/cosmwasm.wasm.v1.MsgInstantiateContract2Response", MsgInstantiateContract2Response], + ["/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", MsgUpdateInstantiateConfig], + ["/cosmwasm.wasm.v1.ContractMigrationAuthorization", ContractMigrationAuthorization], + ["/cosmwasm.wasm.v1.Contract", Contract], + ["/cosmwasm.wasm.v1.InstantiateContract2Proposal", InstantiateContract2Proposal], + ["/cosmwasm.wasm.v1.QueryCodesRequest", QueryCodesRequest], + ["/cosmwasm.wasm.v1.QueryAllContractStateResponse", QueryAllContractStateResponse], + ["/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse", MsgRemoveCodeUploadParamsAddressesResponse], + ["/cosmwasm.wasm.v1.CodeInfo", CodeInfo], + ["/cosmwasm.wasm.v1.MsgIBCCloseChannel", MsgIBCCloseChannel], + ["/cosmwasm.wasm.v1.MsgUnpinCodes", MsgUnpinCodes], + ["/cosmwasm.wasm.v1.CodeGrant", CodeGrant], ["/cosmwasm.wasm.v1.InstantiateContractProposal", InstantiateContractProposal], - ["/cosmwasm.wasm.v1.UpdateAdminProposal", UpdateAdminProposal], + ["/cosmwasm.wasm.v1.MigrateContractProposal", MigrateContractProposal], + ["/cosmwasm.wasm.v1.MsgInstantiateContract2", MsgInstantiateContract2], + ["/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", MsgAddCodeUploadParamsAddresses], + ["/cosmwasm.wasm.v1.QueryContractInfoResponse", QueryContractInfoResponse], ["/cosmwasm.wasm.v1.QuerySmartContractStateRequest", QuerySmartContractStateRequest], - ["/cosmwasm.wasm.v1.QueryPinnedCodesResponse", QueryPinnedCodesResponse], + ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin], + ["/cosmwasm.wasm.v1.UpdateAdminProposal", UpdateAdminProposal], + ["/cosmwasm.wasm.v1.MaxCallsLimit", MaxCallsLimit], + ["/cosmwasm.wasm.v1.MaxFundsLimit", MaxFundsLimit], + ["/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse", MsgStoreAndInstantiateContractResponse], + ["/cosmwasm.wasm.v1.QueryContractsByCodeRequest", QueryContractsByCodeRequest], + ["/cosmwasm.wasm.v1.MsgStoreCodeResponse", MsgStoreCodeResponse], + ["/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", AcceptedMessageKeysFilter], + ["/cosmwasm.wasm.v1.QueryContractsByCreatorRequest", QueryContractsByCreatorRequest], + ["/cosmwasm.wasm.v1.QueryBuildAddressResponse", QueryBuildAddressResponse], + ["/cosmwasm.wasm.v1.GenesisState", GenesisState], + ["/cosmwasm.wasm.v1.QueryAllContractStateRequest", QueryAllContractStateRequest], + ["/cosmwasm.wasm.v1.MsgUpdateAdminResponse", MsgUpdateAdminResponse], + ["/cosmwasm.wasm.v1.MsgPinCodesResponse", MsgPinCodesResponse], + ["/cosmwasm.wasm.v1.MsgIBCSendResponse", MsgIBCSendResponse], + ["/cosmwasm.wasm.v1.Sequence", Sequence], ]; diff --git a/ts-client/cosmwasm.wasm.v1/types/amino/amino.ts b/ts-client/cosmwasm.wasm.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/cosmwasm.wasm.v1/types/amino/amino.ts +++ b/ts-client/cosmwasm.wasm.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/cosmwasm.wasm.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/cosmwasm.wasm.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/cosmwasm.wasm.v1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/cosmwasm.wasm.v1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/cosmwasm.wasm.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/cosmwasm.wasm.v1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/cosmwasm.wasm.v1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/cosmwasm.wasm.v1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/cosmwasm.wasm.v1/types/cosmos/msg/v1/msg.ts b/ts-client/cosmwasm.wasm.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/cosmwasm.wasm.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/cosmwasm.wasm.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/cosmwasm.wasm.v1/types/cosmos_proto/cosmos.ts b/ts-client/cosmwasm.wasm.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/cosmwasm.wasm.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/cosmwasm.wasm.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/common/shared_types.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/commitments.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/genesis.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/module/module.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/packet.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/params.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/query.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/tx.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/decryption_key.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/genesis.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/module/module.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/params.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/query.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/request_id.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/tx.ts b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/gogoproto/gogo.ts b/ts-client/cosmwasm.wasm.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/cosmwasm.wasm.v1/types/gogoproto/gogo.ts +++ b/ts-client/cosmwasm.wasm.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/cosmwasm.wasm.v1/types/google/api/annotations.ts b/ts-client/cosmwasm.wasm.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/cosmwasm.wasm.v1/types/google/api/annotations.ts +++ b/ts-client/cosmwasm.wasm.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/cosmwasm.wasm.v1/types/google/api/http.ts b/ts-client/cosmwasm.wasm.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/cosmwasm.wasm.v1/types/google/api/http.ts +++ b/ts-client/cosmwasm.wasm.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/google/protobuf/descriptor.ts b/ts-client/cosmwasm.wasm.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/cosmwasm.wasm.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/cosmwasm.wasm.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/google/protobuf/duration.ts b/ts-client/cosmwasm.wasm.v1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/cosmwasm.wasm.v1/types/route-name.eta b/ts-client/cosmwasm.wasm.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/cosmwasm.wasm.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/fairyring.keyshare/module.ts b/ts-client/fairyring.keyshare/module.ts index e72ee14a..0ac1551d 100755 --- a/ts-client/fairyring.keyshare/module.ts +++ b/ts-client/fairyring.keyshare/module.ts @@ -6,348 +6,358 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { KeyShareRequest } from "./types/fairyring/keyshare/requested_keyshare"; -import { QueryGetValidatorSetRequest } from "./types/fairyring/keyshare/query"; -import { QueryAllAggregatedKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { MsgDeRegisterValidatorResponse } from "./types/fairyring/keyshare/tx"; -import { MsgCreateLatestPubKeyResponse } from "./types/fairyring/keyshare/tx"; -import { MsgCreateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgCreateGeneralKeyShareResponse } from "./types/fairyring/keyshare/tx"; -import { AggregatedKeyShare } from "./types/fairyring/keyshare/aggregated_key_share"; -import { KeysharePacketData } from "./types/fairyring/keyshare/packet"; -import { MsgDeRegisterValidator } from "./types/fairyring/keyshare/tx"; -import { MsgDeleteAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; +import { QueryValidatorSetRequest } from "./types/fairyring/keyshare/query"; +import { QueryValidatorSetResponse } from "./types/fairyring/keyshare/query"; +import { QueryDecryptionKeyAllRequest } from "./types/fairyring/keyshare/query"; +import { QueryGeneralKeyshareResponse } from "./types/fairyring/keyshare/query"; import { GenesisState } from "./types/fairyring/keyshare/genesis"; -import { NoData } from "./types/fairyring/keyshare/packet"; -import { QueryCommitmentsResponse } from "./types/fairyring/keyshare/query"; -import { MsgCreateLatestPubKey } from "./types/fairyring/keyshare/tx"; -import { KeyShare } from "./types/fairyring/keyshare/key_share"; +import { MsgUpdateParams } from "./types/fairyring/keyshare/tx"; +import { MsgDeRegisterValidatorResponse } from "./types/fairyring/keyshare/tx"; import { MsgCreateAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; -import { MsgUpdateParamsResponse } from "./types/fairyring/keyshare/tx"; -import { QueryGetKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { AggrKeyshareDataPacketData } from "./types/fairyring/keyshare/packet"; -import { CurrentKeysPacketAck } from "./types/fairyring/keyshare/packet"; -import { QueryParamsResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { MsgOverrideLatestPubKey } from "./types/fairyring/keyshare/tx"; -import { QueryVerifiableRandomnessQuery } from "./types/fairyring/keyshare/query"; -import { QueryGetValidatorSetResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetAggregatedKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { QueryAllAuthorizedAddressResponse } from "./types/fairyring/keyshare/query"; -import { GeneralKeyShare } from "./types/fairyring/keyshare/general_key_share"; -import { RequestAggrKeysharePacketAck } from "./types/fairyring/keyshare/packet"; -import { CounterPartyIBCInfo } from "./types/fairyring/keyshare/requested_keyshare"; -import { QueryAllKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { QueryAllGeneralKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { MsgOverrideLatestPubKeyResponse } from "./types/fairyring/keyshare/tx"; -import { MsgSendKeyshareResponse } from "./types/fairyring/keyshare/tx"; -import { QueryAllValidatorSetResponse } from "./types/fairyring/keyshare/query"; -import { QueuedPubKey } from "./types/fairyring/keyshare/pub_key"; -import { AggrKeyshareDataPacketAck } from "./types/fairyring/keyshare/packet"; -import { QueryCommitmentsRequest } from "./types/fairyring/keyshare/query"; -import { QueryAllValidatorSetRequest } from "./types/fairyring/keyshare/query"; -import { QueryPubKeyResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetGeneralKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { Commitments } from "./types/fairyring/keyshare/commitments"; -import { QueryAllGeneralKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { MsgCreateGeneralKeyShare } from "./types/fairyring/keyshare/tx"; -import { CurrentKeysPacketData } from "./types/fairyring/keyshare/packet"; -import { QueryVerifiableRandomnessResponse } from "./types/fairyring/keyshare/query"; -import { QueryAllAggregatedKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { QueryPubKeyRequest } from "./types/fairyring/keyshare/query"; -import { MsgSendKeyshare } from "./types/fairyring/keyshare/tx"; -import { AuthorizedAddress } from "./types/fairyring/keyshare/authorized_address"; -import { EncryptedKeyShare } from "./types/fairyring/keyshare/pub_key"; -import { ActivePubKey } from "./types/fairyring/keyshare/pub_key"; -import { IBCInfo } from "./types/fairyring/keyshare/requested_keyshare"; -import { QueryAllKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetAuthorizedAddressResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetGeneralKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { MsgRegisterValidator } from "./types/fairyring/keyshare/tx"; +import { RequestPrivateDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { QueryParamsRequest } from "./types/fairyring/keyshare/query"; +import { QueryCommitmentsResponse } from "./types/fairyring/keyshare/query"; +import { QueryDecryptionKeyResponse } from "./types/fairyring/keyshare/query"; +import { DecryptionKey } from "./types/fairyring/keyshare/decryption_key"; +import { PrivateDecryptionKeyRequest } from "./types/fairyring/keyshare/requested_decryption_key"; +import { QueryKeyshareRequest } from "./types/fairyring/keyshare/query"; +import { QueryKeyshareResponse } from "./types/fairyring/keyshare/query"; +import { QueryPubkeyResponse } from "./types/fairyring/keyshare/query"; +import { GetDecryptionKeyPacketData } from "./types/fairyring/keyshare/packet"; +import { MsgOverrideLatestPubkey } from "./types/fairyring/keyshare/tx"; +import { PrivateDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { MsgCreateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; +import { QueryGeneralKeyshareAllResponse } from "./types/fairyring/keyshare/query"; +import { GeneralKeyshare } from "./types/fairyring/keyshare/keyshare"; +import { RequestPrivateDecryptionKeyPacketData } from "./types/fairyring/keyshare/packet"; +import { MsgSubmitGeneralKeyshareResponse } from "./types/fairyring/keyshare/tx"; +import { EncryptedKeyshare } from "./types/fairyring/keyshare/pubkey"; import { ValidatorSet } from "./types/fairyring/keyshare/validator_set"; +import { QueryVerifiableRandomnessRequest } from "./types/fairyring/keyshare/query"; +import { QueryKeyshareAllRequest } from "./types/fairyring/keyshare/query"; +import { QueryAuthorizedAddressResponse } from "./types/fairyring/keyshare/query"; +import { GetPrivateDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { MsgSubmitEncryptedKeyshare } from "./types/fairyring/keyshare/tx"; +import { QueryGeneralKeyshareRequest } from "./types/fairyring/keyshare/query"; +import { QueryGeneralKeyshareAllRequest } from "./types/fairyring/keyshare/query"; +import { PrivateDecryptionKeyDataPacketData } from "./types/fairyring/keyshare/packet"; +import { MsgRegisterValidator } from "./types/fairyring/keyshare/tx"; +import { MsgCreateLatestPubkey } from "./types/fairyring/keyshare/tx"; import { MsgDeleteAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { QueryGetAggregatedKeyShareRequest } from "./types/fairyring/keyshare/query"; +import { QueryVerifiableRandomnessResponse } from "./types/fairyring/keyshare/query"; +import { QueryValidatorSetAllResponse } from "./types/fairyring/keyshare/query"; +import { QueryPubkeyRequest } from "./types/fairyring/keyshare/query"; +import { CurrentKeysPacketAck } from "./types/fairyring/keyshare/packet"; +import { Params } from "./types/fairyring/keyshare/params"; +import { QueryAuthorizedAddressAllResponse } from "./types/fairyring/keyshare/query"; +import { AuthorizedAddress } from "./types/fairyring/keyshare/authorized_address"; +import { CurrentKeysPacketData } from "./types/fairyring/keyshare/packet"; import { MsgUpdateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgUpdateAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; -import { RequestAggrKeysharePacketData } from "./types/fairyring/keyshare/packet"; -import { GetAggrKeysharePacketData } from "./types/fairyring/keyshare/packet"; -import { GetAggrKeysharePacketAck } from "./types/fairyring/keyshare/packet"; -import { QueryParamsRequest } from "./types/fairyring/keyshare/query"; -import { MsgUpdateParams } from "./types/fairyring/keyshare/tx"; -import { QueryGetAuthorizedAddressRequest } from "./types/fairyring/keyshare/query"; +import { ValidatorEncryptedKeyshare } from "./types/fairyring/keyshare/keyshare"; import { MsgRegisterValidatorResponse } from "./types/fairyring/keyshare/tx"; -import { QueryAllAuthorizedAddressRequest } from "./types/fairyring/keyshare/query"; -import { Params } from "./types/fairyring/keyshare/params"; +import { MsgDeRegisterValidator } from "./types/fairyring/keyshare/tx"; +import { MsgSendKeyshareResponse } from "./types/fairyring/keyshare/tx"; +import { ActivePubkey } from "./types/fairyring/keyshare/pubkey"; +import { CounterPartyIBCInfo } from "./types/fairyring/keyshare/requested_decryption_key"; +import { QueryValidatorSetAllRequest } from "./types/fairyring/keyshare/query"; +import { QueryKeyshareAllResponse } from "./types/fairyring/keyshare/query"; +import { MsgUpdateAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; +import { DecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { QueryCommitmentsRequest } from "./types/fairyring/keyshare/query"; +import { QueryDecryptionKeyRequest } from "./types/fairyring/keyshare/query"; +import { MsgDeleteAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; +import { RequestDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { DecryptionKeyRequest } from "./types/fairyring/keyshare/requested_decryption_key"; +import { IBCInfo } from "./types/fairyring/keyshare/requested_decryption_key"; +import { MsgSubmitGeneralKeyshare } from "./types/fairyring/keyshare/tx"; +import { MsgSubmitEncryptedKeyshareResponse } from "./types/fairyring/keyshare/tx"; +import { KeysharePacketData } from "./types/fairyring/keyshare/packet"; +import { QueryParamsResponse } from "./types/fairyring/keyshare/query"; +import { Keyshare } from "./types/fairyring/keyshare/keyshare"; +import { MsgSendKeyshare } from "./types/fairyring/keyshare/tx"; +import { MsgUpdateParamsResponse } from "./types/fairyring/keyshare/tx"; +import { MsgCreateLatestPubkeyResponse } from "./types/fairyring/keyshare/tx"; +import { MsgOverrideLatestPubkeyResponse } from "./types/fairyring/keyshare/tx"; +import { QueuedPubkey } from "./types/fairyring/keyshare/pubkey"; +import { GetDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { Commitments } from "./types/fairyring/keyshare/commitments"; +import { QueryDecryptionKeyAllResponse } from "./types/fairyring/keyshare/query"; +import { QueryAuthorizedAddressRequest } from "./types/fairyring/keyshare/query"; +import { QueryAuthorizedAddressAllRequest } from "./types/fairyring/keyshare/query"; +import { RequestDecryptionKeyPacketData } from "./types/fairyring/keyshare/packet"; +import { NoData } from "./types/fairyring/keyshare/packet"; +import { DecryptionKeyDataPacketData } from "./types/fairyring/keyshare/packet"; +import { GetPrivateDecryptionKeyPacketData } from "./types/fairyring/keyshare/packet"; -export { KeyShareRequest, QueryGetValidatorSetRequest, QueryAllAggregatedKeyShareResponse, MsgDeRegisterValidatorResponse, MsgCreateLatestPubKeyResponse, MsgCreateAuthorizedAddress, MsgCreateGeneralKeyShareResponse, AggregatedKeyShare, KeysharePacketData, MsgDeRegisterValidator, MsgDeleteAuthorizedAddressResponse, GenesisState, NoData, QueryCommitmentsResponse, MsgCreateLatestPubKey, KeyShare, MsgCreateAuthorizedAddressResponse, MsgUpdateParamsResponse, QueryGetKeyShareRequest, AggrKeyshareDataPacketData, CurrentKeysPacketAck, QueryParamsResponse, QueryGetKeyShareResponse, MsgOverrideLatestPubKey, QueryVerifiableRandomnessQuery, QueryGetValidatorSetResponse, QueryGetAggregatedKeyShareResponse, QueryAllAuthorizedAddressResponse, GeneralKeyShare, RequestAggrKeysharePacketAck, CounterPartyIBCInfo, QueryAllKeyShareRequest, QueryAllGeneralKeyShareRequest, MsgOverrideLatestPubKeyResponse, MsgSendKeyshareResponse, QueryAllValidatorSetResponse, QueuedPubKey, AggrKeyshareDataPacketAck, QueryCommitmentsRequest, QueryAllValidatorSetRequest, QueryPubKeyResponse, QueryGetGeneralKeyShareResponse, Commitments, QueryAllGeneralKeyShareResponse, MsgCreateGeneralKeyShare, CurrentKeysPacketData, QueryVerifiableRandomnessResponse, QueryAllAggregatedKeyShareRequest, QueryPubKeyRequest, MsgSendKeyshare, AuthorizedAddress, EncryptedKeyShare, ActivePubKey, IBCInfo, QueryAllKeyShareResponse, QueryGetAuthorizedAddressResponse, QueryGetGeneralKeyShareRequest, MsgRegisterValidator, ValidatorSet, MsgDeleteAuthorizedAddress, QueryGetAggregatedKeyShareRequest, MsgUpdateAuthorizedAddress, MsgUpdateAuthorizedAddressResponse, RequestAggrKeysharePacketData, GetAggrKeysharePacketData, GetAggrKeysharePacketAck, QueryParamsRequest, MsgUpdateParams, QueryGetAuthorizedAddressRequest, MsgRegisterValidatorResponse, QueryAllAuthorizedAddressRequest, Params }; +export { QueryValidatorSetRequest, QueryValidatorSetResponse, QueryDecryptionKeyAllRequest, QueryGeneralKeyshareResponse, GenesisState, MsgUpdateParams, MsgDeRegisterValidatorResponse, MsgCreateAuthorizedAddressResponse, RequestPrivateDecryptionKeyPacketAck, QueryParamsRequest, QueryCommitmentsResponse, QueryDecryptionKeyResponse, DecryptionKey, PrivateDecryptionKeyRequest, QueryKeyshareRequest, QueryKeyshareResponse, QueryPubkeyResponse, GetDecryptionKeyPacketData, MsgOverrideLatestPubkey, PrivateDecryptionKeyPacketAck, MsgCreateAuthorizedAddress, QueryGeneralKeyshareAllResponse, GeneralKeyshare, RequestPrivateDecryptionKeyPacketData, MsgSubmitGeneralKeyshareResponse, EncryptedKeyshare, ValidatorSet, QueryVerifiableRandomnessRequest, QueryKeyshareAllRequest, QueryAuthorizedAddressResponse, GetPrivateDecryptionKeyPacketAck, MsgSubmitEncryptedKeyshare, QueryGeneralKeyshareRequest, QueryGeneralKeyshareAllRequest, PrivateDecryptionKeyDataPacketData, MsgRegisterValidator, MsgCreateLatestPubkey, MsgDeleteAuthorizedAddress, QueryVerifiableRandomnessResponse, QueryValidatorSetAllResponse, QueryPubkeyRequest, CurrentKeysPacketAck, Params, QueryAuthorizedAddressAllResponse, AuthorizedAddress, CurrentKeysPacketData, MsgUpdateAuthorizedAddress, ValidatorEncryptedKeyshare, MsgRegisterValidatorResponse, MsgDeRegisterValidator, MsgSendKeyshareResponse, ActivePubkey, CounterPartyIBCInfo, QueryValidatorSetAllRequest, QueryKeyshareAllResponse, MsgUpdateAuthorizedAddressResponse, DecryptionKeyPacketAck, QueryCommitmentsRequest, QueryDecryptionKeyRequest, MsgDeleteAuthorizedAddressResponse, RequestDecryptionKeyPacketAck, DecryptionKeyRequest, IBCInfo, MsgSubmitGeneralKeyshare, MsgSubmitEncryptedKeyshareResponse, KeysharePacketData, QueryParamsResponse, Keyshare, MsgSendKeyshare, MsgUpdateParamsResponse, MsgCreateLatestPubkeyResponse, MsgOverrideLatestPubkeyResponse, QueuedPubkey, GetDecryptionKeyPacketAck, Commitments, QueryDecryptionKeyAllResponse, QueryAuthorizedAddressRequest, QueryAuthorizedAddressAllRequest, RequestDecryptionKeyPacketData, NoData, DecryptionKeyDataPacketData, GetPrivateDecryptionKeyPacketData }; -type sendKeyShareRequestParams = { - value: KeyShareRequest, +type sendQueryValidatorSetRequestParams = { + value: QueryValidatorSetRequest, fee?: StdFee, memo?: string }; -type sendQueryGetValidatorSetRequestParams = { - value: QueryGetValidatorSetRequest, +type sendQueryValidatorSetResponseParams = { + value: QueryValidatorSetResponse, fee?: StdFee, memo?: string }; -type sendQueryAllAggregatedKeyShareResponseParams = { - value: QueryAllAggregatedKeyShareResponse, +type sendQueryDecryptionKeyAllRequestParams = { + value: QueryDecryptionKeyAllRequest, fee?: StdFee, memo?: string }; -type sendMsgDeRegisterValidatorResponseParams = { - value: MsgDeRegisterValidatorResponse, +type sendQueryGeneralKeyshareResponseParams = { + value: QueryGeneralKeyshareResponse, fee?: StdFee, memo?: string }; -type sendMsgCreateLatestPubKeyResponseParams = { - value: MsgCreateLatestPubKeyResponse, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendMsgCreateAuthorizedAddressParams = { - value: MsgCreateAuthorizedAddress, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendMsgCreateGeneralKeyShareResponseParams = { - value: MsgCreateGeneralKeyShareResponse, +type sendMsgDeRegisterValidatorResponseParams = { + value: MsgDeRegisterValidatorResponse, fee?: StdFee, memo?: string }; -type sendAggregatedKeyShareParams = { - value: AggregatedKeyShare, +type sendMsgCreateAuthorizedAddressResponseParams = { + value: MsgCreateAuthorizedAddressResponse, fee?: StdFee, memo?: string }; -type sendKeysharePacketDataParams = { - value: KeysharePacketData, +type sendRequestPrivateDecryptionKeyPacketAckParams = { + value: RequestPrivateDecryptionKeyPacketAck, fee?: StdFee, memo?: string }; -type sendMsgDeRegisterValidatorParams = { - value: MsgDeRegisterValidator, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; -type sendMsgDeleteAuthorizedAddressResponseParams = { - value: MsgDeleteAuthorizedAddressResponse, +type sendQueryCommitmentsResponseParams = { + value: QueryCommitmentsResponse, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryDecryptionKeyResponseParams = { + value: QueryDecryptionKeyResponse, fee?: StdFee, memo?: string }; -type sendNoDataParams = { - value: NoData, +type sendDecryptionKeyParams = { + value: DecryptionKey, fee?: StdFee, memo?: string }; -type sendQueryCommitmentsResponseParams = { - value: QueryCommitmentsResponse, +type sendPrivateDecryptionKeyRequestParams = { + value: PrivateDecryptionKeyRequest, fee?: StdFee, memo?: string }; -type sendMsgCreateLatestPubKeyParams = { - value: MsgCreateLatestPubKey, +type sendQueryKeyshareRequestParams = { + value: QueryKeyshareRequest, fee?: StdFee, memo?: string }; -type sendKeyShareParams = { - value: KeyShare, +type sendQueryKeyshareResponseParams = { + value: QueryKeyshareResponse, fee?: StdFee, memo?: string }; -type sendMsgCreateAuthorizedAddressResponseParams = { - value: MsgCreateAuthorizedAddressResponse, +type sendQueryPubkeyResponseParams = { + value: QueryPubkeyResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendGetDecryptionKeyPacketDataParams = { + value: GetDecryptionKeyPacketData, fee?: StdFee, memo?: string }; -type sendQueryGetKeyShareRequestParams = { - value: QueryGetKeyShareRequest, +type sendMsgOverrideLatestPubkeyParams = { + value: MsgOverrideLatestPubkey, fee?: StdFee, memo?: string }; -type sendAggrKeyshareDataPacketDataParams = { - value: AggrKeyshareDataPacketData, +type sendPrivateDecryptionKeyPacketAckParams = { + value: PrivateDecryptionKeyPacketAck, fee?: StdFee, memo?: string }; -type sendCurrentKeysPacketAckParams = { - value: CurrentKeysPacketAck, +type sendMsgCreateAuthorizedAddressParams = { + value: MsgCreateAuthorizedAddress, fee?: StdFee, memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendQueryGeneralKeyshareAllResponseParams = { + value: QueryGeneralKeyshareAllResponse, fee?: StdFee, memo?: string }; -type sendQueryGetKeyShareResponseParams = { - value: QueryGetKeyShareResponse, +type sendGeneralKeyshareParams = { + value: GeneralKeyshare, fee?: StdFee, memo?: string }; -type sendMsgOverrideLatestPubKeyParams = { - value: MsgOverrideLatestPubKey, +type sendRequestPrivateDecryptionKeyPacketDataParams = { + value: RequestPrivateDecryptionKeyPacketData, fee?: StdFee, memo?: string }; -type sendQueryVerifiableRandomnessQueryParams = { - value: QueryVerifiableRandomnessQuery, +type sendMsgSubmitGeneralKeyshareResponseParams = { + value: MsgSubmitGeneralKeyshareResponse, fee?: StdFee, memo?: string }; -type sendQueryGetValidatorSetResponseParams = { - value: QueryGetValidatorSetResponse, +type sendEncryptedKeyshareParams = { + value: EncryptedKeyshare, fee?: StdFee, memo?: string }; -type sendQueryGetAggregatedKeyShareResponseParams = { - value: QueryGetAggregatedKeyShareResponse, +type sendValidatorSetParams = { + value: ValidatorSet, fee?: StdFee, memo?: string }; -type sendQueryAllAuthorizedAddressResponseParams = { - value: QueryAllAuthorizedAddressResponse, +type sendQueryVerifiableRandomnessRequestParams = { + value: QueryVerifiableRandomnessRequest, fee?: StdFee, memo?: string }; -type sendGeneralKeyShareParams = { - value: GeneralKeyShare, +type sendQueryKeyshareAllRequestParams = { + value: QueryKeyshareAllRequest, fee?: StdFee, memo?: string }; -type sendRequestAggrKeysharePacketAckParams = { - value: RequestAggrKeysharePacketAck, +type sendQueryAuthorizedAddressResponseParams = { + value: QueryAuthorizedAddressResponse, fee?: StdFee, memo?: string }; -type sendCounterPartyIBCInfoParams = { - value: CounterPartyIBCInfo, +type sendGetPrivateDecryptionKeyPacketAckParams = { + value: GetPrivateDecryptionKeyPacketAck, fee?: StdFee, memo?: string }; -type sendQueryAllKeyShareRequestParams = { - value: QueryAllKeyShareRequest, +type sendMsgSubmitEncryptedKeyshareParams = { + value: MsgSubmitEncryptedKeyshare, fee?: StdFee, memo?: string }; -type sendQueryAllGeneralKeyShareRequestParams = { - value: QueryAllGeneralKeyShareRequest, +type sendQueryGeneralKeyshareRequestParams = { + value: QueryGeneralKeyshareRequest, fee?: StdFee, memo?: string }; -type sendMsgOverrideLatestPubKeyResponseParams = { - value: MsgOverrideLatestPubKeyResponse, +type sendQueryGeneralKeyshareAllRequestParams = { + value: QueryGeneralKeyshareAllRequest, fee?: StdFee, memo?: string }; -type sendMsgSendKeyshareResponseParams = { - value: MsgSendKeyshareResponse, +type sendPrivateDecryptionKeyDataPacketDataParams = { + value: PrivateDecryptionKeyDataPacketData, fee?: StdFee, memo?: string }; -type sendQueryAllValidatorSetResponseParams = { - value: QueryAllValidatorSetResponse, +type sendMsgRegisterValidatorParams = { + value: MsgRegisterValidator, fee?: StdFee, memo?: string }; -type sendQueuedPubKeyParams = { - value: QueuedPubKey, +type sendMsgCreateLatestPubkeyParams = { + value: MsgCreateLatestPubkey, fee?: StdFee, memo?: string }; -type sendAggrKeyshareDataPacketAckParams = { - value: AggrKeyshareDataPacketAck, +type sendMsgDeleteAuthorizedAddressParams = { + value: MsgDeleteAuthorizedAddress, fee?: StdFee, memo?: string }; -type sendQueryCommitmentsRequestParams = { - value: QueryCommitmentsRequest, +type sendQueryVerifiableRandomnessResponseParams = { + value: QueryVerifiableRandomnessResponse, fee?: StdFee, memo?: string }; -type sendQueryAllValidatorSetRequestParams = { - value: QueryAllValidatorSetRequest, +type sendQueryValidatorSetAllResponseParams = { + value: QueryValidatorSetAllResponse, fee?: StdFee, memo?: string }; -type sendQueryPubKeyResponseParams = { - value: QueryPubKeyResponse, +type sendQueryPubkeyRequestParams = { + value: QueryPubkeyRequest, fee?: StdFee, memo?: string }; -type sendQueryGetGeneralKeyShareResponseParams = { - value: QueryGetGeneralKeyShareResponse, +type sendCurrentKeysPacketAckParams = { + value: CurrentKeysPacketAck, fee?: StdFee, memo?: string }; -type sendCommitmentsParams = { - value: Commitments, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendQueryAllGeneralKeyShareResponseParams = { - value: QueryAllGeneralKeyShareResponse, +type sendQueryAuthorizedAddressAllResponseParams = { + value: QueryAuthorizedAddressAllResponse, fee?: StdFee, memo?: string }; -type sendMsgCreateGeneralKeyShareParams = { - value: MsgCreateGeneralKeyShare, +type sendAuthorizedAddressParams = { + value: AuthorizedAddress, fee?: StdFee, memo?: string }; @@ -358,449 +368,549 @@ type sendCurrentKeysPacketDataParams = { memo?: string }; -type sendQueryVerifiableRandomnessResponseParams = { - value: QueryVerifiableRandomnessResponse, +type sendMsgUpdateAuthorizedAddressParams = { + value: MsgUpdateAuthorizedAddress, fee?: StdFee, memo?: string }; -type sendQueryAllAggregatedKeyShareRequestParams = { - value: QueryAllAggregatedKeyShareRequest, +type sendValidatorEncryptedKeyshareParams = { + value: ValidatorEncryptedKeyshare, fee?: StdFee, memo?: string }; -type sendQueryPubKeyRequestParams = { - value: QueryPubKeyRequest, +type sendMsgRegisterValidatorResponseParams = { + value: MsgRegisterValidatorResponse, fee?: StdFee, memo?: string }; -type sendMsgSendKeyshareParams = { - value: MsgSendKeyshare, +type sendMsgDeRegisterValidatorParams = { + value: MsgDeRegisterValidator, fee?: StdFee, memo?: string }; -type sendAuthorizedAddressParams = { - value: AuthorizedAddress, +type sendMsgSendKeyshareResponseParams = { + value: MsgSendKeyshareResponse, fee?: StdFee, memo?: string }; -type sendEncryptedKeyShareParams = { - value: EncryptedKeyShare, +type sendActivePubkeyParams = { + value: ActivePubkey, fee?: StdFee, memo?: string }; -type sendActivePubKeyParams = { - value: ActivePubKey, +type sendCounterPartyIBCInfoParams = { + value: CounterPartyIBCInfo, fee?: StdFee, memo?: string }; -type sendIBCInfoParams = { - value: IBCInfo, +type sendQueryValidatorSetAllRequestParams = { + value: QueryValidatorSetAllRequest, fee?: StdFee, memo?: string }; -type sendQueryAllKeyShareResponseParams = { - value: QueryAllKeyShareResponse, +type sendQueryKeyshareAllResponseParams = { + value: QueryKeyshareAllResponse, fee?: StdFee, memo?: string }; -type sendQueryGetAuthorizedAddressResponseParams = { - value: QueryGetAuthorizedAddressResponse, +type sendMsgUpdateAuthorizedAddressResponseParams = { + value: MsgUpdateAuthorizedAddressResponse, fee?: StdFee, memo?: string }; -type sendQueryGetGeneralKeyShareRequestParams = { - value: QueryGetGeneralKeyShareRequest, +type sendDecryptionKeyPacketAckParams = { + value: DecryptionKeyPacketAck, fee?: StdFee, memo?: string }; -type sendMsgRegisterValidatorParams = { - value: MsgRegisterValidator, +type sendQueryCommitmentsRequestParams = { + value: QueryCommitmentsRequest, fee?: StdFee, memo?: string }; -type sendValidatorSetParams = { - value: ValidatorSet, +type sendQueryDecryptionKeyRequestParams = { + value: QueryDecryptionKeyRequest, fee?: StdFee, memo?: string }; -type sendMsgDeleteAuthorizedAddressParams = { - value: MsgDeleteAuthorizedAddress, +type sendMsgDeleteAuthorizedAddressResponseParams = { + value: MsgDeleteAuthorizedAddressResponse, fee?: StdFee, memo?: string }; -type sendQueryGetAggregatedKeyShareRequestParams = { - value: QueryGetAggregatedKeyShareRequest, +type sendRequestDecryptionKeyPacketAckParams = { + value: RequestDecryptionKeyPacketAck, fee?: StdFee, memo?: string }; -type sendMsgUpdateAuthorizedAddressParams = { - value: MsgUpdateAuthorizedAddress, +type sendDecryptionKeyRequestParams = { + value: DecryptionKeyRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateAuthorizedAddressResponseParams = { - value: MsgUpdateAuthorizedAddressResponse, +type sendIBCInfoParams = { + value: IBCInfo, fee?: StdFee, memo?: string }; -type sendRequestAggrKeysharePacketDataParams = { - value: RequestAggrKeysharePacketData, +type sendMsgSubmitGeneralKeyshareParams = { + value: MsgSubmitGeneralKeyshare, fee?: StdFee, memo?: string }; -type sendGetAggrKeysharePacketDataParams = { - value: GetAggrKeysharePacketData, +type sendMsgSubmitEncryptedKeyshareResponseParams = { + value: MsgSubmitEncryptedKeyshareResponse, fee?: StdFee, memo?: string }; -type sendGetAggrKeysharePacketAckParams = { - value: GetAggrKeysharePacketAck, +type sendKeysharePacketDataParams = { + value: KeysharePacketData, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendKeyshareParams = { + value: Keyshare, fee?: StdFee, memo?: string }; -type sendQueryGetAuthorizedAddressRequestParams = { - value: QueryGetAuthorizedAddressRequest, +type sendMsgSendKeyshareParams = { + value: MsgSendKeyshare, fee?: StdFee, memo?: string }; -type sendMsgRegisterValidatorResponseParams = { - value: MsgRegisterValidatorResponse, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryAllAuthorizedAddressRequestParams = { - value: QueryAllAuthorizedAddressRequest, +type sendMsgCreateLatestPubkeyResponseParams = { + value: MsgCreateLatestPubkeyResponse, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendMsgOverrideLatestPubkeyResponseParams = { + value: MsgOverrideLatestPubkeyResponse, fee?: StdFee, memo?: string }; +type sendQueuedPubkeyParams = { + value: QueuedPubkey, + fee?: StdFee, + memo?: string +}; -type keyShareRequestParams = { - value: KeyShareRequest, +type sendGetDecryptionKeyPacketAckParams = { + value: GetDecryptionKeyPacketAck, + fee?: StdFee, + memo?: string }; -type queryGetValidatorSetRequestParams = { - value: QueryGetValidatorSetRequest, +type sendCommitmentsParams = { + value: Commitments, + fee?: StdFee, + memo?: string }; -type queryAllAggregatedKeyShareResponseParams = { - value: QueryAllAggregatedKeyShareResponse, +type sendQueryDecryptionKeyAllResponseParams = { + value: QueryDecryptionKeyAllResponse, + fee?: StdFee, + memo?: string }; -type msgDeRegisterValidatorResponseParams = { - value: MsgDeRegisterValidatorResponse, +type sendQueryAuthorizedAddressRequestParams = { + value: QueryAuthorizedAddressRequest, + fee?: StdFee, + memo?: string }; -type msgCreateLatestPubKeyResponseParams = { - value: MsgCreateLatestPubKeyResponse, +type sendQueryAuthorizedAddressAllRequestParams = { + value: QueryAuthorizedAddressAllRequest, + fee?: StdFee, + memo?: string }; -type msgCreateAuthorizedAddressParams = { - value: MsgCreateAuthorizedAddress, +type sendRequestDecryptionKeyPacketDataParams = { + value: RequestDecryptionKeyPacketData, + fee?: StdFee, + memo?: string }; -type msgCreateGeneralKeyShareResponseParams = { - value: MsgCreateGeneralKeyShareResponse, +type sendNoDataParams = { + value: NoData, + fee?: StdFee, + memo?: string }; -type aggregatedKeyShareParams = { - value: AggregatedKeyShare, +type sendDecryptionKeyDataPacketDataParams = { + value: DecryptionKeyDataPacketData, + fee?: StdFee, + memo?: string }; -type keysharePacketDataParams = { - value: KeysharePacketData, +type sendGetPrivateDecryptionKeyPacketDataParams = { + value: GetPrivateDecryptionKeyPacketData, + fee?: StdFee, + memo?: string }; -type msgDeRegisterValidatorParams = { - value: MsgDeRegisterValidator, + +type queryValidatorSetRequestParams = { + value: QueryValidatorSetRequest, }; -type msgDeleteAuthorizedAddressResponseParams = { - value: MsgDeleteAuthorizedAddressResponse, +type queryValidatorSetResponseParams = { + value: QueryValidatorSetResponse, }; -type genesisStateParams = { - value: GenesisState, +type queryDecryptionKeyAllRequestParams = { + value: QueryDecryptionKeyAllRequest, }; -type noDataParams = { - value: NoData, +type queryGeneralKeyshareResponseParams = { + value: QueryGeneralKeyshareResponse, }; -type queryCommitmentsResponseParams = { - value: QueryCommitmentsResponse, +type genesisStateParams = { + value: GenesisState, }; -type msgCreateLatestPubKeyParams = { - value: MsgCreateLatestPubKey, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type keyShareParams = { - value: KeyShare, +type msgDeRegisterValidatorResponseParams = { + value: MsgDeRegisterValidatorResponse, }; type msgCreateAuthorizedAddressResponseParams = { value: MsgCreateAuthorizedAddressResponse, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type requestPrivateDecryptionKeyPacketAckParams = { + value: RequestPrivateDecryptionKeyPacketAck, }; -type queryGetKeyShareRequestParams = { - value: QueryGetKeyShareRequest, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; -type aggrKeyshareDataPacketDataParams = { - value: AggrKeyshareDataPacketData, +type queryCommitmentsResponseParams = { + value: QueryCommitmentsResponse, }; -type currentKeysPacketAckParams = { - value: CurrentKeysPacketAck, +type queryDecryptionKeyResponseParams = { + value: QueryDecryptionKeyResponse, }; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type decryptionKeyParams = { + value: DecryptionKey, }; -type queryGetKeyShareResponseParams = { - value: QueryGetKeyShareResponse, +type privateDecryptionKeyRequestParams = { + value: PrivateDecryptionKeyRequest, }; -type msgOverrideLatestPubKeyParams = { - value: MsgOverrideLatestPubKey, +type queryKeyshareRequestParams = { + value: QueryKeyshareRequest, }; -type queryVerifiableRandomnessQueryParams = { - value: QueryVerifiableRandomnessQuery, +type queryKeyshareResponseParams = { + value: QueryKeyshareResponse, }; -type queryGetValidatorSetResponseParams = { - value: QueryGetValidatorSetResponse, +type queryPubkeyResponseParams = { + value: QueryPubkeyResponse, }; -type queryGetAggregatedKeyShareResponseParams = { - value: QueryGetAggregatedKeyShareResponse, +type getDecryptionKeyPacketDataParams = { + value: GetDecryptionKeyPacketData, }; -type queryAllAuthorizedAddressResponseParams = { - value: QueryAllAuthorizedAddressResponse, +type msgOverrideLatestPubkeyParams = { + value: MsgOverrideLatestPubkey, }; -type generalKeyShareParams = { - value: GeneralKeyShare, +type privateDecryptionKeyPacketAckParams = { + value: PrivateDecryptionKeyPacketAck, }; -type requestAggrKeysharePacketAckParams = { - value: RequestAggrKeysharePacketAck, +type msgCreateAuthorizedAddressParams = { + value: MsgCreateAuthorizedAddress, }; -type counterPartyIbcinfoParams = { - value: CounterPartyIBCInfo, +type queryGeneralKeyshareAllResponseParams = { + value: QueryGeneralKeyshareAllResponse, }; -type queryAllKeyShareRequestParams = { - value: QueryAllKeyShareRequest, +type generalKeyshareParams = { + value: GeneralKeyshare, }; -type queryAllGeneralKeyShareRequestParams = { - value: QueryAllGeneralKeyShareRequest, +type requestPrivateDecryptionKeyPacketDataParams = { + value: RequestPrivateDecryptionKeyPacketData, }; -type msgOverrideLatestPubKeyResponseParams = { - value: MsgOverrideLatestPubKeyResponse, +type msgSubmitGeneralKeyshareResponseParams = { + value: MsgSubmitGeneralKeyshareResponse, }; -type msgSendKeyshareResponseParams = { - value: MsgSendKeyshareResponse, +type encryptedKeyshareParams = { + value: EncryptedKeyshare, }; -type queryAllValidatorSetResponseParams = { - value: QueryAllValidatorSetResponse, +type validatorSetParams = { + value: ValidatorSet, }; -type queuedPubKeyParams = { - value: QueuedPubKey, +type queryVerifiableRandomnessRequestParams = { + value: QueryVerifiableRandomnessRequest, }; -type aggrKeyshareDataPacketAckParams = { - value: AggrKeyshareDataPacketAck, +type queryKeyshareAllRequestParams = { + value: QueryKeyshareAllRequest, }; -type queryCommitmentsRequestParams = { - value: QueryCommitmentsRequest, +type queryAuthorizedAddressResponseParams = { + value: QueryAuthorizedAddressResponse, }; -type queryAllValidatorSetRequestParams = { - value: QueryAllValidatorSetRequest, +type getPrivateDecryptionKeyPacketAckParams = { + value: GetPrivateDecryptionKeyPacketAck, }; -type queryPubKeyResponseParams = { - value: QueryPubKeyResponse, +type msgSubmitEncryptedKeyshareParams = { + value: MsgSubmitEncryptedKeyshare, }; -type queryGetGeneralKeyShareResponseParams = { - value: QueryGetGeneralKeyShareResponse, +type queryGeneralKeyshareRequestParams = { + value: QueryGeneralKeyshareRequest, }; -type commitmentsParams = { - value: Commitments, +type queryGeneralKeyshareAllRequestParams = { + value: QueryGeneralKeyshareAllRequest, }; -type queryAllGeneralKeyShareResponseParams = { - value: QueryAllGeneralKeyShareResponse, +type privateDecryptionKeyDataPacketDataParams = { + value: PrivateDecryptionKeyDataPacketData, }; -type msgCreateGeneralKeyShareParams = { - value: MsgCreateGeneralKeyShare, +type msgRegisterValidatorParams = { + value: MsgRegisterValidator, }; -type currentKeysPacketDataParams = { - value: CurrentKeysPacketData, +type msgCreateLatestPubkeyParams = { + value: MsgCreateLatestPubkey, +}; + +type msgDeleteAuthorizedAddressParams = { + value: MsgDeleteAuthorizedAddress, }; type queryVerifiableRandomnessResponseParams = { value: QueryVerifiableRandomnessResponse, }; -type queryAllAggregatedKeyShareRequestParams = { - value: QueryAllAggregatedKeyShareRequest, +type queryValidatorSetAllResponseParams = { + value: QueryValidatorSetAllResponse, }; -type queryPubKeyRequestParams = { - value: QueryPubKeyRequest, +type queryPubkeyRequestParams = { + value: QueryPubkeyRequest, }; -type msgSendKeyshareParams = { - value: MsgSendKeyshare, +type currentKeysPacketAckParams = { + value: CurrentKeysPacketAck, +}; + +type paramsParams = { + value: Params, +}; + +type queryAuthorizedAddressAllResponseParams = { + value: QueryAuthorizedAddressAllResponse, }; type authorizedAddressParams = { value: AuthorizedAddress, }; -type encryptedKeyShareParams = { - value: EncryptedKeyShare, +type currentKeysPacketDataParams = { + value: CurrentKeysPacketData, +}; + +type msgUpdateAuthorizedAddressParams = { + value: MsgUpdateAuthorizedAddress, +}; + +type validatorEncryptedKeyshareParams = { + value: ValidatorEncryptedKeyshare, +}; + +type msgRegisterValidatorResponseParams = { + value: MsgRegisterValidatorResponse, }; -type activePubKeyParams = { - value: ActivePubKey, +type msgDeRegisterValidatorParams = { + value: MsgDeRegisterValidator, +}; + +type msgSendKeyshareResponseParams = { + value: MsgSendKeyshareResponse, +}; + +type activePubkeyParams = { + value: ActivePubkey, +}; + +type counterPartyIbcinfoParams = { + value: CounterPartyIBCInfo, +}; + +type queryValidatorSetAllRequestParams = { + value: QueryValidatorSetAllRequest, +}; + +type queryKeyshareAllResponseParams = { + value: QueryKeyshareAllResponse, +}; + +type msgUpdateAuthorizedAddressResponseParams = { + value: MsgUpdateAuthorizedAddressResponse, +}; + +type decryptionKeyPacketAckParams = { + value: DecryptionKeyPacketAck, +}; + +type queryCommitmentsRequestParams = { + value: QueryCommitmentsRequest, +}; + +type queryDecryptionKeyRequestParams = { + value: QueryDecryptionKeyRequest, +}; + +type msgDeleteAuthorizedAddressResponseParams = { + value: MsgDeleteAuthorizedAddressResponse, +}; + +type requestDecryptionKeyPacketAckParams = { + value: RequestDecryptionKeyPacketAck, +}; + +type decryptionKeyRequestParams = { + value: DecryptionKeyRequest, }; type ibcinfoParams = { value: IBCInfo, }; -type queryAllKeyShareResponseParams = { - value: QueryAllKeyShareResponse, +type msgSubmitGeneralKeyshareParams = { + value: MsgSubmitGeneralKeyshare, }; -type queryGetAuthorizedAddressResponseParams = { - value: QueryGetAuthorizedAddressResponse, +type msgSubmitEncryptedKeyshareResponseParams = { + value: MsgSubmitEncryptedKeyshareResponse, }; -type queryGetGeneralKeyShareRequestParams = { - value: QueryGetGeneralKeyShareRequest, +type keysharePacketDataParams = { + value: KeysharePacketData, }; -type msgRegisterValidatorParams = { - value: MsgRegisterValidator, +type queryParamsResponseParams = { + value: QueryParamsResponse, }; -type validatorSetParams = { - value: ValidatorSet, +type keyshareParams = { + value: Keyshare, }; -type msgDeleteAuthorizedAddressParams = { - value: MsgDeleteAuthorizedAddress, +type msgSendKeyshareParams = { + value: MsgSendKeyshare, }; -type queryGetAggregatedKeyShareRequestParams = { - value: QueryGetAggregatedKeyShareRequest, +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; -type msgUpdateAuthorizedAddressParams = { - value: MsgUpdateAuthorizedAddress, +type msgCreateLatestPubkeyResponseParams = { + value: MsgCreateLatestPubkeyResponse, }; -type msgUpdateAuthorizedAddressResponseParams = { - value: MsgUpdateAuthorizedAddressResponse, +type msgOverrideLatestPubkeyResponseParams = { + value: MsgOverrideLatestPubkeyResponse, }; -type requestAggrKeysharePacketDataParams = { - value: RequestAggrKeysharePacketData, +type queuedPubkeyParams = { + value: QueuedPubkey, }; -type getAggrKeysharePacketDataParams = { - value: GetAggrKeysharePacketData, +type getDecryptionKeyPacketAckParams = { + value: GetDecryptionKeyPacketAck, }; -type getAggrKeysharePacketAckParams = { - value: GetAggrKeysharePacketAck, +type commitmentsParams = { + value: Commitments, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type queryDecryptionKeyAllResponseParams = { + value: QueryDecryptionKeyAllResponse, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type queryAuthorizedAddressRequestParams = { + value: QueryAuthorizedAddressRequest, }; -type queryGetAuthorizedAddressRequestParams = { - value: QueryGetAuthorizedAddressRequest, +type queryAuthorizedAddressAllRequestParams = { + value: QueryAuthorizedAddressAllRequest, }; -type msgRegisterValidatorResponseParams = { - value: MsgRegisterValidatorResponse, +type requestDecryptionKeyPacketDataParams = { + value: RequestDecryptionKeyPacketData, }; -type queryAllAuthorizedAddressRequestParams = { - value: QueryAllAuthorizedAddressRequest, +type noDataParams = { + value: NoData, }; -type paramsParams = { - value: Params, +type decryptionKeyDataPacketDataParams = { + value: DecryptionKeyDataPacketData, +}; + +type getPrivateDecryptionKeyPacketDataParams = { + value: GetPrivateDecryptionKeyPacketData, }; @@ -833,45 +943,87 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendKeyShareRequest({ value, fee, memo }: sendKeyShareRequestParams): Promise { + async sendQueryValidatorSetRequest({ value, fee, memo }: sendQueryValidatorSetRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryValidatorSetRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryValidatorSetRequest({ value: QueryValidatorSetRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryValidatorSetRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryValidatorSetResponse({ value, fee, memo }: sendQueryValidatorSetResponseParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryValidatorSetResponse: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryValidatorSetResponse({ value: QueryValidatorSetResponse.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryValidatorSetResponse: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryDecryptionKeyAllRequest({ value, fee, memo }: sendQueryDecryptionKeyAllRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryDecryptionKeyAllRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryDecryptionKeyAllRequest({ value: QueryDecryptionKeyAllRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryDecryptionKeyAllRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryGeneralKeyshareResponse({ value, fee, memo }: sendQueryGeneralKeyshareResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendKeyShareRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGeneralKeyshareResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.keyShareRequest({ value: KeyShareRequest.fromPartial(value) }) + let msg = this.queryGeneralKeyshareResponse({ value: QueryGeneralKeyshareResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendKeyShareRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGeneralKeyshareResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetValidatorSetRequest({ value, fee, memo }: sendQueryGetValidatorSetRequestParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetValidatorSetRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetValidatorSetRequest({ value: QueryGetValidatorSetRequest.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetValidatorSetRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllAggregatedKeyShareResponse({ value, fee, memo }: sendQueryAllAggregatedKeyShareResponseParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllAggregatedKeyShareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllAggregatedKeyShareResponse({ value: QueryAllAggregatedKeyShareResponse.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllAggregatedKeyShareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, @@ -889,689 +1041,773 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgCreateLatestPubKeyResponse({ value, fee, memo }: sendMsgCreateLatestPubKeyResponseParams): Promise { + async sendMsgCreateAuthorizedAddressResponse({ value, fee, memo }: sendMsgCreateAuthorizedAddressResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateLatestPubKeyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateAuthorizedAddressResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateLatestPubKeyResponse({ value: MsgCreateLatestPubKeyResponse.fromPartial(value) }) + let msg = this.msgCreateAuthorizedAddressResponse({ value: MsgCreateAuthorizedAddressResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateLatestPubKeyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateAuthorizedAddressResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateAuthorizedAddress({ value, fee, memo }: sendMsgCreateAuthorizedAddressParams): Promise { + async sendRequestPrivateDecryptionKeyPacketAck({ value, fee, memo }: sendRequestPrivateDecryptionKeyPacketAckParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateAuthorizedAddress: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRequestPrivateDecryptionKeyPacketAck: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateAuthorizedAddress({ value: MsgCreateAuthorizedAddress.fromPartial(value) }) + let msg = this.requestPrivateDecryptionKeyPacketAck({ value: RequestPrivateDecryptionKeyPacketAck.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateAuthorizedAddress: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRequestPrivateDecryptionKeyPacketAck: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateGeneralKeyShareResponse({ value, fee, memo }: sendMsgCreateGeneralKeyShareResponseParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateGeneralKeyShareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateGeneralKeyShareResponse({ value: MsgCreateGeneralKeyShareResponse.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateGeneralKeyShareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendAggregatedKeyShare({ value, fee, memo }: sendAggregatedKeyShareParams): Promise { + async sendQueryCommitmentsResponse({ value, fee, memo }: sendQueryCommitmentsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendAggregatedKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCommitmentsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.aggregatedKeyShare({ value: AggregatedKeyShare.fromPartial(value) }) + let msg = this.queryCommitmentsResponse({ value: QueryCommitmentsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAggregatedKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCommitmentsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendKeysharePacketData({ value, fee, memo }: sendKeysharePacketDataParams): Promise { + async sendQueryDecryptionKeyResponse({ value, fee, memo }: sendQueryDecryptionKeyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendKeysharePacketData: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDecryptionKeyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.keysharePacketData({ value: KeysharePacketData.fromPartial(value) }) + let msg = this.queryDecryptionKeyResponse({ value: QueryDecryptionKeyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendKeysharePacketData: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDecryptionKeyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDeRegisterValidator({ value, fee, memo }: sendMsgDeRegisterValidatorParams): Promise { + async sendDecryptionKey({ value, fee, memo }: sendDecryptionKeyParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDeRegisterValidator: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDecryptionKey: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDeRegisterValidator({ value: MsgDeRegisterValidator.fromPartial(value) }) + let msg = this.decryptionKey({ value: DecryptionKey.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDeRegisterValidator: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDecryptionKey: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDeleteAuthorizedAddressResponse({ value, fee, memo }: sendMsgDeleteAuthorizedAddressResponseParams): Promise { + async sendPrivateDecryptionKeyRequest({ value, fee, memo }: sendPrivateDecryptionKeyRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDeleteAuthorizedAddressResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPrivateDecryptionKeyRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDeleteAuthorizedAddressResponse({ value: MsgDeleteAuthorizedAddressResponse.fromPartial(value) }) + let msg = this.privateDecryptionKeyRequest({ value: PrivateDecryptionKeyRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDeleteAuthorizedAddressResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPrivateDecryptionKeyRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryKeyshareRequest({ value, fee, memo }: sendQueryKeyshareRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryKeyshareRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryKeyshareRequest({ value: QueryKeyshareRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryKeyshareRequest: Could not broadcast Tx: '+ e.message) } }, - async sendNoData({ value, fee, memo }: sendNoDataParams): Promise { + async sendQueryKeyshareResponse({ value, fee, memo }: sendQueryKeyshareResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendNoData: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryKeyshareResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.noData({ value: NoData.fromPartial(value) }) + let msg = this.queryKeyshareResponse({ value: QueryKeyshareResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendNoData: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryKeyshareResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCommitmentsResponse({ value, fee, memo }: sendQueryCommitmentsResponseParams): Promise { + async sendQueryPubkeyResponse({ value, fee, memo }: sendQueryPubkeyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCommitmentsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPubkeyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCommitmentsResponse({ value: QueryCommitmentsResponse.fromPartial(value) }) + let msg = this.queryPubkeyResponse({ value: QueryPubkeyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCommitmentsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPubkeyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateLatestPubKey({ value, fee, memo }: sendMsgCreateLatestPubKeyParams): Promise { + async sendGetDecryptionKeyPacketData({ value, fee, memo }: sendGetDecryptionKeyPacketDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateLatestPubKey: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetDecryptionKeyPacketData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateLatestPubKey({ value: MsgCreateLatestPubKey.fromPartial(value) }) + let msg = this.getDecryptionKeyPacketData({ value: GetDecryptionKeyPacketData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateLatestPubKey: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetDecryptionKeyPacketData: Could not broadcast Tx: '+ e.message) } }, - async sendKeyShare({ value, fee, memo }: sendKeyShareParams): Promise { + async sendMsgOverrideLatestPubkey({ value, fee, memo }: sendMsgOverrideLatestPubkeyParams): Promise { if (!signer) { - throw new Error('TxClient:sendKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgOverrideLatestPubkey: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.keyShare({ value: KeyShare.fromPartial(value) }) + let msg = this.msgOverrideLatestPubkey({ value: MsgOverrideLatestPubkey.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgOverrideLatestPubkey: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateAuthorizedAddressResponse({ value, fee, memo }: sendMsgCreateAuthorizedAddressResponseParams): Promise { + async sendPrivateDecryptionKeyPacketAck({ value, fee, memo }: sendPrivateDecryptionKeyPacketAckParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateAuthorizedAddressResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPrivateDecryptionKeyPacketAck: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateAuthorizedAddressResponse({ value: MsgCreateAuthorizedAddressResponse.fromPartial(value) }) + let msg = this.privateDecryptionKeyPacketAck({ value: PrivateDecryptionKeyPacketAck.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateAuthorizedAddressResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPrivateDecryptionKeyPacketAck: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendMsgCreateAuthorizedAddress({ value, fee, memo }: sendMsgCreateAuthorizedAddressParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateAuthorizedAddress: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.msgCreateAuthorizedAddress({ value: MsgCreateAuthorizedAddress.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateAuthorizedAddress: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetKeyShareRequest({ value, fee, memo }: sendQueryGetKeyShareRequestParams): Promise { + async sendQueryGeneralKeyshareAllResponse({ value, fee, memo }: sendQueryGeneralKeyshareAllResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetKeyShareRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGeneralKeyshareAllResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetKeyShareRequest({ value: QueryGetKeyShareRequest.fromPartial(value) }) + let msg = this.queryGeneralKeyshareAllResponse({ value: QueryGeneralKeyshareAllResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetKeyShareRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGeneralKeyshareAllResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAggrKeyshareDataPacketData({ value, fee, memo }: sendAggrKeyshareDataPacketDataParams): Promise { + async sendGeneralKeyshare({ value, fee, memo }: sendGeneralKeyshareParams): Promise { if (!signer) { - throw new Error('TxClient:sendAggrKeyshareDataPacketData: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGeneralKeyshare: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.aggrKeyshareDataPacketData({ value: AggrKeyshareDataPacketData.fromPartial(value) }) + let msg = this.generalKeyshare({ value: GeneralKeyshare.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAggrKeyshareDataPacketData: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGeneralKeyshare: Could not broadcast Tx: '+ e.message) } }, - async sendCurrentKeysPacketAck({ value, fee, memo }: sendCurrentKeysPacketAckParams): Promise { + async sendRequestPrivateDecryptionKeyPacketData({ value, fee, memo }: sendRequestPrivateDecryptionKeyPacketDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendCurrentKeysPacketAck: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRequestPrivateDecryptionKeyPacketData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.currentKeysPacketAck({ value: CurrentKeysPacketAck.fromPartial(value) }) + let msg = this.requestPrivateDecryptionKeyPacketData({ value: RequestPrivateDecryptionKeyPacketData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCurrentKeysPacketAck: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRequestPrivateDecryptionKeyPacketData: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendMsgSubmitGeneralKeyshareResponse({ value, fee, memo }: sendMsgSubmitGeneralKeyshareResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitGeneralKeyshareResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.msgSubmitGeneralKeyshareResponse({ value: MsgSubmitGeneralKeyshareResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitGeneralKeyshareResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetKeyShareResponse({ value, fee, memo }: sendQueryGetKeyShareResponseParams): Promise { + async sendEncryptedKeyshare({ value, fee, memo }: sendEncryptedKeyshareParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetKeyShareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEncryptedKeyshare: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetKeyShareResponse({ value: QueryGetKeyShareResponse.fromPartial(value) }) + let msg = this.encryptedKeyshare({ value: EncryptedKeyshare.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetKeyShareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEncryptedKeyshare: Could not broadcast Tx: '+ e.message) } }, - async sendMsgOverrideLatestPubKey({ value, fee, memo }: sendMsgOverrideLatestPubKeyParams): Promise { + async sendValidatorSet({ value, fee, memo }: sendValidatorSetParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgOverrideLatestPubKey: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorSet: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgOverrideLatestPubKey({ value: MsgOverrideLatestPubKey.fromPartial(value) }) + let msg = this.validatorSet({ value: ValidatorSet.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgOverrideLatestPubKey: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorSet: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVerifiableRandomnessQuery({ value, fee, memo }: sendQueryVerifiableRandomnessQueryParams): Promise { + async sendQueryVerifiableRandomnessRequest({ value, fee, memo }: sendQueryVerifiableRandomnessRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVerifiableRandomnessQuery: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVerifiableRandomnessRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVerifiableRandomnessQuery({ value: QueryVerifiableRandomnessQuery.fromPartial(value) }) + let msg = this.queryVerifiableRandomnessRequest({ value: QueryVerifiableRandomnessRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVerifiableRandomnessQuery: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVerifiableRandomnessRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetValidatorSetResponse({ value, fee, memo }: sendQueryGetValidatorSetResponseParams): Promise { + async sendQueryKeyshareAllRequest({ value, fee, memo }: sendQueryKeyshareAllRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetValidatorSetResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryKeyshareAllRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetValidatorSetResponse({ value: QueryGetValidatorSetResponse.fromPartial(value) }) + let msg = this.queryKeyshareAllRequest({ value: QueryKeyshareAllRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetValidatorSetResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryKeyshareAllRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetAggregatedKeyShareResponse({ value, fee, memo }: sendQueryGetAggregatedKeyShareResponseParams): Promise { + async sendQueryAuthorizedAddressResponse({ value, fee, memo }: sendQueryAuthorizedAddressResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetAggregatedKeyShareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAuthorizedAddressResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetAggregatedKeyShareResponse({ value: QueryGetAggregatedKeyShareResponse.fromPartial(value) }) + let msg = this.queryAuthorizedAddressResponse({ value: QueryAuthorizedAddressResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetAggregatedKeyShareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAuthorizedAddressResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllAuthorizedAddressResponse({ value, fee, memo }: sendQueryAllAuthorizedAddressResponseParams): Promise { + async sendGetPrivateDecryptionKeyPacketAck({ value, fee, memo }: sendGetPrivateDecryptionKeyPacketAckParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllAuthorizedAddressResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetPrivateDecryptionKeyPacketAck: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllAuthorizedAddressResponse({ value: QueryAllAuthorizedAddressResponse.fromPartial(value) }) + let msg = this.getPrivateDecryptionKeyPacketAck({ value: GetPrivateDecryptionKeyPacketAck.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllAuthorizedAddressResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetPrivateDecryptionKeyPacketAck: Could not broadcast Tx: '+ e.message) } }, - async sendGeneralKeyShare({ value, fee, memo }: sendGeneralKeyShareParams): Promise { + async sendMsgSubmitEncryptedKeyshare({ value, fee, memo }: sendMsgSubmitEncryptedKeyshareParams): Promise { if (!signer) { - throw new Error('TxClient:sendGeneralKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitEncryptedKeyshare: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.generalKeyShare({ value: GeneralKeyShare.fromPartial(value) }) + let msg = this.msgSubmitEncryptedKeyshare({ value: MsgSubmitEncryptedKeyshare.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGeneralKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitEncryptedKeyshare: Could not broadcast Tx: '+ e.message) } }, - async sendRequestAggrKeysharePacketAck({ value, fee, memo }: sendRequestAggrKeysharePacketAckParams): Promise { + async sendQueryGeneralKeyshareRequest({ value, fee, memo }: sendQueryGeneralKeyshareRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendRequestAggrKeysharePacketAck: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGeneralKeyshareRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.requestAggrKeysharePacketAck({ value: RequestAggrKeysharePacketAck.fromPartial(value) }) + let msg = this.queryGeneralKeyshareRequest({ value: QueryGeneralKeyshareRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendRequestAggrKeysharePacketAck: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGeneralKeyshareRequest: Could not broadcast Tx: '+ e.message) } }, - async sendCounterPartyIBCInfo({ value, fee, memo }: sendCounterPartyIBCInfoParams): Promise { + async sendQueryGeneralKeyshareAllRequest({ value, fee, memo }: sendQueryGeneralKeyshareAllRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendCounterPartyIBCInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGeneralKeyshareAllRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.counterPartyIbcinfo({ value: CounterPartyIBCInfo.fromPartial(value) }) + let msg = this.queryGeneralKeyshareAllRequest({ value: QueryGeneralKeyshareAllRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCounterPartyIBCInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGeneralKeyshareAllRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllKeyShareRequest({ value, fee, memo }: sendQueryAllKeyShareRequestParams): Promise { + async sendPrivateDecryptionKeyDataPacketData({ value, fee, memo }: sendPrivateDecryptionKeyDataPacketDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllKeyShareRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPrivateDecryptionKeyDataPacketData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllKeyShareRequest({ value: QueryAllKeyShareRequest.fromPartial(value) }) + let msg = this.privateDecryptionKeyDataPacketData({ value: PrivateDecryptionKeyDataPacketData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllKeyShareRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPrivateDecryptionKeyDataPacketData: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllGeneralKeyShareRequest({ value, fee, memo }: sendQueryAllGeneralKeyShareRequestParams): Promise { + async sendMsgRegisterValidator({ value, fee, memo }: sendMsgRegisterValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllGeneralKeyShareRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllGeneralKeyShareRequest({ value: QueryAllGeneralKeyShareRequest.fromPartial(value) }) + let msg = this.msgRegisterValidator({ value: MsgRegisterValidator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllGeneralKeyShareRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterValidator: Could not broadcast Tx: '+ e.message) } }, - async sendMsgOverrideLatestPubKeyResponse({ value, fee, memo }: sendMsgOverrideLatestPubKeyResponseParams): Promise { + async sendMsgCreateLatestPubkey({ value, fee, memo }: sendMsgCreateLatestPubkeyParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgOverrideLatestPubKeyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateLatestPubkey: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgOverrideLatestPubKeyResponse({ value: MsgOverrideLatestPubKeyResponse.fromPartial(value) }) + let msg = this.msgCreateLatestPubkey({ value: MsgCreateLatestPubkey.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgOverrideLatestPubKeyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateLatestPubkey: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSendKeyshareResponse({ value, fee, memo }: sendMsgSendKeyshareResponseParams): Promise { + async sendMsgDeleteAuthorizedAddress({ value, fee, memo }: sendMsgDeleteAuthorizedAddressParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSendKeyshareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDeleteAuthorizedAddress: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSendKeyshareResponse({ value: MsgSendKeyshareResponse.fromPartial(value) }) + let msg = this.msgDeleteAuthorizedAddress({ value: MsgDeleteAuthorizedAddress.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSendKeyshareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDeleteAuthorizedAddress: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllValidatorSetResponse({ value, fee, memo }: sendQueryAllValidatorSetResponseParams): Promise { + async sendQueryVerifiableRandomnessResponse({ value, fee, memo }: sendQueryVerifiableRandomnessResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllValidatorSetResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryVerifiableRandomnessResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllValidatorSetResponse({ value: QueryAllValidatorSetResponse.fromPartial(value) }) + let msg = this.queryVerifiableRandomnessResponse({ value: QueryVerifiableRandomnessResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllValidatorSetResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryVerifiableRandomnessResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueuedPubKey({ value, fee, memo }: sendQueuedPubKeyParams): Promise { + async sendQueryValidatorSetAllResponse({ value, fee, memo }: sendQueryValidatorSetAllResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueuedPubKey: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorSetAllResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queuedPubKey({ value: QueuedPubKey.fromPartial(value) }) + let msg = this.queryValidatorSetAllResponse({ value: QueryValidatorSetAllResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueuedPubKey: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorSetAllResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAggrKeyshareDataPacketAck({ value, fee, memo }: sendAggrKeyshareDataPacketAckParams): Promise { + async sendQueryPubkeyRequest({ value, fee, memo }: sendQueryPubkeyRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendAggrKeyshareDataPacketAck: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPubkeyRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.aggrKeyshareDataPacketAck({ value: AggrKeyshareDataPacketAck.fromPartial(value) }) + let msg = this.queryPubkeyRequest({ value: QueryPubkeyRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAggrKeyshareDataPacketAck: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPubkeyRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCommitmentsRequest({ value, fee, memo }: sendQueryCommitmentsRequestParams): Promise { + async sendCurrentKeysPacketAck({ value, fee, memo }: sendCurrentKeysPacketAckParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCommitmentsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCurrentKeysPacketAck: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCommitmentsRequest({ value: QueryCommitmentsRequest.fromPartial(value) }) + let msg = this.currentKeysPacketAck({ value: CurrentKeysPacketAck.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCommitmentsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCurrentKeysPacketAck: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllValidatorSetRequest({ value, fee, memo }: sendQueryAllValidatorSetRequestParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllValidatorSetRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllValidatorSetRequest({ value: QueryAllValidatorSetRequest.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllValidatorSetRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPubKeyResponse({ value, fee, memo }: sendQueryPubKeyResponseParams): Promise { + async sendQueryAuthorizedAddressAllResponse({ value, fee, memo }: sendQueryAuthorizedAddressAllResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPubKeyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAuthorizedAddressAllResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPubKeyResponse({ value: QueryPubKeyResponse.fromPartial(value) }) + let msg = this.queryAuthorizedAddressAllResponse({ value: QueryAuthorizedAddressAllResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPubKeyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAuthorizedAddressAllResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetGeneralKeyShareResponse({ value, fee, memo }: sendQueryGetGeneralKeyShareResponseParams): Promise { + async sendAuthorizedAddress({ value, fee, memo }: sendAuthorizedAddressParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetGeneralKeyShareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAuthorizedAddress: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetGeneralKeyShareResponse({ value: QueryGetGeneralKeyShareResponse.fromPartial(value) }) + let msg = this.authorizedAddress({ value: AuthorizedAddress.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetGeneralKeyShareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAuthorizedAddress: Could not broadcast Tx: '+ e.message) } }, - async sendCommitments({ value, fee, memo }: sendCommitmentsParams): Promise { + async sendCurrentKeysPacketData({ value, fee, memo }: sendCurrentKeysPacketDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendCommitments: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCurrentKeysPacketData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.commitments({ value: Commitments.fromPartial(value) }) + let msg = this.currentKeysPacketData({ value: CurrentKeysPacketData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCommitments: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCurrentKeysPacketData: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllGeneralKeyShareResponse({ value, fee, memo }: sendQueryAllGeneralKeyShareResponseParams): Promise { + async sendMsgUpdateAuthorizedAddress({ value, fee, memo }: sendMsgUpdateAuthorizedAddressParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllGeneralKeyShareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateAuthorizedAddress: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllGeneralKeyShareResponse({ value: QueryAllGeneralKeyShareResponse.fromPartial(value) }) + let msg = this.msgUpdateAuthorizedAddress({ value: MsgUpdateAuthorizedAddress.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllGeneralKeyShareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateAuthorizedAddress: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateGeneralKeyShare({ value, fee, memo }: sendMsgCreateGeneralKeyShareParams): Promise { + async sendValidatorEncryptedKeyshare({ value, fee, memo }: sendValidatorEncryptedKeyshareParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateGeneralKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendValidatorEncryptedKeyshare: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateGeneralKeyShare({ value: MsgCreateGeneralKeyShare.fromPartial(value) }) + let msg = this.validatorEncryptedKeyshare({ value: ValidatorEncryptedKeyshare.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateGeneralKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendValidatorEncryptedKeyshare: Could not broadcast Tx: '+ e.message) } }, - async sendCurrentKeysPacketData({ value, fee, memo }: sendCurrentKeysPacketDataParams): Promise { + async sendMsgRegisterValidatorResponse({ value, fee, memo }: sendMsgRegisterValidatorResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendCurrentKeysPacketData: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterValidatorResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.currentKeysPacketData({ value: CurrentKeysPacketData.fromPartial(value) }) + let msg = this.msgRegisterValidatorResponse({ value: MsgRegisterValidatorResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCurrentKeysPacketData: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterValidatorResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryVerifiableRandomnessResponse({ value, fee, memo }: sendQueryVerifiableRandomnessResponseParams): Promise { + async sendMsgDeRegisterValidator({ value, fee, memo }: sendMsgDeRegisterValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryVerifiableRandomnessResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDeRegisterValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryVerifiableRandomnessResponse({ value: QueryVerifiableRandomnessResponse.fromPartial(value) }) + let msg = this.msgDeRegisterValidator({ value: MsgDeRegisterValidator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryVerifiableRandomnessResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDeRegisterValidator: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllAggregatedKeyShareRequest({ value, fee, memo }: sendQueryAllAggregatedKeyShareRequestParams): Promise { + async sendMsgSendKeyshareResponse({ value, fee, memo }: sendMsgSendKeyshareResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllAggregatedKeyShareRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSendKeyshareResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllAggregatedKeyShareRequest({ value: QueryAllAggregatedKeyShareRequest.fromPartial(value) }) + let msg = this.msgSendKeyshareResponse({ value: MsgSendKeyshareResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllAggregatedKeyShareRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSendKeyshareResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPubKeyRequest({ value, fee, memo }: sendQueryPubKeyRequestParams): Promise { + async sendActivePubkey({ value, fee, memo }: sendActivePubkeyParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPubKeyRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendActivePubkey: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPubKeyRequest({ value: QueryPubKeyRequest.fromPartial(value) }) + let msg = this.activePubkey({ value: ActivePubkey.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPubKeyRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendActivePubkey: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSendKeyshare({ value, fee, memo }: sendMsgSendKeyshareParams): Promise { + async sendCounterPartyIBCInfo({ value, fee, memo }: sendCounterPartyIBCInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSendKeyshare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCounterPartyIBCInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSendKeyshare({ value: MsgSendKeyshare.fromPartial(value) }) + let msg = this.counterPartyIbcinfo({ value: CounterPartyIBCInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSendKeyshare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCounterPartyIBCInfo: Could not broadcast Tx: '+ e.message) } }, - async sendAuthorizedAddress({ value, fee, memo }: sendAuthorizedAddressParams): Promise { + async sendQueryValidatorSetAllRequest({ value, fee, memo }: sendQueryValidatorSetAllRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendAuthorizedAddress: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryValidatorSetAllRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.authorizedAddress({ value: AuthorizedAddress.fromPartial(value) }) + let msg = this.queryValidatorSetAllRequest({ value: QueryValidatorSetAllRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAuthorizedAddress: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryValidatorSetAllRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryKeyshareAllResponse({ value, fee, memo }: sendQueryKeyshareAllResponseParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryKeyshareAllResponse: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryKeyshareAllResponse({ value: QueryKeyshareAllResponse.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryKeyshareAllResponse: Could not broadcast Tx: '+ e.message) + } + }, + + async sendMsgUpdateAuthorizedAddressResponse({ value, fee, memo }: sendMsgUpdateAuthorizedAddressResponseParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgUpdateAuthorizedAddressResponse: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgUpdateAuthorizedAddressResponse({ value: MsgUpdateAuthorizedAddressResponse.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgUpdateAuthorizedAddressResponse: Could not broadcast Tx: '+ e.message) + } + }, + + async sendDecryptionKeyPacketAck({ value, fee, memo }: sendDecryptionKeyPacketAckParams): Promise { + if (!signer) { + throw new Error('TxClient:sendDecryptionKeyPacketAck: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.decryptionKeyPacketAck({ value: DecryptionKeyPacketAck.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendDecryptionKeyPacketAck: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryCommitmentsRequest({ value, fee, memo }: sendQueryCommitmentsRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryCommitmentsRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryCommitmentsRequest({ value: QueryCommitmentsRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryCommitmentsRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryDecryptionKeyRequest({ value, fee, memo }: sendQueryDecryptionKeyRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryDecryptionKeyRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryDecryptionKeyRequest({ value: QueryDecryptionKeyRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryDecryptionKeyRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendMsgDeleteAuthorizedAddressResponse({ value, fee, memo }: sendMsgDeleteAuthorizedAddressResponseParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgDeleteAuthorizedAddressResponse: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgDeleteAuthorizedAddressResponse({ value: MsgDeleteAuthorizedAddressResponse.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgDeleteAuthorizedAddressResponse: Could not broadcast Tx: '+ e.message) } }, - async sendEncryptedKeyShare({ value, fee, memo }: sendEncryptedKeyShareParams): Promise { + async sendRequestDecryptionKeyPacketAck({ value, fee, memo }: sendRequestDecryptionKeyPacketAckParams): Promise { if (!signer) { - throw new Error('TxClient:sendEncryptedKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRequestDecryptionKeyPacketAck: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.encryptedKeyShare({ value: EncryptedKeyShare.fromPartial(value) }) + let msg = this.requestDecryptionKeyPacketAck({ value: RequestDecryptionKeyPacketAck.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEncryptedKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRequestDecryptionKeyPacketAck: Could not broadcast Tx: '+ e.message) } }, - async sendActivePubKey({ value, fee, memo }: sendActivePubKeyParams): Promise { + async sendDecryptionKeyRequest({ value, fee, memo }: sendDecryptionKeyRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendActivePubKey: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDecryptionKeyRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.activePubKey({ value: ActivePubKey.fromPartial(value) }) + let msg = this.decryptionKeyRequest({ value: DecryptionKeyRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendActivePubKey: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDecryptionKeyRequest: Could not broadcast Tx: '+ e.message) } }, @@ -1589,616 +1825,630 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryAllKeyShareResponse({ value, fee, memo }: sendQueryAllKeyShareResponseParams): Promise { + async sendMsgSubmitGeneralKeyshare({ value, fee, memo }: sendMsgSubmitGeneralKeyshareParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllKeyShareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitGeneralKeyshare: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllKeyShareResponse({ value: QueryAllKeyShareResponse.fromPartial(value) }) + let msg = this.msgSubmitGeneralKeyshare({ value: MsgSubmitGeneralKeyshare.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllKeyShareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitGeneralKeyshare: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetAuthorizedAddressResponse({ value, fee, memo }: sendQueryGetAuthorizedAddressResponseParams): Promise { + async sendMsgSubmitEncryptedKeyshareResponse({ value, fee, memo }: sendMsgSubmitEncryptedKeyshareResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetAuthorizedAddressResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitEncryptedKeyshareResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetAuthorizedAddressResponse({ value: QueryGetAuthorizedAddressResponse.fromPartial(value) }) + let msg = this.msgSubmitEncryptedKeyshareResponse({ value: MsgSubmitEncryptedKeyshareResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetAuthorizedAddressResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitEncryptedKeyshareResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetGeneralKeyShareRequest({ value, fee, memo }: sendQueryGetGeneralKeyShareRequestParams): Promise { + async sendKeysharePacketData({ value, fee, memo }: sendKeysharePacketDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetGeneralKeyShareRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendKeysharePacketData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetGeneralKeyShareRequest({ value: QueryGetGeneralKeyShareRequest.fromPartial(value) }) + let msg = this.keysharePacketData({ value: KeysharePacketData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetGeneralKeyShareRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendKeysharePacketData: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRegisterValidator({ value, fee, memo }: sendMsgRegisterValidatorParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRegisterValidator: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRegisterValidator({ value: MsgRegisterValidator.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRegisterValidator: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendValidatorSet({ value, fee, memo }: sendValidatorSetParams): Promise { + async sendKeyshare({ value, fee, memo }: sendKeyshareParams): Promise { if (!signer) { - throw new Error('TxClient:sendValidatorSet: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendKeyshare: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.validatorSet({ value: ValidatorSet.fromPartial(value) }) + let msg = this.keyshare({ value: Keyshare.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendValidatorSet: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendKeyshare: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDeleteAuthorizedAddress({ value, fee, memo }: sendMsgDeleteAuthorizedAddressParams): Promise { + async sendMsgSendKeyshare({ value, fee, memo }: sendMsgSendKeyshareParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgSendKeyshare: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgSendKeyshare({ value: MsgSendKeyshare.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgSendKeyshare: Could not broadcast Tx: '+ e.message) + } + }, + + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDeleteAuthorizedAddress: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgDeleteAuthorizedAddress({ value: MsgDeleteAuthorizedAddress.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDeleteAuthorizedAddress: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetAggregatedKeyShareRequest({ value, fee, memo }: sendQueryGetAggregatedKeyShareRequestParams): Promise { + async sendMsgCreateLatestPubkeyResponse({ value, fee, memo }: sendMsgCreateLatestPubkeyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetAggregatedKeyShareRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateLatestPubkeyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetAggregatedKeyShareRequest({ value: QueryGetAggregatedKeyShareRequest.fromPartial(value) }) + let msg = this.msgCreateLatestPubkeyResponse({ value: MsgCreateLatestPubkeyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetAggregatedKeyShareRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateLatestPubkeyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateAuthorizedAddress({ value, fee, memo }: sendMsgUpdateAuthorizedAddressParams): Promise { + async sendMsgOverrideLatestPubkeyResponse({ value, fee, memo }: sendMsgOverrideLatestPubkeyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateAuthorizedAddress: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgOverrideLatestPubkeyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateAuthorizedAddress({ value: MsgUpdateAuthorizedAddress.fromPartial(value) }) + let msg = this.msgOverrideLatestPubkeyResponse({ value: MsgOverrideLatestPubkeyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateAuthorizedAddress: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgOverrideLatestPubkeyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateAuthorizedAddressResponse({ value, fee, memo }: sendMsgUpdateAuthorizedAddressResponseParams): Promise { + async sendQueuedPubkey({ value, fee, memo }: sendQueuedPubkeyParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateAuthorizedAddressResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueuedPubkey: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateAuthorizedAddressResponse({ value: MsgUpdateAuthorizedAddressResponse.fromPartial(value) }) + let msg = this.queuedPubkey({ value: QueuedPubkey.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateAuthorizedAddressResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueuedPubkey: Could not broadcast Tx: '+ e.message) } }, - async sendRequestAggrKeysharePacketData({ value, fee, memo }: sendRequestAggrKeysharePacketDataParams): Promise { + async sendGetDecryptionKeyPacketAck({ value, fee, memo }: sendGetDecryptionKeyPacketAckParams): Promise { if (!signer) { - throw new Error('TxClient:sendRequestAggrKeysharePacketData: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetDecryptionKeyPacketAck: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.requestAggrKeysharePacketData({ value: RequestAggrKeysharePacketData.fromPartial(value) }) + let msg = this.getDecryptionKeyPacketAck({ value: GetDecryptionKeyPacketAck.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendRequestAggrKeysharePacketData: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetDecryptionKeyPacketAck: Could not broadcast Tx: '+ e.message) } }, - async sendGetAggrKeysharePacketData({ value, fee, memo }: sendGetAggrKeysharePacketDataParams): Promise { + async sendCommitments({ value, fee, memo }: sendCommitmentsParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetAggrKeysharePacketData: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCommitments: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getAggrKeysharePacketData({ value: GetAggrKeysharePacketData.fromPartial(value) }) + let msg = this.commitments({ value: Commitments.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetAggrKeysharePacketData: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCommitments: Could not broadcast Tx: '+ e.message) } }, - async sendGetAggrKeysharePacketAck({ value, fee, memo }: sendGetAggrKeysharePacketAckParams): Promise { + async sendQueryDecryptionKeyAllResponse({ value, fee, memo }: sendQueryDecryptionKeyAllResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGetAggrKeysharePacketAck: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDecryptionKeyAllResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.getAggrKeysharePacketAck({ value: GetAggrKeysharePacketAck.fromPartial(value) }) + let msg = this.queryDecryptionKeyAllResponse({ value: QueryDecryptionKeyAllResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGetAggrKeysharePacketAck: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDecryptionKeyAllResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendQueryAuthorizedAddressRequest({ value, fee, memo }: sendQueryAuthorizedAddressRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAuthorizedAddressRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.queryAuthorizedAddressRequest({ value: QueryAuthorizedAddressRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAuthorizedAddressRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendQueryAuthorizedAddressAllRequest({ value, fee, memo }: sendQueryAuthorizedAddressAllRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryAuthorizedAddressAllRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.queryAuthorizedAddressAllRequest({ value: QueryAuthorizedAddressAllRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryAuthorizedAddressAllRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetAuthorizedAddressRequest({ value, fee, memo }: sendQueryGetAuthorizedAddressRequestParams): Promise { + async sendRequestDecryptionKeyPacketData({ value, fee, memo }: sendRequestDecryptionKeyPacketDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetAuthorizedAddressRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRequestDecryptionKeyPacketData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetAuthorizedAddressRequest({ value: QueryGetAuthorizedAddressRequest.fromPartial(value) }) + let msg = this.requestDecryptionKeyPacketData({ value: RequestDecryptionKeyPacketData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetAuthorizedAddressRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRequestDecryptionKeyPacketData: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRegisterValidatorResponse({ value, fee, memo }: sendMsgRegisterValidatorResponseParams): Promise { + async sendNoData({ value, fee, memo }: sendNoDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRegisterValidatorResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendNoData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRegisterValidatorResponse({ value: MsgRegisterValidatorResponse.fromPartial(value) }) + let msg = this.noData({ value: NoData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRegisterValidatorResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendNoData: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllAuthorizedAddressRequest({ value, fee, memo }: sendQueryAllAuthorizedAddressRequestParams): Promise { + async sendDecryptionKeyDataPacketData({ value, fee, memo }: sendDecryptionKeyDataPacketDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllAuthorizedAddressRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDecryptionKeyDataPacketData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllAuthorizedAddressRequest({ value: QueryAllAuthorizedAddressRequest.fromPartial(value) }) + let msg = this.decryptionKeyDataPacketData({ value: DecryptionKeyDataPacketData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllAuthorizedAddressRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDecryptionKeyDataPacketData: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendGetPrivateDecryptionKeyPacketData({ value, fee, memo }: sendGetPrivateDecryptionKeyPacketDataParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGetPrivateDecryptionKeyPacketData: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.getPrivateDecryptionKeyPacketData({ value: GetPrivateDecryptionKeyPacketData.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGetPrivateDecryptionKeyPacketData: Could not broadcast Tx: '+ e.message) } }, - keyShareRequest({ value }: keyShareRequestParams): EncodeObject { + queryValidatorSetRequest({ value }: queryValidatorSetRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.KeyShareRequest", value: KeyShareRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryValidatorSetRequest", value: QueryValidatorSetRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:KeyShareRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorSetRequest: Could not create message: ' + e.message) } }, - queryGetValidatorSetRequest({ value }: queryGetValidatorSetRequestParams): EncodeObject { + queryValidatorSetResponse({ value }: queryValidatorSetResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetValidatorSetRequest", value: QueryGetValidatorSetRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryValidatorSetResponse", value: QueryValidatorSetResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetValidatorSetRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorSetResponse: Could not create message: ' + e.message) } }, - queryAllAggregatedKeyShareResponse({ value }: queryAllAggregatedKeyShareResponseParams): EncodeObject { + queryDecryptionKeyAllRequest({ value }: queryDecryptionKeyAllRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllAggregatedKeyShareResponse", value: QueryAllAggregatedKeyShareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryDecryptionKeyAllRequest", value: QueryDecryptionKeyAllRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllAggregatedKeyShareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDecryptionKeyAllRequest: Could not create message: ' + e.message) } }, - msgDeRegisterValidatorResponse({ value }: msgDeRegisterValidatorResponseParams): EncodeObject { + queryGeneralKeyshareResponse({ value }: queryGeneralKeyshareResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgDeRegisterValidatorResponse", value: MsgDeRegisterValidatorResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryGeneralKeyshareResponse", value: QueryGeneralKeyshareResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDeRegisterValidatorResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGeneralKeyshareResponse: Could not create message: ' + e.message) } }, - msgCreateLatestPubKeyResponse({ value }: msgCreateLatestPubKeyResponseParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgCreateLatestPubKeyResponse", value: MsgCreateLatestPubKeyResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateLatestPubKeyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - msgCreateAuthorizedAddress({ value }: msgCreateAuthorizedAddressParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgCreateAuthorizedAddress", value: MsgCreateAuthorizedAddress.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateAuthorizedAddress: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - msgCreateGeneralKeyShareResponse({ value }: msgCreateGeneralKeyShareResponseParams): EncodeObject { + msgDeRegisterValidatorResponse({ value }: msgDeRegisterValidatorResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgCreateGeneralKeyShareResponse", value: MsgCreateGeneralKeyShareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgDeRegisterValidatorResponse", value: MsgDeRegisterValidatorResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateGeneralKeyShareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDeRegisterValidatorResponse: Could not create message: ' + e.message) } }, - aggregatedKeyShare({ value }: aggregatedKeyShareParams): EncodeObject { + msgCreateAuthorizedAddressResponse({ value }: msgCreateAuthorizedAddressResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.AggregatedKeyShare", value: AggregatedKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgCreateAuthorizedAddressResponse", value: MsgCreateAuthorizedAddressResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AggregatedKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateAuthorizedAddressResponse: Could not create message: ' + e.message) } }, - keysharePacketData({ value }: keysharePacketDataParams): EncodeObject { + requestPrivateDecryptionKeyPacketAck({ value }: requestPrivateDecryptionKeyPacketAckParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.KeysharePacketData", value: KeysharePacketData.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.RequestPrivateDecryptionKeyPacketAck", value: RequestPrivateDecryptionKeyPacketAck.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:KeysharePacketData: Could not create message: ' + e.message) + throw new Error('TxClient:RequestPrivateDecryptionKeyPacketAck: Could not create message: ' + e.message) } }, - msgDeRegisterValidator({ value }: msgDeRegisterValidatorParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgDeRegisterValidator", value: MsgDeRegisterValidator.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDeRegisterValidator: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, - msgDeleteAuthorizedAddressResponse({ value }: msgDeleteAuthorizedAddressResponseParams): EncodeObject { + queryCommitmentsResponse({ value }: queryCommitmentsResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgDeleteAuthorizedAddressResponse", value: MsgDeleteAuthorizedAddressResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryCommitmentsResponse", value: QueryCommitmentsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDeleteAuthorizedAddressResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCommitmentsResponse: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryDecryptionKeyResponse({ value }: queryDecryptionKeyResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryDecryptionKeyResponse", value: QueryDecryptionKeyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDecryptionKeyResponse: Could not create message: ' + e.message) } }, - noData({ value }: noDataParams): EncodeObject { + decryptionKey({ value }: decryptionKeyParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.NoData", value: NoData.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.DecryptionKey", value: DecryptionKey.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:NoData: Could not create message: ' + e.message) + throw new Error('TxClient:DecryptionKey: Could not create message: ' + e.message) } }, - queryCommitmentsResponse({ value }: queryCommitmentsResponseParams): EncodeObject { + privateDecryptionKeyRequest({ value }: privateDecryptionKeyRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryCommitmentsResponse", value: QueryCommitmentsResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.PrivateDecryptionKeyRequest", value: PrivateDecryptionKeyRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCommitmentsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:PrivateDecryptionKeyRequest: Could not create message: ' + e.message) } }, - msgCreateLatestPubKey({ value }: msgCreateLatestPubKeyParams): EncodeObject { + queryKeyshareRequest({ value }: queryKeyshareRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgCreateLatestPubKey", value: MsgCreateLatestPubKey.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryKeyshareRequest", value: QueryKeyshareRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateLatestPubKey: Could not create message: ' + e.message) + throw new Error('TxClient:QueryKeyshareRequest: Could not create message: ' + e.message) } }, - keyShare({ value }: keyShareParams): EncodeObject { + queryKeyshareResponse({ value }: queryKeyshareResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.KeyShare", value: KeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryKeyshareResponse", value: QueryKeyshareResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:KeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:QueryKeyshareResponse: Could not create message: ' + e.message) } }, - msgCreateAuthorizedAddressResponse({ value }: msgCreateAuthorizedAddressResponseParams): EncodeObject { + queryPubkeyResponse({ value }: queryPubkeyResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgCreateAuthorizedAddressResponse", value: MsgCreateAuthorizedAddressResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryPubkeyResponse", value: QueryPubkeyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateAuthorizedAddressResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPubkeyResponse: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + getDecryptionKeyPacketData({ value }: getDecryptionKeyPacketDataParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.GetDecryptionKeyPacketData", value: GetDecryptionKeyPacketData.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GetDecryptionKeyPacketData: Could not create message: ' + e.message) } }, - queryGetKeyShareRequest({ value }: queryGetKeyShareRequestParams): EncodeObject { + msgOverrideLatestPubkey({ value }: msgOverrideLatestPubkeyParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetKeyShareRequest", value: QueryGetKeyShareRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgOverrideLatestPubkey", value: MsgOverrideLatestPubkey.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetKeyShareRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgOverrideLatestPubkey: Could not create message: ' + e.message) } }, - aggrKeyshareDataPacketData({ value }: aggrKeyshareDataPacketDataParams): EncodeObject { + privateDecryptionKeyPacketAck({ value }: privateDecryptionKeyPacketAckParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.AggrKeyshareDataPacketData", value: AggrKeyshareDataPacketData.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.PrivateDecryptionKeyPacketAck", value: PrivateDecryptionKeyPacketAck.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AggrKeyshareDataPacketData: Could not create message: ' + e.message) + throw new Error('TxClient:PrivateDecryptionKeyPacketAck: Could not create message: ' + e.message) } }, - currentKeysPacketAck({ value }: currentKeysPacketAckParams): EncodeObject { + msgCreateAuthorizedAddress({ value }: msgCreateAuthorizedAddressParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.CurrentKeysPacketAck", value: CurrentKeysPacketAck.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgCreateAuthorizedAddress", value: MsgCreateAuthorizedAddress.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:CurrentKeysPacketAck: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateAuthorizedAddress: Could not create message: ' + e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + queryGeneralKeyshareAllResponse({ value }: queryGeneralKeyshareAllResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryGeneralKeyshareAllResponse", value: QueryGeneralKeyshareAllResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGeneralKeyshareAllResponse: Could not create message: ' + e.message) } }, - queryGetKeyShareResponse({ value }: queryGetKeyShareResponseParams): EncodeObject { + generalKeyshare({ value }: generalKeyshareParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetKeyShareResponse", value: QueryGetKeyShareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.GeneralKeyshare", value: GeneralKeyshare.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetKeyShareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GeneralKeyshare: Could not create message: ' + e.message) } }, - msgOverrideLatestPubKey({ value }: msgOverrideLatestPubKeyParams): EncodeObject { + requestPrivateDecryptionKeyPacketData({ value }: requestPrivateDecryptionKeyPacketDataParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgOverrideLatestPubKey", value: MsgOverrideLatestPubKey.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.RequestPrivateDecryptionKeyPacketData", value: RequestPrivateDecryptionKeyPacketData.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgOverrideLatestPubKey: Could not create message: ' + e.message) + throw new Error('TxClient:RequestPrivateDecryptionKeyPacketData: Could not create message: ' + e.message) } }, - queryVerifiableRandomnessQuery({ value }: queryVerifiableRandomnessQueryParams): EncodeObject { + msgSubmitGeneralKeyshareResponse({ value }: msgSubmitGeneralKeyshareResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryVerifiableRandomnessQuery", value: QueryVerifiableRandomnessQuery.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgSubmitGeneralKeyshareResponse", value: MsgSubmitGeneralKeyshareResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVerifiableRandomnessQuery: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitGeneralKeyshareResponse: Could not create message: ' + e.message) } }, - queryGetValidatorSetResponse({ value }: queryGetValidatorSetResponseParams): EncodeObject { + encryptedKeyshare({ value }: encryptedKeyshareParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetValidatorSetResponse", value: QueryGetValidatorSetResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.EncryptedKeyshare", value: EncryptedKeyshare.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetValidatorSetResponse: Could not create message: ' + e.message) + throw new Error('TxClient:EncryptedKeyshare: Could not create message: ' + e.message) } }, - queryGetAggregatedKeyShareResponse({ value }: queryGetAggregatedKeyShareResponseParams): EncodeObject { + validatorSet({ value }: validatorSetParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetAggregatedKeyShareResponse", value: QueryGetAggregatedKeyShareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.ValidatorSet", value: ValidatorSet.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetAggregatedKeyShareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorSet: Could not create message: ' + e.message) } }, - queryAllAuthorizedAddressResponse({ value }: queryAllAuthorizedAddressResponseParams): EncodeObject { + queryVerifiableRandomnessRequest({ value }: queryVerifiableRandomnessRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllAuthorizedAddressResponse", value: QueryAllAuthorizedAddressResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryVerifiableRandomnessRequest", value: QueryVerifiableRandomnessRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllAuthorizedAddressResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVerifiableRandomnessRequest: Could not create message: ' + e.message) } }, - generalKeyShare({ value }: generalKeyShareParams): EncodeObject { + queryKeyshareAllRequest({ value }: queryKeyshareAllRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.GeneralKeyShare", value: GeneralKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryKeyshareAllRequest", value: QueryKeyshareAllRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GeneralKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:QueryKeyshareAllRequest: Could not create message: ' + e.message) } }, - requestAggrKeysharePacketAck({ value }: requestAggrKeysharePacketAckParams): EncodeObject { + queryAuthorizedAddressResponse({ value }: queryAuthorizedAddressResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.RequestAggrKeysharePacketAck", value: RequestAggrKeysharePacketAck.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryAuthorizedAddressResponse", value: QueryAuthorizedAddressResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:RequestAggrKeysharePacketAck: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAuthorizedAddressResponse: Could not create message: ' + e.message) } }, - counterPartyIbcinfo({ value }: counterPartyIbcinfoParams): EncodeObject { + getPrivateDecryptionKeyPacketAck({ value }: getPrivateDecryptionKeyPacketAckParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.CounterPartyIBCInfo", value: CounterPartyIBCInfo.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.GetPrivateDecryptionKeyPacketAck", value: GetPrivateDecryptionKeyPacketAck.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:CounterPartyIBCInfo: Could not create message: ' + e.message) + throw new Error('TxClient:GetPrivateDecryptionKeyPacketAck: Could not create message: ' + e.message) } }, - queryAllKeyShareRequest({ value }: queryAllKeyShareRequestParams): EncodeObject { + msgSubmitEncryptedKeyshare({ value }: msgSubmitEncryptedKeyshareParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllKeyShareRequest", value: QueryAllKeyShareRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgSubmitEncryptedKeyshare", value: MsgSubmitEncryptedKeyshare.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllKeyShareRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitEncryptedKeyshare: Could not create message: ' + e.message) } }, - queryAllGeneralKeyShareRequest({ value }: queryAllGeneralKeyShareRequestParams): EncodeObject { + queryGeneralKeyshareRequest({ value }: queryGeneralKeyshareRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllGeneralKeyShareRequest", value: QueryAllGeneralKeyShareRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryGeneralKeyshareRequest", value: QueryGeneralKeyshareRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllGeneralKeyShareRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGeneralKeyshareRequest: Could not create message: ' + e.message) } }, - msgOverrideLatestPubKeyResponse({ value }: msgOverrideLatestPubKeyResponseParams): EncodeObject { + queryGeneralKeyshareAllRequest({ value }: queryGeneralKeyshareAllRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgOverrideLatestPubKeyResponse", value: MsgOverrideLatestPubKeyResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryGeneralKeyshareAllRequest", value: QueryGeneralKeyshareAllRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgOverrideLatestPubKeyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGeneralKeyshareAllRequest: Could not create message: ' + e.message) } }, - msgSendKeyshareResponse({ value }: msgSendKeyshareResponseParams): EncodeObject { + privateDecryptionKeyDataPacketData({ value }: privateDecryptionKeyDataPacketDataParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgSendKeyshareResponse", value: MsgSendKeyshareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.PrivateDecryptionKeyDataPacketData", value: PrivateDecryptionKeyDataPacketData.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSendKeyshareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:PrivateDecryptionKeyDataPacketData: Could not create message: ' + e.message) } }, - queryAllValidatorSetResponse({ value }: queryAllValidatorSetResponseParams): EncodeObject { + msgRegisterValidator({ value }: msgRegisterValidatorParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllValidatorSetResponse", value: QueryAllValidatorSetResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgRegisterValidator", value: MsgRegisterValidator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllValidatorSetResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRegisterValidator: Could not create message: ' + e.message) } }, - queuedPubKey({ value }: queuedPubKeyParams): EncodeObject { + msgCreateLatestPubkey({ value }: msgCreateLatestPubkeyParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueuedPubKey", value: QueuedPubKey.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgCreateLatestPubkey", value: MsgCreateLatestPubkey.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueuedPubKey: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateLatestPubkey: Could not create message: ' + e.message) } }, - aggrKeyshareDataPacketAck({ value }: aggrKeyshareDataPacketAckParams): EncodeObject { + msgDeleteAuthorizedAddress({ value }: msgDeleteAuthorizedAddressParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.AggrKeyshareDataPacketAck", value: AggrKeyshareDataPacketAck.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgDeleteAuthorizedAddress", value: MsgDeleteAuthorizedAddress.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AggrKeyshareDataPacketAck: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDeleteAuthorizedAddress: Could not create message: ' + e.message) } }, - queryCommitmentsRequest({ value }: queryCommitmentsRequestParams): EncodeObject { + queryVerifiableRandomnessResponse({ value }: queryVerifiableRandomnessResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryCommitmentsRequest", value: QueryCommitmentsRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryVerifiableRandomnessResponse", value: QueryVerifiableRandomnessResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCommitmentsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryVerifiableRandomnessResponse: Could not create message: ' + e.message) } }, - queryAllValidatorSetRequest({ value }: queryAllValidatorSetRequestParams): EncodeObject { + queryValidatorSetAllResponse({ value }: queryValidatorSetAllResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllValidatorSetRequest", value: QueryAllValidatorSetRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryValidatorSetAllResponse", value: QueryValidatorSetAllResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllValidatorSetRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryValidatorSetAllResponse: Could not create message: ' + e.message) } }, - queryPubKeyResponse({ value }: queryPubKeyResponseParams): EncodeObject { + queryPubkeyRequest({ value }: queryPubkeyRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryPubKeyResponse", value: QueryPubKeyResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryPubkeyRequest", value: QueryPubkeyRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPubKeyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPubkeyRequest: Could not create message: ' + e.message) } }, - queryGetGeneralKeyShareResponse({ value }: queryGetGeneralKeyShareResponseParams): EncodeObject { + currentKeysPacketAck({ value }: currentKeysPacketAckParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetGeneralKeyShareResponse", value: QueryGetGeneralKeyShareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.CurrentKeysPacketAck", value: CurrentKeysPacketAck.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetGeneralKeyShareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:CurrentKeysPacketAck: Could not create message: ' + e.message) } }, - commitments({ value }: commitmentsParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.Commitments", value: Commitments.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Commitments: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - queryAllGeneralKeyShareResponse({ value }: queryAllGeneralKeyShareResponseParams): EncodeObject { + queryAuthorizedAddressAllResponse({ value }: queryAuthorizedAddressAllResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllGeneralKeyShareResponse", value: QueryAllGeneralKeyShareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryAuthorizedAddressAllResponse", value: QueryAuthorizedAddressAllResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllGeneralKeyShareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAuthorizedAddressAllResponse: Could not create message: ' + e.message) } }, - msgCreateGeneralKeyShare({ value }: msgCreateGeneralKeyShareParams): EncodeObject { + authorizedAddress({ value }: authorizedAddressParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgCreateGeneralKeyShare", value: MsgCreateGeneralKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.AuthorizedAddress", value: AuthorizedAddress.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateGeneralKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:AuthorizedAddress: Could not create message: ' + e.message) } }, @@ -2210,59 +2460,131 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryVerifiableRandomnessResponse({ value }: queryVerifiableRandomnessResponseParams): EncodeObject { + msgUpdateAuthorizedAddress({ value }: msgUpdateAuthorizedAddressParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryVerifiableRandomnessResponse", value: QueryVerifiableRandomnessResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgUpdateAuthorizedAddress", value: MsgUpdateAuthorizedAddress.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryVerifiableRandomnessResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateAuthorizedAddress: Could not create message: ' + e.message) } }, - queryAllAggregatedKeyShareRequest({ value }: queryAllAggregatedKeyShareRequestParams): EncodeObject { + validatorEncryptedKeyshare({ value }: validatorEncryptedKeyshareParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllAggregatedKeyShareRequest", value: QueryAllAggregatedKeyShareRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.ValidatorEncryptedKeyshare", value: ValidatorEncryptedKeyshare.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllAggregatedKeyShareRequest: Could not create message: ' + e.message) + throw new Error('TxClient:ValidatorEncryptedKeyshare: Could not create message: ' + e.message) } }, - queryPubKeyRequest({ value }: queryPubKeyRequestParams): EncodeObject { + msgRegisterValidatorResponse({ value }: msgRegisterValidatorResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryPubKeyRequest", value: QueryPubKeyRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgRegisterValidatorResponse", value: MsgRegisterValidatorResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPubKeyRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRegisterValidatorResponse: Could not create message: ' + e.message) } }, - msgSendKeyshare({ value }: msgSendKeyshareParams): EncodeObject { + msgDeRegisterValidator({ value }: msgDeRegisterValidatorParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgSendKeyshare", value: MsgSendKeyshare.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgDeRegisterValidator", value: MsgDeRegisterValidator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSendKeyshare: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDeRegisterValidator: Could not create message: ' + e.message) } }, - authorizedAddress({ value }: authorizedAddressParams): EncodeObject { + msgSendKeyshareResponse({ value }: msgSendKeyshareResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.AuthorizedAddress", value: AuthorizedAddress.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgSendKeyshareResponse", value: MsgSendKeyshareResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AuthorizedAddress: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSendKeyshareResponse: Could not create message: ' + e.message) + } + }, + + activePubkey({ value }: activePubkeyParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.ActivePubkey", value: ActivePubkey.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:ActivePubkey: Could not create message: ' + e.message) + } + }, + + counterPartyIbcinfo({ value }: counterPartyIbcinfoParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.CounterPartyIBCInfo", value: CounterPartyIBCInfo.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:CounterPartyIBCInfo: Could not create message: ' + e.message) + } + }, + + queryValidatorSetAllRequest({ value }: queryValidatorSetAllRequestParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.QueryValidatorSetAllRequest", value: QueryValidatorSetAllRequest.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryValidatorSetAllRequest: Could not create message: ' + e.message) + } + }, + + queryKeyshareAllResponse({ value }: queryKeyshareAllResponseParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.QueryKeyshareAllResponse", value: QueryKeyshareAllResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryKeyshareAllResponse: Could not create message: ' + e.message) + } + }, + + msgUpdateAuthorizedAddressResponse({ value }: msgUpdateAuthorizedAddressResponseParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.MsgUpdateAuthorizedAddressResponse", value: MsgUpdateAuthorizedAddressResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgUpdateAuthorizedAddressResponse: Could not create message: ' + e.message) + } + }, + + decryptionKeyPacketAck({ value }: decryptionKeyPacketAckParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.DecryptionKeyPacketAck", value: DecryptionKeyPacketAck.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:DecryptionKeyPacketAck: Could not create message: ' + e.message) + } + }, + + queryCommitmentsRequest({ value }: queryCommitmentsRequestParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.QueryCommitmentsRequest", value: QueryCommitmentsRequest.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryCommitmentsRequest: Could not create message: ' + e.message) + } + }, + + queryDecryptionKeyRequest({ value }: queryDecryptionKeyRequestParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.QueryDecryptionKeyRequest", value: QueryDecryptionKeyRequest.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryDecryptionKeyRequest: Could not create message: ' + e.message) + } + }, + + msgDeleteAuthorizedAddressResponse({ value }: msgDeleteAuthorizedAddressResponseParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.MsgDeleteAuthorizedAddressResponse", value: MsgDeleteAuthorizedAddressResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgDeleteAuthorizedAddressResponse: Could not create message: ' + e.message) } }, - encryptedKeyShare({ value }: encryptedKeyShareParams): EncodeObject { + requestDecryptionKeyPacketAck({ value }: requestDecryptionKeyPacketAckParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.EncryptedKeyShare", value: EncryptedKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.RequestDecryptionKeyPacketAck", value: RequestDecryptionKeyPacketAck.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EncryptedKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:RequestDecryptionKeyPacketAck: Could not create message: ' + e.message) } }, - activePubKey({ value }: activePubKeyParams): EncodeObject { + decryptionKeyRequest({ value }: decryptionKeyRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.ActivePubKey", value: ActivePubKey.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.DecryptionKeyRequest", value: DecryptionKeyRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ActivePubKey: Could not create message: ' + e.message) + throw new Error('TxClient:DecryptionKeyRequest: Could not create message: ' + e.message) } }, @@ -2274,147 +2596,155 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryAllKeyShareResponse({ value }: queryAllKeyShareResponseParams): EncodeObject { + msgSubmitGeneralKeyshare({ value }: msgSubmitGeneralKeyshareParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllKeyShareResponse", value: QueryAllKeyShareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgSubmitGeneralKeyshare", value: MsgSubmitGeneralKeyshare.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllKeyShareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitGeneralKeyshare: Could not create message: ' + e.message) } }, - queryGetAuthorizedAddressResponse({ value }: queryGetAuthorizedAddressResponseParams): EncodeObject { + msgSubmitEncryptedKeyshareResponse({ value }: msgSubmitEncryptedKeyshareResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetAuthorizedAddressResponse", value: QueryGetAuthorizedAddressResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgSubmitEncryptedKeyshareResponse", value: MsgSubmitEncryptedKeyshareResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetAuthorizedAddressResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitEncryptedKeyshareResponse: Could not create message: ' + e.message) } }, - queryGetGeneralKeyShareRequest({ value }: queryGetGeneralKeyShareRequestParams): EncodeObject { + keysharePacketData({ value }: keysharePacketDataParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetGeneralKeyShareRequest", value: QueryGetGeneralKeyShareRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.KeysharePacketData", value: KeysharePacketData.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetGeneralKeyShareRequest: Could not create message: ' + e.message) + throw new Error('TxClient:KeysharePacketData: Could not create message: ' + e.message) } }, - msgRegisterValidator({ value }: msgRegisterValidatorParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgRegisterValidator", value: MsgRegisterValidator.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRegisterValidator: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - validatorSet({ value }: validatorSetParams): EncodeObject { + keyshare({ value }: keyshareParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.ValidatorSet", value: ValidatorSet.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.Keyshare", value: Keyshare.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ValidatorSet: Could not create message: ' + e.message) + throw new Error('TxClient:Keyshare: Could not create message: ' + e.message) } }, - msgDeleteAuthorizedAddress({ value }: msgDeleteAuthorizedAddressParams): EncodeObject { + msgSendKeyshare({ value }: msgSendKeyshareParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgDeleteAuthorizedAddress", value: MsgDeleteAuthorizedAddress.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgSendKeyshare", value: MsgSendKeyshare.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDeleteAuthorizedAddress: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSendKeyshare: Could not create message: ' + e.message) } }, - queryGetAggregatedKeyShareRequest({ value }: queryGetAggregatedKeyShareRequestParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetAggregatedKeyShareRequest", value: QueryGetAggregatedKeyShareRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetAggregatedKeyShareRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - msgUpdateAuthorizedAddress({ value }: msgUpdateAuthorizedAddressParams): EncodeObject { + msgCreateLatestPubkeyResponse({ value }: msgCreateLatestPubkeyResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgUpdateAuthorizedAddress", value: MsgUpdateAuthorizedAddress.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgCreateLatestPubkeyResponse", value: MsgCreateLatestPubkeyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateAuthorizedAddress: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateLatestPubkeyResponse: Could not create message: ' + e.message) } }, - msgUpdateAuthorizedAddressResponse({ value }: msgUpdateAuthorizedAddressResponseParams): EncodeObject { + msgOverrideLatestPubkeyResponse({ value }: msgOverrideLatestPubkeyResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgUpdateAuthorizedAddressResponse", value: MsgUpdateAuthorizedAddressResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgOverrideLatestPubkeyResponse", value: MsgOverrideLatestPubkeyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateAuthorizedAddressResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgOverrideLatestPubkeyResponse: Could not create message: ' + e.message) } }, - requestAggrKeysharePacketData({ value }: requestAggrKeysharePacketDataParams): EncodeObject { + queuedPubkey({ value }: queuedPubkeyParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.RequestAggrKeysharePacketData", value: RequestAggrKeysharePacketData.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueuedPubkey", value: QueuedPubkey.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:RequestAggrKeysharePacketData: Could not create message: ' + e.message) + throw new Error('TxClient:QueuedPubkey: Could not create message: ' + e.message) } }, - getAggrKeysharePacketData({ value }: getAggrKeysharePacketDataParams): EncodeObject { + getDecryptionKeyPacketAck({ value }: getDecryptionKeyPacketAckParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.GetAggrKeysharePacketData", value: GetAggrKeysharePacketData.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.GetDecryptionKeyPacketAck", value: GetDecryptionKeyPacketAck.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetAggrKeysharePacketData: Could not create message: ' + e.message) + throw new Error('TxClient:GetDecryptionKeyPacketAck: Could not create message: ' + e.message) } }, - getAggrKeysharePacketAck({ value }: getAggrKeysharePacketAckParams): EncodeObject { + commitments({ value }: commitmentsParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.GetAggrKeysharePacketAck", value: GetAggrKeysharePacketAck.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.Commitments", value: Commitments.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GetAggrKeysharePacketAck: Could not create message: ' + e.message) + throw new Error('TxClient:Commitments: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + queryDecryptionKeyAllResponse({ value }: queryDecryptionKeyAllResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryDecryptionKeyAllResponse", value: QueryDecryptionKeyAllResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDecryptionKeyAllResponse: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + queryAuthorizedAddressRequest({ value }: queryAuthorizedAddressRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryAuthorizedAddressRequest", value: QueryAuthorizedAddressRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAuthorizedAddressRequest: Could not create message: ' + e.message) } }, - queryGetAuthorizedAddressRequest({ value }: queryGetAuthorizedAddressRequestParams): EncodeObject { + queryAuthorizedAddressAllRequest({ value }: queryAuthorizedAddressAllRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryGetAuthorizedAddressRequest", value: QueryGetAuthorizedAddressRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.QueryAuthorizedAddressAllRequest", value: QueryAuthorizedAddressAllRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetAuthorizedAddressRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryAuthorizedAddressAllRequest: Could not create message: ' + e.message) } }, - msgRegisterValidatorResponse({ value }: msgRegisterValidatorResponseParams): EncodeObject { + requestDecryptionKeyPacketData({ value }: requestDecryptionKeyPacketDataParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgRegisterValidatorResponse", value: MsgRegisterValidatorResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.RequestDecryptionKeyPacketData", value: RequestDecryptionKeyPacketData.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRegisterValidatorResponse: Could not create message: ' + e.message) + throw new Error('TxClient:RequestDecryptionKeyPacketData: Could not create message: ' + e.message) + } + }, + + noData({ value }: noDataParams): EncodeObject { + try { + return { typeUrl: "/fairyring.keyshare.NoData", value: NoData.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:NoData: Could not create message: ' + e.message) } }, - queryAllAuthorizedAddressRequest({ value }: queryAllAuthorizedAddressRequestParams): EncodeObject { + decryptionKeyDataPacketData({ value }: decryptionKeyDataPacketDataParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.QueryAllAuthorizedAddressRequest", value: QueryAllAuthorizedAddressRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.DecryptionKeyDataPacketData", value: DecryptionKeyDataPacketData.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllAuthorizedAddressRequest: Could not create message: ' + e.message) + throw new Error('TxClient:DecryptionKeyDataPacketData: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + getPrivateDecryptionKeyPacketData({ value }: getPrivateDecryptionKeyPacketDataParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.GetPrivateDecryptionKeyPacketData", value: GetPrivateDecryptionKeyPacketData.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:GetPrivateDecryptionKeyPacketData: Could not create message: ' + e.message) } }, diff --git a/ts-client/fairyring.keyshare/registry.ts b/ts-client/fairyring.keyshare/registry.ts index 65cd1663..185b3d54 100755 --- a/ts-client/fairyring.keyshare/registry.ts +++ b/ts-client/fairyring.keyshare/registry.ts @@ -1,150 +1,170 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { KeyShareRequest } from "./types/fairyring/keyshare/requested_keyshare"; -import { QueryGetValidatorSetRequest } from "./types/fairyring/keyshare/query"; -import { QueryAllAggregatedKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { MsgDeRegisterValidatorResponse } from "./types/fairyring/keyshare/tx"; -import { MsgCreateLatestPubKeyResponse } from "./types/fairyring/keyshare/tx"; -import { MsgCreateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgCreateGeneralKeyShareResponse } from "./types/fairyring/keyshare/tx"; -import { AggregatedKeyShare } from "./types/fairyring/keyshare/aggregated_key_share"; -import { KeysharePacketData } from "./types/fairyring/keyshare/packet"; -import { MsgDeRegisterValidator } from "./types/fairyring/keyshare/tx"; -import { MsgDeleteAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; +import { QueryValidatorSetRequest } from "./types/fairyring/keyshare/query"; +import { QueryValidatorSetResponse } from "./types/fairyring/keyshare/query"; +import { QueryDecryptionKeyAllRequest } from "./types/fairyring/keyshare/query"; +import { QueryGeneralKeyshareResponse } from "./types/fairyring/keyshare/query"; import { GenesisState } from "./types/fairyring/keyshare/genesis"; -import { NoData } from "./types/fairyring/keyshare/packet"; -import { QueryCommitmentsResponse } from "./types/fairyring/keyshare/query"; -import { MsgCreateLatestPubKey } from "./types/fairyring/keyshare/tx"; -import { KeyShare } from "./types/fairyring/keyshare/key_share"; +import { MsgUpdateParams } from "./types/fairyring/keyshare/tx"; +import { MsgDeRegisterValidatorResponse } from "./types/fairyring/keyshare/tx"; import { MsgCreateAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; -import { MsgUpdateParamsResponse } from "./types/fairyring/keyshare/tx"; -import { QueryGetKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { AggrKeyshareDataPacketData } from "./types/fairyring/keyshare/packet"; -import { CurrentKeysPacketAck } from "./types/fairyring/keyshare/packet"; -import { QueryParamsResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { MsgOverrideLatestPubKey } from "./types/fairyring/keyshare/tx"; -import { QueryVerifiableRandomnessQuery } from "./types/fairyring/keyshare/query"; -import { QueryGetValidatorSetResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetAggregatedKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { QueryAllAuthorizedAddressResponse } from "./types/fairyring/keyshare/query"; -import { GeneralKeyShare } from "./types/fairyring/keyshare/general_key_share"; -import { RequestAggrKeysharePacketAck } from "./types/fairyring/keyshare/packet"; -import { CounterPartyIBCInfo } from "./types/fairyring/keyshare/requested_keyshare"; -import { QueryAllKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { QueryAllGeneralKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { MsgOverrideLatestPubKeyResponse } from "./types/fairyring/keyshare/tx"; -import { MsgSendKeyshareResponse } from "./types/fairyring/keyshare/tx"; -import { QueryAllValidatorSetResponse } from "./types/fairyring/keyshare/query"; -import { QueuedPubKey } from "./types/fairyring/keyshare/pub_key"; -import { AggrKeyshareDataPacketAck } from "./types/fairyring/keyshare/packet"; -import { QueryCommitmentsRequest } from "./types/fairyring/keyshare/query"; -import { QueryAllValidatorSetRequest } from "./types/fairyring/keyshare/query"; -import { QueryPubKeyResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetGeneralKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { Commitments } from "./types/fairyring/keyshare/commitments"; -import { QueryAllGeneralKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { MsgCreateGeneralKeyShare } from "./types/fairyring/keyshare/tx"; -import { CurrentKeysPacketData } from "./types/fairyring/keyshare/packet"; -import { QueryVerifiableRandomnessResponse } from "./types/fairyring/keyshare/query"; -import { QueryAllAggregatedKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { QueryPubKeyRequest } from "./types/fairyring/keyshare/query"; -import { MsgSendKeyshare } from "./types/fairyring/keyshare/tx"; -import { AuthorizedAddress } from "./types/fairyring/keyshare/authorized_address"; -import { EncryptedKeyShare } from "./types/fairyring/keyshare/pub_key"; -import { ActivePubKey } from "./types/fairyring/keyshare/pub_key"; -import { IBCInfo } from "./types/fairyring/keyshare/requested_keyshare"; -import { QueryAllKeyShareResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetAuthorizedAddressResponse } from "./types/fairyring/keyshare/query"; -import { QueryGetGeneralKeyShareRequest } from "./types/fairyring/keyshare/query"; -import { MsgRegisterValidator } from "./types/fairyring/keyshare/tx"; +import { RequestPrivateDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { QueryParamsRequest } from "./types/fairyring/keyshare/query"; +import { QueryCommitmentsResponse } from "./types/fairyring/keyshare/query"; +import { QueryDecryptionKeyResponse } from "./types/fairyring/keyshare/query"; +import { DecryptionKey } from "./types/fairyring/keyshare/decryption_key"; +import { PrivateDecryptionKeyRequest } from "./types/fairyring/keyshare/requested_decryption_key"; +import { QueryKeyshareRequest } from "./types/fairyring/keyshare/query"; +import { QueryKeyshareResponse } from "./types/fairyring/keyshare/query"; +import { QueryPubkeyResponse } from "./types/fairyring/keyshare/query"; +import { GetDecryptionKeyPacketData } from "./types/fairyring/keyshare/packet"; +import { MsgOverrideLatestPubkey } from "./types/fairyring/keyshare/tx"; +import { PrivateDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { MsgCreateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; +import { QueryGeneralKeyshareAllResponse } from "./types/fairyring/keyshare/query"; +import { GeneralKeyshare } from "./types/fairyring/keyshare/keyshare"; +import { RequestPrivateDecryptionKeyPacketData } from "./types/fairyring/keyshare/packet"; +import { MsgSubmitGeneralKeyshareResponse } from "./types/fairyring/keyshare/tx"; +import { EncryptedKeyshare } from "./types/fairyring/keyshare/pubkey"; import { ValidatorSet } from "./types/fairyring/keyshare/validator_set"; +import { QueryVerifiableRandomnessRequest } from "./types/fairyring/keyshare/query"; +import { QueryKeyshareAllRequest } from "./types/fairyring/keyshare/query"; +import { QueryAuthorizedAddressResponse } from "./types/fairyring/keyshare/query"; +import { GetPrivateDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { MsgSubmitEncryptedKeyshare } from "./types/fairyring/keyshare/tx"; +import { QueryGeneralKeyshareRequest } from "./types/fairyring/keyshare/query"; +import { QueryGeneralKeyshareAllRequest } from "./types/fairyring/keyshare/query"; +import { PrivateDecryptionKeyDataPacketData } from "./types/fairyring/keyshare/packet"; +import { MsgRegisterValidator } from "./types/fairyring/keyshare/tx"; +import { MsgCreateLatestPubkey } from "./types/fairyring/keyshare/tx"; import { MsgDeleteAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { QueryGetAggregatedKeyShareRequest } from "./types/fairyring/keyshare/query"; +import { QueryVerifiableRandomnessResponse } from "./types/fairyring/keyshare/query"; +import { QueryValidatorSetAllResponse } from "./types/fairyring/keyshare/query"; +import { QueryPubkeyRequest } from "./types/fairyring/keyshare/query"; +import { CurrentKeysPacketAck } from "./types/fairyring/keyshare/packet"; +import { Params } from "./types/fairyring/keyshare/params"; +import { QueryAuthorizedAddressAllResponse } from "./types/fairyring/keyshare/query"; +import { AuthorizedAddress } from "./types/fairyring/keyshare/authorized_address"; +import { CurrentKeysPacketData } from "./types/fairyring/keyshare/packet"; import { MsgUpdateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgUpdateAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; -import { RequestAggrKeysharePacketData } from "./types/fairyring/keyshare/packet"; -import { GetAggrKeysharePacketData } from "./types/fairyring/keyshare/packet"; -import { GetAggrKeysharePacketAck } from "./types/fairyring/keyshare/packet"; -import { QueryParamsRequest } from "./types/fairyring/keyshare/query"; -import { MsgUpdateParams } from "./types/fairyring/keyshare/tx"; -import { QueryGetAuthorizedAddressRequest } from "./types/fairyring/keyshare/query"; +import { ValidatorEncryptedKeyshare } from "./types/fairyring/keyshare/keyshare"; import { MsgRegisterValidatorResponse } from "./types/fairyring/keyshare/tx"; -import { QueryAllAuthorizedAddressRequest } from "./types/fairyring/keyshare/query"; -import { Params } from "./types/fairyring/keyshare/params"; +import { MsgDeRegisterValidator } from "./types/fairyring/keyshare/tx"; +import { MsgSendKeyshareResponse } from "./types/fairyring/keyshare/tx"; +import { ActivePubkey } from "./types/fairyring/keyshare/pubkey"; +import { CounterPartyIBCInfo } from "./types/fairyring/keyshare/requested_decryption_key"; +import { QueryValidatorSetAllRequest } from "./types/fairyring/keyshare/query"; +import { QueryKeyshareAllResponse } from "./types/fairyring/keyshare/query"; +import { MsgUpdateAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; +import { DecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { QueryCommitmentsRequest } from "./types/fairyring/keyshare/query"; +import { QueryDecryptionKeyRequest } from "./types/fairyring/keyshare/query"; +import { MsgDeleteAuthorizedAddressResponse } from "./types/fairyring/keyshare/tx"; +import { RequestDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { DecryptionKeyRequest } from "./types/fairyring/keyshare/requested_decryption_key"; +import { IBCInfo } from "./types/fairyring/keyshare/requested_decryption_key"; +import { MsgSubmitGeneralKeyshare } from "./types/fairyring/keyshare/tx"; +import { MsgSubmitEncryptedKeyshareResponse } from "./types/fairyring/keyshare/tx"; +import { KeysharePacketData } from "./types/fairyring/keyshare/packet"; +import { QueryParamsResponse } from "./types/fairyring/keyshare/query"; +import { Keyshare } from "./types/fairyring/keyshare/keyshare"; +import { MsgSendKeyshare } from "./types/fairyring/keyshare/tx"; +import { MsgUpdateParamsResponse } from "./types/fairyring/keyshare/tx"; +import { MsgCreateLatestPubkeyResponse } from "./types/fairyring/keyshare/tx"; +import { MsgOverrideLatestPubkeyResponse } from "./types/fairyring/keyshare/tx"; +import { QueuedPubkey } from "./types/fairyring/keyshare/pubkey"; +import { GetDecryptionKeyPacketAck } from "./types/fairyring/keyshare/packet"; +import { Commitments } from "./types/fairyring/keyshare/commitments"; +import { QueryDecryptionKeyAllResponse } from "./types/fairyring/keyshare/query"; +import { QueryAuthorizedAddressRequest } from "./types/fairyring/keyshare/query"; +import { QueryAuthorizedAddressAllRequest } from "./types/fairyring/keyshare/query"; +import { RequestDecryptionKeyPacketData } from "./types/fairyring/keyshare/packet"; +import { NoData } from "./types/fairyring/keyshare/packet"; +import { DecryptionKeyDataPacketData } from "./types/fairyring/keyshare/packet"; +import { GetPrivateDecryptionKeyPacketData } from "./types/fairyring/keyshare/packet"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/fairyring.keyshare.KeyShareRequest", KeyShareRequest], - ["/fairyring.keyshare.QueryGetValidatorSetRequest", QueryGetValidatorSetRequest], - ["/fairyring.keyshare.QueryAllAggregatedKeyShareResponse", QueryAllAggregatedKeyShareResponse], - ["/fairyring.keyshare.MsgDeRegisterValidatorResponse", MsgDeRegisterValidatorResponse], - ["/fairyring.keyshare.MsgCreateLatestPubKeyResponse", MsgCreateLatestPubKeyResponse], - ["/fairyring.keyshare.MsgCreateAuthorizedAddress", MsgCreateAuthorizedAddress], - ["/fairyring.keyshare.MsgCreateGeneralKeyShareResponse", MsgCreateGeneralKeyShareResponse], - ["/fairyring.keyshare.AggregatedKeyShare", AggregatedKeyShare], - ["/fairyring.keyshare.KeysharePacketData", KeysharePacketData], - ["/fairyring.keyshare.MsgDeRegisterValidator", MsgDeRegisterValidator], - ["/fairyring.keyshare.MsgDeleteAuthorizedAddressResponse", MsgDeleteAuthorizedAddressResponse], + ["/fairyring.keyshare.QueryValidatorSetRequest", QueryValidatorSetRequest], + ["/fairyring.keyshare.QueryValidatorSetResponse", QueryValidatorSetResponse], + ["/fairyring.keyshare.QueryDecryptionKeyAllRequest", QueryDecryptionKeyAllRequest], + ["/fairyring.keyshare.QueryGeneralKeyshareResponse", QueryGeneralKeyshareResponse], ["/fairyring.keyshare.GenesisState", GenesisState], - ["/fairyring.keyshare.NoData", NoData], - ["/fairyring.keyshare.QueryCommitmentsResponse", QueryCommitmentsResponse], - ["/fairyring.keyshare.MsgCreateLatestPubKey", MsgCreateLatestPubKey], - ["/fairyring.keyshare.KeyShare", KeyShare], + ["/fairyring.keyshare.MsgUpdateParams", MsgUpdateParams], + ["/fairyring.keyshare.MsgDeRegisterValidatorResponse", MsgDeRegisterValidatorResponse], ["/fairyring.keyshare.MsgCreateAuthorizedAddressResponse", MsgCreateAuthorizedAddressResponse], - ["/fairyring.keyshare.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/fairyring.keyshare.QueryGetKeyShareRequest", QueryGetKeyShareRequest], - ["/fairyring.keyshare.AggrKeyshareDataPacketData", AggrKeyshareDataPacketData], - ["/fairyring.keyshare.CurrentKeysPacketAck", CurrentKeysPacketAck], - ["/fairyring.keyshare.QueryParamsResponse", QueryParamsResponse], - ["/fairyring.keyshare.QueryGetKeyShareResponse", QueryGetKeyShareResponse], - ["/fairyring.keyshare.MsgOverrideLatestPubKey", MsgOverrideLatestPubKey], - ["/fairyring.keyshare.QueryVerifiableRandomnessQuery", QueryVerifiableRandomnessQuery], - ["/fairyring.keyshare.QueryGetValidatorSetResponse", QueryGetValidatorSetResponse], - ["/fairyring.keyshare.QueryGetAggregatedKeyShareResponse", QueryGetAggregatedKeyShareResponse], - ["/fairyring.keyshare.QueryAllAuthorizedAddressResponse", QueryAllAuthorizedAddressResponse], - ["/fairyring.keyshare.GeneralKeyShare", GeneralKeyShare], - ["/fairyring.keyshare.RequestAggrKeysharePacketAck", RequestAggrKeysharePacketAck], - ["/fairyring.keyshare.CounterPartyIBCInfo", CounterPartyIBCInfo], - ["/fairyring.keyshare.QueryAllKeyShareRequest", QueryAllKeyShareRequest], - ["/fairyring.keyshare.QueryAllGeneralKeyShareRequest", QueryAllGeneralKeyShareRequest], - ["/fairyring.keyshare.MsgOverrideLatestPubKeyResponse", MsgOverrideLatestPubKeyResponse], - ["/fairyring.keyshare.MsgSendKeyshareResponse", MsgSendKeyshareResponse], - ["/fairyring.keyshare.QueryAllValidatorSetResponse", QueryAllValidatorSetResponse], - ["/fairyring.keyshare.QueuedPubKey", QueuedPubKey], - ["/fairyring.keyshare.AggrKeyshareDataPacketAck", AggrKeyshareDataPacketAck], - ["/fairyring.keyshare.QueryCommitmentsRequest", QueryCommitmentsRequest], - ["/fairyring.keyshare.QueryAllValidatorSetRequest", QueryAllValidatorSetRequest], - ["/fairyring.keyshare.QueryPubKeyResponse", QueryPubKeyResponse], - ["/fairyring.keyshare.QueryGetGeneralKeyShareResponse", QueryGetGeneralKeyShareResponse], - ["/fairyring.keyshare.Commitments", Commitments], - ["/fairyring.keyshare.QueryAllGeneralKeyShareResponse", QueryAllGeneralKeyShareResponse], - ["/fairyring.keyshare.MsgCreateGeneralKeyShare", MsgCreateGeneralKeyShare], - ["/fairyring.keyshare.CurrentKeysPacketData", CurrentKeysPacketData], - ["/fairyring.keyshare.QueryVerifiableRandomnessResponse", QueryVerifiableRandomnessResponse], - ["/fairyring.keyshare.QueryAllAggregatedKeyShareRequest", QueryAllAggregatedKeyShareRequest], - ["/fairyring.keyshare.QueryPubKeyRequest", QueryPubKeyRequest], - ["/fairyring.keyshare.MsgSendKeyshare", MsgSendKeyshare], - ["/fairyring.keyshare.AuthorizedAddress", AuthorizedAddress], - ["/fairyring.keyshare.EncryptedKeyShare", EncryptedKeyShare], - ["/fairyring.keyshare.ActivePubKey", ActivePubKey], - ["/fairyring.keyshare.IBCInfo", IBCInfo], - ["/fairyring.keyshare.QueryAllKeyShareResponse", QueryAllKeyShareResponse], - ["/fairyring.keyshare.QueryGetAuthorizedAddressResponse", QueryGetAuthorizedAddressResponse], - ["/fairyring.keyshare.QueryGetGeneralKeyShareRequest", QueryGetGeneralKeyShareRequest], - ["/fairyring.keyshare.MsgRegisterValidator", MsgRegisterValidator], + ["/fairyring.keyshare.RequestPrivateDecryptionKeyPacketAck", RequestPrivateDecryptionKeyPacketAck], + ["/fairyring.keyshare.QueryParamsRequest", QueryParamsRequest], + ["/fairyring.keyshare.QueryCommitmentsResponse", QueryCommitmentsResponse], + ["/fairyring.keyshare.QueryDecryptionKeyResponse", QueryDecryptionKeyResponse], + ["/fairyring.keyshare.DecryptionKey", DecryptionKey], + ["/fairyring.keyshare.PrivateDecryptionKeyRequest", PrivateDecryptionKeyRequest], + ["/fairyring.keyshare.QueryKeyshareRequest", QueryKeyshareRequest], + ["/fairyring.keyshare.QueryKeyshareResponse", QueryKeyshareResponse], + ["/fairyring.keyshare.QueryPubkeyResponse", QueryPubkeyResponse], + ["/fairyring.keyshare.GetDecryptionKeyPacketData", GetDecryptionKeyPacketData], + ["/fairyring.keyshare.MsgOverrideLatestPubkey", MsgOverrideLatestPubkey], + ["/fairyring.keyshare.PrivateDecryptionKeyPacketAck", PrivateDecryptionKeyPacketAck], + ["/fairyring.keyshare.MsgCreateAuthorizedAddress", MsgCreateAuthorizedAddress], + ["/fairyring.keyshare.QueryGeneralKeyshareAllResponse", QueryGeneralKeyshareAllResponse], + ["/fairyring.keyshare.GeneralKeyshare", GeneralKeyshare], + ["/fairyring.keyshare.RequestPrivateDecryptionKeyPacketData", RequestPrivateDecryptionKeyPacketData], + ["/fairyring.keyshare.MsgSubmitGeneralKeyshareResponse", MsgSubmitGeneralKeyshareResponse], + ["/fairyring.keyshare.EncryptedKeyshare", EncryptedKeyshare], ["/fairyring.keyshare.ValidatorSet", ValidatorSet], + ["/fairyring.keyshare.QueryVerifiableRandomnessRequest", QueryVerifiableRandomnessRequest], + ["/fairyring.keyshare.QueryKeyshareAllRequest", QueryKeyshareAllRequest], + ["/fairyring.keyshare.QueryAuthorizedAddressResponse", QueryAuthorizedAddressResponse], + ["/fairyring.keyshare.GetPrivateDecryptionKeyPacketAck", GetPrivateDecryptionKeyPacketAck], + ["/fairyring.keyshare.MsgSubmitEncryptedKeyshare", MsgSubmitEncryptedKeyshare], + ["/fairyring.keyshare.QueryGeneralKeyshareRequest", QueryGeneralKeyshareRequest], + ["/fairyring.keyshare.QueryGeneralKeyshareAllRequest", QueryGeneralKeyshareAllRequest], + ["/fairyring.keyshare.PrivateDecryptionKeyDataPacketData", PrivateDecryptionKeyDataPacketData], + ["/fairyring.keyshare.MsgRegisterValidator", MsgRegisterValidator], + ["/fairyring.keyshare.MsgCreateLatestPubkey", MsgCreateLatestPubkey], ["/fairyring.keyshare.MsgDeleteAuthorizedAddress", MsgDeleteAuthorizedAddress], - ["/fairyring.keyshare.QueryGetAggregatedKeyShareRequest", QueryGetAggregatedKeyShareRequest], + ["/fairyring.keyshare.QueryVerifiableRandomnessResponse", QueryVerifiableRandomnessResponse], + ["/fairyring.keyshare.QueryValidatorSetAllResponse", QueryValidatorSetAllResponse], + ["/fairyring.keyshare.QueryPubkeyRequest", QueryPubkeyRequest], + ["/fairyring.keyshare.CurrentKeysPacketAck", CurrentKeysPacketAck], + ["/fairyring.keyshare.Params", Params], + ["/fairyring.keyshare.QueryAuthorizedAddressAllResponse", QueryAuthorizedAddressAllResponse], + ["/fairyring.keyshare.AuthorizedAddress", AuthorizedAddress], + ["/fairyring.keyshare.CurrentKeysPacketData", CurrentKeysPacketData], ["/fairyring.keyshare.MsgUpdateAuthorizedAddress", MsgUpdateAuthorizedAddress], - ["/fairyring.keyshare.MsgUpdateAuthorizedAddressResponse", MsgUpdateAuthorizedAddressResponse], - ["/fairyring.keyshare.RequestAggrKeysharePacketData", RequestAggrKeysharePacketData], - ["/fairyring.keyshare.GetAggrKeysharePacketData", GetAggrKeysharePacketData], - ["/fairyring.keyshare.GetAggrKeysharePacketAck", GetAggrKeysharePacketAck], - ["/fairyring.keyshare.QueryParamsRequest", QueryParamsRequest], - ["/fairyring.keyshare.MsgUpdateParams", MsgUpdateParams], - ["/fairyring.keyshare.QueryGetAuthorizedAddressRequest", QueryGetAuthorizedAddressRequest], + ["/fairyring.keyshare.ValidatorEncryptedKeyshare", ValidatorEncryptedKeyshare], ["/fairyring.keyshare.MsgRegisterValidatorResponse", MsgRegisterValidatorResponse], - ["/fairyring.keyshare.QueryAllAuthorizedAddressRequest", QueryAllAuthorizedAddressRequest], - ["/fairyring.keyshare.Params", Params], + ["/fairyring.keyshare.MsgDeRegisterValidator", MsgDeRegisterValidator], + ["/fairyring.keyshare.MsgSendKeyshareResponse", MsgSendKeyshareResponse], + ["/fairyring.keyshare.ActivePubkey", ActivePubkey], + ["/fairyring.keyshare.CounterPartyIBCInfo", CounterPartyIBCInfo], + ["/fairyring.keyshare.QueryValidatorSetAllRequest", QueryValidatorSetAllRequest], + ["/fairyring.keyshare.QueryKeyshareAllResponse", QueryKeyshareAllResponse], + ["/fairyring.keyshare.MsgUpdateAuthorizedAddressResponse", MsgUpdateAuthorizedAddressResponse], + ["/fairyring.keyshare.DecryptionKeyPacketAck", DecryptionKeyPacketAck], + ["/fairyring.keyshare.QueryCommitmentsRequest", QueryCommitmentsRequest], + ["/fairyring.keyshare.QueryDecryptionKeyRequest", QueryDecryptionKeyRequest], + ["/fairyring.keyshare.MsgDeleteAuthorizedAddressResponse", MsgDeleteAuthorizedAddressResponse], + ["/fairyring.keyshare.RequestDecryptionKeyPacketAck", RequestDecryptionKeyPacketAck], + ["/fairyring.keyshare.DecryptionKeyRequest", DecryptionKeyRequest], + ["/fairyring.keyshare.IBCInfo", IBCInfo], + ["/fairyring.keyshare.MsgSubmitGeneralKeyshare", MsgSubmitGeneralKeyshare], + ["/fairyring.keyshare.MsgSubmitEncryptedKeyshareResponse", MsgSubmitEncryptedKeyshareResponse], + ["/fairyring.keyshare.KeysharePacketData", KeysharePacketData], + ["/fairyring.keyshare.QueryParamsResponse", QueryParamsResponse], + ["/fairyring.keyshare.Keyshare", Keyshare], + ["/fairyring.keyshare.MsgSendKeyshare", MsgSendKeyshare], + ["/fairyring.keyshare.MsgUpdateParamsResponse", MsgUpdateParamsResponse], + ["/fairyring.keyshare.MsgCreateLatestPubkeyResponse", MsgCreateLatestPubkeyResponse], + ["/fairyring.keyshare.MsgOverrideLatestPubkeyResponse", MsgOverrideLatestPubkeyResponse], + ["/fairyring.keyshare.QueuedPubkey", QueuedPubkey], + ["/fairyring.keyshare.GetDecryptionKeyPacketAck", GetDecryptionKeyPacketAck], + ["/fairyring.keyshare.Commitments", Commitments], + ["/fairyring.keyshare.QueryDecryptionKeyAllResponse", QueryDecryptionKeyAllResponse], + ["/fairyring.keyshare.QueryAuthorizedAddressRequest", QueryAuthorizedAddressRequest], + ["/fairyring.keyshare.QueryAuthorizedAddressAllRequest", QueryAuthorizedAddressAllRequest], + ["/fairyring.keyshare.RequestDecryptionKeyPacketData", RequestDecryptionKeyPacketData], + ["/fairyring.keyshare.NoData", NoData], + ["/fairyring.keyshare.DecryptionKeyDataPacketData", DecryptionKeyDataPacketData], + ["/fairyring.keyshare.GetPrivateDecryptionKeyPacketData", GetPrivateDecryptionKeyPacketData], ]; diff --git a/ts-client/fairyring.keyshare/types/amino/amino.ts b/ts-client/fairyring.keyshare/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/fairyring.keyshare/types/amino/amino.ts +++ b/ts-client/fairyring.keyshare/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/fairyring.keyshare/types/cosmos/app/v1alpha1/module.ts b/ts-client/fairyring.keyshare/types/cosmos/app/v1alpha1/module.ts index 6469e9c8..f8045357 100644 --- a/ts-client/fairyring.keyshare/types/cosmos/app/v1alpha1/module.ts +++ b/ts-client/fairyring.keyshare/types/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.app.v1alpha1"; @@ -90,22 +96,22 @@ function createBaseModuleDescriptor(): ModuleDescriptor { return { goImport: "", usePackage: [], canMigrateFrom: [] }; } -export const ModuleDescriptor = { - encode(message: ModuleDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.goImport !== "") { writer.uint32(10).string(message.goImport); } for (const v of message.usePackage) { - PackageReference.encode(v!, writer.uint32(18).fork()).ldelim(); + PackageReference.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.canMigrateFrom) { - MigrateFromInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ModuleDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModuleDescriptor(); while (reader.pos < end) { @@ -136,18 +142,18 @@ export const ModuleDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ModuleDescriptor { return { - goImport: isSet(object.goImport) ? String(object.goImport) : "", - usePackage: Array.isArray(object?.usePackage) + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) : [], - canMigrateFrom: Array.isArray(object?.canMigrateFrom) + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) : [], }; @@ -183,8 +189,8 @@ function createBasePackageReference(): PackageReference { return { name: "", revision: 0 }; } -export const PackageReference = { - encode(message: PackageReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -194,8 +200,8 @@ export const PackageReference = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PackageReference { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePackageReference(); while (reader.pos < end) { @@ -219,15 +225,15 @@ export const PackageReference = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): PackageReference { return { - name: isSet(object.name) ? String(object.name) : "", - revision: isSet(object.revision) ? Number(object.revision) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, }; }, @@ -257,16 +263,16 @@ function createBaseMigrateFromInfo(): MigrateFromInfo { return { module: "" }; } -export const MigrateFromInfo = { - encode(message: MigrateFromInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MigrateFromInfo: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMigrateFromInfo(); while (reader.pos < end) { @@ -283,13 +289,13 @@ export const MigrateFromInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MigrateFromInfo { - return { module: isSet(object.module) ? String(object.module) : "" }; + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; }, toJSON(message: MigrateFromInfo): unknown { @@ -313,7 +319,8 @@ export const MigrateFromInfo = { type Builtin = 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; @@ -324,3 +331,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/fairyring.keyshare/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/fairyring.keyshare/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/fairyring.keyshare/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/cosmos/base/v1beta1/coin.ts b/ts-client/fairyring.keyshare/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/query.ts b/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/fairyring.keyshare/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/fairyring.keyshare/types/cosmos/msg/v1/msg.ts b/ts-client/fairyring.keyshare/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/fairyring.keyshare/types/cosmos/msg/v1/msg.ts +++ b/ts-client/fairyring.keyshare/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/fairyring.keyshare/types/cosmos_proto/cosmos.ts b/ts-client/fairyring.keyshare/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/fairyring.keyshare/types/cosmos_proto/cosmos.ts +++ b/ts-client/fairyring.keyshare/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/common/shared_types.ts b/ts-client/fairyring.keyshare/types/fairyring/common/shared_types.ts index d27ee23d..af855b23 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/common/shared_types.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/common/shared_types.ts @@ -1,51 +1,103 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Duration } from "../../google/protobuf/duration"; export const protobufPackage = "fairyring.common"; -/** RequestAggrKeyshare defines a struct for the data payload */ -export interface RequestAggrKeyshare { +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { creator: string; proposalId?: string | undefined; requestId?: string | undefined; estimatedDelay: Duration | undefined; } -export interface RequestAggrKeyshareResponse { +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { identity: string; pubkey: string; } -/** GetAggrKeyshare defines a struct for the data payload */ -export interface GetAggrKeyshare { +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { proposalId?: string | undefined; requestId?: string | undefined; identity: string; } -export interface GetAggrKeyshareResponse { +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { } +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ export interface ActivePublicKey { publicKey: string; creator: string; expiry: number; } +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ export interface QueuedPublicKey { publicKey: string; creator: string; expiry: number; } -function createBaseRequestAggrKeyshare(): RequestAggrKeyshare { +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; } -export const RequestAggrKeyshare = { - encode(message: RequestAggrKeyshare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -56,15 +108,15 @@ export const RequestAggrKeyshare = { writer.uint32(26).string(message.requestId); } if (message.estimatedDelay !== undefined) { - Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).ldelim(); + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): RequestAggrKeyshare { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestAggrKeyshare(); + const message = createBaseRequestDecryptionKey(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -100,21 +152,21 @@ export const RequestAggrKeyshare = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): RequestAggrKeyshare { + fromJSON(object: any): RequestDecryptionKey { return { - creator: isSet(object.creator) ? String(object.creator) : "", - proposalId: isSet(object.proposalId) ? String(object.proposalId) : undefined, - requestId: isSet(object.requestId) ? String(object.requestId) : undefined, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, }; }, - toJSON(message: RequestAggrKeyshare): unknown { + toJSON(message: RequestDecryptionKey): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -131,11 +183,11 @@ export const RequestAggrKeyshare = { return obj; }, - create, I>>(base?: I): RequestAggrKeyshare { - return RequestAggrKeyshare.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): RequestAggrKeyshare { - const message = createBaseRequestAggrKeyshare(); + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); message.creator = object.creator ?? ""; message.proposalId = object.proposalId ?? undefined; message.requestId = object.requestId ?? undefined; @@ -146,12 +198,12 @@ export const RequestAggrKeyshare = { }, }; -function createBaseRequestAggrKeyshareResponse(): RequestAggrKeyshareResponse { +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { return { identity: "", pubkey: "" }; } -export const RequestAggrKeyshareResponse = { - encode(message: RequestAggrKeyshareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.identity !== "") { writer.uint32(10).string(message.identity); } @@ -161,10 +213,10 @@ export const RequestAggrKeyshareResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): RequestAggrKeyshareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestAggrKeyshareResponse(); + const message = createBaseRequestDecryptionKeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -186,19 +238,19 @@ export const RequestAggrKeyshareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): RequestAggrKeyshareResponse { + fromJSON(object: any): RequestDecryptionKeyResponse { return { - identity: isSet(object.identity) ? String(object.identity) : "", - pubkey: isSet(object.pubkey) ? String(object.pubkey) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", }; }, - toJSON(message: RequestAggrKeyshareResponse): unknown { + toJSON(message: RequestDecryptionKeyResponse): unknown { const obj: any = {}; if (message.identity !== "") { obj.identity = message.identity; @@ -209,23 +261,23 @@ export const RequestAggrKeyshareResponse = { return obj; }, - create, I>>(base?: I): RequestAggrKeyshareResponse { - return RequestAggrKeyshareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): RequestAggrKeyshareResponse { - const message = createBaseRequestAggrKeyshareResponse(); + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); message.identity = object.identity ?? ""; message.pubkey = object.pubkey ?? ""; return message; }, }; -function createBaseGetAggrKeyshare(): GetAggrKeyshare { +function createBaseGetDecryptionKey(): GetDecryptionKey { return { proposalId: undefined, requestId: undefined, identity: "" }; } -export const GetAggrKeyshare = { - encode(message: GetAggrKeyshare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.proposalId !== undefined) { writer.uint32(10).string(message.proposalId); } @@ -238,10 +290,10 @@ export const GetAggrKeyshare = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GetAggrKeyshare { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAggrKeyshare(); + const message = createBaseGetDecryptionKey(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -270,20 +322,20 @@ export const GetAggrKeyshare = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): GetAggrKeyshare { + fromJSON(object: any): GetDecryptionKey { return { - proposalId: isSet(object.proposalId) ? String(object.proposalId) : undefined, - requestId: isSet(object.requestId) ? String(object.requestId) : undefined, - identity: isSet(object.identity) ? String(object.identity) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", }; }, - toJSON(message: GetAggrKeyshare): unknown { + toJSON(message: GetDecryptionKey): unknown { const obj: any = {}; if (message.proposalId !== undefined) { obj.proposalId = message.proposalId; @@ -297,11 +349,11 @@ export const GetAggrKeyshare = { return obj; }, - create, I>>(base?: I): GetAggrKeyshare { - return GetAggrKeyshare.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GetAggrKeyshare { - const message = createBaseGetAggrKeyshare(); + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); message.proposalId = object.proposalId ?? undefined; message.requestId = object.requestId ?? undefined; message.identity = object.identity ?? ""; @@ -309,19 +361,19 @@ export const GetAggrKeyshare = { }, }; -function createBaseGetAggrKeyshareResponse(): GetAggrKeyshareResponse { +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { return {}; } -export const GetAggrKeyshareResponse = { - encode(_: GetAggrKeyshareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GetAggrKeyshareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAggrKeyshareResponse(); + const message = createBaseGetDecryptionKeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -329,25 +381,188 @@ export const GetAggrKeyshareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): GetAggrKeyshareResponse { + fromJSON(_: any): GetDecryptionKeyResponse { return {}; }, - toJSON(_: GetAggrKeyshareResponse): unknown { + toJSON(_: GetDecryptionKeyResponse): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): GetAggrKeyshareResponse { - return GetAggrKeyshareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): GetAggrKeyshareResponse { - const message = createBaseGetAggrKeyshareResponse(); + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; return message; }, }; @@ -356,8 +571,8 @@ function createBaseActivePublicKey(): ActivePublicKey { return { publicKey: "", creator: "", expiry: 0 }; } -export const ActivePublicKey = { - encode(message: ActivePublicKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.publicKey !== "") { writer.uint32(10).string(message.publicKey); } @@ -370,8 +585,8 @@ export const ActivePublicKey = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ActivePublicKey { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseActivePublicKey(); while (reader.pos < end) { @@ -396,22 +611,22 @@ export const ActivePublicKey = { break; } - message.expiry = longToNumber(reader.uint64() as Long); + message.expiry = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ActivePublicKey { return { - publicKey: isSet(object.publicKey) ? String(object.publicKey) : "", - creator: isSet(object.creator) ? String(object.creator) : "", - expiry: isSet(object.expiry) ? Number(object.expiry) : 0, + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, }; }, @@ -445,8 +660,8 @@ function createBaseQueuedPublicKey(): QueuedPublicKey { return { publicKey: "", creator: "", expiry: 0 }; } -export const QueuedPublicKey = { - encode(message: QueuedPublicKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.publicKey !== "") { writer.uint32(10).string(message.publicKey); } @@ -459,8 +674,8 @@ export const QueuedPublicKey = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueuedPublicKey { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueuedPublicKey(); while (reader.pos < end) { @@ -485,22 +700,22 @@ export const QueuedPublicKey = { break; } - message.expiry = longToNumber(reader.uint64() as Long); + message.expiry = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueuedPublicKey { return { - publicKey: isSet(object.publicKey) ? String(object.publicKey) : "", - creator: isSet(object.creator) ? String(object.creator) : "", - expiry: isSet(object.expiry) ? Number(object.expiry) : 0, + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, }; }, @@ -530,29 +745,239 @@ export const QueuedPublicKey = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -560,18 +985,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/authorized_address.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/authorized_address.ts index 39e68afd..30941721 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/authorized_address.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/authorized_address.ts @@ -1,8 +1,15 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "fairyring.keyshare"; +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ export interface AuthorizedAddress { target: string; isAuthorized: boolean; @@ -13,12 +20,12 @@ function createBaseAuthorizedAddress(): AuthorizedAddress { return { target: "", isAuthorized: false, authorizedBy: "" }; } -export const AuthorizedAddress = { - encode(message: AuthorizedAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.target !== "") { writer.uint32(10).string(message.target); } - if (message.isAuthorized === true) { + if (message.isAuthorized !== false) { writer.uint32(16).bool(message.isAuthorized); } if (message.authorizedBy !== "") { @@ -27,8 +34,8 @@ export const AuthorizedAddress = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): AuthorizedAddress { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAuthorizedAddress(); while (reader.pos < end) { @@ -59,16 +66,16 @@ export const AuthorizedAddress = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): AuthorizedAddress { return { - target: isSet(object.target) ? String(object.target) : "", - isAuthorized: isSet(object.isAuthorized) ? Boolean(object.isAuthorized) : false, - authorizedBy: isSet(object.authorizedBy) ? String(object.authorizedBy) : "", + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", }; }, @@ -77,7 +84,7 @@ export const AuthorizedAddress = { if (message.target !== "") { obj.target = message.target; } - if (message.isAuthorized === true) { + if (message.isAuthorized !== false) { obj.isAuthorized = message.isAuthorized; } if (message.authorizedBy !== "") { @@ -101,7 +108,8 @@ export const AuthorizedAddress = { type Builtin = 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; @@ -112,3 +120,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/commitments.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/commitments.ts index 43ceccbe..bcda4b78 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/commitments.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/commitments.ts @@ -1,8 +1,18 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "fairyring.keyshare"; +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ export interface Commitments { commitments: string[]; } @@ -11,16 +21,16 @@ function createBaseCommitments(): Commitments { return { commitments: [] }; } -export const Commitments = { - encode(message: Commitments, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.commitments) { writer.uint32(10).string(v!); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Commitments { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCommitments(); while (reader.pos < end) { @@ -37,13 +47,17 @@ export const Commitments = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Commitments { - return { commitments: Array.isArray(object?.commitments) ? object.commitments.map((e: any) => String(e)) : [] }; + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; }, toJSON(message: Commitments): unknown { @@ -67,10 +81,20 @@ export const Commitments = { type Builtin = 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; type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/decryption_key.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/genesis.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/genesis.ts index b2263699..875617b6 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/genesis.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/genesis.ts @@ -1,12 +1,16 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; -import { AggregatedKeyShare } from "./aggregated_key_share"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { AuthorizedAddress } from "./authorized_address"; -import { GeneralKeyShare } from "./general_key_share"; -import { KeyShare } from "./key_share"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; import { Params } from "./params"; -import { ActivePubKey, QueuedPubKey } from "./pub_key"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; import { ValidatorSet } from "./validator_set"; export const protobufPackage = "fairyring.keyshare"; @@ -17,14 +21,13 @@ export interface GenesisState { params: Params | undefined; portId: string; validatorSetList: ValidatorSet[]; - keyShareList: KeyShare[]; - /** this line is used by starport scaffolding # genesis/proto/state */ - aggregatedKeyShareList: AggregatedKeyShare[]; - activePubKey: ActivePubKey | undefined; - queuedPubKey: QueuedPubKey | undefined; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; authorizedAddressList: AuthorizedAddress[]; requestCount: number; - generalKeyShareList: GeneralKeyShare[]; + generalKeyshareList: GeneralKeyshare[]; } function createBaseGenesisState(): GenesisState { @@ -32,53 +35,53 @@ function createBaseGenesisState(): GenesisState { params: undefined, portId: "", validatorSetList: [], - keyShareList: [], - aggregatedKeyShareList: [], - activePubKey: undefined, - queuedPubKey: undefined, + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, authorizedAddressList: [], requestCount: 0, - generalKeyShareList: [], + generalKeyshareList: [], }; } -export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + Params.encode(message.params, writer.uint32(10).fork()).join(); } if (message.portId !== "") { writer.uint32(18).string(message.portId); } for (const v of message.validatorSetList) { - ValidatorSet.encode(v!, writer.uint32(26).fork()).ldelim(); + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); } - for (const v of message.keyShareList) { - KeyShare.encode(v!, writer.uint32(34).fork()).ldelim(); + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); } - for (const v of message.aggregatedKeyShareList) { - AggregatedKeyShare.encode(v!, writer.uint32(42).fork()).ldelim(); + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); } - if (message.activePubKey !== undefined) { - ActivePubKey.encode(message.activePubKey, writer.uint32(50).fork()).ldelim(); + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); } - if (message.queuedPubKey !== undefined) { - QueuedPubKey.encode(message.queuedPubKey, writer.uint32(58).fork()).ldelim(); + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); } for (const v of message.authorizedAddressList) { - AuthorizedAddress.encode(v!, writer.uint32(66).fork()).ldelim(); + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); } if (message.requestCount !== 0) { writer.uint32(72).uint64(message.requestCount); } - for (const v of message.generalKeyShareList) { - GeneralKeyShare.encode(v!, writer.uint32(82).fork()).ldelim(); + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisState(); while (reader.pos < end) { @@ -110,28 +113,28 @@ export const GenesisState = { break; } - message.keyShareList.push(KeyShare.decode(reader, reader.uint32())); + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); continue; case 5: if (tag !== 42) { break; } - message.aggregatedKeyShareList.push(AggregatedKeyShare.decode(reader, reader.uint32())); + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); continue; case 6: if (tag !== 50) { break; } - message.activePubKey = ActivePubKey.decode(reader, reader.uint32()); + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); continue; case 7: if (tag !== 58) { break; } - message.queuedPubKey = QueuedPubKey.decode(reader, reader.uint32()); + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); continue; case 8: if (tag !== 66) { @@ -145,20 +148,20 @@ export const GenesisState = { break; } - message.requestCount = longToNumber(reader.uint64() as Long); + message.requestCount = longToNumber(reader.uint64()); continue; case 10: if (tag !== 82) { break; } - message.generalKeyShareList.push(GeneralKeyShare.decode(reader, reader.uint32())); + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -166,24 +169,24 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - portId: isSet(object.portId) ? String(object.portId) : "", - validatorSetList: Array.isArray(object?.validatorSetList) + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) : [], - keyShareList: Array.isArray(object?.keyShareList) - ? object.keyShareList.map((e: any) => KeyShare.fromJSON(e)) + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) : [], - aggregatedKeyShareList: Array.isArray(object?.aggregatedKeyShareList) - ? object.aggregatedKeyShareList.map((e: any) => AggregatedKeyShare.fromJSON(e)) + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) : [], - activePubKey: isSet(object.activePubKey) ? ActivePubKey.fromJSON(object.activePubKey) : undefined, - queuedPubKey: isSet(object.queuedPubKey) ? QueuedPubKey.fromJSON(object.queuedPubKey) : undefined, - authorizedAddressList: Array.isArray(object?.authorizedAddressList) + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) : [], - requestCount: isSet(object.requestCount) ? Number(object.requestCount) : 0, - generalKeyShareList: Array.isArray(object?.generalKeyShareList) - ? object.generalKeyShareList.map((e: any) => GeneralKeyShare.fromJSON(e)) + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) : [], }; }, @@ -199,17 +202,17 @@ export const GenesisState = { if (message.validatorSetList?.length) { obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); } - if (message.keyShareList?.length) { - obj.keyShareList = message.keyShareList.map((e) => KeyShare.toJSON(e)); + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); } - if (message.aggregatedKeyShareList?.length) { - obj.aggregatedKeyShareList = message.aggregatedKeyShareList.map((e) => AggregatedKeyShare.toJSON(e)); + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); } - if (message.activePubKey !== undefined) { - obj.activePubKey = ActivePubKey.toJSON(message.activePubKey); + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); } - if (message.queuedPubKey !== undefined) { - obj.queuedPubKey = QueuedPubKey.toJSON(message.queuedPubKey); + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); } if (message.authorizedAddressList?.length) { obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); @@ -217,8 +220,8 @@ export const GenesisState = { if (message.requestCount !== 0) { obj.requestCount = Math.round(message.requestCount); } - if (message.generalKeyShareList?.length) { - obj.generalKeyShareList = message.generalKeyShareList.map((e) => GeneralKeyShare.toJSON(e)); + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.toJSON(e)); } return obj; }, @@ -233,44 +236,26 @@ export const GenesisState = { : undefined; message.portId = object.portId ?? ""; message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; - message.keyShareList = object.keyShareList?.map((e) => KeyShare.fromPartial(e)) || []; - message.aggregatedKeyShareList = object.aggregatedKeyShareList?.map((e) => AggregatedKeyShare.fromPartial(e)) || []; - message.activePubKey = (object.activePubKey !== undefined && object.activePubKey !== null) - ? ActivePubKey.fromPartial(object.activePubKey) + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) : undefined; - message.queuedPubKey = (object.queuedPubKey !== undefined && object.queuedPubKey !== null) - ? QueuedPubKey.fromPartial(object.queuedPubKey) + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) : undefined; message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; message.requestCount = object.requestCount ?? 0; - message.generalKeyShareList = object.generalKeyShareList?.map((e) => GeneralKeyShare.fromPartial(e)) || []; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -278,18 +263,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/keyshare.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/module/module.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/module/module.ts index 2013f3e1..a29ec78f 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/module/module.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/module/module.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "fairyring.keyshare.module"; @@ -13,16 +19,16 @@ function createBaseModule(): Module { return { authority: "" }; } -export const Module = { - encode(message: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Module { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModule(); while (reader.pos < end) { @@ -39,13 +45,13 @@ export const Module = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Module { - return { authority: isSet(object.authority) ? String(object.authority) : "" }; + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; }, toJSON(message: Module): unknown { @@ -69,7 +75,8 @@ export const Module = { type Builtin = 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; @@ -80,3 +87,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/packet.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/packet.ts index 7e5ad095..2485cba5 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/packet.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/packet.ts @@ -1,50 +1,83 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Duration } from "../../google/protobuf/duration"; -import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; export const protobufPackage = "fairyring.keyshare"; +/** KeysharePacketData defines all the packet types of the keyshare module */ export interface KeysharePacketData { noData?: NoData | undefined; - requestAggrKeysharePacket?: RequestAggrKeysharePacketData | undefined; - getAggrKeysharePacket?: GetAggrKeysharePacketData | undefined; - aggrKeyshareDataPacket?: AggrKeyshareDataPacketData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; } +/** NoData defines a blank packet */ export interface NoData { } -/** RequestAggrKeysharePacketData defines a struct for the packet payload */ -export interface RequestAggrKeysharePacketData { +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { requester: string; proposalId?: string | undefined; requestId?: string | undefined; estimatedDelay: Duration | undefined; } -/** RequestAggrKeysharePacketAck defines a struct for the packet acknowledgment */ -export interface RequestAggrKeysharePacketAck { +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { identity: string; pubkey: string; } -/** GetAggrKeysharePacketData defines a struct for the packet payload */ -export interface GetAggrKeysharePacketData { +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { identity: string; + pubkey: string; } -/** GetAggrKeysharePacketAck defines a struct for the packet acknowledgment */ -export interface GetAggrKeysharePacketAck { +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; } -/** AggrKeyshareDataPacketData defines a struct for the packet payload */ -export interface AggrKeyshareDataPacketData { +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { identity: string; pubkey: string; - aggrKeyshare: string; + decryptionKey: string; aggrHeight: string; /** used for private governance */ proposalId: string; @@ -53,8 +86,20 @@ export interface AggrKeyshareDataPacketData { retries: number; } -/** AggrKeyshareDataPacketAck defines a struct for the packet acknowledgment */ -export interface AggrKeyshareDataPacketAck { +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { } /** CurrentKeysPacketData defines a struct for the packet payload */ @@ -70,35 +115,49 @@ export interface CurrentKeysPacketAck { function createBaseKeysharePacketData(): KeysharePacketData { return { noData: undefined, - requestAggrKeysharePacket: undefined, - getAggrKeysharePacket: undefined, - aggrKeyshareDataPacket: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, }; } -export const KeysharePacketData = { - encode(message: KeysharePacketData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.noData !== undefined) { - NoData.encode(message.noData, writer.uint32(10).fork()).ldelim(); + NoData.encode(message.noData, writer.uint32(10).fork()).join(); } - if (message.requestAggrKeysharePacket !== undefined) { - RequestAggrKeysharePacketData.encode(message.requestAggrKeysharePacket, writer.uint32(18).fork()).ldelim(); + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); } - if (message.getAggrKeysharePacket !== undefined) { - GetAggrKeysharePacketData.encode(message.getAggrKeysharePacket, writer.uint32(26).fork()).ldelim(); + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); } - if (message.aggrKeyshareDataPacket !== undefined) { - AggrKeyshareDataPacketData.encode(message.aggrKeyshareDataPacket, writer.uint32(34).fork()).ldelim(); + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); } if (message.currentKeysPacket !== undefined) { - CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(42).fork()).ldelim(); + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): KeysharePacketData { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseKeysharePacketData(); while (reader.pos < end) { @@ -116,34 +175,58 @@ export const KeysharePacketData = { break; } - message.requestAggrKeysharePacket = RequestAggrKeysharePacketData.decode(reader, reader.uint32()); + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); continue; case 3: if (tag !== 26) { break; } - message.getAggrKeysharePacket = GetAggrKeysharePacketData.decode(reader, reader.uint32()); + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); continue; case 4: if (tag !== 34) { break; } - message.aggrKeyshareDataPacket = AggrKeyshareDataPacketData.decode(reader, reader.uint32()); + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); continue; case 5: if (tag !== 42) { break; } + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -151,18 +234,27 @@ export const KeysharePacketData = { fromJSON(object: any): KeysharePacketData { return { noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, - requestAggrKeysharePacket: isSet(object.requestAggrKeysharePacket) - ? RequestAggrKeysharePacketData.fromJSON(object.requestAggrKeysharePacket) + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) : undefined, - getAggrKeysharePacket: isSet(object.getAggrKeysharePacket) - ? GetAggrKeysharePacketData.fromJSON(object.getAggrKeysharePacket) + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) : undefined, - aggrKeyshareDataPacket: isSet(object.aggrKeyshareDataPacket) - ? AggrKeyshareDataPacketData.fromJSON(object.aggrKeyshareDataPacket) + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) : undefined, currentKeysPacket: isSet(object.currentKeysPacket) ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, }; }, @@ -171,18 +263,33 @@ export const KeysharePacketData = { if (message.noData !== undefined) { obj.noData = NoData.toJSON(message.noData); } - if (message.requestAggrKeysharePacket !== undefined) { - obj.requestAggrKeysharePacket = RequestAggrKeysharePacketData.toJSON(message.requestAggrKeysharePacket); + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); } - if (message.getAggrKeysharePacket !== undefined) { - obj.getAggrKeysharePacket = GetAggrKeysharePacketData.toJSON(message.getAggrKeysharePacket); + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); } - if (message.aggrKeyshareDataPacket !== undefined) { - obj.aggrKeyshareDataPacket = AggrKeyshareDataPacketData.toJSON(message.aggrKeyshareDataPacket); + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); } if (message.currentKeysPacket !== undefined) { obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } return obj; }, @@ -194,21 +301,33 @@ export const KeysharePacketData = { message.noData = (object.noData !== undefined && object.noData !== null) ? NoData.fromPartial(object.noData) : undefined; - message.requestAggrKeysharePacket = - (object.requestAggrKeysharePacket !== undefined && object.requestAggrKeysharePacket !== null) - ? RequestAggrKeysharePacketData.fromPartial(object.requestAggrKeysharePacket) + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) : undefined; - message.getAggrKeysharePacket = - (object.getAggrKeysharePacket !== undefined && object.getAggrKeysharePacket !== null) - ? GetAggrKeysharePacketData.fromPartial(object.getAggrKeysharePacket) + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) : undefined; - message.aggrKeyshareDataPacket = - (object.aggrKeyshareDataPacket !== undefined && object.aggrKeyshareDataPacket !== null) - ? AggrKeyshareDataPacketData.fromPartial(object.aggrKeyshareDataPacket) + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) : undefined; message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; return message; }, }; @@ -217,13 +336,13 @@ function createBaseNoData(): NoData { return {}; } -export const NoData = { - encode(_: NoData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): NoData { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNoData(); while (reader.pos < end) { @@ -233,7 +352,7 @@ export const NoData = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -256,12 +375,12 @@ export const NoData = { }, }; -function createBaseRequestAggrKeysharePacketData(): RequestAggrKeysharePacketData { +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; } -export const RequestAggrKeysharePacketData = { - encode(message: RequestAggrKeysharePacketData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.requester !== "") { writer.uint32(10).string(message.requester); } @@ -272,15 +391,15 @@ export const RequestAggrKeysharePacketData = { writer.uint32(26).string(message.requestId); } if (message.estimatedDelay !== undefined) { - Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).ldelim(); + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): RequestAggrKeysharePacketData { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestAggrKeysharePacketData(); + const message = createBaseRequestDecryptionKeyPacketData(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -316,21 +435,21 @@ export const RequestAggrKeysharePacketData = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): RequestAggrKeysharePacketData { + fromJSON(object: any): RequestDecryptionKeyPacketData { return { - requester: isSet(object.requester) ? String(object.requester) : "", - proposalId: isSet(object.proposalId) ? String(object.proposalId) : undefined, - requestId: isSet(object.requestId) ? String(object.requestId) : undefined, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, }; }, - toJSON(message: RequestAggrKeysharePacketData): unknown { + toJSON(message: RequestDecryptionKeyPacketData): unknown { const obj: any = {}; if (message.requester !== "") { obj.requester = message.requester; @@ -347,13 +466,13 @@ export const RequestAggrKeysharePacketData = { return obj; }, - create, I>>(base?: I): RequestAggrKeysharePacketData { - return RequestAggrKeysharePacketData.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): RequestAggrKeysharePacketData { - const message = createBaseRequestAggrKeysharePacketData(); + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); message.requester = object.requester ?? ""; message.proposalId = object.proposalId ?? undefined; message.requestId = object.requestId ?? undefined; @@ -364,12 +483,168 @@ export const RequestAggrKeysharePacketData = { }, }; -function createBaseRequestAggrKeysharePacketAck(): RequestAggrKeysharePacketAck { +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { return { identity: "", pubkey: "" }; } -export const RequestAggrKeysharePacketAck = { - encode(message: RequestAggrKeysharePacketAck, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.identity !== "") { writer.uint32(10).string(message.identity); } @@ -379,10 +654,10 @@ export const RequestAggrKeysharePacketAck = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): RequestAggrKeysharePacketAck { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestAggrKeysharePacketAck(); + const message = createBaseRequestDecryptionKeyPacketAck(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -404,19 +679,19 @@ export const RequestAggrKeysharePacketAck = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): RequestAggrKeysharePacketAck { + fromJSON(object: any): RequestDecryptionKeyPacketAck { return { - identity: isSet(object.identity) ? String(object.identity) : "", - pubkey: isSet(object.pubkey) ? String(object.pubkey) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", }; }, - toJSON(message: RequestAggrKeysharePacketAck): unknown { + toJSON(message: RequestDecryptionKeyPacketAck): unknown { const obj: any = {}; if (message.identity !== "") { obj.identity = message.identity; @@ -427,33 +702,35 @@ export const RequestAggrKeysharePacketAck = { return obj; }, - create, I>>(base?: I): RequestAggrKeysharePacketAck { - return RequestAggrKeysharePacketAck.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): RequestAggrKeysharePacketAck { - const message = createBaseRequestAggrKeysharePacketAck(); + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); message.identity = object.identity ?? ""; message.pubkey = object.pubkey ?? ""; return message; }, }; -function createBaseGetAggrKeysharePacketData(): GetAggrKeysharePacketData { +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { return { identity: "" }; } -export const GetAggrKeysharePacketData = { - encode(message: GetAggrKeysharePacketData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.identity !== "") { writer.uint32(10).string(message.identity); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GetAggrKeysharePacketData { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAggrKeysharePacketData(); + const message = createBaseGetDecryptionKeyPacketData(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -468,16 +745,16 @@ export const GetAggrKeysharePacketData = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): GetAggrKeysharePacketData { - return { identity: isSet(object.identity) ? String(object.identity) : "" }; + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; }, - toJSON(message: GetAggrKeysharePacketData): unknown { + toJSON(message: GetDecryptionKeyPacketData): unknown { const obj: any = {}; if (message.identity !== "") { obj.identity = message.identity; @@ -485,29 +762,29 @@ export const GetAggrKeysharePacketData = { return obj; }, - create, I>>(base?: I): GetAggrKeysharePacketData { - return GetAggrKeysharePacketData.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GetAggrKeysharePacketData { - const message = createBaseGetAggrKeysharePacketData(); + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); message.identity = object.identity ?? ""; return message; }, }; -function createBaseGetAggrKeysharePacketAck(): GetAggrKeysharePacketAck { +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { return {}; } -export const GetAggrKeysharePacketAck = { - encode(_: GetAggrKeysharePacketAck, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GetAggrKeysharePacketAck { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAggrKeysharePacketAck(); + const message = createBaseGetDecryptionKeyPacketAck(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -515,43 +792,183 @@ export const GetAggrKeysharePacketAck = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): GetAggrKeysharePacketAck { + fromJSON(_: any): GetDecryptionKeyPacketAck { return {}; }, - toJSON(_: GetAggrKeysharePacketAck): unknown { + toJSON(_: GetDecryptionKeyPacketAck): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): GetAggrKeysharePacketAck { - return GetAggrKeysharePacketAck.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): GetAggrKeysharePacketAck { - const message = createBaseGetAggrKeysharePacketAck(); + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); return message; }, }; -function createBaseAggrKeyshareDataPacketData(): AggrKeyshareDataPacketData { - return { identity: "", pubkey: "", aggrKeyshare: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; } -export const AggrKeyshareDataPacketData = { - encode(message: AggrKeyshareDataPacketData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.identity !== "") { writer.uint32(10).string(message.identity); } if (message.pubkey !== "") { writer.uint32(18).string(message.pubkey); } - if (message.aggrKeyshare !== "") { - writer.uint32(26).string(message.aggrKeyshare); + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); } if (message.aggrHeight !== "") { writer.uint32(34).string(message.aggrHeight); @@ -568,10 +985,10 @@ export const AggrKeyshareDataPacketData = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): AggrKeyshareDataPacketData { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAggrKeyshareDataPacketData(); + const message = createBaseDecryptionKeyDataPacketData(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -594,7 +1011,7 @@ export const AggrKeyshareDataPacketData = { break; } - message.aggrKeyshare = reader.string(); + message.decryptionKey = reader.string(); continue; case 4: if (tag !== 34) { @@ -622,30 +1039,30 @@ export const AggrKeyshareDataPacketData = { break; } - message.retries = longToNumber(reader.uint64() as Long); + message.retries = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): AggrKeyshareDataPacketData { + fromJSON(object: any): DecryptionKeyDataPacketData { return { - identity: isSet(object.identity) ? String(object.identity) : "", - pubkey: isSet(object.pubkey) ? String(object.pubkey) : "", - aggrKeyshare: isSet(object.aggrKeyshare) ? String(object.aggrKeyshare) : "", - aggrHeight: isSet(object.aggrHeight) ? String(object.aggrHeight) : "", - proposalId: isSet(object.proposalId) ? String(object.proposalId) : "", - requestId: isSet(object.requestId) ? String(object.requestId) : "", - retries: isSet(object.retries) ? Number(object.retries) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, }; }, - toJSON(message: AggrKeyshareDataPacketData): unknown { + toJSON(message: DecryptionKeyDataPacketData): unknown { const obj: any = {}; if (message.identity !== "") { obj.identity = message.identity; @@ -653,8 +1070,8 @@ export const AggrKeyshareDataPacketData = { if (message.pubkey !== "") { obj.pubkey = message.pubkey; } - if (message.aggrKeyshare !== "") { - obj.aggrKeyshare = message.aggrKeyshare; + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; } if (message.aggrHeight !== "") { obj.aggrHeight = message.aggrHeight; @@ -671,14 +1088,14 @@ export const AggrKeyshareDataPacketData = { return obj; }, - create, I>>(base?: I): AggrKeyshareDataPacketData { - return AggrKeyshareDataPacketData.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): AggrKeyshareDataPacketData { - const message = createBaseAggrKeyshareDataPacketData(); + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); message.identity = object.identity ?? ""; message.pubkey = object.pubkey ?? ""; - message.aggrKeyshare = object.aggrKeyshare ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; message.aggrHeight = object.aggrHeight ?? ""; message.proposalId = object.proposalId ?? ""; message.requestId = object.requestId ?? ""; @@ -687,19 +1104,172 @@ export const AggrKeyshareDataPacketData = { }, }; -function createBaseAggrKeyshareDataPacketAck(): AggrKeyshareDataPacketAck { +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { return {}; } -export const AggrKeyshareDataPacketAck = { - encode(_: AggrKeyshareDataPacketAck, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): AggrKeyshareDataPacketAck { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAggrKeyshareDataPacketAck(); + const message = createBasePrivateDecryptionKeyPacketAck(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -707,25 +1277,25 @@ export const AggrKeyshareDataPacketAck = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): AggrKeyshareDataPacketAck { + fromJSON(_: any): PrivateDecryptionKeyPacketAck { return {}; }, - toJSON(_: AggrKeyshareDataPacketAck): unknown { + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): AggrKeyshareDataPacketAck { - return AggrKeyshareDataPacketAck.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): AggrKeyshareDataPacketAck { - const message = createBaseAggrKeyshareDataPacketAck(); + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); return message; }, }; @@ -734,13 +1304,13 @@ function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { return {}; } -export const CurrentKeysPacketData = { - encode(_: CurrentKeysPacketData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CurrentKeysPacketData { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCurrentKeysPacketData(); while (reader.pos < end) { @@ -750,7 +1320,7 @@ export const CurrentKeysPacketData = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -777,19 +1347,19 @@ function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { return { activeKey: undefined, queuedKey: undefined }; } -export const CurrentKeysPacketAck = { - encode(message: CurrentKeysPacketAck, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.activeKey !== undefined) { - ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).ldelim(); + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); } if (message.queuedKey !== undefined) { - QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).ldelim(); + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CurrentKeysPacketAck { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCurrentKeysPacketAck(); while (reader.pos < end) { @@ -813,7 +1383,7 @@ export const CurrentKeysPacketAck = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -851,29 +1421,11 @@ export const CurrentKeysPacketAck = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -881,18 +1433,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/params.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/params.ts index 902a1aaf..51435c5b 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/params.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/params.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "fairyring.keyshare"; @@ -25,8 +30,8 @@ function createBaseParams(): Params { }; } -export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.keyExpiry !== 0) { writer.uint32(8).uint64(message.keyExpiry); } @@ -48,8 +53,8 @@ export const Params = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseParams(); while (reader.pos < end) { @@ -60,21 +65,21 @@ export const Params = { break; } - message.keyExpiry = longToNumber(reader.uint64() as Long); + message.keyExpiry = longToNumber(reader.uint64()); continue; case 2: if (tag !== 16) { break; } - message.minimumBonded = longToNumber(reader.uint64() as Long); + message.minimumBonded = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.maxIdledBlock = longToNumber(reader.uint64() as Long); + message.maxIdledBlock = longToNumber(reader.uint64()); continue; case 4: if (tag !== 34) { @@ -101,18 +106,18 @@ export const Params = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Params { return { - keyExpiry: isSet(object.keyExpiry) ? Number(object.keyExpiry) : 0, - minimumBonded: isSet(object.minimumBonded) ? Number(object.minimumBonded) : 0, - maxIdledBlock: isSet(object.maxIdledBlock) ? Number(object.maxIdledBlock) : 0, - trustedAddresses: Array.isArray(object?.trustedAddresses) - ? object.trustedAddresses.map((e: any) => String(e)) + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) : [], slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) ? bytesFromBase64(object.slashFractionNoKeyshare) @@ -161,30 +166,11 @@ export const Params = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -194,21 +180,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -216,18 +203,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/pubkey.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/query.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/query.ts index 5e1cae79..e9da6c11 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/query.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/query.ts @@ -1,21 +1,33 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; -import { AggregatedKeyShare } from "./aggregated_key_share"; import { AuthorizedAddress } from "./authorized_address"; import { Commitments } from "./commitments"; -import { GeneralKeyShare } from "./general_key_share"; -import { KeyShare } from "./key_share"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; import { Params } from "./params"; -import { ActivePubKey, QueuedPubKey } from "./pub_key"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; import { ValidatorSet } from "./validator_set"; export const protobufPackage = "fairyring.keyshare"; -export interface QueryVerifiableRandomnessQuery { +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { } +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ export interface QueryVerifiableRandomnessResponse { randomness: string; round: number; @@ -31,124 +43,147 @@ export interface QueryParamsResponse { params: Params | undefined; } +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ export interface QueryCommitmentsRequest { } +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ export interface QueryCommitmentsResponse { activeCommitments: Commitments | undefined; queuedCommitments: Commitments | undefined; } -export interface QueryGetValidatorSetRequest { +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { index: string; } -export interface QueryGetValidatorSetResponse { +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { validatorSet: ValidatorSet | undefined; } -export interface QueryAllValidatorSetRequest { +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { pagination: PageRequest | undefined; } -export interface QueryAllValidatorSetResponse { +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { validatorSet: ValidatorSet[]; pagination: PageResponse | undefined; } -export interface QueryGetKeyShareRequest { +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { validator: string; blockHeight: number; } -export interface QueryGetKeyShareResponse { - keyShare: KeyShare | undefined; +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; } -export interface QueryAllKeyShareRequest { +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { pagination: PageRequest | undefined; } -export interface QueryAllKeyShareResponse { - keyShare: KeyShare[]; +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; pagination: PageResponse | undefined; } -/** this line is used by starport scaffolding # 3 */ -export interface QueryGetAggregatedKeyShareRequest { +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { height: number; } -export interface QueryGetAggregatedKeyShareResponse { - aggregatedKeyShare: AggregatedKeyShare | undefined; +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; } -export interface QueryAllAggregatedKeyShareRequest { +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { pagination: PageRequest | undefined; } -export interface QueryAllAggregatedKeyShareResponse { - aggregatedKeyShare: AggregatedKeyShare[]; +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; pagination: PageResponse | undefined; } -export interface QueryPubKeyRequest { +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { } -export interface QueryPubKeyResponse { - activePubKey: ActivePubKey | undefined; - queuedPubKey: QueuedPubKey | undefined; +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; } -export interface QueryGetAuthorizedAddressRequest { +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { target: string; } -export interface QueryGetAuthorizedAddressResponse { +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { authorizedAddress: AuthorizedAddress | undefined; } -export interface QueryAllAuthorizedAddressRequest { +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { pagination: PageRequest | undefined; } -export interface QueryAllAuthorizedAddressResponse { +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { authorizedAddress: AuthorizedAddress[]; pagination: PageResponse | undefined; } -export interface QueryGetGeneralKeyShareRequest { +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { validator: string; idType: string; idValue: string; } -export interface QueryGetGeneralKeyShareResponse { - generalKeyShare: GeneralKeyShare | undefined; +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; } -export interface QueryAllGeneralKeyShareRequest { +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { pagination: PageRequest | undefined; } -export interface QueryAllGeneralKeyShareResponse { - generalKeyShare: GeneralKeyShare[]; +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; pagination: PageResponse | undefined; } -function createBaseQueryVerifiableRandomnessQuery(): QueryVerifiableRandomnessQuery { +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { return {}; } -export const QueryVerifiableRandomnessQuery = { - encode(_: QueryVerifiableRandomnessQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVerifiableRandomnessQuery { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryVerifiableRandomnessQuery(); + const message = createBaseQueryVerifiableRandomnessRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -156,25 +191,29 @@ export const QueryVerifiableRandomnessQuery = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): QueryVerifiableRandomnessQuery { + fromJSON(_: any): QueryVerifiableRandomnessRequest { return {}; }, - toJSON(_: QueryVerifiableRandomnessQuery): unknown { + toJSON(_: QueryVerifiableRandomnessRequest): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): QueryVerifiableRandomnessQuery { - return QueryVerifiableRandomnessQuery.fromPartial(base ?? ({} as any)); + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): QueryVerifiableRandomnessQuery { - const message = createBaseQueryVerifiableRandomnessQuery(); + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); return message; }, }; @@ -183,8 +222,8 @@ function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnes return { randomness: "", round: 0 }; } -export const QueryVerifiableRandomnessResponse = { - encode(message: QueryVerifiableRandomnessResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.randomness !== "") { writer.uint32(10).string(message.randomness); } @@ -194,8 +233,8 @@ export const QueryVerifiableRandomnessResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVerifiableRandomnessResponse(); while (reader.pos < end) { @@ -213,21 +252,21 @@ export const QueryVerifiableRandomnessResponse = { break; } - message.round = longToNumber(reader.uint64() as Long); + message.round = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryVerifiableRandomnessResponse { return { - randomness: isSet(object.randomness) ? String(object.randomness) : "", - round: isSet(object.round) ? Number(object.round) : 0, + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, }; }, @@ -261,13 +300,13 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } -export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParamsRequest(); while (reader.pos < end) { @@ -277,7 +316,7 @@ export const QueryParamsRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -304,16 +343,16 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { return { params: undefined }; } -export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + Params.encode(message.params, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParamsResponse(); while (reader.pos < end) { @@ -330,7 +369,7 @@ export const QueryParamsResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -363,13 +402,13 @@ function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { return {}; } -export const QueryCommitmentsRequest = { - encode(_: QueryCommitmentsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommitmentsRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryCommitmentsRequest(); while (reader.pos < end) { @@ -379,7 +418,7 @@ export const QueryCommitmentsRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -406,19 +445,19 @@ function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { return { activeCommitments: undefined, queuedCommitments: undefined }; } -export const QueryCommitmentsResponse = { - encode(message: QueryCommitmentsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.activeCommitments !== undefined) { - Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).ldelim(); + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); } if (message.queuedCommitments !== undefined) { - Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).ldelim(); + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommitmentsResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryCommitmentsResponse(); while (reader.pos < end) { @@ -442,7 +481,7 @@ export const QueryCommitmentsResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -480,22 +519,22 @@ export const QueryCommitmentsResponse = { }, }; -function createBaseQueryGetValidatorSetRequest(): QueryGetValidatorSetRequest { +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { return { index: "" }; } -export const QueryGetValidatorSetRequest = { - encode(message: QueryGetValidatorSetRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.index !== "") { writer.uint32(10).string(message.index); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetValidatorSetRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetValidatorSetRequest(); + const message = createBaseQueryValidatorSetRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -510,16 +549,16 @@ export const QueryGetValidatorSetRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetValidatorSetRequest { - return { index: isSet(object.index) ? String(object.index) : "" }; + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; }, - toJSON(message: QueryGetValidatorSetRequest): unknown { + toJSON(message: QueryValidatorSetRequest): unknown { const obj: any = {}; if (message.index !== "") { obj.index = message.index; @@ -527,32 +566,32 @@ export const QueryGetValidatorSetRequest = { return obj; }, - create, I>>(base?: I): QueryGetValidatorSetRequest { - return QueryGetValidatorSetRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryGetValidatorSetRequest { - const message = createBaseQueryGetValidatorSetRequest(); + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); message.index = object.index ?? ""; return message; }, }; -function createBaseQueryGetValidatorSetResponse(): QueryGetValidatorSetResponse { +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { return { validatorSet: undefined }; } -export const QueryGetValidatorSetResponse = { - encode(message: QueryGetValidatorSetResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.validatorSet !== undefined) { - ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).ldelim(); + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetValidatorSetResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetValidatorSetResponse(); + const message = createBaseQueryValidatorSetResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -567,16 +606,16 @@ export const QueryGetValidatorSetResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetValidatorSetResponse { + fromJSON(object: any): QueryValidatorSetResponse { return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; }, - toJSON(message: QueryGetValidatorSetResponse): unknown { + toJSON(message: QueryValidatorSetResponse): unknown { const obj: any = {}; if (message.validatorSet !== undefined) { obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); @@ -584,11 +623,11 @@ export const QueryGetValidatorSetResponse = { return obj; }, - create, I>>(base?: I): QueryGetValidatorSetResponse { - return QueryGetValidatorSetResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryGetValidatorSetResponse { - const message = createBaseQueryGetValidatorSetResponse(); + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) ? ValidatorSet.fromPartial(object.validatorSet) : undefined; @@ -596,22 +635,22 @@ export const QueryGetValidatorSetResponse = { }, }; -function createBaseQueryAllValidatorSetRequest(): QueryAllValidatorSetRequest { +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { return { pagination: undefined }; } -export const QueryAllValidatorSetRequest = { - encode(message: QueryAllValidatorSetRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllValidatorSetRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllValidatorSetRequest(); + const message = createBaseQueryValidatorSetAllRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -626,16 +665,16 @@ export const QueryAllValidatorSetRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllValidatorSetRequest { + fromJSON(object: any): QueryValidatorSetAllRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllValidatorSetRequest): unknown { + toJSON(message: QueryValidatorSetAllRequest): unknown { const obj: any = {}; if (message.pagination !== undefined) { obj.pagination = PageRequest.toJSON(message.pagination); @@ -643,11 +682,11 @@ export const QueryAllValidatorSetRequest = { return obj; }, - create, I>>(base?: I): QueryAllValidatorSetRequest { - return QueryAllValidatorSetRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllValidatorSetRequest { - const message = createBaseQueryAllValidatorSetRequest(); + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -655,25 +694,25 @@ export const QueryAllValidatorSetRequest = { }, }; -function createBaseQueryAllValidatorSetResponse(): QueryAllValidatorSetResponse { +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { return { validatorSet: [], pagination: undefined }; } -export const QueryAllValidatorSetResponse = { - encode(message: QueryAllValidatorSetResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.validatorSet) { - ValidatorSet.encode(v!, writer.uint32(10).fork()).ldelim(); + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllValidatorSetResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllValidatorSetResponse(); + const message = createBaseQueryValidatorSetAllResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -695,21 +734,21 @@ export const QueryAllValidatorSetResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllValidatorSetResponse { + fromJSON(object: any): QueryValidatorSetAllResponse { return { - validatorSet: Array.isArray(object?.validatorSet) + validatorSet: globalThis.Array.isArray(object?.validatorSet) ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllValidatorSetResponse): unknown { + toJSON(message: QueryValidatorSetAllResponse): unknown { const obj: any = {}; if (message.validatorSet?.length) { obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); @@ -720,11 +759,11 @@ export const QueryAllValidatorSetResponse = { return obj; }, - create, I>>(base?: I): QueryAllValidatorSetResponse { - return QueryAllValidatorSetResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllValidatorSetResponse { - const message = createBaseQueryAllValidatorSetResponse(); + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) @@ -733,12 +772,12 @@ export const QueryAllValidatorSetResponse = { }, }; -function createBaseQueryGetKeyShareRequest(): QueryGetKeyShareRequest { +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { return { validator: "", blockHeight: 0 }; } -export const QueryGetKeyShareRequest = { - encode(message: QueryGetKeyShareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.validator !== "") { writer.uint32(10).string(message.validator); } @@ -748,10 +787,10 @@ export const QueryGetKeyShareRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetKeyShareRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetKeyShareRequest(); + const message = createBaseQueryKeyshareRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -767,25 +806,25 @@ export const QueryGetKeyShareRequest = { break; } - message.blockHeight = longToNumber(reader.uint64() as Long); + message.blockHeight = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetKeyShareRequest { + fromJSON(object: any): QueryKeyshareRequest { return { - validator: isSet(object.validator) ? String(object.validator) : "", - blockHeight: isSet(object.blockHeight) ? Number(object.blockHeight) : 0, + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, }; }, - toJSON(message: QueryGetKeyShareRequest): unknown { + toJSON(message: QueryKeyshareRequest): unknown { const obj: any = {}; if (message.validator !== "") { obj.validator = message.validator; @@ -796,33 +835,33 @@ export const QueryGetKeyShareRequest = { return obj; }, - create, I>>(base?: I): QueryGetKeyShareRequest { - return QueryGetKeyShareRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryGetKeyShareRequest { - const message = createBaseQueryGetKeyShareRequest(); + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); message.validator = object.validator ?? ""; message.blockHeight = object.blockHeight ?? 0; return message; }, }; -function createBaseQueryGetKeyShareResponse(): QueryGetKeyShareResponse { - return { keyShare: undefined }; +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; } -export const QueryGetKeyShareResponse = { - encode(message: QueryGetKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.keyShare !== undefined) { - KeyShare.encode(message.keyShare, writer.uint32(10).fork()).ldelim(); +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetKeyShareResponse(); + const message = createBaseQueryKeyshareResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -831,57 +870,57 @@ export const QueryGetKeyShareResponse = { break; } - message.keyShare = KeyShare.decode(reader, reader.uint32()); + message.keyshare = Keyshare.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetKeyShareResponse { - return { keyShare: isSet(object.keyShare) ? KeyShare.fromJSON(object.keyShare) : undefined }; + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; }, - toJSON(message: QueryGetKeyShareResponse): unknown { + toJSON(message: QueryKeyshareResponse): unknown { const obj: any = {}; - if (message.keyShare !== undefined) { - obj.keyShare = KeyShare.toJSON(message.keyShare); + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); } return obj; }, - create, I>>(base?: I): QueryGetKeyShareResponse { - return QueryGetKeyShareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryGetKeyShareResponse { - const message = createBaseQueryGetKeyShareResponse(); - message.keyShare = (object.keyShare !== undefined && object.keyShare !== null) - ? KeyShare.fromPartial(object.keyShare) + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) : undefined; return message; }, }; -function createBaseQueryAllKeyShareRequest(): QueryAllKeyShareRequest { +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { return { pagination: undefined }; } -export const QueryAllKeyShareRequest = { - encode(message: QueryAllKeyShareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllKeyShareRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllKeyShareRequest(); + const message = createBaseQueryKeyshareAllRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -896,16 +935,16 @@ export const QueryAllKeyShareRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllKeyShareRequest { + fromJSON(object: any): QueryKeyshareAllRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllKeyShareRequest): unknown { + toJSON(message: QueryKeyshareAllRequest): unknown { const obj: any = {}; if (message.pagination !== undefined) { obj.pagination = PageRequest.toJSON(message.pagination); @@ -913,11 +952,11 @@ export const QueryAllKeyShareRequest = { return obj; }, - create, I>>(base?: I): QueryAllKeyShareRequest { - return QueryAllKeyShareRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllKeyShareRequest { - const message = createBaseQueryAllKeyShareRequest(); + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -925,25 +964,25 @@ export const QueryAllKeyShareRequest = { }, }; -function createBaseQueryAllKeyShareResponse(): QueryAllKeyShareResponse { - return { keyShare: [], pagination: undefined }; +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; } -export const QueryAllKeyShareResponse = { - encode(message: QueryAllKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.keyShare) { - KeyShare.encode(v!, writer.uint32(10).fork()).ldelim(); +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllKeyShareResponse(); + const message = createBaseQueryKeyshareAllResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -952,7 +991,7 @@ export const QueryAllKeyShareResponse = { break; } - message.keyShare.push(KeyShare.decode(reader, reader.uint32())); + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); continue; case 2: if (tag !== 18) { @@ -965,22 +1004,22 @@ export const QueryAllKeyShareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllKeyShareResponse { + fromJSON(object: any): QueryKeyshareAllResponse { return { - keyShare: Array.isArray(object?.keyShare) ? object.keyShare.map((e: any) => KeyShare.fromJSON(e)) : [], + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllKeyShareResponse): unknown { + toJSON(message: QueryKeyshareAllResponse): unknown { const obj: any = {}; - if (message.keyShare?.length) { - obj.keyShare = message.keyShare.map((e) => KeyShare.toJSON(e)); + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); } if (message.pagination !== undefined) { obj.pagination = PageResponse.toJSON(message.pagination); @@ -988,12 +1027,12 @@ export const QueryAllKeyShareResponse = { return obj; }, - create, I>>(base?: I): QueryAllKeyShareResponse { - return QueryAllKeyShareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllKeyShareResponse { - const message = createBaseQueryAllKeyShareResponse(); - message.keyShare = object.keyShare?.map((e) => KeyShare.fromPartial(e)) || []; + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) : undefined; @@ -1001,22 +1040,22 @@ export const QueryAllKeyShareResponse = { }, }; -function createBaseQueryGetAggregatedKeyShareRequest(): QueryGetAggregatedKeyShareRequest { +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { return { height: 0 }; } -export const QueryGetAggregatedKeyShareRequest = { - encode(message: QueryGetAggregatedKeyShareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.height !== 0) { writer.uint32(8).uint64(message.height); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetAggregatedKeyShareRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetAggregatedKeyShareRequest(); + const message = createBaseQueryDecryptionKeyRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1025,22 +1064,22 @@ export const QueryGetAggregatedKeyShareRequest = { break; } - message.height = longToNumber(reader.uint64() as Long); + message.height = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetAggregatedKeyShareRequest { - return { height: isSet(object.height) ? Number(object.height) : 0 }; + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; }, - toJSON(message: QueryGetAggregatedKeyShareRequest): unknown { + toJSON(message: QueryDecryptionKeyRequest): unknown { const obj: any = {}; if (message.height !== 0) { obj.height = Math.round(message.height); @@ -1048,36 +1087,32 @@ export const QueryGetAggregatedKeyShareRequest = { return obj; }, - create, I>>( - base?: I, - ): QueryGetAggregatedKeyShareRequest { - return QueryGetAggregatedKeyShareRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): QueryGetAggregatedKeyShareRequest { - const message = createBaseQueryGetAggregatedKeyShareRequest(); + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); message.height = object.height ?? 0; return message; }, }; -function createBaseQueryGetAggregatedKeyShareResponse(): QueryGetAggregatedKeyShareResponse { - return { aggregatedKeyShare: undefined }; +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; } -export const QueryGetAggregatedKeyShareResponse = { - encode(message: QueryGetAggregatedKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.aggregatedKeyShare !== undefined) { - AggregatedKeyShare.encode(message.aggregatedKeyShare, writer.uint32(10).fork()).ldelim(); +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetAggregatedKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetAggregatedKeyShareResponse(); + const message = createBaseQueryDecryptionKeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1086,65 +1121,57 @@ export const QueryGetAggregatedKeyShareResponse = { break; } - message.aggregatedKeyShare = AggregatedKeyShare.decode(reader, reader.uint32()); + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetAggregatedKeyShareResponse { - return { - aggregatedKeyShare: isSet(object.aggregatedKeyShare) - ? AggregatedKeyShare.fromJSON(object.aggregatedKeyShare) - : undefined, - }; + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; }, - toJSON(message: QueryGetAggregatedKeyShareResponse): unknown { + toJSON(message: QueryDecryptionKeyResponse): unknown { const obj: any = {}; - if (message.aggregatedKeyShare !== undefined) { - obj.aggregatedKeyShare = AggregatedKeyShare.toJSON(message.aggregatedKeyShare); + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); } return obj; }, - create, I>>( - base?: I, - ): QueryGetAggregatedKeyShareResponse { - return QueryGetAggregatedKeyShareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): QueryGetAggregatedKeyShareResponse { - const message = createBaseQueryGetAggregatedKeyShareResponse(); - message.aggregatedKeyShare = (object.aggregatedKeyShare !== undefined && object.aggregatedKeyShare !== null) - ? AggregatedKeyShare.fromPartial(object.aggregatedKeyShare) + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) : undefined; return message; }, }; -function createBaseQueryAllAggregatedKeyShareRequest(): QueryAllAggregatedKeyShareRequest { +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { return { pagination: undefined }; } -export const QueryAllAggregatedKeyShareRequest = { - encode(message: QueryAllAggregatedKeyShareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllAggregatedKeyShareRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllAggregatedKeyShareRequest(); + const message = createBaseQueryDecryptionKeyAllRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1159,16 +1186,16 @@ export const QueryAllAggregatedKeyShareRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllAggregatedKeyShareRequest { + fromJSON(object: any): QueryDecryptionKeyAllRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllAggregatedKeyShareRequest): unknown { + toJSON(message: QueryDecryptionKeyAllRequest): unknown { const obj: any = {}; if (message.pagination !== undefined) { obj.pagination = PageRequest.toJSON(message.pagination); @@ -1176,15 +1203,11 @@ export const QueryAllAggregatedKeyShareRequest = { return obj; }, - create, I>>( - base?: I, - ): QueryAllAggregatedKeyShareRequest { - return QueryAllAggregatedKeyShareRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): QueryAllAggregatedKeyShareRequest { - const message = createBaseQueryAllAggregatedKeyShareRequest(); + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -1192,25 +1215,25 @@ export const QueryAllAggregatedKeyShareRequest = { }, }; -function createBaseQueryAllAggregatedKeyShareResponse(): QueryAllAggregatedKeyShareResponse { - return { aggregatedKeyShare: [], pagination: undefined }; +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; } -export const QueryAllAggregatedKeyShareResponse = { - encode(message: QueryAllAggregatedKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.aggregatedKeyShare) { - AggregatedKeyShare.encode(v!, writer.uint32(10).fork()).ldelim(); +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllAggregatedKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllAggregatedKeyShareResponse(); + const message = createBaseQueryDecryptionKeyAllResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1219,7 +1242,7 @@ export const QueryAllAggregatedKeyShareResponse = { break; } - message.aggregatedKeyShare.push(AggregatedKeyShare.decode(reader, reader.uint32())); + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); continue; case 2: if (tag !== 18) { @@ -1232,24 +1255,24 @@ export const QueryAllAggregatedKeyShareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllAggregatedKeyShareResponse { + fromJSON(object: any): QueryDecryptionKeyAllResponse { return { - aggregatedKeyShare: Array.isArray(object?.aggregatedKeyShare) - ? object.aggregatedKeyShare.map((e: any) => AggregatedKeyShare.fromJSON(e)) + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllAggregatedKeyShareResponse): unknown { + toJSON(message: QueryDecryptionKeyAllResponse): unknown { const obj: any = {}; - if (message.aggregatedKeyShare?.length) { - obj.aggregatedKeyShare = message.aggregatedKeyShare.map((e) => AggregatedKeyShare.toJSON(e)); + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); } if (message.pagination !== undefined) { obj.pagination = PageResponse.toJSON(message.pagination); @@ -1257,16 +1280,14 @@ export const QueryAllAggregatedKeyShareResponse = { return obj; }, - create, I>>( - base?: I, - ): QueryAllAggregatedKeyShareResponse { - return QueryAllAggregatedKeyShareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllAggregatedKeyShareResponse { - const message = createBaseQueryAllAggregatedKeyShareResponse(); - message.aggregatedKeyShare = object.aggregatedKeyShare?.map((e) => AggregatedKeyShare.fromPartial(e)) || []; + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) : undefined; @@ -1274,19 +1295,19 @@ export const QueryAllAggregatedKeyShareResponse = { }, }; -function createBaseQueryPubKeyRequest(): QueryPubKeyRequest { +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { return {}; } -export const QueryPubKeyRequest = { - encode(_: QueryPubKeyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPubKeyRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryPubKeyRequest(); + const message = createBaseQueryPubkeyRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1294,48 +1315,48 @@ export const QueryPubKeyRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): QueryPubKeyRequest { + fromJSON(_: any): QueryPubkeyRequest { return {}; }, - toJSON(_: QueryPubKeyRequest): unknown { + toJSON(_: QueryPubkeyRequest): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): QueryPubKeyRequest { - return QueryPubKeyRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): QueryPubKeyRequest { - const message = createBaseQueryPubKeyRequest(); + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); return message; }, }; -function createBaseQueryPubKeyResponse(): QueryPubKeyResponse { - return { activePubKey: undefined, queuedPubKey: undefined }; +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; } -export const QueryPubKeyResponse = { - encode(message: QueryPubKeyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.activePubKey !== undefined) { - ActivePubKey.encode(message.activePubKey, writer.uint32(10).fork()).ldelim(); +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); } - if (message.queuedPubKey !== undefined) { - QueuedPubKey.encode(message.queuedPubKey, writer.uint32(18).fork()).ldelim(); + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPubKeyResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryPubKeyResponse(); + const message = createBaseQueryPubkeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1344,73 +1365,73 @@ export const QueryPubKeyResponse = { break; } - message.activePubKey = ActivePubKey.decode(reader, reader.uint32()); + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); continue; case 2: if (tag !== 18) { break; } - message.queuedPubKey = QueuedPubKey.decode(reader, reader.uint32()); + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryPubKeyResponse { + fromJSON(object: any): QueryPubkeyResponse { return { - activePubKey: isSet(object.activePubKey) ? ActivePubKey.fromJSON(object.activePubKey) : undefined, - queuedPubKey: isSet(object.queuedPubKey) ? QueuedPubKey.fromJSON(object.queuedPubKey) : undefined, + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, }; }, - toJSON(message: QueryPubKeyResponse): unknown { + toJSON(message: QueryPubkeyResponse): unknown { const obj: any = {}; - if (message.activePubKey !== undefined) { - obj.activePubKey = ActivePubKey.toJSON(message.activePubKey); + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); } - if (message.queuedPubKey !== undefined) { - obj.queuedPubKey = QueuedPubKey.toJSON(message.queuedPubKey); + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); } return obj; }, - create, I>>(base?: I): QueryPubKeyResponse { - return QueryPubKeyResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryPubKeyResponse { - const message = createBaseQueryPubKeyResponse(); - message.activePubKey = (object.activePubKey !== undefined && object.activePubKey !== null) - ? ActivePubKey.fromPartial(object.activePubKey) + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) : undefined; - message.queuedPubKey = (object.queuedPubKey !== undefined && object.queuedPubKey !== null) - ? QueuedPubKey.fromPartial(object.queuedPubKey) + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) : undefined; return message; }, }; -function createBaseQueryGetAuthorizedAddressRequest(): QueryGetAuthorizedAddressRequest { +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { return { target: "" }; } -export const QueryGetAuthorizedAddressRequest = { - encode(message: QueryGetAuthorizedAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.target !== "") { writer.uint32(10).string(message.target); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetAuthorizedAddressRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetAuthorizedAddressRequest(); + const message = createBaseQueryAuthorizedAddressRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1425,16 +1446,16 @@ export const QueryGetAuthorizedAddressRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetAuthorizedAddressRequest { - return { target: isSet(object.target) ? String(object.target) : "" }; + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; }, - toJSON(message: QueryGetAuthorizedAddressRequest): unknown { + toJSON(message: QueryAuthorizedAddressRequest): unknown { const obj: any = {}; if (message.target !== "") { obj.target = message.target; @@ -1442,36 +1463,34 @@ export const QueryGetAuthorizedAddressRequest = { return obj; }, - create, I>>( - base?: I, - ): QueryGetAuthorizedAddressRequest { - return QueryGetAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetAuthorizedAddressRequest { - const message = createBaseQueryGetAuthorizedAddressRequest(); + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); message.target = object.target ?? ""; return message; }, }; -function createBaseQueryGetAuthorizedAddressResponse(): QueryGetAuthorizedAddressResponse { +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { return { authorizedAddress: undefined }; } -export const QueryGetAuthorizedAddressResponse = { - encode(message: QueryGetAuthorizedAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.authorizedAddress !== undefined) { - AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).ldelim(); + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetAuthorizedAddressResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetAuthorizedAddressResponse(); + const message = createBaseQueryAuthorizedAddressResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1486,12 +1505,12 @@ export const QueryGetAuthorizedAddressResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetAuthorizedAddressResponse { + fromJSON(object: any): QueryAuthorizedAddressResponse { return { authorizedAddress: isSet(object.authorizedAddress) ? AuthorizedAddress.fromJSON(object.authorizedAddress) @@ -1499,7 +1518,7 @@ export const QueryGetAuthorizedAddressResponse = { }; }, - toJSON(message: QueryGetAuthorizedAddressResponse): unknown { + toJSON(message: QueryAuthorizedAddressResponse): unknown { const obj: any = {}; if (message.authorizedAddress !== undefined) { obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); @@ -1507,15 +1526,13 @@ export const QueryGetAuthorizedAddressResponse = { return obj; }, - create, I>>( - base?: I, - ): QueryGetAuthorizedAddressResponse { - return QueryGetAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetAuthorizedAddressResponse { - const message = createBaseQueryGetAuthorizedAddressResponse(); + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) ? AuthorizedAddress.fromPartial(object.authorizedAddress) : undefined; @@ -1523,22 +1540,22 @@ export const QueryGetAuthorizedAddressResponse = { }, }; -function createBaseQueryAllAuthorizedAddressRequest(): QueryAllAuthorizedAddressRequest { +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { return { pagination: undefined }; } -export const QueryAllAuthorizedAddressRequest = { - encode(message: QueryAllAuthorizedAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllAuthorizedAddressRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllAuthorizedAddressRequest(); + const message = createBaseQueryAuthorizedAddressAllRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1553,16 +1570,16 @@ export const QueryAllAuthorizedAddressRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllAuthorizedAddressRequest { + fromJSON(object: any): QueryAuthorizedAddressAllRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllAuthorizedAddressRequest): unknown { + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { const obj: any = {}; if (message.pagination !== undefined) { obj.pagination = PageRequest.toJSON(message.pagination); @@ -1570,15 +1587,15 @@ export const QueryAllAuthorizedAddressRequest = { return obj; }, - create, I>>( + create, I>>( base?: I, - ): QueryAllAuthorizedAddressRequest { - return QueryAllAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllAuthorizedAddressRequest { - const message = createBaseQueryAllAuthorizedAddressRequest(); + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -1586,25 +1603,25 @@ export const QueryAllAuthorizedAddressRequest = { }, }; -function createBaseQueryAllAuthorizedAddressResponse(): QueryAllAuthorizedAddressResponse { +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { return { authorizedAddress: [], pagination: undefined }; } -export const QueryAllAuthorizedAddressResponse = { - encode(message: QueryAllAuthorizedAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.authorizedAddress) { - AuthorizedAddress.encode(v!, writer.uint32(10).fork()).ldelim(); + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllAuthorizedAddressResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllAuthorizedAddressResponse(); + const message = createBaseQueryAuthorizedAddressAllResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1626,21 +1643,21 @@ export const QueryAllAuthorizedAddressResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllAuthorizedAddressResponse { + fromJSON(object: any): QueryAuthorizedAddressAllResponse { return { - authorizedAddress: Array.isArray(object?.authorizedAddress) + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllAuthorizedAddressResponse): unknown { + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { const obj: any = {}; if (message.authorizedAddress?.length) { obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); @@ -1651,15 +1668,15 @@ export const QueryAllAuthorizedAddressResponse = { return obj; }, - create, I>>( + create, I>>( base?: I, - ): QueryAllAuthorizedAddressResponse { - return QueryAllAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllAuthorizedAddressResponse { - const message = createBaseQueryAllAuthorizedAddressResponse(); + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) @@ -1668,12 +1685,12 @@ export const QueryAllAuthorizedAddressResponse = { }, }; -function createBaseQueryGetGeneralKeyShareRequest(): QueryGetGeneralKeyShareRequest { +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { return { validator: "", idType: "", idValue: "" }; } -export const QueryGetGeneralKeyShareRequest = { - encode(message: QueryGetGeneralKeyShareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.validator !== "") { writer.uint32(10).string(message.validator); } @@ -1686,10 +1703,10 @@ export const QueryGetGeneralKeyShareRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetGeneralKeyShareRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetGeneralKeyShareRequest(); + const message = createBaseQueryGeneralKeyshareRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1718,20 +1735,20 @@ export const QueryGetGeneralKeyShareRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetGeneralKeyShareRequest { + fromJSON(object: any): QueryGeneralKeyshareRequest { return { - validator: isSet(object.validator) ? String(object.validator) : "", - idType: isSet(object.idType) ? String(object.idType) : "", - idValue: isSet(object.idValue) ? String(object.idValue) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", }; }, - toJSON(message: QueryGetGeneralKeyShareRequest): unknown { + toJSON(message: QueryGeneralKeyshareRequest): unknown { const obj: any = {}; if (message.validator !== "") { obj.validator = message.validator; @@ -1745,13 +1762,11 @@ export const QueryGetGeneralKeyShareRequest = { return obj; }, - create, I>>(base?: I): QueryGetGeneralKeyShareRequest { - return QueryGetGeneralKeyShareRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): QueryGetGeneralKeyShareRequest { - const message = createBaseQueryGetGeneralKeyShareRequest(); + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); message.validator = object.validator ?? ""; message.idType = object.idType ?? ""; message.idValue = object.idValue ?? ""; @@ -1759,22 +1774,22 @@ export const QueryGetGeneralKeyShareRequest = { }, }; -function createBaseQueryGetGeneralKeyShareResponse(): QueryGetGeneralKeyShareResponse { - return { generalKeyShare: undefined }; +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; } -export const QueryGetGeneralKeyShareResponse = { - encode(message: QueryGetGeneralKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.generalKeyShare !== undefined) { - GeneralKeyShare.encode(message.generalKeyShare, writer.uint32(10).fork()).ldelim(); +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetGeneralKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetGeneralKeyShareResponse(); + const message = createBaseQueryGeneralKeyshareResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1783,61 +1798,59 @@ export const QueryGetGeneralKeyShareResponse = { break; } - message.generalKeyShare = GeneralKeyShare.decode(reader, reader.uint32()); + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetGeneralKeyShareResponse { + fromJSON(object: any): QueryGeneralKeyshareResponse { return { - generalKeyShare: isSet(object.generalKeyShare) ? GeneralKeyShare.fromJSON(object.generalKeyShare) : undefined, + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, }; }, - toJSON(message: QueryGetGeneralKeyShareResponse): unknown { + toJSON(message: QueryGeneralKeyshareResponse): unknown { const obj: any = {}; - if (message.generalKeyShare !== undefined) { - obj.generalKeyShare = GeneralKeyShare.toJSON(message.generalKeyShare); + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); } return obj; }, - create, I>>(base?: I): QueryGetGeneralKeyShareResponse { - return QueryGetGeneralKeyShareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): QueryGetGeneralKeyShareResponse { - const message = createBaseQueryGetGeneralKeyShareResponse(); - message.generalKeyShare = (object.generalKeyShare !== undefined && object.generalKeyShare !== null) - ? GeneralKeyShare.fromPartial(object.generalKeyShare) + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) : undefined; return message; }, }; -function createBaseQueryAllGeneralKeyShareRequest(): QueryAllGeneralKeyShareRequest { +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { return { pagination: undefined }; } -export const QueryAllGeneralKeyShareRequest = { - encode(message: QueryAllGeneralKeyShareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllGeneralKeyShareRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllGeneralKeyShareRequest(); + const message = createBaseQueryGeneralKeyshareAllRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1852,16 +1865,16 @@ export const QueryAllGeneralKeyShareRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllGeneralKeyShareRequest { + fromJSON(object: any): QueryGeneralKeyshareAllRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllGeneralKeyShareRequest): unknown { + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { const obj: any = {}; if (message.pagination !== undefined) { obj.pagination = PageRequest.toJSON(message.pagination); @@ -1869,13 +1882,13 @@ export const QueryAllGeneralKeyShareRequest = { return obj; }, - create, I>>(base?: I): QueryAllGeneralKeyShareRequest { - return QueryAllGeneralKeyShareRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllGeneralKeyShareRequest { - const message = createBaseQueryAllGeneralKeyShareRequest(); + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -1883,25 +1896,25 @@ export const QueryAllGeneralKeyShareRequest = { }, }; -function createBaseQueryAllGeneralKeyShareResponse(): QueryAllGeneralKeyShareResponse { - return { generalKeyShare: [], pagination: undefined }; +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; } -export const QueryAllGeneralKeyShareResponse = { - encode(message: QueryAllGeneralKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.generalKeyShare) { - GeneralKeyShare.encode(v!, writer.uint32(10).fork()).ldelim(); +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllGeneralKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllGeneralKeyShareResponse(); + const message = createBaseQueryGeneralKeyshareAllResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1910,7 +1923,7 @@ export const QueryAllGeneralKeyShareResponse = { break; } - message.generalKeyShare.push(GeneralKeyShare.decode(reader, reader.uint32())); + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); continue; case 2: if (tag !== 18) { @@ -1923,24 +1936,24 @@ export const QueryAllGeneralKeyShareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllGeneralKeyShareResponse { + fromJSON(object: any): QueryGeneralKeyshareAllResponse { return { - generalKeyShare: Array.isArray(object?.generalKeyShare) - ? object.generalKeyShare.map((e: any) => GeneralKeyShare.fromJSON(e)) + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllGeneralKeyShareResponse): unknown { + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { const obj: any = {}; - if (message.generalKeyShare?.length) { - obj.generalKeyShare = message.generalKeyShare.map((e) => GeneralKeyShare.toJSON(e)); + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); } if (message.pagination !== undefined) { obj.pagination = PageResponse.toJSON(message.pagination); @@ -1948,14 +1961,14 @@ export const QueryAllGeneralKeyShareResponse = { return obj; }, - create, I>>(base?: I): QueryAllGeneralKeyShareResponse { - return QueryAllGeneralKeyShareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllGeneralKeyShareResponse { - const message = createBaseQueryAllGeneralKeyShareResponse(); - message.generalKeyShare = object.generalKeyShare?.map((e) => GeneralKeyShare.fromPartial(e)) || []; + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) : undefined; @@ -1967,27 +1980,32 @@ export const QueryAllGeneralKeyShareResponse = { export interface Query { /** Parameters queries the parameters of the module. */ Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ Commitments(request: QueryCommitmentsRequest): Promise; /** Queries a ValidatorSet by index. */ - ValidatorSet(request: QueryGetValidatorSetRequest): Promise; + ValidatorSet(request: QueryValidatorSetRequest): Promise; /** Queries a list of ValidatorSet items. */ - ValidatorSetAll(request: QueryAllValidatorSetRequest): Promise; - /** Queries a KeyShare by index. */ - KeyShare(request: QueryGetKeyShareRequest): Promise; - /** Queries a list of KeyShare items. */ - KeyShareAll(request: QueryAllKeyShareRequest): Promise; - /** Queries a list of AggregatedKeyShare items. */ - AggregatedKeyShare(request: QueryGetAggregatedKeyShareRequest): Promise; - AggregatedKeyShareAll(request: QueryAllAggregatedKeyShareRequest): Promise; + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; /** Queries the public keys */ - PubKey(request: QueryPubKeyRequest): Promise; - /** Queries a list of AuthorizedAddress items. */ - AuthorizedAddress(request: QueryGetAuthorizedAddressRequest): Promise; - AuthorizedAddressAll(request: QueryAllAuthorizedAddressRequest): Promise; - /** Queries a list of GeneralKeyShare items. */ - GeneralKeyShare(request: QueryGetGeneralKeyShareRequest): Promise; - GeneralKeyShareAll(request: QueryAllGeneralKeyShareRequest): Promise; - VerifiableRandomness(request: QueryVerifiableRandomnessQuery): Promise; + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; } export const QueryServiceName = "fairyring.keyshare.Query"; @@ -2001,99 +2019,99 @@ export class QueryClientImpl implements Query { this.Commitments = this.Commitments.bind(this); this.ValidatorSet = this.ValidatorSet.bind(this); this.ValidatorSetAll = this.ValidatorSetAll.bind(this); - this.KeyShare = this.KeyShare.bind(this); - this.KeyShareAll = this.KeyShareAll.bind(this); - this.AggregatedKeyShare = this.AggregatedKeyShare.bind(this); - this.AggregatedKeyShareAll = this.AggregatedKeyShareAll.bind(this); - this.PubKey = this.PubKey.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); this.AuthorizedAddress = this.AuthorizedAddress.bind(this); this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); - this.GeneralKeyShare = this.GeneralKeyShare.bind(this); - this.GeneralKeyShareAll = this.GeneralKeyShareAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); this.VerifiableRandomness = this.VerifiableRandomness.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(_m0.Reader.create(data))); + return promise.then((data) => QueryParamsResponse.decode(new BinaryReader(data))); } Commitments(request: QueryCommitmentsRequest): Promise { const data = QueryCommitmentsRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "Commitments", data); - return promise.then((data) => QueryCommitmentsResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); } - ValidatorSet(request: QueryGetValidatorSetRequest): Promise { - const data = QueryGetValidatorSetRequest.encode(request).finish(); + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "ValidatorSet", data); - return promise.then((data) => QueryGetValidatorSetResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); } - ValidatorSetAll(request: QueryAllValidatorSetRequest): Promise { - const data = QueryAllValidatorSetRequest.encode(request).finish(); + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "ValidatorSetAll", data); - return promise.then((data) => QueryAllValidatorSetResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); } - KeyShare(request: QueryGetKeyShareRequest): Promise { - const data = QueryGetKeyShareRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "KeyShare", data); - return promise.then((data) => QueryGetKeyShareResponse.decode(_m0.Reader.create(data))); + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); } - KeyShareAll(request: QueryAllKeyShareRequest): Promise { - const data = QueryAllKeyShareRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "KeyShareAll", data); - return promise.then((data) => QueryAllKeyShareResponse.decode(_m0.Reader.create(data))); + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); } - AggregatedKeyShare(request: QueryGetAggregatedKeyShareRequest): Promise { - const data = QueryGetAggregatedKeyShareRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "AggregatedKeyShare", data); - return promise.then((data) => QueryGetAggregatedKeyShareResponse.decode(_m0.Reader.create(data))); + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); } - AggregatedKeyShareAll(request: QueryAllAggregatedKeyShareRequest): Promise { - const data = QueryAllAggregatedKeyShareRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "AggregatedKeyShareAll", data); - return promise.then((data) => QueryAllAggregatedKeyShareResponse.decode(_m0.Reader.create(data))); + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); } - PubKey(request: QueryPubKeyRequest): Promise { - const data = QueryPubKeyRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "PubKey", data); - return promise.then((data) => QueryPubKeyResponse.decode(_m0.Reader.create(data))); + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); } - AuthorizedAddress(request: QueryGetAuthorizedAddressRequest): Promise { - const data = QueryGetAuthorizedAddressRequest.encode(request).finish(); + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "AuthorizedAddress", data); - return promise.then((data) => QueryGetAuthorizedAddressResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); } - AuthorizedAddressAll(request: QueryAllAuthorizedAddressRequest): Promise { - const data = QueryAllAuthorizedAddressRequest.encode(request).finish(); + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); - return promise.then((data) => QueryAllAuthorizedAddressResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); } - GeneralKeyShare(request: QueryGetGeneralKeyShareRequest): Promise { - const data = QueryGetGeneralKeyShareRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "GeneralKeyShare", data); - return promise.then((data) => QueryGetGeneralKeyShareResponse.decode(_m0.Reader.create(data))); + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); } - GeneralKeyShareAll(request: QueryAllGeneralKeyShareRequest): Promise { - const data = QueryAllGeneralKeyShareRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "GeneralKeyShareAll", data); - return promise.then((data) => QueryAllGeneralKeyShareResponse.decode(_m0.Reader.create(data))); + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); } - VerifiableRandomness(request: QueryVerifiableRandomnessQuery): Promise { - const data = QueryVerifiableRandomnessQuery.encode(request).finish(); + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "VerifiableRandomness", data); - return promise.then((data) => QueryVerifiableRandomnessResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(data))); } } @@ -2101,29 +2119,11 @@ interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -2131,18 +2131,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/tx.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/tx.ts index a51c25f0..5f75e3f8 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/tx.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/tx.ts @@ -1,8 +1,13 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Params } from "./params"; -import { EncryptedKeyShare } from "./pub_key"; +import { EncryptedKeyshare } from "./pubkey"; export const protobufPackage = "fairyring.keyshare"; @@ -14,36 +19,48 @@ export interface MsgUpdateParams { params: Params | undefined; } -/** - * MsgUpdateParamsResponse defines the response structure for executing a - * MsgUpdateParams message. - */ +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ export interface MsgUpdateParamsResponse { } +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ export interface MsgRegisterValidator { creator: string; } +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ export interface MsgRegisterValidatorResponse { creator: string; } +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ export interface MsgDeRegisterValidator { creator: string; } +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ export interface MsgDeRegisterValidatorResponse { creator: string; } +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ export interface MsgSendKeyshare { creator: string; message: string; - keyShareIndex: number; + keyshareIndex: number; blockHeight: number; } +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ export interface MsgSendKeyshareResponse { creator: string; keyshare: string; @@ -54,92 +71,139 @@ export interface MsgSendKeyshareResponse { errorMessage: string; } -/** this line is used by starport scaffolding # proto/tx/message */ -export interface MsgCreateLatestPubKey { +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { creator: string; publicKey: string; commitments: string[]; numberOfValidators: number; - encryptedKeyShares: EncryptedKeyShare[]; + encryptedKeyshares: EncryptedKeyshare[]; } -export interface MsgCreateLatestPubKeyResponse { +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { } -export interface MsgOverrideLatestPubKey { +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { creator: string; publicKey: string; commitments: string[]; numberOfValidators: number; - encryptedKeyShares: EncryptedKeyShare[]; + encryptedKeyshares: EncryptedKeyshare[]; } -export interface MsgOverrideLatestPubKeyResponse { +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { } +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ export interface MsgCreateAuthorizedAddress { target: string; creator: string; } +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ export interface MsgCreateAuthorizedAddressResponse { } +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ export interface MsgUpdateAuthorizedAddress { target: string; isAuthorized: boolean; creator: string; } +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ export interface MsgUpdateAuthorizedAddressResponse { } +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ export interface MsgDeleteAuthorizedAddress { target: string; creator: string; } +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ export interface MsgDeleteAuthorizedAddressResponse { } -export interface MsgCreateGeneralKeyShare { +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { creator: string; idType: string; idValue: string; - keyShare: string; - keyShareIndex: number; + keyshare: string; + keyshareIndex: number; receivedTimestamp: number; receivedBlockHeight: number; } -export interface MsgCreateGeneralKeyShareResponse { +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { creator: string; idType: string; idValue: string; - keyShare: string; - keyShareIndex: number; + keyshare: string; + keyshareIndex: number; receivedBlockHeight: number; success: boolean; errorMessage: string; } +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + function createBaseMsgUpdateParams(): MsgUpdateParams { return { authority: "", params: undefined }; } -export const MsgUpdateParams = { - encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); } if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + Params.encode(message.params, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateParams(); while (reader.pos < end) { @@ -163,14 +227,14 @@ export const MsgUpdateParams = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, }; }, @@ -203,13 +267,13 @@ function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { return {}; } -export const MsgUpdateParamsResponse = { - encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateParamsResponse(); while (reader.pos < end) { @@ -219,7 +283,7 @@ export const MsgUpdateParamsResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -246,16 +310,16 @@ function createBaseMsgRegisterValidator(): MsgRegisterValidator { return { creator: "" }; } -export const MsgRegisterValidator = { - encode(message: MsgRegisterValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRegisterValidator { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRegisterValidator(); while (reader.pos < end) { @@ -272,13 +336,13 @@ export const MsgRegisterValidator = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgRegisterValidator { - return { creator: isSet(object.creator) ? String(object.creator) : "" }; + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; }, toJSON(message: MsgRegisterValidator): unknown { @@ -303,16 +367,16 @@ function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse return { creator: "" }; } -export const MsgRegisterValidatorResponse = { - encode(message: MsgRegisterValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRegisterValidatorResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRegisterValidatorResponse(); while (reader.pos < end) { @@ -329,13 +393,13 @@ export const MsgRegisterValidatorResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgRegisterValidatorResponse { - return { creator: isSet(object.creator) ? String(object.creator) : "" }; + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; }, toJSON(message: MsgRegisterValidatorResponse): unknown { @@ -360,16 +424,16 @@ function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { return { creator: "" }; } -export const MsgDeRegisterValidator = { - encode(message: MsgDeRegisterValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeRegisterValidator { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDeRegisterValidator(); while (reader.pos < end) { @@ -386,13 +450,13 @@ export const MsgDeRegisterValidator = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgDeRegisterValidator { - return { creator: isSet(object.creator) ? String(object.creator) : "" }; + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; }, toJSON(message: MsgDeRegisterValidator): unknown { @@ -417,16 +481,16 @@ function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorRespo return { creator: "" }; } -export const MsgDeRegisterValidatorResponse = { - encode(message: MsgDeRegisterValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDeRegisterValidatorResponse(); while (reader.pos < end) { @@ -443,13 +507,13 @@ export const MsgDeRegisterValidatorResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgDeRegisterValidatorResponse { - return { creator: isSet(object.creator) ? String(object.creator) : "" }; + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; }, toJSON(message: MsgDeRegisterValidatorResponse): unknown { @@ -473,19 +537,19 @@ export const MsgDeRegisterValidatorResponse = { }; function createBaseMsgSendKeyshare(): MsgSendKeyshare { - return { creator: "", message: "", keyShareIndex: 0, blockHeight: 0 }; + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; } -export const MsgSendKeyshare = { - encode(message: MsgSendKeyshare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } if (message.message !== "") { writer.uint32(18).string(message.message); } - if (message.keyShareIndex !== 0) { - writer.uint32(24).uint64(message.keyShareIndex); + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); } if (message.blockHeight !== 0) { writer.uint32(32).uint64(message.blockHeight); @@ -493,8 +557,8 @@ export const MsgSendKeyshare = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendKeyshare { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSendKeyshare(); while (reader.pos < end) { @@ -519,30 +583,30 @@ export const MsgSendKeyshare = { break; } - message.keyShareIndex = longToNumber(reader.uint64() as Long); + message.keyshareIndex = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { break; } - message.blockHeight = longToNumber(reader.uint64() as Long); + message.blockHeight = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgSendKeyshare { return { - creator: isSet(object.creator) ? String(object.creator) : "", - message: isSet(object.message) ? String(object.message) : "", - keyShareIndex: isSet(object.keyShareIndex) ? Number(object.keyShareIndex) : 0, - blockHeight: isSet(object.blockHeight) ? Number(object.blockHeight) : 0, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, }; }, @@ -554,8 +618,8 @@ export const MsgSendKeyshare = { if (message.message !== "") { obj.message = message.message; } - if (message.keyShareIndex !== 0) { - obj.keyShareIndex = Math.round(message.keyShareIndex); + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); } if (message.blockHeight !== 0) { obj.blockHeight = Math.round(message.blockHeight); @@ -570,7 +634,7 @@ export const MsgSendKeyshare = { const message = createBaseMsgSendKeyshare(); message.creator = object.creator ?? ""; message.message = object.message ?? ""; - message.keyShareIndex = object.keyShareIndex ?? 0; + message.keyshareIndex = object.keyshareIndex ?? 0; message.blockHeight = object.blockHeight ?? 0; return message; }, @@ -588,8 +652,8 @@ function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { }; } -export const MsgSendKeyshareResponse = { - encode(message: MsgSendKeyshareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -605,7 +669,7 @@ export const MsgSendKeyshareResponse = { if (message.receivedBlockHeight !== 0) { writer.uint32(40).uint64(message.receivedBlockHeight); } - if (message.success === true) { + if (message.success !== false) { writer.uint32(48).bool(message.success); } if (message.errorMessage !== "") { @@ -614,8 +678,8 @@ export const MsgSendKeyshareResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendKeyshareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSendKeyshareResponse(); while (reader.pos < end) { @@ -640,21 +704,21 @@ export const MsgSendKeyshareResponse = { break; } - message.keyshareIndex = longToNumber(reader.uint64() as Long); + message.keyshareIndex = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { break; } - message.blockHeight = longToNumber(reader.uint64() as Long); + message.blockHeight = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.receivedBlockHeight = longToNumber(reader.uint64() as Long); + message.receivedBlockHeight = longToNumber(reader.uint64()); continue; case 6: if (tag !== 48) { @@ -674,20 +738,20 @@ export const MsgSendKeyshareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgSendKeyshareResponse { return { - creator: isSet(object.creator) ? String(object.creator) : "", - keyshare: isSet(object.keyshare) ? String(object.keyshare) : "", - keyshareIndex: isSet(object.keyshareIndex) ? Number(object.keyshareIndex) : 0, - blockHeight: isSet(object.blockHeight) ? Number(object.blockHeight) : 0, - receivedBlockHeight: isSet(object.receivedBlockHeight) ? Number(object.receivedBlockHeight) : 0, - success: isSet(object.success) ? Boolean(object.success) : false, - errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", }; }, @@ -708,7 +772,7 @@ export const MsgSendKeyshareResponse = { if (message.receivedBlockHeight !== 0) { obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); } - if (message.success === true) { + if (message.success !== false) { obj.success = message.success; } if (message.errorMessage !== "") { @@ -733,12 +797,12 @@ export const MsgSendKeyshareResponse = { }, }; -function createBaseMsgCreateLatestPubKey(): MsgCreateLatestPubKey { - return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyShares: [] }; +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; } -export const MsgCreateLatestPubKey = { - encode(message: MsgCreateLatestPubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -751,16 +815,16 @@ export const MsgCreateLatestPubKey = { if (message.numberOfValidators !== 0) { writer.uint32(32).uint64(message.numberOfValidators); } - for (const v of message.encryptedKeyShares) { - EncryptedKeyShare.encode(v!, writer.uint32(42).fork()).ldelim(); + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateLatestPubKey { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateLatestPubKey(); + const message = createBaseMsgCreateLatestPubkey(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -790,37 +854,39 @@ export const MsgCreateLatestPubKey = { break; } - message.numberOfValidators = longToNumber(reader.uint64() as Long); + message.numberOfValidators = longToNumber(reader.uint64()); continue; case 5: if (tag !== 42) { break; } - message.encryptedKeyShares.push(EncryptedKeyShare.decode(reader, reader.uint32())); + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): MsgCreateLatestPubKey { + fromJSON(object: any): MsgCreateLatestPubkey { return { - creator: isSet(object.creator) ? String(object.creator) : "", - publicKey: isSet(object.publicKey) ? String(object.publicKey) : "", - commitments: Array.isArray(object?.commitments) ? object.commitments.map((e: any) => String(e)) : [], - numberOfValidators: isSet(object.numberOfValidators) ? Number(object.numberOfValidators) : 0, - encryptedKeyShares: Array.isArray(object?.encryptedKeyShares) - ? object.encryptedKeyShares.map((e: any) => EncryptedKeyShare.fromJSON(e)) + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) : [], }; }, - toJSON(message: MsgCreateLatestPubKey): unknown { + toJSON(message: MsgCreateLatestPubkey): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -834,39 +900,39 @@ export const MsgCreateLatestPubKey = { if (message.numberOfValidators !== 0) { obj.numberOfValidators = Math.round(message.numberOfValidators); } - if (message.encryptedKeyShares?.length) { - obj.encryptedKeyShares = message.encryptedKeyShares.map((e) => EncryptedKeyShare.toJSON(e)); + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); } return obj; }, - create, I>>(base?: I): MsgCreateLatestPubKey { - return MsgCreateLatestPubKey.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MsgCreateLatestPubKey { - const message = createBaseMsgCreateLatestPubKey(); + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); message.creator = object.creator ?? ""; message.publicKey = object.publicKey ?? ""; message.commitments = object.commitments?.map((e) => e) || []; message.numberOfValidators = object.numberOfValidators ?? 0; - message.encryptedKeyShares = object.encryptedKeyShares?.map((e) => EncryptedKeyShare.fromPartial(e)) || []; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; return message; }, }; -function createBaseMsgCreateLatestPubKeyResponse(): MsgCreateLatestPubKeyResponse { +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { return {}; } -export const MsgCreateLatestPubKeyResponse = { - encode(_: MsgCreateLatestPubKeyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateLatestPubKeyResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateLatestPubKeyResponse(); + const message = createBaseMsgCreateLatestPubkeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -874,35 +940,35 @@ export const MsgCreateLatestPubKeyResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): MsgCreateLatestPubKeyResponse { + fromJSON(_: any): MsgCreateLatestPubkeyResponse { return {}; }, - toJSON(_: MsgCreateLatestPubKeyResponse): unknown { + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): MsgCreateLatestPubKeyResponse { - return MsgCreateLatestPubKeyResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): MsgCreateLatestPubKeyResponse { - const message = createBaseMsgCreateLatestPubKeyResponse(); + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); return message; }, }; -function createBaseMsgOverrideLatestPubKey(): MsgOverrideLatestPubKey { - return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyShares: [] }; +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; } -export const MsgOverrideLatestPubKey = { - encode(message: MsgOverrideLatestPubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -915,16 +981,16 @@ export const MsgOverrideLatestPubKey = { if (message.numberOfValidators !== 0) { writer.uint32(32).uint64(message.numberOfValidators); } - for (const v of message.encryptedKeyShares) { - EncryptedKeyShare.encode(v!, writer.uint32(42).fork()).ldelim(); + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgOverrideLatestPubKey { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgOverrideLatestPubKey(); + const message = createBaseMsgOverrideLatestPubkey(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -954,37 +1020,39 @@ export const MsgOverrideLatestPubKey = { break; } - message.numberOfValidators = longToNumber(reader.uint64() as Long); + message.numberOfValidators = longToNumber(reader.uint64()); continue; case 5: if (tag !== 42) { break; } - message.encryptedKeyShares.push(EncryptedKeyShare.decode(reader, reader.uint32())); + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): MsgOverrideLatestPubKey { + fromJSON(object: any): MsgOverrideLatestPubkey { return { - creator: isSet(object.creator) ? String(object.creator) : "", - publicKey: isSet(object.publicKey) ? String(object.publicKey) : "", - commitments: Array.isArray(object?.commitments) ? object.commitments.map((e: any) => String(e)) : [], - numberOfValidators: isSet(object.numberOfValidators) ? Number(object.numberOfValidators) : 0, - encryptedKeyShares: Array.isArray(object?.encryptedKeyShares) - ? object.encryptedKeyShares.map((e: any) => EncryptedKeyShare.fromJSON(e)) + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) : [], }; }, - toJSON(message: MsgOverrideLatestPubKey): unknown { + toJSON(message: MsgOverrideLatestPubkey): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -998,39 +1066,39 @@ export const MsgOverrideLatestPubKey = { if (message.numberOfValidators !== 0) { obj.numberOfValidators = Math.round(message.numberOfValidators); } - if (message.encryptedKeyShares?.length) { - obj.encryptedKeyShares = message.encryptedKeyShares.map((e) => EncryptedKeyShare.toJSON(e)); + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); } return obj; }, - create, I>>(base?: I): MsgOverrideLatestPubKey { - return MsgOverrideLatestPubKey.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MsgOverrideLatestPubKey { - const message = createBaseMsgOverrideLatestPubKey(); + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); message.creator = object.creator ?? ""; message.publicKey = object.publicKey ?? ""; message.commitments = object.commitments?.map((e) => e) || []; message.numberOfValidators = object.numberOfValidators ?? 0; - message.encryptedKeyShares = object.encryptedKeyShares?.map((e) => EncryptedKeyShare.fromPartial(e)) || []; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; return message; }, }; -function createBaseMsgOverrideLatestPubKeyResponse(): MsgOverrideLatestPubKeyResponse { +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { return {}; } -export const MsgOverrideLatestPubKeyResponse = { - encode(_: MsgOverrideLatestPubKeyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgOverrideLatestPubKeyResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgOverrideLatestPubKeyResponse(); + const message = createBaseMsgOverrideLatestPubkeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1038,25 +1106,25 @@ export const MsgOverrideLatestPubKeyResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): MsgOverrideLatestPubKeyResponse { + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { return {}; }, - toJSON(_: MsgOverrideLatestPubKeyResponse): unknown { + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): MsgOverrideLatestPubKeyResponse { - return MsgOverrideLatestPubKeyResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): MsgOverrideLatestPubKeyResponse { - const message = createBaseMsgOverrideLatestPubKeyResponse(); + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); return message; }, }; @@ -1065,8 +1133,8 @@ function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { return { target: "", creator: "" }; } -export const MsgCreateAuthorizedAddress = { - encode(message: MsgCreateAuthorizedAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.target !== "") { writer.uint32(10).string(message.target); } @@ -1076,8 +1144,8 @@ export const MsgCreateAuthorizedAddress = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateAuthorizedAddress(); while (reader.pos < end) { @@ -1101,15 +1169,15 @@ export const MsgCreateAuthorizedAddress = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgCreateAuthorizedAddress { return { - target: isSet(object.target) ? String(object.target) : "", - creator: isSet(object.creator) ? String(object.creator) : "", + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", }; }, @@ -1139,13 +1207,13 @@ function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddr return {}; } -export const MsgCreateAuthorizedAddressResponse = { - encode(_: MsgCreateAuthorizedAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateAuthorizedAddressResponse(); while (reader.pos < end) { @@ -1155,7 +1223,7 @@ export const MsgCreateAuthorizedAddressResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -1186,12 +1254,12 @@ function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { return { target: "", isAuthorized: false, creator: "" }; } -export const MsgUpdateAuthorizedAddress = { - encode(message: MsgUpdateAuthorizedAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.target !== "") { writer.uint32(10).string(message.target); } - if (message.isAuthorized === true) { + if (message.isAuthorized !== false) { writer.uint32(16).bool(message.isAuthorized); } if (message.creator !== "") { @@ -1200,8 +1268,8 @@ export const MsgUpdateAuthorizedAddress = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateAuthorizedAddress(); while (reader.pos < end) { @@ -1232,16 +1300,16 @@ export const MsgUpdateAuthorizedAddress = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateAuthorizedAddress { return { - target: isSet(object.target) ? String(object.target) : "", - isAuthorized: isSet(object.isAuthorized) ? Boolean(object.isAuthorized) : false, - creator: isSet(object.creator) ? String(object.creator) : "", + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", }; }, @@ -1250,7 +1318,7 @@ export const MsgUpdateAuthorizedAddress = { if (message.target !== "") { obj.target = message.target; } - if (message.isAuthorized === true) { + if (message.isAuthorized !== false) { obj.isAuthorized = message.isAuthorized; } if (message.creator !== "") { @@ -1275,13 +1343,13 @@ function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddr return {}; } -export const MsgUpdateAuthorizedAddressResponse = { - encode(_: MsgUpdateAuthorizedAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateAuthorizedAddressResponse(); while (reader.pos < end) { @@ -1291,7 +1359,7 @@ export const MsgUpdateAuthorizedAddressResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -1322,8 +1390,8 @@ function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { return { target: "", creator: "" }; } -export const MsgDeleteAuthorizedAddress = { - encode(message: MsgDeleteAuthorizedAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.target !== "") { writer.uint32(10).string(message.target); } @@ -1333,8 +1401,8 @@ export const MsgDeleteAuthorizedAddress = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDeleteAuthorizedAddress(); while (reader.pos < end) { @@ -1358,15 +1426,15 @@ export const MsgDeleteAuthorizedAddress = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgDeleteAuthorizedAddress { return { - target: isSet(object.target) ? String(object.target) : "", - creator: isSet(object.creator) ? String(object.creator) : "", + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", }; }, @@ -1396,13 +1464,13 @@ function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddr return {}; } -export const MsgDeleteAuthorizedAddressResponse = { - encode(_: MsgDeleteAuthorizedAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDeleteAuthorizedAddressResponse(); while (reader.pos < end) { @@ -1412,7 +1480,7 @@ export const MsgDeleteAuthorizedAddressResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -1439,20 +1507,20 @@ export const MsgDeleteAuthorizedAddressResponse = { }, }; -function createBaseMsgCreateGeneralKeyShare(): MsgCreateGeneralKeyShare { +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { return { creator: "", idType: "", idValue: "", - keyShare: "", - keyShareIndex: 0, + keyshare: "", + keyshareIndex: 0, receivedTimestamp: 0, receivedBlockHeight: 0, }; } -export const MsgCreateGeneralKeyShare = { - encode(message: MsgCreateGeneralKeyShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -1462,11 +1530,11 @@ export const MsgCreateGeneralKeyShare = { if (message.idValue !== "") { writer.uint32(26).string(message.idValue); } - if (message.keyShare !== "") { - writer.uint32(34).string(message.keyShare); + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); } - if (message.keyShareIndex !== 0) { - writer.uint32(40).uint64(message.keyShareIndex); + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); } if (message.receivedTimestamp !== 0) { writer.uint32(48).uint64(message.receivedTimestamp); @@ -1477,10 +1545,10 @@ export const MsgCreateGeneralKeyShare = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGeneralKeyShare { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateGeneralKeyShare(); + const message = createBaseMsgSubmitGeneralKeyshare(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1510,51 +1578,51 @@ export const MsgCreateGeneralKeyShare = { break; } - message.keyShare = reader.string(); + message.keyshare = reader.string(); continue; case 5: if (tag !== 40) { break; } - message.keyShareIndex = longToNumber(reader.uint64() as Long); + message.keyshareIndex = longToNumber(reader.uint64()); continue; case 6: if (tag !== 48) { break; } - message.receivedTimestamp = longToNumber(reader.uint64() as Long); + message.receivedTimestamp = longToNumber(reader.uint64()); continue; case 7: if (tag !== 56) { break; } - message.receivedBlockHeight = longToNumber(reader.uint64() as Long); + message.receivedBlockHeight = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): MsgCreateGeneralKeyShare { + fromJSON(object: any): MsgSubmitGeneralKeyshare { return { - creator: isSet(object.creator) ? String(object.creator) : "", - idType: isSet(object.idType) ? String(object.idType) : "", - idValue: isSet(object.idValue) ? String(object.idValue) : "", - keyShare: isSet(object.keyShare) ? String(object.keyShare) : "", - keyShareIndex: isSet(object.keyShareIndex) ? Number(object.keyShareIndex) : 0, - receivedTimestamp: isSet(object.receivedTimestamp) ? Number(object.receivedTimestamp) : 0, - receivedBlockHeight: isSet(object.receivedBlockHeight) ? Number(object.receivedBlockHeight) : 0, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, }; }, - toJSON(message: MsgCreateGeneralKeyShare): unknown { + toJSON(message: MsgSubmitGeneralKeyshare): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -1565,11 +1633,11 @@ export const MsgCreateGeneralKeyShare = { if (message.idValue !== "") { obj.idValue = message.idValue; } - if (message.keyShare !== "") { - obj.keyShare = message.keyShare; + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; } - if (message.keyShareIndex !== 0) { - obj.keyShareIndex = Math.round(message.keyShareIndex); + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); } if (message.receivedTimestamp !== 0) { obj.receivedTimestamp = Math.round(message.receivedTimestamp); @@ -1580,37 +1648,37 @@ export const MsgCreateGeneralKeyShare = { return obj; }, - create, I>>(base?: I): MsgCreateGeneralKeyShare { - return MsgCreateGeneralKeyShare.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MsgCreateGeneralKeyShare { - const message = createBaseMsgCreateGeneralKeyShare(); + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); message.creator = object.creator ?? ""; message.idType = object.idType ?? ""; message.idValue = object.idValue ?? ""; - message.keyShare = object.keyShare ?? ""; - message.keyShareIndex = object.keyShareIndex ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; message.receivedTimestamp = object.receivedTimestamp ?? 0; message.receivedBlockHeight = object.receivedBlockHeight ?? 0; return message; }, }; -function createBaseMsgCreateGeneralKeyShareResponse(): MsgCreateGeneralKeyShareResponse { +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { return { creator: "", idType: "", idValue: "", - keyShare: "", - keyShareIndex: 0, + keyshare: "", + keyshareIndex: 0, receivedBlockHeight: 0, success: false, errorMessage: "", }; } -export const MsgCreateGeneralKeyShareResponse = { - encode(message: MsgCreateGeneralKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -1620,16 +1688,16 @@ export const MsgCreateGeneralKeyShareResponse = { if (message.idValue !== "") { writer.uint32(26).string(message.idValue); } - if (message.keyShare !== "") { - writer.uint32(34).string(message.keyShare); + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); } - if (message.keyShareIndex !== 0) { - writer.uint32(40).uint64(message.keyShareIndex); + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); } if (message.receivedBlockHeight !== 0) { writer.uint32(48).uint64(message.receivedBlockHeight); } - if (message.success === true) { + if (message.success !== false) { writer.uint32(56).bool(message.success); } if (message.errorMessage !== "") { @@ -1638,10 +1706,10 @@ export const MsgCreateGeneralKeyShareResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGeneralKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateGeneralKeyShareResponse(); + const message = createBaseMsgSubmitGeneralKeyshareResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1671,21 +1739,21 @@ export const MsgCreateGeneralKeyShareResponse = { break; } - message.keyShare = reader.string(); + message.keyshare = reader.string(); continue; case 5: if (tag !== 40) { break; } - message.keyShareIndex = longToNumber(reader.uint64() as Long); + message.keyshareIndex = longToNumber(reader.uint64()); continue; case 6: if (tag !== 48) { break; } - message.receivedBlockHeight = longToNumber(reader.uint64() as Long); + message.receivedBlockHeight = longToNumber(reader.uint64()); continue; case 7: if (tag !== 56) { @@ -1705,25 +1773,25 @@ export const MsgCreateGeneralKeyShareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): MsgCreateGeneralKeyShareResponse { + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { return { - creator: isSet(object.creator) ? String(object.creator) : "", - idType: isSet(object.idType) ? String(object.idType) : "", - idValue: isSet(object.idValue) ? String(object.idValue) : "", - keyShare: isSet(object.keyShare) ? String(object.keyShare) : "", - keyShareIndex: isSet(object.keyShareIndex) ? Number(object.keyShareIndex) : 0, - receivedBlockHeight: isSet(object.receivedBlockHeight) ? Number(object.receivedBlockHeight) : 0, - success: isSet(object.success) ? Boolean(object.success) : false, - errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", }; }, - toJSON(message: MsgCreateGeneralKeyShareResponse): unknown { + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -1734,16 +1802,16 @@ export const MsgCreateGeneralKeyShareResponse = { if (message.idValue !== "") { obj.idValue = message.idValue; } - if (message.keyShare !== "") { - obj.keyShare = message.keyShare; + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; } - if (message.keyShareIndex !== 0) { - obj.keyShareIndex = Math.round(message.keyShareIndex); + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); } if (message.receivedBlockHeight !== 0) { obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); } - if (message.success === true) { + if (message.success !== false) { obj.success = message.success; } if (message.errorMessage !== "") { @@ -1752,20 +1820,20 @@ export const MsgCreateGeneralKeyShareResponse = { return obj; }, - create, I>>( + create, I>>( base?: I, - ): MsgCreateGeneralKeyShareResponse { - return MsgCreateGeneralKeyShareResponse.fromPartial(base ?? ({} as any)); + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): MsgCreateGeneralKeyShareResponse { - const message = createBaseMsgCreateGeneralKeyShareResponse(); + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); message.creator = object.creator ?? ""; message.idType = object.idType ?? ""; message.idValue = object.idValue ?? ""; - message.keyShare = object.keyShare ?? ""; - message.keyShareIndex = object.keyShareIndex ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; message.receivedBlockHeight = object.receivedBlockHeight ?? 0; message.success = object.success ?? false; message.errorMessage = object.errorMessage ?? ""; @@ -1773,6 +1841,210 @@ export const MsgCreateGeneralKeyShareResponse = { }, }; +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + /** Msg defines the Msg service. */ export interface Msg { /** @@ -1780,16 +2052,53 @@ export interface Msg { * parameters. The authority defaults to the x/gov module account. */ UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ SendKeyshare(request: MsgSendKeyshare): Promise; - /** this line is used by starport scaffolding # proto/tx/rpc */ - CreateLatestPubKey(request: MsgCreateLatestPubKey): Promise; - OverrideLatestPubKey(request: MsgOverrideLatestPubKey): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; - CreateGeneralKeyShare(request: MsgCreateGeneralKeyShare): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; } export const MsgServiceName = "fairyring.keyshare.Msg"; @@ -1803,71 +2112,78 @@ export class MsgClientImpl implements Msg { this.RegisterValidator = this.RegisterValidator.bind(this); this.DeRegisterValidator = this.DeRegisterValidator.bind(this); this.SendKeyshare = this.SendKeyshare.bind(this); - this.CreateLatestPubKey = this.CreateLatestPubKey.bind(this); - this.OverrideLatestPubKey = this.OverrideLatestPubKey.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); - this.CreateGeneralKeyShare = this.CreateGeneralKeyShare.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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(_m0.Reader.create(data))); + return promise.then((data) => MsgUpdateParamsResponse.decode(new BinaryReader(data))); } RegisterValidator(request: MsgRegisterValidator): Promise { const data = MsgRegisterValidator.encode(request).finish(); const promise = this.rpc.request(this.service, "RegisterValidator", data); - return promise.then((data) => MsgRegisterValidatorResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); } DeRegisterValidator(request: MsgDeRegisterValidator): Promise { const data = MsgDeRegisterValidator.encode(request).finish(); const promise = this.rpc.request(this.service, "DeRegisterValidator", data); - return promise.then((data) => MsgDeRegisterValidatorResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); } SendKeyshare(request: MsgSendKeyshare): Promise { const data = MsgSendKeyshare.encode(request).finish(); const promise = this.rpc.request(this.service, "SendKeyshare", data); - return promise.then((data) => MsgSendKeyshareResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); } - CreateLatestPubKey(request: MsgCreateLatestPubKey): Promise { - const data = MsgCreateLatestPubKey.encode(request).finish(); - const promise = this.rpc.request(this.service, "CreateLatestPubKey", data); - return promise.then((data) => MsgCreateLatestPubKeyResponse.decode(_m0.Reader.create(data))); + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); } - OverrideLatestPubKey(request: MsgOverrideLatestPubKey): Promise { - const data = MsgOverrideLatestPubKey.encode(request).finish(); - const promise = this.rpc.request(this.service, "OverrideLatestPubKey", data); - return promise.then((data) => MsgOverrideLatestPubKeyResponse.decode(_m0.Reader.create(data))); + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); } CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { const data = MsgCreateAuthorizedAddress.encode(request).finish(); const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); - return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); } UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { const data = MsgUpdateAuthorizedAddress.encode(request).finish(); const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); - return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); } DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { const data = MsgDeleteAuthorizedAddress.encode(request).finish(); const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); - return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); } - CreateGeneralKeyShare(request: MsgCreateGeneralKeyShare): Promise { - const data = MsgCreateGeneralKeyShare.encode(request).finish(); - const promise = this.rpc.request(this.service, "CreateGeneralKeyShare", data); - return promise.then((data) => MsgCreateGeneralKeyShareResponse.decode(_m0.Reader.create(data))); + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(data))); } } @@ -1875,29 +2191,11 @@ interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -1905,18 +2203,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/validator_set.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/validator_set.ts index c02561e1..29cbe6c9 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/validator_set.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/validator_set.ts @@ -1,8 +1,18 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "fairyring.keyshare"; +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ export interface ValidatorSet { index: string; validator: string; @@ -14,8 +24,8 @@ function createBaseValidatorSet(): ValidatorSet { return { index: "", validator: "", consAddr: "", isActive: false }; } -export const ValidatorSet = { - encode(message: ValidatorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.index !== "") { writer.uint32(10).string(message.index); } @@ -25,14 +35,14 @@ export const ValidatorSet = { if (message.consAddr !== "") { writer.uint32(26).string(message.consAddr); } - if (message.isActive === true) { + if (message.isActive !== false) { writer.uint32(32).bool(message.isActive); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidatorSet(); while (reader.pos < end) { @@ -70,17 +80,17 @@ export const ValidatorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ValidatorSet { return { - index: isSet(object.index) ? String(object.index) : "", - validator: isSet(object.validator) ? String(object.validator) : "", - consAddr: isSet(object.consAddr) ? String(object.consAddr) : "", - isActive: isSet(object.isActive) ? Boolean(object.isActive) : false, + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, }; }, @@ -95,7 +105,7 @@ export const ValidatorSet = { if (message.consAddr !== "") { obj.consAddr = message.consAddr; } - if (message.isActive === true) { + if (message.isActive !== false) { obj.isActive = message.isActive; } return obj; @@ -117,7 +127,8 @@ export const ValidatorSet = { type Builtin = 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; @@ -128,3 +139,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/pep/decryption_key.ts b/ts-client/fairyring.keyshare/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/pep/encrypted_tx.ts b/ts-client/fairyring.keyshare/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/pep/genesis.ts b/ts-client/fairyring.keyshare/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/pep/module/module.ts b/ts-client/fairyring.keyshare/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/pep/params.ts b/ts-client/fairyring.keyshare/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/pep/pep_nonce.ts b/ts-client/fairyring.keyshare/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/pep/query.ts b/ts-client/fairyring.keyshare/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/pep/request_id.ts b/ts-client/fairyring.keyshare/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/fairyring/pep/tx.ts b/ts-client/fairyring.keyshare/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/fairyring.keyshare/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/gogoproto/gogo.ts b/ts-client/fairyring.keyshare/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/fairyring.keyshare/types/gogoproto/gogo.ts +++ b/ts-client/fairyring.keyshare/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/fairyring.keyshare/types/google/api/annotations.ts b/ts-client/fairyring.keyshare/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/fairyring.keyshare/types/google/api/annotations.ts +++ b/ts-client/fairyring.keyshare/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/fairyring.keyshare/types/google/api/http.ts b/ts-client/fairyring.keyshare/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/fairyring.keyshare/types/google/api/http.ts +++ b/ts-client/fairyring.keyshare/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/google/protobuf/descriptor.ts b/ts-client/fairyring.keyshare/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/fairyring.keyshare/types/google/protobuf/descriptor.ts +++ b/ts-client/fairyring.keyshare/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/google/protobuf/duration.ts b/ts-client/fairyring.keyshare/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/fairyring.keyshare/types/google/protobuf/duration.ts +++ b/ts-client/fairyring.keyshare/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.keyshare/types/route-name.eta b/ts-client/fairyring.keyshare/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/fairyring.keyshare/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/fairyring.pep/module.ts b/ts-client/fairyring.pep/module.ts index 1b4ef253..6ee1bf0d 100755 --- a/ts-client/fairyring.pep/module.ts +++ b/ts-client/fairyring.pep/module.ts @@ -6,66 +6,125 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgRequestGeneralKeyshare } from "./types/fairyring/pep/tx"; -import { MsgCreateAggregatedKeyShare } from "./types/fairyring/pep/tx"; -import { QueryGetPepNonceRequest } from "./types/fairyring/pep/query"; +import { MsgSubmitDecryptionKey } from "./types/fairyring/pep/tx"; +import { ContractDetails } from "./types/fairyring/pep/request_id"; +import { Params } from "./types/fairyring/pep/params"; +import { MsgRequestGeneralIdentityResponse } from "./types/fairyring/pep/tx"; +import { QueryEncryptedTxAllFromHeightRequest } from "./types/fairyring/pep/query"; +import { QueryPepNonceRequest } from "./types/fairyring/pep/query"; +import { GeneralEncryptedTx } from "./types/fairyring/pep/encrypted_tx"; +import { IdentityExecutionEntry } from "./types/fairyring/pep/encrypted_tx"; +import { MsgRequestGeneralDecryptionKey } from "./types/fairyring/pep/tx"; +import { TrustedCounterParty } from "./types/fairyring/pep/params"; import { MsgUpdateParamsResponse } from "./types/fairyring/pep/tx"; -import { QueryGetEncryptedTxResponse } from "./types/fairyring/pep/query"; -import { MsgSubmitEncryptedTxResponse } from "./types/fairyring/pep/tx"; -import { QueryPubKeyRequest } from "./types/fairyring/pep/query"; -import { RequestId } from "./types/fairyring/pep/request_id"; -import { GenEncTxExecutionQueue } from "./types/fairyring/pep/encrypted_tx"; -import { QueryAllEncryptedTxRequest } from "./types/fairyring/pep/query"; -import { QueryAllPepNonceResponse } from "./types/fairyring/pep/query"; -import { QueryAllPepNonceRequest } from "./types/fairyring/pep/query"; +import { MsgRequestPrivateIdentity } from "./types/fairyring/pep/tx"; +import { RegisteredContract } from "./types/fairyring/pep/request_id"; +import { QueryDecryptDataResponse } from "./types/fairyring/pep/query"; +import { QueryGeneralIdentityAllRequest } from "./types/fairyring/pep/query"; +import { QueryPepNonceAllRequest } from "./types/fairyring/pep/query"; +import { MsgUnregisterContract } from "./types/fairyring/pep/tx"; +import { MsgRequestPrivateDecryptionKey } from "./types/fairyring/pep/tx"; import { QueryLatestHeightRequest } from "./types/fairyring/pep/query"; -import { Params } from "./types/fairyring/pep/params"; -import { MsgGetGeneralKeyshareResponse } from "./types/fairyring/pep/tx"; -import { PepNonce } from "./types/fairyring/pep/pep_nonce"; -import { QueryGetEncryptedTxRequest } from "./types/fairyring/pep/query"; -import { EncryptedTx } from "./types/fairyring/pep/encrypted_tx"; -import { QueryAllEncryptedTxFromHeightRequest } from "./types/fairyring/pep/query"; -import { QueryAllKeyshareRequest } from "./types/fairyring/pep/query"; -import { MsgGetGeneralKeyshare } from "./types/fairyring/pep/tx"; -import { QueryAllEncryptedTxResponse } from "./types/fairyring/pep/query"; -import { MsgSubmitGeneralEncryptedTx } from "./types/fairyring/pep/tx"; -import { QueryPubKeyResponse } from "./types/fairyring/pep/query"; +import { RequestId } from "./types/fairyring/pep/request_id"; +import { GenesisState } from "./types/fairyring/pep/genesis"; +import { QueryEncryptedTxResponse } from "./types/fairyring/pep/query"; +import { QueryPrivateIdentityResponse } from "./types/fairyring/pep/query"; +import { MsgRequestPrivateDecryptionKeyResponse } from "./types/fairyring/pep/tx"; +import { QueryEncryptedTxAllRequest } from "./types/fairyring/pep/query"; +import { QueryPubkeyRequest } from "./types/fairyring/pep/query"; +import { MsgRequestGeneralDecryptionKeyResponse } from "./types/fairyring/pep/tx"; +import { QueryEncryptedTxRequest } from "./types/fairyring/pep/query"; +import { ExecuteContractMsg } from "./types/fairyring/pep/request_id"; import { MsgUpdateParams } from "./types/fairyring/pep/tx"; -import { QueryAllKeyshareResponse } from "./types/fairyring/pep/query"; +import { QueryParamsRequest } from "./types/fairyring/pep/query"; +import { EncryptedTx } from "./types/fairyring/pep/encrypted_tx"; +import { QueryPepNonceResponse } from "./types/fairyring/pep/query"; +import { QueryPubkeyResponse } from "./types/fairyring/pep/query"; +import { QueryDecryptDataRequest } from "./types/fairyring/pep/query"; +import { PepNonce } from "./types/fairyring/pep/pep_nonce"; +import { MsgSubmitDecryptionKeyResponse } from "./types/fairyring/pep/tx"; +import { MsgUnregisterContractResponse } from "./types/fairyring/pep/tx"; +import { QueryGeneralIdentityResponse } from "./types/fairyring/pep/query"; +import { QueryEncryptedTxAllFromHeightResponse } from "./types/fairyring/pep/query"; +import { DecryptionKey } from "./types/fairyring/pep/decryption_key"; +import { QueryGeneralIdentityAllResponse } from "./types/fairyring/pep/query"; +import { QueryLatestHeightResponse } from "./types/fairyring/pep/query"; +import { QueryPrivateIdentityRequest } from "./types/fairyring/pep/query"; import { GeneralEncryptedTxArray } from "./types/fairyring/pep/encrypted_tx"; +import { MsgSubmitEncryptedTxResponse } from "./types/fairyring/pep/tx"; +import { QueryParamsResponse } from "./types/fairyring/pep/query"; +import { QueryGeneralIdentityRequest } from "./types/fairyring/pep/query"; +import { MsgRequestGeneralIdentity } from "./types/fairyring/pep/tx"; +import { PrivateRequest } from "./types/fairyring/pep/request_id"; import { EncryptedTxArray } from "./types/fairyring/pep/encrypted_tx"; -import { GenesisState } from "./types/fairyring/pep/genesis"; -import { AggregatedKeyShare } from "./types/fairyring/pep/aggregated_key_share"; -import { QueryLatestHeightResponse } from "./types/fairyring/pep/query"; -import { QueryKeyshareRequest } from "./types/fairyring/pep/query"; -import { QueryAllEncryptedTxFromHeightResponse } from "./types/fairyring/pep/query"; import { MsgSubmitEncryptedTx } from "./types/fairyring/pep/tx"; -import { QueryParamsRequest } from "./types/fairyring/pep/query"; -import { QueryParamsResponse } from "./types/fairyring/pep/query"; -import { MsgCreateAggregatedKeyShareResponse } from "./types/fairyring/pep/tx"; -import { MsgRequestGeneralKeyshareResponse } from "./types/fairyring/pep/tx"; -import { QueryGetPepNonceResponse } from "./types/fairyring/pep/query"; -import { GeneralEncryptedTx } from "./types/fairyring/pep/encrypted_tx"; -import { TrustedCounterParty } from "./types/fairyring/pep/params"; -import { QueryKeyshareResponse } from "./types/fairyring/pep/query"; +import { MsgSubmitGeneralEncryptedTx } from "./types/fairyring/pep/tx"; +import { MsgRegisterContract } from "./types/fairyring/pep/tx"; +import { QueryPepNonceAllResponse } from "./types/fairyring/pep/query"; +import { MsgRegisterContractResponse } from "./types/fairyring/pep/tx"; +import { MsgRequestPrivateIdentityResponse } from "./types/fairyring/pep/tx"; +import { QueryEncryptedTxAllResponse } from "./types/fairyring/pep/query"; +import { MsgSubmitGeneralEncryptedTxResponse } from "./types/fairyring/pep/tx"; + + +export { MsgSubmitDecryptionKey, ContractDetails, Params, MsgRequestGeneralIdentityResponse, QueryEncryptedTxAllFromHeightRequest, QueryPepNonceRequest, GeneralEncryptedTx, IdentityExecutionEntry, MsgRequestGeneralDecryptionKey, TrustedCounterParty, MsgUpdateParamsResponse, MsgRequestPrivateIdentity, RegisteredContract, QueryDecryptDataResponse, QueryGeneralIdentityAllRequest, QueryPepNonceAllRequest, MsgUnregisterContract, MsgRequestPrivateDecryptionKey, QueryLatestHeightRequest, RequestId, GenesisState, QueryEncryptedTxResponse, QueryPrivateIdentityResponse, MsgRequestPrivateDecryptionKeyResponse, QueryEncryptedTxAllRequest, QueryPubkeyRequest, MsgRequestGeneralDecryptionKeyResponse, QueryEncryptedTxRequest, ExecuteContractMsg, MsgUpdateParams, QueryParamsRequest, EncryptedTx, QueryPepNonceResponse, QueryPubkeyResponse, QueryDecryptDataRequest, PepNonce, MsgSubmitDecryptionKeyResponse, MsgUnregisterContractResponse, QueryGeneralIdentityResponse, QueryEncryptedTxAllFromHeightResponse, DecryptionKey, QueryGeneralIdentityAllResponse, QueryLatestHeightResponse, QueryPrivateIdentityRequest, GeneralEncryptedTxArray, MsgSubmitEncryptedTxResponse, QueryParamsResponse, QueryGeneralIdentityRequest, MsgRequestGeneralIdentity, PrivateRequest, EncryptedTxArray, MsgSubmitEncryptedTx, MsgSubmitGeneralEncryptedTx, MsgRegisterContract, QueryPepNonceAllResponse, MsgRegisterContractResponse, MsgRequestPrivateIdentityResponse, QueryEncryptedTxAllResponse, MsgSubmitGeneralEncryptedTxResponse }; + +type sendMsgSubmitDecryptionKeyParams = { + value: MsgSubmitDecryptionKey, + fee?: StdFee, + memo?: string +}; + +type sendContractDetailsParams = { + value: ContractDetails, + fee?: StdFee, + memo?: string +}; + +type sendParamsParams = { + value: Params, + fee?: StdFee, + memo?: string +}; + +type sendMsgRequestGeneralIdentityResponseParams = { + value: MsgRequestGeneralIdentityResponse, + fee?: StdFee, + memo?: string +}; +type sendQueryEncryptedTxAllFromHeightRequestParams = { + value: QueryEncryptedTxAllFromHeightRequest, + fee?: StdFee, + memo?: string +}; + +type sendQueryPepNonceRequestParams = { + value: QueryPepNonceRequest, + fee?: StdFee, + memo?: string +}; -export { MsgRequestGeneralKeyshare, MsgCreateAggregatedKeyShare, QueryGetPepNonceRequest, MsgUpdateParamsResponse, QueryGetEncryptedTxResponse, MsgSubmitEncryptedTxResponse, QueryPubKeyRequest, RequestId, GenEncTxExecutionQueue, QueryAllEncryptedTxRequest, QueryAllPepNonceResponse, QueryAllPepNonceRequest, QueryLatestHeightRequest, Params, MsgGetGeneralKeyshareResponse, PepNonce, QueryGetEncryptedTxRequest, EncryptedTx, QueryAllEncryptedTxFromHeightRequest, QueryAllKeyshareRequest, MsgGetGeneralKeyshare, QueryAllEncryptedTxResponse, MsgSubmitGeneralEncryptedTx, QueryPubKeyResponse, MsgUpdateParams, QueryAllKeyshareResponse, GeneralEncryptedTxArray, EncryptedTxArray, GenesisState, AggregatedKeyShare, QueryLatestHeightResponse, QueryKeyshareRequest, QueryAllEncryptedTxFromHeightResponse, MsgSubmitEncryptedTx, QueryParamsRequest, QueryParamsResponse, MsgCreateAggregatedKeyShareResponse, MsgRequestGeneralKeyshareResponse, QueryGetPepNonceResponse, GeneralEncryptedTx, TrustedCounterParty, QueryKeyshareResponse }; +type sendGeneralEncryptedTxParams = { + value: GeneralEncryptedTx, + fee?: StdFee, + memo?: string +}; -type sendMsgRequestGeneralKeyshareParams = { - value: MsgRequestGeneralKeyshare, +type sendIdentityExecutionEntryParams = { + value: IdentityExecutionEntry, fee?: StdFee, memo?: string }; -type sendMsgCreateAggregatedKeyShareParams = { - value: MsgCreateAggregatedKeyShare, +type sendMsgRequestGeneralDecryptionKeyParams = { + value: MsgRequestGeneralDecryptionKey, fee?: StdFee, memo?: string }; -type sendQueryGetPepNonceRequestParams = { - value: QueryGetPepNonceRequest, +type sendTrustedCounterPartyParams = { + value: TrustedCounterParty, fee?: StdFee, memo?: string }; @@ -76,20 +135,50 @@ type sendMsgUpdateParamsResponseParams = { memo?: string }; -type sendQueryGetEncryptedTxResponseParams = { - value: QueryGetEncryptedTxResponse, +type sendMsgRequestPrivateIdentityParams = { + value: MsgRequestPrivateIdentity, fee?: StdFee, memo?: string }; -type sendMsgSubmitEncryptedTxResponseParams = { - value: MsgSubmitEncryptedTxResponse, +type sendRegisteredContractParams = { + value: RegisteredContract, + fee?: StdFee, + memo?: string +}; + +type sendQueryDecryptDataResponseParams = { + value: QueryDecryptDataResponse, + fee?: StdFee, + memo?: string +}; + +type sendQueryGeneralIdentityAllRequestParams = { + value: QueryGeneralIdentityAllRequest, + fee?: StdFee, + memo?: string +}; + +type sendQueryPepNonceAllRequestParams = { + value: QueryPepNonceAllRequest, + fee?: StdFee, + memo?: string +}; + +type sendMsgUnregisterContractParams = { + value: MsgUnregisterContract, + fee?: StdFee, + memo?: string +}; + +type sendMsgRequestPrivateDecryptionKeyParams = { + value: MsgRequestPrivateDecryptionKey, fee?: StdFee, memo?: string }; -type sendQueryPubKeyRequestParams = { - value: QueryPubKeyRequest, +type sendQueryLatestHeightRequestParams = { + value: QueryLatestHeightRequest, fee?: StdFee, memo?: string }; @@ -100,56 +189,68 @@ type sendRequestIdParams = { memo?: string }; -type sendGenEncTxExecutionQueueParams = { - value: GenEncTxExecutionQueue, +type sendGenesisStateParams = { + value: GenesisState, + fee?: StdFee, + memo?: string +}; + +type sendQueryEncryptedTxResponseParams = { + value: QueryEncryptedTxResponse, fee?: StdFee, memo?: string }; -type sendQueryAllEncryptedTxRequestParams = { - value: QueryAllEncryptedTxRequest, +type sendQueryPrivateIdentityResponseParams = { + value: QueryPrivateIdentityResponse, fee?: StdFee, memo?: string }; -type sendQueryAllPepNonceResponseParams = { - value: QueryAllPepNonceResponse, +type sendMsgRequestPrivateDecryptionKeyResponseParams = { + value: MsgRequestPrivateDecryptionKeyResponse, fee?: StdFee, memo?: string }; -type sendQueryAllPepNonceRequestParams = { - value: QueryAllPepNonceRequest, +type sendQueryEncryptedTxAllRequestParams = { + value: QueryEncryptedTxAllRequest, fee?: StdFee, memo?: string }; -type sendQueryLatestHeightRequestParams = { - value: QueryLatestHeightRequest, +type sendQueryPubkeyRequestParams = { + value: QueryPubkeyRequest, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendMsgRequestGeneralDecryptionKeyResponseParams = { + value: MsgRequestGeneralDecryptionKeyResponse, fee?: StdFee, memo?: string }; -type sendMsgGetGeneralKeyshareResponseParams = { - value: MsgGetGeneralKeyshareResponse, +type sendQueryEncryptedTxRequestParams = { + value: QueryEncryptedTxRequest, fee?: StdFee, memo?: string }; -type sendPepNonceParams = { - value: PepNonce, +type sendExecuteContractMsgParams = { + value: ExecuteContractMsg, + fee?: StdFee, + memo?: string +}; + +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendQueryGetEncryptedTxRequestParams = { - value: QueryGetEncryptedTxRequest, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; @@ -160,50 +261,74 @@ type sendEncryptedTxParams = { memo?: string }; -type sendQueryAllEncryptedTxFromHeightRequestParams = { - value: QueryAllEncryptedTxFromHeightRequest, +type sendQueryPepNonceResponseParams = { + value: QueryPepNonceResponse, fee?: StdFee, memo?: string }; -type sendQueryAllKeyshareRequestParams = { - value: QueryAllKeyshareRequest, +type sendQueryPubkeyResponseParams = { + value: QueryPubkeyResponse, fee?: StdFee, memo?: string }; -type sendMsgGetGeneralKeyshareParams = { - value: MsgGetGeneralKeyshare, +type sendQueryDecryptDataRequestParams = { + value: QueryDecryptDataRequest, fee?: StdFee, memo?: string }; -type sendQueryAllEncryptedTxResponseParams = { - value: QueryAllEncryptedTxResponse, +type sendPepNonceParams = { + value: PepNonce, fee?: StdFee, memo?: string }; -type sendMsgSubmitGeneralEncryptedTxParams = { - value: MsgSubmitGeneralEncryptedTx, +type sendMsgSubmitDecryptionKeyResponseParams = { + value: MsgSubmitDecryptionKeyResponse, fee?: StdFee, memo?: string }; -type sendQueryPubKeyResponseParams = { - value: QueryPubKeyResponse, +type sendMsgUnregisterContractResponseParams = { + value: MsgUnregisterContractResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendQueryGeneralIdentityResponseParams = { + value: QueryGeneralIdentityResponse, + fee?: StdFee, + memo?: string +}; + +type sendQueryEncryptedTxAllFromHeightResponseParams = { + value: QueryEncryptedTxAllFromHeightResponse, fee?: StdFee, memo?: string }; -type sendQueryAllKeyshareResponseParams = { - value: QueryAllKeyshareResponse, +type sendDecryptionKeyParams = { + value: DecryptionKey, + fee?: StdFee, + memo?: string +}; + +type sendQueryGeneralIdentityAllResponseParams = { + value: QueryGeneralIdentityAllResponse, + fee?: StdFee, + memo?: string +}; + +type sendQueryLatestHeightResponseParams = { + value: QueryLatestHeightResponse, + fee?: StdFee, + memo?: string +}; + +type sendQueryPrivateIdentityRequestParams = { + value: QueryPrivateIdentityRequest, fee?: StdFee, memo?: string }; @@ -214,38 +339,38 @@ type sendGeneralEncryptedTxArrayParams = { memo?: string }; -type sendEncryptedTxArrayParams = { - value: EncryptedTxArray, +type sendMsgSubmitEncryptedTxResponseParams = { + value: MsgSubmitEncryptedTxResponse, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, fee?: StdFee, memo?: string }; -type sendAggregatedKeyShareParams = { - value: AggregatedKeyShare, +type sendQueryGeneralIdentityRequestParams = { + value: QueryGeneralIdentityRequest, fee?: StdFee, memo?: string }; -type sendQueryLatestHeightResponseParams = { - value: QueryLatestHeightResponse, +type sendMsgRequestGeneralIdentityParams = { + value: MsgRequestGeneralIdentity, fee?: StdFee, memo?: string }; -type sendQueryKeyshareRequestParams = { - value: QueryKeyshareRequest, +type sendPrivateRequestParams = { + value: PrivateRequest, fee?: StdFee, memo?: string }; -type sendQueryAllEncryptedTxFromHeightResponseParams = { - value: QueryAllEncryptedTxFromHeightResponse, +type sendEncryptedTxArrayParams = { + value: EncryptedTxArray, fee?: StdFee, memo?: string }; @@ -256,221 +381,283 @@ type sendMsgSubmitEncryptedTxParams = { memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendMsgSubmitGeneralEncryptedTxParams = { + value: MsgSubmitGeneralEncryptedTx, fee?: StdFee, memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendMsgRegisterContractParams = { + value: MsgRegisterContract, fee?: StdFee, memo?: string }; -type sendMsgCreateAggregatedKeyShareResponseParams = { - value: MsgCreateAggregatedKeyShareResponse, +type sendQueryPepNonceAllResponseParams = { + value: QueryPepNonceAllResponse, fee?: StdFee, memo?: string }; -type sendMsgRequestGeneralKeyshareResponseParams = { - value: MsgRequestGeneralKeyshareResponse, +type sendMsgRegisterContractResponseParams = { + value: MsgRegisterContractResponse, fee?: StdFee, memo?: string }; -type sendQueryGetPepNonceResponseParams = { - value: QueryGetPepNonceResponse, +type sendMsgRequestPrivateIdentityResponseParams = { + value: MsgRequestPrivateIdentityResponse, fee?: StdFee, memo?: string }; -type sendGeneralEncryptedTxParams = { - value: GeneralEncryptedTx, +type sendQueryEncryptedTxAllResponseParams = { + value: QueryEncryptedTxAllResponse, fee?: StdFee, memo?: string }; -type sendTrustedCounterPartyParams = { - value: TrustedCounterParty, +type sendMsgSubmitGeneralEncryptedTxResponseParams = { + value: MsgSubmitGeneralEncryptedTxResponse, fee?: StdFee, memo?: string }; -type sendQueryKeyshareResponseParams = { - value: QueryKeyshareResponse, - fee?: StdFee, - memo?: string + +type msgSubmitDecryptionKeyParams = { + value: MsgSubmitDecryptionKey, +}; + +type contractDetailsParams = { + value: ContractDetails, +}; + +type paramsParams = { + value: Params, +}; + +type msgRequestGeneralIdentityResponseParams = { + value: MsgRequestGeneralIdentityResponse, +}; + +type queryEncryptedTxAllFromHeightRequestParams = { + value: QueryEncryptedTxAllFromHeightRequest, }; +type queryPepNonceRequestParams = { + value: QueryPepNonceRequest, +}; -type msgRequestGeneralKeyshareParams = { - value: MsgRequestGeneralKeyshare, +type generalEncryptedTxParams = { + value: GeneralEncryptedTx, }; -type msgCreateAggregatedKeyShareParams = { - value: MsgCreateAggregatedKeyShare, +type identityExecutionEntryParams = { + value: IdentityExecutionEntry, }; -type queryGetPepNonceRequestParams = { - value: QueryGetPepNonceRequest, +type msgRequestGeneralDecryptionKeyParams = { + value: MsgRequestGeneralDecryptionKey, +}; + +type trustedCounterPartyParams = { + value: TrustedCounterParty, }; type msgUpdateParamsResponseParams = { value: MsgUpdateParamsResponse, }; -type queryGetEncryptedTxResponseParams = { - value: QueryGetEncryptedTxResponse, +type msgRequestPrivateIdentityParams = { + value: MsgRequestPrivateIdentity, }; -type msgSubmitEncryptedTxResponseParams = { - value: MsgSubmitEncryptedTxResponse, +type registeredContractParams = { + value: RegisteredContract, +}; + +type queryDecryptDataResponseParams = { + value: QueryDecryptDataResponse, +}; + +type queryGeneralIdentityAllRequestParams = { + value: QueryGeneralIdentityAllRequest, +}; + +type queryPepNonceAllRequestParams = { + value: QueryPepNonceAllRequest, +}; + +type msgUnregisterContractParams = { + value: MsgUnregisterContract, }; -type queryPubKeyRequestParams = { - value: QueryPubKeyRequest, +type msgRequestPrivateDecryptionKeyParams = { + value: MsgRequestPrivateDecryptionKey, +}; + +type queryLatestHeightRequestParams = { + value: QueryLatestHeightRequest, }; type requestIdParams = { value: RequestId, }; -type genEncTxExecutionQueueParams = { - value: GenEncTxExecutionQueue, +type genesisStateParams = { + value: GenesisState, }; -type queryAllEncryptedTxRequestParams = { - value: QueryAllEncryptedTxRequest, +type queryEncryptedTxResponseParams = { + value: QueryEncryptedTxResponse, }; -type queryAllPepNonceResponseParams = { - value: QueryAllPepNonceResponse, +type queryPrivateIdentityResponseParams = { + value: QueryPrivateIdentityResponse, }; -type queryAllPepNonceRequestParams = { - value: QueryAllPepNonceRequest, +type msgRequestPrivateDecryptionKeyResponseParams = { + value: MsgRequestPrivateDecryptionKeyResponse, }; -type queryLatestHeightRequestParams = { - value: QueryLatestHeightRequest, +type queryEncryptedTxAllRequestParams = { + value: QueryEncryptedTxAllRequest, }; -type paramsParams = { - value: Params, +type queryPubkeyRequestParams = { + value: QueryPubkeyRequest, }; -type msgGetGeneralKeyshareResponseParams = { - value: MsgGetGeneralKeyshareResponse, +type msgRequestGeneralDecryptionKeyResponseParams = { + value: MsgRequestGeneralDecryptionKeyResponse, }; -type pepNonceParams = { - value: PepNonce, +type queryEncryptedTxRequestParams = { + value: QueryEncryptedTxRequest, +}; + +type executeContractMsgParams = { + value: ExecuteContractMsg, +}; + +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type queryGetEncryptedTxRequestParams = { - value: QueryGetEncryptedTxRequest, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; type encryptedTxParams = { value: EncryptedTx, }; -type queryAllEncryptedTxFromHeightRequestParams = { - value: QueryAllEncryptedTxFromHeightRequest, +type queryPepNonceResponseParams = { + value: QueryPepNonceResponse, }; -type queryAllKeyshareRequestParams = { - value: QueryAllKeyshareRequest, +type queryPubkeyResponseParams = { + value: QueryPubkeyResponse, }; -type msgGetGeneralKeyshareParams = { - value: MsgGetGeneralKeyshare, +type queryDecryptDataRequestParams = { + value: QueryDecryptDataRequest, }; -type queryAllEncryptedTxResponseParams = { - value: QueryAllEncryptedTxResponse, +type pepNonceParams = { + value: PepNonce, }; -type msgSubmitGeneralEncryptedTxParams = { - value: MsgSubmitGeneralEncryptedTx, +type msgSubmitDecryptionKeyResponseParams = { + value: MsgSubmitDecryptionKeyResponse, }; -type queryPubKeyResponseParams = { - value: QueryPubKeyResponse, +type msgUnregisterContractResponseParams = { + value: MsgUnregisterContractResponse, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type queryGeneralIdentityResponseParams = { + value: QueryGeneralIdentityResponse, +}; + +type queryEncryptedTxAllFromHeightResponseParams = { + value: QueryEncryptedTxAllFromHeightResponse, +}; + +type decryptionKeyParams = { + value: DecryptionKey, +}; + +type queryGeneralIdentityAllResponseParams = { + value: QueryGeneralIdentityAllResponse, }; -type queryAllKeyshareResponseParams = { - value: QueryAllKeyshareResponse, +type queryLatestHeightResponseParams = { + value: QueryLatestHeightResponse, +}; + +type queryPrivateIdentityRequestParams = { + value: QueryPrivateIdentityRequest, }; type generalEncryptedTxArrayParams = { value: GeneralEncryptedTxArray, }; -type encryptedTxArrayParams = { - value: EncryptedTxArray, +type msgSubmitEncryptedTxResponseParams = { + value: MsgSubmitEncryptedTxResponse, }; -type genesisStateParams = { - value: GenesisState, +type queryParamsResponseParams = { + value: QueryParamsResponse, }; -type aggregatedKeyShareParams = { - value: AggregatedKeyShare, +type queryGeneralIdentityRequestParams = { + value: QueryGeneralIdentityRequest, }; -type queryLatestHeightResponseParams = { - value: QueryLatestHeightResponse, +type msgRequestGeneralIdentityParams = { + value: MsgRequestGeneralIdentity, }; -type queryKeyshareRequestParams = { - value: QueryKeyshareRequest, +type privateRequestParams = { + value: PrivateRequest, }; -type queryAllEncryptedTxFromHeightResponseParams = { - value: QueryAllEncryptedTxFromHeightResponse, +type encryptedTxArrayParams = { + value: EncryptedTxArray, }; type msgSubmitEncryptedTxParams = { value: MsgSubmitEncryptedTx, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, -}; - -type queryParamsResponseParams = { - value: QueryParamsResponse, +type msgSubmitGeneralEncryptedTxParams = { + value: MsgSubmitGeneralEncryptedTx, }; -type msgCreateAggregatedKeyShareResponseParams = { - value: MsgCreateAggregatedKeyShareResponse, +type msgRegisterContractParams = { + value: MsgRegisterContract, }; -type msgRequestGeneralKeyshareResponseParams = { - value: MsgRequestGeneralKeyshareResponse, +type queryPepNonceAllResponseParams = { + value: QueryPepNonceAllResponse, }; -type queryGetPepNonceResponseParams = { - value: QueryGetPepNonceResponse, +type msgRegisterContractResponseParams = { + value: MsgRegisterContractResponse, }; -type generalEncryptedTxParams = { - value: GeneralEncryptedTx, +type msgRequestPrivateIdentityResponseParams = { + value: MsgRequestPrivateIdentityResponse, }; -type trustedCounterPartyParams = { - value: TrustedCounterParty, +type queryEncryptedTxAllResponseParams = { + value: QueryEncryptedTxAllResponse, }; -type queryKeyshareResponseParams = { - value: QueryKeyshareResponse, +type msgSubmitGeneralEncryptedTxResponseParams = { + value: MsgSubmitGeneralEncryptedTxResponse, }; @@ -503,45 +690,143 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgRequestGeneralKeyshare({ value, fee, memo }: sendMsgRequestGeneralKeyshareParams): Promise { + async sendMsgSubmitDecryptionKey({ value, fee, memo }: sendMsgSubmitDecryptionKeyParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgSubmitDecryptionKey: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgSubmitDecryptionKey({ value: MsgSubmitDecryptionKey.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgSubmitDecryptionKey: Could not broadcast Tx: '+ e.message) + } + }, + + async sendContractDetails({ value, fee, memo }: sendContractDetailsParams): Promise { + if (!signer) { + throw new Error('TxClient:sendContractDetails: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.contractDetails({ value: ContractDetails.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendContractDetails: Could not broadcast Tx: '+ e.message) + } + }, + + async sendParams({ value, fee, memo }: sendParamsParams): Promise { + if (!signer) { + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.params({ value: Params.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + } + }, + + async sendMsgRequestGeneralIdentityResponse({ value, fee, memo }: sendMsgRequestGeneralIdentityResponseParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgRequestGeneralIdentityResponse: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgRequestGeneralIdentityResponse({ value: MsgRequestGeneralIdentityResponse.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgRequestGeneralIdentityResponse: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryEncryptedTxAllFromHeightRequest({ value, fee, memo }: sendQueryEncryptedTxAllFromHeightRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryEncryptedTxAllFromHeightRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryEncryptedTxAllFromHeightRequest({ value: QueryEncryptedTxAllFromHeightRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryEncryptedTxAllFromHeightRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryPepNonceRequest({ value, fee, memo }: sendQueryPepNonceRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryPepNonceRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryPepNonceRequest({ value: QueryPepNonceRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryPepNonceRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendGeneralEncryptedTx({ value, fee, memo }: sendGeneralEncryptedTxParams): Promise { + if (!signer) { + throw new Error('TxClient:sendGeneralEncryptedTx: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.generalEncryptedTx({ value: GeneralEncryptedTx.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendGeneralEncryptedTx: Could not broadcast Tx: '+ e.message) + } + }, + + async sendIdentityExecutionEntry({ value, fee, memo }: sendIdentityExecutionEntryParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRequestGeneralKeyshare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendIdentityExecutionEntry: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRequestGeneralKeyshare({ value: MsgRequestGeneralKeyshare.fromPartial(value) }) + let msg = this.identityExecutionEntry({ value: IdentityExecutionEntry.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRequestGeneralKeyshare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendIdentityExecutionEntry: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateAggregatedKeyShare({ value, fee, memo }: sendMsgCreateAggregatedKeyShareParams): Promise { + async sendMsgRequestGeneralDecryptionKey({ value, fee, memo }: sendMsgRequestGeneralDecryptionKeyParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateAggregatedKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRequestGeneralDecryptionKey: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateAggregatedKeyShare({ value: MsgCreateAggregatedKeyShare.fromPartial(value) }) + let msg = this.msgRequestGeneralDecryptionKey({ value: MsgRequestGeneralDecryptionKey.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateAggregatedKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRequestGeneralDecryptionKey: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetPepNonceRequest({ value, fee, memo }: sendQueryGetPepNonceRequestParams): Promise { + async sendTrustedCounterParty({ value, fee, memo }: sendTrustedCounterPartyParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetPepNonceRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTrustedCounterParty: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetPepNonceRequest({ value: QueryGetPepNonceRequest.fromPartial(value) }) + let msg = this.trustedCounterParty({ value: TrustedCounterParty.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetPepNonceRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTrustedCounterParty: Could not broadcast Tx: '+ e.message) } }, @@ -559,45 +844,115 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryGetEncryptedTxResponse({ value, fee, memo }: sendQueryGetEncryptedTxResponseParams): Promise { + async sendMsgRequestPrivateIdentity({ value, fee, memo }: sendMsgRequestPrivateIdentityParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetEncryptedTxResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRequestPrivateIdentity: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetEncryptedTxResponse({ value: QueryGetEncryptedTxResponse.fromPartial(value) }) + let msg = this.msgRequestPrivateIdentity({ value: MsgRequestPrivateIdentity.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetEncryptedTxResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRequestPrivateIdentity: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitEncryptedTxResponse({ value, fee, memo }: sendMsgSubmitEncryptedTxResponseParams): Promise { + async sendRegisteredContract({ value, fee, memo }: sendRegisteredContractParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitEncryptedTxResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRegisteredContract: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitEncryptedTxResponse({ value: MsgSubmitEncryptedTxResponse.fromPartial(value) }) + let msg = this.registeredContract({ value: RegisteredContract.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitEncryptedTxResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRegisteredContract: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryDecryptDataResponse({ value, fee, memo }: sendQueryDecryptDataResponseParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryDecryptDataResponse: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryDecryptDataResponse({ value: QueryDecryptDataResponse.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryDecryptDataResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPubKeyRequest({ value, fee, memo }: sendQueryPubKeyRequestParams): Promise { + async sendQueryGeneralIdentityAllRequest({ value, fee, memo }: sendQueryGeneralIdentityAllRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPubKeyRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGeneralIdentityAllRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPubKeyRequest({ value: QueryPubKeyRequest.fromPartial(value) }) + let msg = this.queryGeneralIdentityAllRequest({ value: QueryGeneralIdentityAllRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPubKeyRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGeneralIdentityAllRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryPepNonceAllRequest({ value, fee, memo }: sendQueryPepNonceAllRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryPepNonceAllRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryPepNonceAllRequest({ value: QueryPepNonceAllRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryPepNonceAllRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendMsgUnregisterContract({ value, fee, memo }: sendMsgUnregisterContractParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgUnregisterContract: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgUnregisterContract({ value: MsgUnregisterContract.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgUnregisterContract: Could not broadcast Tx: '+ e.message) + } + }, + + async sendMsgRequestPrivateDecryptionKey({ value, fee, memo }: sendMsgRequestPrivateDecryptionKeyParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgRequestPrivateDecryptionKey: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgRequestPrivateDecryptionKey({ value: MsgRequestPrivateDecryptionKey.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgRequestPrivateDecryptionKey: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryLatestHeightRequest({ value, fee, memo }: sendQueryLatestHeightRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryLatestHeightRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryLatestHeightRequest({ value: QueryLatestHeightRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryLatestHeightRequest: Could not broadcast Tx: '+ e.message) } }, @@ -615,255 +970,339 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendGenEncTxExecutionQueue({ value, fee, memo }: sendGenEncTxExecutionQueueParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenEncTxExecutionQueue: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genEncTxExecutionQueue({ value: GenEncTxExecutionQueue.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenEncTxExecutionQueue: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllEncryptedTxRequest({ value, fee, memo }: sendQueryAllEncryptedTxRequestParams): Promise { + async sendQueryEncryptedTxResponse({ value, fee, memo }: sendQueryEncryptedTxResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllEncryptedTxRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryEncryptedTxResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllEncryptedTxRequest({ value: QueryAllEncryptedTxRequest.fromPartial(value) }) + let msg = this.queryEncryptedTxResponse({ value: QueryEncryptedTxResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllEncryptedTxRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryEncryptedTxResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllPepNonceResponse({ value, fee, memo }: sendQueryAllPepNonceResponseParams): Promise { + async sendQueryPrivateIdentityResponse({ value, fee, memo }: sendQueryPrivateIdentityResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllPepNonceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPrivateIdentityResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllPepNonceResponse({ value: QueryAllPepNonceResponse.fromPartial(value) }) + let msg = this.queryPrivateIdentityResponse({ value: QueryPrivateIdentityResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllPepNonceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPrivateIdentityResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllPepNonceRequest({ value, fee, memo }: sendQueryAllPepNonceRequestParams): Promise { + async sendMsgRequestPrivateDecryptionKeyResponse({ value, fee, memo }: sendMsgRequestPrivateDecryptionKeyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllPepNonceRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRequestPrivateDecryptionKeyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllPepNonceRequest({ value: QueryAllPepNonceRequest.fromPartial(value) }) + let msg = this.msgRequestPrivateDecryptionKeyResponse({ value: MsgRequestPrivateDecryptionKeyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllPepNonceRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRequestPrivateDecryptionKeyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryLatestHeightRequest({ value, fee, memo }: sendQueryLatestHeightRequestParams): Promise { + async sendQueryEncryptedTxAllRequest({ value, fee, memo }: sendQueryEncryptedTxAllRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryEncryptedTxAllRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryEncryptedTxAllRequest({ value: QueryEncryptedTxAllRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryEncryptedTxAllRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryPubkeyRequest({ value, fee, memo }: sendQueryPubkeyRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryPubkeyRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryPubkeyRequest({ value: QueryPubkeyRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryPubkeyRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendMsgRequestGeneralDecryptionKeyResponse({ value, fee, memo }: sendMsgRequestGeneralDecryptionKeyResponseParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgRequestGeneralDecryptionKeyResponse: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgRequestGeneralDecryptionKeyResponse({ value: MsgRequestGeneralDecryptionKeyResponse.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgRequestGeneralDecryptionKeyResponse: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryEncryptedTxRequest({ value, fee, memo }: sendQueryEncryptedTxRequestParams): Promise { + if (!signer) { + throw new Error('TxClient:sendQueryEncryptedTxRequest: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.queryEncryptedTxRequest({ value: QueryEncryptedTxRequest.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendQueryEncryptedTxRequest: Could not broadcast Tx: '+ e.message) + } + }, + + async sendExecuteContractMsg({ value, fee, memo }: sendExecuteContractMsgParams): Promise { + if (!signer) { + throw new Error('TxClient:sendExecuteContractMsg: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.executeContractMsg({ value: ExecuteContractMsg.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendExecuteContractMsg: Could not broadcast Tx: '+ e.message) + } + }, + + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + } + }, + + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryLatestHeightRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryLatestHeightRequest({ value: QueryLatestHeightRequest.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryLatestHeightRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendEncryptedTx({ value, fee, memo }: sendEncryptedTxParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEncryptedTx: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.encryptedTx({ value: EncryptedTx.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEncryptedTx: Could not broadcast Tx: '+ e.message) } }, - async sendMsgGetGeneralKeyshareResponse({ value, fee, memo }: sendMsgGetGeneralKeyshareResponseParams): Promise { + async sendQueryPepNonceResponse({ value, fee, memo }: sendQueryPepNonceResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgGetGeneralKeyshareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPepNonceResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgGetGeneralKeyshareResponse({ value: MsgGetGeneralKeyshareResponse.fromPartial(value) }) + let msg = this.queryPepNonceResponse({ value: QueryPepNonceResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgGetGeneralKeyshareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPepNonceResponse: Could not broadcast Tx: '+ e.message) } }, - async sendPepNonce({ value, fee, memo }: sendPepNonceParams): Promise { + async sendQueryPubkeyResponse({ value, fee, memo }: sendQueryPubkeyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendPepNonce: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPubkeyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.pepNonce({ value: PepNonce.fromPartial(value) }) + let msg = this.queryPubkeyResponse({ value: QueryPubkeyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPepNonce: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPubkeyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetEncryptedTxRequest({ value, fee, memo }: sendQueryGetEncryptedTxRequestParams): Promise { + async sendQueryDecryptDataRequest({ value, fee, memo }: sendQueryDecryptDataRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetEncryptedTxRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDecryptDataRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetEncryptedTxRequest({ value: QueryGetEncryptedTxRequest.fromPartial(value) }) + let msg = this.queryDecryptDataRequest({ value: QueryDecryptDataRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetEncryptedTxRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDecryptDataRequest: Could not broadcast Tx: '+ e.message) } }, - async sendEncryptedTx({ value, fee, memo }: sendEncryptedTxParams): Promise { + async sendPepNonce({ value, fee, memo }: sendPepNonceParams): Promise { if (!signer) { - throw new Error('TxClient:sendEncryptedTx: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPepNonce: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.encryptedTx({ value: EncryptedTx.fromPartial(value) }) + let msg = this.pepNonce({ value: PepNonce.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEncryptedTx: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPepNonce: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllEncryptedTxFromHeightRequest({ value, fee, memo }: sendQueryAllEncryptedTxFromHeightRequestParams): Promise { + async sendMsgSubmitDecryptionKeyResponse({ value, fee, memo }: sendMsgSubmitDecryptionKeyResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllEncryptedTxFromHeightRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitDecryptionKeyResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllEncryptedTxFromHeightRequest({ value: QueryAllEncryptedTxFromHeightRequest.fromPartial(value) }) + let msg = this.msgSubmitDecryptionKeyResponse({ value: MsgSubmitDecryptionKeyResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllEncryptedTxFromHeightRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitDecryptionKeyResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllKeyshareRequest({ value, fee, memo }: sendQueryAllKeyshareRequestParams): Promise { + async sendMsgUnregisterContractResponse({ value, fee, memo }: sendMsgUnregisterContractResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllKeyshareRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUnregisterContractResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllKeyshareRequest({ value: QueryAllKeyshareRequest.fromPartial(value) }) + let msg = this.msgUnregisterContractResponse({ value: MsgUnregisterContractResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllKeyshareRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUnregisterContractResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgGetGeneralKeyshare({ value, fee, memo }: sendMsgGetGeneralKeyshareParams): Promise { + async sendQueryGeneralIdentityResponse({ value, fee, memo }: sendQueryGeneralIdentityResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgGetGeneralKeyshare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGeneralIdentityResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgGetGeneralKeyshare({ value: MsgGetGeneralKeyshare.fromPartial(value) }) + let msg = this.queryGeneralIdentityResponse({ value: QueryGeneralIdentityResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgGetGeneralKeyshare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGeneralIdentityResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllEncryptedTxResponse({ value, fee, memo }: sendQueryAllEncryptedTxResponseParams): Promise { + async sendQueryEncryptedTxAllFromHeightResponse({ value, fee, memo }: sendQueryEncryptedTxAllFromHeightResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllEncryptedTxResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryEncryptedTxAllFromHeightResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllEncryptedTxResponse({ value: QueryAllEncryptedTxResponse.fromPartial(value) }) + let msg = this.queryEncryptedTxAllFromHeightResponse({ value: QueryEncryptedTxAllFromHeightResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllEncryptedTxResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryEncryptedTxAllFromHeightResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitGeneralEncryptedTx({ value, fee, memo }: sendMsgSubmitGeneralEncryptedTxParams): Promise { + async sendDecryptionKey({ value, fee, memo }: sendDecryptionKeyParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitGeneralEncryptedTx: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDecryptionKey: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitGeneralEncryptedTx({ value: MsgSubmitGeneralEncryptedTx.fromPartial(value) }) + let msg = this.decryptionKey({ value: DecryptionKey.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitGeneralEncryptedTx: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDecryptionKey: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPubKeyResponse({ value, fee, memo }: sendQueryPubKeyResponseParams): Promise { + async sendQueryGeneralIdentityAllResponse({ value, fee, memo }: sendQueryGeneralIdentityAllResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPubKeyResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGeneralIdentityAllResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPubKeyResponse({ value: QueryPubKeyResponse.fromPartial(value) }) + let msg = this.queryGeneralIdentityAllResponse({ value: QueryGeneralIdentityAllResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPubKeyResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGeneralIdentityAllResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendQueryLatestHeightResponse({ value, fee, memo }: sendQueryLatestHeightResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryLatestHeightResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.queryLatestHeightResponse({ value: QueryLatestHeightResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryLatestHeightResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllKeyshareResponse({ value, fee, memo }: sendQueryAllKeyshareResponseParams): Promise { + async sendQueryPrivateIdentityRequest({ value, fee, memo }: sendQueryPrivateIdentityRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllKeyshareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPrivateIdentityRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllKeyshareResponse({ value: QueryAllKeyshareResponse.fromPartial(value) }) + let msg = this.queryPrivateIdentityRequest({ value: QueryPrivateIdentityRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllKeyshareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPrivateIdentityRequest: Could not broadcast Tx: '+ e.message) } }, @@ -881,87 +1320,87 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendEncryptedTxArray({ value, fee, memo }: sendEncryptedTxArrayParams): Promise { + async sendMsgSubmitEncryptedTxResponse({ value, fee, memo }: sendMsgSubmitEncryptedTxResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendEncryptedTxArray: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitEncryptedTxResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.encryptedTxArray({ value: EncryptedTxArray.fromPartial(value) }) + let msg = this.msgSubmitEncryptedTxResponse({ value: MsgSubmitEncryptedTxResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendEncryptedTxArray: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitEncryptedTxResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendAggregatedKeyShare({ value, fee, memo }: sendAggregatedKeyShareParams): Promise { + async sendQueryGeneralIdentityRequest({ value, fee, memo }: sendQueryGeneralIdentityRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendAggregatedKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryGeneralIdentityRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.aggregatedKeyShare({ value: AggregatedKeyShare.fromPartial(value) }) + let msg = this.queryGeneralIdentityRequest({ value: QueryGeneralIdentityRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAggregatedKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryGeneralIdentityRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryLatestHeightResponse({ value, fee, memo }: sendQueryLatestHeightResponseParams): Promise { + async sendMsgRequestGeneralIdentity({ value, fee, memo }: sendMsgRequestGeneralIdentityParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryLatestHeightResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRequestGeneralIdentity: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryLatestHeightResponse({ value: QueryLatestHeightResponse.fromPartial(value) }) + let msg = this.msgRequestGeneralIdentity({ value: MsgRequestGeneralIdentity.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryLatestHeightResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRequestGeneralIdentity: Could not broadcast Tx: '+ e.message) } }, - async sendQueryKeyshareRequest({ value, fee, memo }: sendQueryKeyshareRequestParams): Promise { + async sendPrivateRequest({ value, fee, memo }: sendPrivateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryKeyshareRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPrivateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryKeyshareRequest({ value: QueryKeyshareRequest.fromPartial(value) }) + let msg = this.privateRequest({ value: PrivateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryKeyshareRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPrivateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryAllEncryptedTxFromHeightResponse({ value, fee, memo }: sendQueryAllEncryptedTxFromHeightResponseParams): Promise { + async sendEncryptedTxArray({ value, fee, memo }: sendEncryptedTxArrayParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryAllEncryptedTxFromHeightResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendEncryptedTxArray: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryAllEncryptedTxFromHeightResponse({ value: QueryAllEncryptedTxFromHeightResponse.fromPartial(value) }) + let msg = this.encryptedTxArray({ value: EncryptedTxArray.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryAllEncryptedTxFromHeightResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendEncryptedTxArray: Could not broadcast Tx: '+ e.message) } }, @@ -979,140 +1418,182 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendMsgSubmitGeneralEncryptedTx({ value, fee, memo }: sendMsgSubmitGeneralEncryptedTxParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitGeneralEncryptedTx: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.msgSubmitGeneralEncryptedTx({ value: MsgSubmitGeneralEncryptedTx.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitGeneralEncryptedTx: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendMsgRegisterContract({ value, fee, memo }: sendMsgRegisterContractParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterContract: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.msgRegisterContract({ value: MsgRegisterContract.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterContract: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateAggregatedKeyShareResponse({ value, fee, memo }: sendMsgCreateAggregatedKeyShareResponseParams): Promise { + async sendQueryPepNonceAllResponse({ value, fee, memo }: sendQueryPepNonceAllResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateAggregatedKeyShareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPepNonceAllResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateAggregatedKeyShareResponse({ value: MsgCreateAggregatedKeyShareResponse.fromPartial(value) }) + let msg = this.queryPepNonceAllResponse({ value: QueryPepNonceAllResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateAggregatedKeyShareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPepNonceAllResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRequestGeneralKeyshareResponse({ value, fee, memo }: sendMsgRequestGeneralKeyshareResponseParams): Promise { + async sendMsgRegisterContractResponse({ value, fee, memo }: sendMsgRegisterContractResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRequestGeneralKeyshareResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterContractResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRequestGeneralKeyshareResponse({ value: MsgRequestGeneralKeyshareResponse.fromPartial(value) }) + let msg = this.msgRegisterContractResponse({ value: MsgRegisterContractResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRequestGeneralKeyshareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterContractResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryGetPepNonceResponse({ value, fee, memo }: sendQueryGetPepNonceResponseParams): Promise { + async sendMsgRequestPrivateIdentityResponse({ value, fee, memo }: sendMsgRequestPrivateIdentityResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryGetPepNonceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRequestPrivateIdentityResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryGetPepNonceResponse({ value: QueryGetPepNonceResponse.fromPartial(value) }) + let msg = this.msgRequestPrivateIdentityResponse({ value: MsgRequestPrivateIdentityResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryGetPepNonceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRequestPrivateIdentityResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGeneralEncryptedTx({ value, fee, memo }: sendGeneralEncryptedTxParams): Promise { + async sendQueryEncryptedTxAllResponse({ value, fee, memo }: sendQueryEncryptedTxAllResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGeneralEncryptedTx: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryEncryptedTxAllResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.generalEncryptedTx({ value: GeneralEncryptedTx.fromPartial(value) }) + let msg = this.queryEncryptedTxAllResponse({ value: QueryEncryptedTxAllResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGeneralEncryptedTx: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryEncryptedTxAllResponse: Could not broadcast Tx: '+ e.message) } }, - async sendTrustedCounterParty({ value, fee, memo }: sendTrustedCounterPartyParams): Promise { + async sendMsgSubmitGeneralEncryptedTxResponse({ value, fee, memo }: sendMsgSubmitGeneralEncryptedTxResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendTrustedCounterParty: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitGeneralEncryptedTxResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.trustedCounterParty({ value: TrustedCounterParty.fromPartial(value) }) + let msg = this.msgSubmitGeneralEncryptedTxResponse({ value: MsgSubmitGeneralEncryptedTxResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTrustedCounterParty: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitGeneralEncryptedTxResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryKeyshareResponse({ value, fee, memo }: sendQueryKeyshareResponseParams): Promise { - if (!signer) { - throw new Error('TxClient:sendQueryKeyshareResponse: Unable to sign Tx. Signer is not present.') + + msgSubmitDecryptionKey({ value }: msgSubmitDecryptionKeyParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.MsgSubmitDecryptionKey", value: MsgSubmitDecryptionKey.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgSubmitDecryptionKey: Could not create message: ' + e.message) } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryKeyshareResponse({ value: QueryKeyshareResponse.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + }, + + contractDetails({ value }: contractDetailsParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.ContractDetails", value: ContractDetails.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:ContractDetails: Could not create message: ' + e.message) + } + }, + + params({ value }: paramsParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.Params", value: Params.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:Params: Could not create message: ' + e.message) + } + }, + + msgRequestGeneralIdentityResponse({ value }: msgRequestGeneralIdentityResponseParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.MsgRequestGeneralIdentityResponse", value: MsgRequestGeneralIdentityResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgRequestGeneralIdentityResponse: Could not create message: ' + e.message) + } + }, + + queryEncryptedTxAllFromHeightRequest({ value }: queryEncryptedTxAllFromHeightRequestParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.QueryEncryptedTxAllFromHeightRequest", value: QueryEncryptedTxAllFromHeightRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:sendQueryKeyshareResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:QueryEncryptedTxAllFromHeightRequest: Could not create message: ' + e.message) } }, + queryPepNonceRequest({ value }: queryPepNonceRequestParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.QueryPepNonceRequest", value: QueryPepNonceRequest.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryPepNonceRequest: Could not create message: ' + e.message) + } + }, + + generalEncryptedTx({ value }: generalEncryptedTxParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.GeneralEncryptedTx", value: GeneralEncryptedTx.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:GeneralEncryptedTx: Could not create message: ' + e.message) + } + }, - msgRequestGeneralKeyshare({ value }: msgRequestGeneralKeyshareParams): EncodeObject { + identityExecutionEntry({ value }: identityExecutionEntryParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgRequestGeneralKeyshare", value: MsgRequestGeneralKeyshare.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.IdentityExecutionEntry", value: IdentityExecutionEntry.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRequestGeneralKeyshare: Could not create message: ' + e.message) + throw new Error('TxClient:IdentityExecutionEntry: Could not create message: ' + e.message) } }, - msgCreateAggregatedKeyShare({ value }: msgCreateAggregatedKeyShareParams): EncodeObject { + msgRequestGeneralDecryptionKey({ value }: msgRequestGeneralDecryptionKeyParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgCreateAggregatedKeyShare", value: MsgCreateAggregatedKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgRequestGeneralDecryptionKey", value: MsgRequestGeneralDecryptionKey.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateAggregatedKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRequestGeneralDecryptionKey: Could not create message: ' + e.message) } }, - queryGetPepNonceRequest({ value }: queryGetPepNonceRequestParams): EncodeObject { + trustedCounterParty({ value }: trustedCounterPartyParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryGetPepNonceRequest", value: QueryGetPepNonceRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.TrustedCounterParty", value: TrustedCounterParty.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetPepNonceRequest: Could not create message: ' + e.message) + throw new Error('TxClient:TrustedCounterParty: Could not create message: ' + e.message) } }, @@ -1124,27 +1605,67 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryGetEncryptedTxResponse({ value }: queryGetEncryptedTxResponseParams): EncodeObject { + msgRequestPrivateIdentity({ value }: msgRequestPrivateIdentityParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryGetEncryptedTxResponse", value: QueryGetEncryptedTxResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgRequestPrivateIdentity", value: MsgRequestPrivateIdentity.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetEncryptedTxResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRequestPrivateIdentity: Could not create message: ' + e.message) } }, - msgSubmitEncryptedTxResponse({ value }: msgSubmitEncryptedTxResponseParams): EncodeObject { + registeredContract({ value }: registeredContractParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgSubmitEncryptedTxResponse", value: MsgSubmitEncryptedTxResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.RegisteredContract", value: RegisteredContract.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitEncryptedTxResponse: Could not create message: ' + e.message) + throw new Error('TxClient:RegisteredContract: Could not create message: ' + e.message) + } + }, + + queryDecryptDataResponse({ value }: queryDecryptDataResponseParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.QueryDecryptDataResponse", value: QueryDecryptDataResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryDecryptDataResponse: Could not create message: ' + e.message) + } + }, + + queryGeneralIdentityAllRequest({ value }: queryGeneralIdentityAllRequestParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.QueryGeneralIdentityAllRequest", value: QueryGeneralIdentityAllRequest.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryGeneralIdentityAllRequest: Could not create message: ' + e.message) + } + }, + + queryPepNonceAllRequest({ value }: queryPepNonceAllRequestParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.QueryPepNonceAllRequest", value: QueryPepNonceAllRequest.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryPepNonceAllRequest: Could not create message: ' + e.message) + } + }, + + msgUnregisterContract({ value }: msgUnregisterContractParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.MsgUnregisterContract", value: MsgUnregisterContract.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgUnregisterContract: Could not create message: ' + e.message) + } + }, + + msgRequestPrivateDecryptionKey({ value }: msgRequestPrivateDecryptionKeyParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.MsgRequestPrivateDecryptionKey", value: MsgRequestPrivateDecryptionKey.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgRequestPrivateDecryptionKey: Could not create message: ' + e.message) } }, - queryPubKeyRequest({ value }: queryPubKeyRequestParams): EncodeObject { + queryLatestHeightRequest({ value }: queryLatestHeightRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryPubKeyRequest", value: QueryPubKeyRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryLatestHeightRequest", value: QueryLatestHeightRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPubKeyRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryLatestHeightRequest: Could not create message: ' + e.message) } }, @@ -1156,75 +1677,91 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - genEncTxExecutionQueue({ value }: genEncTxExecutionQueueParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.GenesisState", value: GenesisState.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + } + }, + + queryEncryptedTxResponse({ value }: queryEncryptedTxResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.GenEncTxExecutionQueue", value: GenEncTxExecutionQueue.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryEncryptedTxResponse", value: QueryEncryptedTxResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenEncTxExecutionQueue: Could not create message: ' + e.message) + throw new Error('TxClient:QueryEncryptedTxResponse: Could not create message: ' + e.message) } }, - queryAllEncryptedTxRequest({ value }: queryAllEncryptedTxRequestParams): EncodeObject { + queryPrivateIdentityResponse({ value }: queryPrivateIdentityResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryAllEncryptedTxRequest", value: QueryAllEncryptedTxRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryPrivateIdentityResponse", value: QueryPrivateIdentityResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllEncryptedTxRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPrivateIdentityResponse: Could not create message: ' + e.message) } }, - queryAllPepNonceResponse({ value }: queryAllPepNonceResponseParams): EncodeObject { + msgRequestPrivateDecryptionKeyResponse({ value }: msgRequestPrivateDecryptionKeyResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryAllPepNonceResponse", value: QueryAllPepNonceResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgRequestPrivateDecryptionKeyResponse", value: MsgRequestPrivateDecryptionKeyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllPepNonceResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRequestPrivateDecryptionKeyResponse: Could not create message: ' + e.message) } }, - queryAllPepNonceRequest({ value }: queryAllPepNonceRequestParams): EncodeObject { + queryEncryptedTxAllRequest({ value }: queryEncryptedTxAllRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryAllPepNonceRequest", value: QueryAllPepNonceRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryEncryptedTxAllRequest", value: QueryEncryptedTxAllRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllPepNonceRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryEncryptedTxAllRequest: Could not create message: ' + e.message) } }, - queryLatestHeightRequest({ value }: queryLatestHeightRequestParams): EncodeObject { + queryPubkeyRequest({ value }: queryPubkeyRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryLatestHeightRequest", value: QueryLatestHeightRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryPubkeyRequest", value: QueryPubkeyRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryLatestHeightRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPubkeyRequest: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + msgRequestGeneralDecryptionKeyResponse({ value }: msgRequestGeneralDecryptionKeyResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgRequestGeneralDecryptionKeyResponse", value: MsgRequestGeneralDecryptionKeyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRequestGeneralDecryptionKeyResponse: Could not create message: ' + e.message) } }, - msgGetGeneralKeyshareResponse({ value }: msgGetGeneralKeyshareResponseParams): EncodeObject { + queryEncryptedTxRequest({ value }: queryEncryptedTxRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgGetGeneralKeyshareResponse", value: MsgGetGeneralKeyshareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryEncryptedTxRequest", value: QueryEncryptedTxRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgGetGeneralKeyshareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryEncryptedTxRequest: Could not create message: ' + e.message) } }, - pepNonce({ value }: pepNonceParams): EncodeObject { + executeContractMsg({ value }: executeContractMsgParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.PepNonce", value: PepNonce.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.ExecuteContractMsg", value: ExecuteContractMsg.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:PepNonce: Could not create message: ' + e.message) + throw new Error('TxClient:ExecuteContractMsg: Could not create message: ' + e.message) + } + }, + + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - queryGetEncryptedTxRequest({ value }: queryGetEncryptedTxRequestParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryGetEncryptedTxRequest", value: QueryGetEncryptedTxRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetEncryptedTxRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, @@ -1236,67 +1773,99 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryAllEncryptedTxFromHeightRequest({ value }: queryAllEncryptedTxFromHeightRequestParams): EncodeObject { + queryPepNonceResponse({ value }: queryPepNonceResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryAllEncryptedTxFromHeightRequest", value: QueryAllEncryptedTxFromHeightRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryPepNonceResponse", value: QueryPepNonceResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllEncryptedTxFromHeightRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPepNonceResponse: Could not create message: ' + e.message) } }, - queryAllKeyshareRequest({ value }: queryAllKeyshareRequestParams): EncodeObject { + queryPubkeyResponse({ value }: queryPubkeyResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryAllKeyshareRequest", value: QueryAllKeyshareRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryPubkeyResponse", value: QueryPubkeyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllKeyshareRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPubkeyResponse: Could not create message: ' + e.message) } }, - msgGetGeneralKeyshare({ value }: msgGetGeneralKeyshareParams): EncodeObject { + queryDecryptDataRequest({ value }: queryDecryptDataRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgGetGeneralKeyshare", value: MsgGetGeneralKeyshare.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryDecryptDataRequest", value: QueryDecryptDataRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgGetGeneralKeyshare: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDecryptDataRequest: Could not create message: ' + e.message) } }, - queryAllEncryptedTxResponse({ value }: queryAllEncryptedTxResponseParams): EncodeObject { + pepNonce({ value }: pepNonceParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryAllEncryptedTxResponse", value: QueryAllEncryptedTxResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.PepNonce", value: PepNonce.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllEncryptedTxResponse: Could not create message: ' + e.message) + throw new Error('TxClient:PepNonce: Could not create message: ' + e.message) } }, - msgSubmitGeneralEncryptedTx({ value }: msgSubmitGeneralEncryptedTxParams): EncodeObject { + msgSubmitDecryptionKeyResponse({ value }: msgSubmitDecryptionKeyResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgSubmitGeneralEncryptedTx", value: MsgSubmitGeneralEncryptedTx.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgSubmitDecryptionKeyResponse", value: MsgSubmitDecryptionKeyResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitGeneralEncryptedTx: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitDecryptionKeyResponse: Could not create message: ' + e.message) } }, - queryPubKeyResponse({ value }: queryPubKeyResponseParams): EncodeObject { + msgUnregisterContractResponse({ value }: msgUnregisterContractResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryPubKeyResponse", value: QueryPubKeyResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgUnregisterContractResponse", value: MsgUnregisterContractResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPubKeyResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUnregisterContractResponse: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + queryGeneralIdentityResponse({ value }: queryGeneralIdentityResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryGeneralIdentityResponse", value: QueryGeneralIdentityResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGeneralIdentityResponse: Could not create message: ' + e.message) + } + }, + + queryEncryptedTxAllFromHeightResponse({ value }: queryEncryptedTxAllFromHeightResponseParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.QueryEncryptedTxAllFromHeightResponse", value: QueryEncryptedTxAllFromHeightResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryEncryptedTxAllFromHeightResponse: Could not create message: ' + e.message) + } + }, + + decryptionKey({ value }: decryptionKeyParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.DecryptionKey", value: DecryptionKey.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:DecryptionKey: Could not create message: ' + e.message) + } + }, + + queryGeneralIdentityAllResponse({ value }: queryGeneralIdentityAllResponseParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.QueryGeneralIdentityAllResponse", value: QueryGeneralIdentityAllResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryGeneralIdentityAllResponse: Could not create message: ' + e.message) + } + }, + + queryLatestHeightResponse({ value }: queryLatestHeightResponseParams): EncodeObject { + try { + return { typeUrl: "/fairyring.pep.QueryLatestHeightResponse", value: QueryLatestHeightResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryLatestHeightResponse: Could not create message: ' + e.message) } }, - queryAllKeyshareResponse({ value }: queryAllKeyshareResponseParams): EncodeObject { + queryPrivateIdentityRequest({ value }: queryPrivateIdentityRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryAllKeyshareResponse", value: QueryAllKeyshareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryPrivateIdentityRequest", value: QueryPrivateIdentityRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllKeyshareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPrivateIdentityRequest: Could not create message: ' + e.message) } }, @@ -1308,51 +1877,51 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - encryptedTxArray({ value }: encryptedTxArrayParams): EncodeObject { + msgSubmitEncryptedTxResponse({ value }: msgSubmitEncryptedTxResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.EncryptedTxArray", value: EncryptedTxArray.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgSubmitEncryptedTxResponse", value: MsgSubmitEncryptedTxResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:EncryptedTxArray: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitEncryptedTxResponse: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - aggregatedKeyShare({ value }: aggregatedKeyShareParams): EncodeObject { + queryGeneralIdentityRequest({ value }: queryGeneralIdentityRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.AggregatedKeyShare", value: AggregatedKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryGeneralIdentityRequest", value: QueryGeneralIdentityRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:AggregatedKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:QueryGeneralIdentityRequest: Could not create message: ' + e.message) } }, - queryLatestHeightResponse({ value }: queryLatestHeightResponseParams): EncodeObject { + msgRequestGeneralIdentity({ value }: msgRequestGeneralIdentityParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryLatestHeightResponse", value: QueryLatestHeightResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgRequestGeneralIdentity", value: MsgRequestGeneralIdentity.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryLatestHeightResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRequestGeneralIdentity: Could not create message: ' + e.message) } }, - queryKeyshareRequest({ value }: queryKeyshareRequestParams): EncodeObject { + privateRequest({ value }: privateRequestParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryKeyshareRequest", value: QueryKeyshareRequest.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.PrivateRequest", value: PrivateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryKeyshareRequest: Could not create message: ' + e.message) + throw new Error('TxClient:PrivateRequest: Could not create message: ' + e.message) } }, - queryAllEncryptedTxFromHeightResponse({ value }: queryAllEncryptedTxFromHeightResponseParams): EncodeObject { + encryptedTxArray({ value }: encryptedTxArrayParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryAllEncryptedTxFromHeightResponse", value: QueryAllEncryptedTxFromHeightResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.EncryptedTxArray", value: EncryptedTxArray.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryAllEncryptedTxFromHeightResponse: Could not create message: ' + e.message) + throw new Error('TxClient:EncryptedTxArray: Could not create message: ' + e.message) } }, @@ -1364,67 +1933,59 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { - try { - return { typeUrl: "/fairyring.pep.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) - } - }, - - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + msgSubmitGeneralEncryptedTx({ value }: msgSubmitGeneralEncryptedTxParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgSubmitGeneralEncryptedTx", value: MsgSubmitGeneralEncryptedTx.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitGeneralEncryptedTx: Could not create message: ' + e.message) } }, - msgCreateAggregatedKeyShareResponse({ value }: msgCreateAggregatedKeyShareResponseParams): EncodeObject { + msgRegisterContract({ value }: msgRegisterContractParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgCreateAggregatedKeyShareResponse", value: MsgCreateAggregatedKeyShareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgRegisterContract", value: MsgRegisterContract.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateAggregatedKeyShareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRegisterContract: Could not create message: ' + e.message) } }, - msgRequestGeneralKeyshareResponse({ value }: msgRequestGeneralKeyshareResponseParams): EncodeObject { + queryPepNonceAllResponse({ value }: queryPepNonceAllResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgRequestGeneralKeyshareResponse", value: MsgRequestGeneralKeyshareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryPepNonceAllResponse", value: QueryPepNonceAllResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRequestGeneralKeyshareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPepNonceAllResponse: Could not create message: ' + e.message) } }, - queryGetPepNonceResponse({ value }: queryGetPepNonceResponseParams): EncodeObject { + msgRegisterContractResponse({ value }: msgRegisterContractResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryGetPepNonceResponse", value: QueryGetPepNonceResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgRegisterContractResponse", value: MsgRegisterContractResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryGetPepNonceResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRegisterContractResponse: Could not create message: ' + e.message) } }, - generalEncryptedTx({ value }: generalEncryptedTxParams): EncodeObject { + msgRequestPrivateIdentityResponse({ value }: msgRequestPrivateIdentityResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.GeneralEncryptedTx", value: GeneralEncryptedTx.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgRequestPrivateIdentityResponse", value: MsgRequestPrivateIdentityResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GeneralEncryptedTx: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRequestPrivateIdentityResponse: Could not create message: ' + e.message) } }, - trustedCounterParty({ value }: trustedCounterPartyParams): EncodeObject { + queryEncryptedTxAllResponse({ value }: queryEncryptedTxAllResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.TrustedCounterParty", value: TrustedCounterParty.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.QueryEncryptedTxAllResponse", value: QueryEncryptedTxAllResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TrustedCounterParty: Could not create message: ' + e.message) + throw new Error('TxClient:QueryEncryptedTxAllResponse: Could not create message: ' + e.message) } }, - queryKeyshareResponse({ value }: queryKeyshareResponseParams): EncodeObject { + msgSubmitGeneralEncryptedTxResponse({ value }: msgSubmitGeneralEncryptedTxResponseParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.QueryKeyshareResponse", value: QueryKeyshareResponse.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgSubmitGeneralEncryptedTxResponse", value: MsgSubmitGeneralEncryptedTxResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryKeyshareResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitGeneralEncryptedTxResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/fairyring.pep/registry.ts b/ts-client/fairyring.pep/registry.ts index 45704efd..e940d624 100755 --- a/ts-client/fairyring.pep/registry.ts +++ b/ts-client/fairyring.pep/registry.ts @@ -1,90 +1,124 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgRequestGeneralKeyshare } from "./types/fairyring/pep/tx"; -import { MsgCreateAggregatedKeyShare } from "./types/fairyring/pep/tx"; -import { QueryGetPepNonceRequest } from "./types/fairyring/pep/query"; +import { MsgSubmitDecryptionKey } from "./types/fairyring/pep/tx"; +import { ContractDetails } from "./types/fairyring/pep/request_id"; +import { Params } from "./types/fairyring/pep/params"; +import { MsgRequestGeneralIdentityResponse } from "./types/fairyring/pep/tx"; +import { QueryEncryptedTxAllFromHeightRequest } from "./types/fairyring/pep/query"; +import { QueryPepNonceRequest } from "./types/fairyring/pep/query"; +import { GeneralEncryptedTx } from "./types/fairyring/pep/encrypted_tx"; +import { IdentityExecutionEntry } from "./types/fairyring/pep/encrypted_tx"; +import { MsgRequestGeneralDecryptionKey } from "./types/fairyring/pep/tx"; +import { TrustedCounterParty } from "./types/fairyring/pep/params"; import { MsgUpdateParamsResponse } from "./types/fairyring/pep/tx"; -import { QueryGetEncryptedTxResponse } from "./types/fairyring/pep/query"; -import { MsgSubmitEncryptedTxResponse } from "./types/fairyring/pep/tx"; -import { QueryPubKeyRequest } from "./types/fairyring/pep/query"; -import { RequestId } from "./types/fairyring/pep/request_id"; -import { GenEncTxExecutionQueue } from "./types/fairyring/pep/encrypted_tx"; -import { QueryAllEncryptedTxRequest } from "./types/fairyring/pep/query"; -import { QueryAllPepNonceResponse } from "./types/fairyring/pep/query"; -import { QueryAllPepNonceRequest } from "./types/fairyring/pep/query"; +import { MsgRequestPrivateIdentity } from "./types/fairyring/pep/tx"; +import { RegisteredContract } from "./types/fairyring/pep/request_id"; +import { QueryDecryptDataResponse } from "./types/fairyring/pep/query"; +import { QueryGeneralIdentityAllRequest } from "./types/fairyring/pep/query"; +import { QueryPepNonceAllRequest } from "./types/fairyring/pep/query"; +import { MsgUnregisterContract } from "./types/fairyring/pep/tx"; +import { MsgRequestPrivateDecryptionKey } from "./types/fairyring/pep/tx"; import { QueryLatestHeightRequest } from "./types/fairyring/pep/query"; -import { Params } from "./types/fairyring/pep/params"; -import { MsgGetGeneralKeyshareResponse } from "./types/fairyring/pep/tx"; -import { PepNonce } from "./types/fairyring/pep/pep_nonce"; -import { QueryGetEncryptedTxRequest } from "./types/fairyring/pep/query"; -import { EncryptedTx } from "./types/fairyring/pep/encrypted_tx"; -import { QueryAllEncryptedTxFromHeightRequest } from "./types/fairyring/pep/query"; -import { QueryAllKeyshareRequest } from "./types/fairyring/pep/query"; -import { MsgGetGeneralKeyshare } from "./types/fairyring/pep/tx"; -import { QueryAllEncryptedTxResponse } from "./types/fairyring/pep/query"; -import { MsgSubmitGeneralEncryptedTx } from "./types/fairyring/pep/tx"; -import { QueryPubKeyResponse } from "./types/fairyring/pep/query"; +import { RequestId } from "./types/fairyring/pep/request_id"; +import { GenesisState } from "./types/fairyring/pep/genesis"; +import { QueryEncryptedTxResponse } from "./types/fairyring/pep/query"; +import { QueryPrivateIdentityResponse } from "./types/fairyring/pep/query"; +import { MsgRequestPrivateDecryptionKeyResponse } from "./types/fairyring/pep/tx"; +import { QueryEncryptedTxAllRequest } from "./types/fairyring/pep/query"; +import { QueryPubkeyRequest } from "./types/fairyring/pep/query"; +import { MsgRequestGeneralDecryptionKeyResponse } from "./types/fairyring/pep/tx"; +import { QueryEncryptedTxRequest } from "./types/fairyring/pep/query"; +import { ExecuteContractMsg } from "./types/fairyring/pep/request_id"; import { MsgUpdateParams } from "./types/fairyring/pep/tx"; -import { QueryAllKeyshareResponse } from "./types/fairyring/pep/query"; +import { QueryParamsRequest } from "./types/fairyring/pep/query"; +import { EncryptedTx } from "./types/fairyring/pep/encrypted_tx"; +import { QueryPepNonceResponse } from "./types/fairyring/pep/query"; +import { QueryPubkeyResponse } from "./types/fairyring/pep/query"; +import { QueryDecryptDataRequest } from "./types/fairyring/pep/query"; +import { PepNonce } from "./types/fairyring/pep/pep_nonce"; +import { MsgSubmitDecryptionKeyResponse } from "./types/fairyring/pep/tx"; +import { MsgUnregisterContractResponse } from "./types/fairyring/pep/tx"; +import { QueryGeneralIdentityResponse } from "./types/fairyring/pep/query"; +import { QueryEncryptedTxAllFromHeightResponse } from "./types/fairyring/pep/query"; +import { DecryptionKey } from "./types/fairyring/pep/decryption_key"; +import { QueryGeneralIdentityAllResponse } from "./types/fairyring/pep/query"; +import { QueryLatestHeightResponse } from "./types/fairyring/pep/query"; +import { QueryPrivateIdentityRequest } from "./types/fairyring/pep/query"; import { GeneralEncryptedTxArray } from "./types/fairyring/pep/encrypted_tx"; +import { MsgSubmitEncryptedTxResponse } from "./types/fairyring/pep/tx"; +import { QueryParamsResponse } from "./types/fairyring/pep/query"; +import { QueryGeneralIdentityRequest } from "./types/fairyring/pep/query"; +import { MsgRequestGeneralIdentity } from "./types/fairyring/pep/tx"; +import { PrivateRequest } from "./types/fairyring/pep/request_id"; import { EncryptedTxArray } from "./types/fairyring/pep/encrypted_tx"; -import { GenesisState } from "./types/fairyring/pep/genesis"; -import { AggregatedKeyShare } from "./types/fairyring/pep/aggregated_key_share"; -import { QueryLatestHeightResponse } from "./types/fairyring/pep/query"; -import { QueryKeyshareRequest } from "./types/fairyring/pep/query"; -import { QueryAllEncryptedTxFromHeightResponse } from "./types/fairyring/pep/query"; import { MsgSubmitEncryptedTx } from "./types/fairyring/pep/tx"; -import { QueryParamsRequest } from "./types/fairyring/pep/query"; -import { QueryParamsResponse } from "./types/fairyring/pep/query"; -import { MsgCreateAggregatedKeyShareResponse } from "./types/fairyring/pep/tx"; -import { MsgRequestGeneralKeyshareResponse } from "./types/fairyring/pep/tx"; -import { QueryGetPepNonceResponse } from "./types/fairyring/pep/query"; -import { GeneralEncryptedTx } from "./types/fairyring/pep/encrypted_tx"; -import { TrustedCounterParty } from "./types/fairyring/pep/params"; -import { QueryKeyshareResponse } from "./types/fairyring/pep/query"; +import { MsgSubmitGeneralEncryptedTx } from "./types/fairyring/pep/tx"; +import { MsgRegisterContract } from "./types/fairyring/pep/tx"; +import { QueryPepNonceAllResponse } from "./types/fairyring/pep/query"; +import { MsgRegisterContractResponse } from "./types/fairyring/pep/tx"; +import { MsgRequestPrivateIdentityResponse } from "./types/fairyring/pep/tx"; +import { QueryEncryptedTxAllResponse } from "./types/fairyring/pep/query"; +import { MsgSubmitGeneralEncryptedTxResponse } from "./types/fairyring/pep/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/fairyring.pep.MsgRequestGeneralKeyshare", MsgRequestGeneralKeyshare], - ["/fairyring.pep.MsgCreateAggregatedKeyShare", MsgCreateAggregatedKeyShare], - ["/fairyring.pep.QueryGetPepNonceRequest", QueryGetPepNonceRequest], + ["/fairyring.pep.MsgSubmitDecryptionKey", MsgSubmitDecryptionKey], + ["/fairyring.pep.ContractDetails", ContractDetails], + ["/fairyring.pep.Params", Params], + ["/fairyring.pep.MsgRequestGeneralIdentityResponse", MsgRequestGeneralIdentityResponse], + ["/fairyring.pep.QueryEncryptedTxAllFromHeightRequest", QueryEncryptedTxAllFromHeightRequest], + ["/fairyring.pep.QueryPepNonceRequest", QueryPepNonceRequest], + ["/fairyring.pep.GeneralEncryptedTx", GeneralEncryptedTx], + ["/fairyring.pep.IdentityExecutionEntry", IdentityExecutionEntry], + ["/fairyring.pep.MsgRequestGeneralDecryptionKey", MsgRequestGeneralDecryptionKey], + ["/fairyring.pep.TrustedCounterParty", TrustedCounterParty], ["/fairyring.pep.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/fairyring.pep.QueryGetEncryptedTxResponse", QueryGetEncryptedTxResponse], - ["/fairyring.pep.MsgSubmitEncryptedTxResponse", MsgSubmitEncryptedTxResponse], - ["/fairyring.pep.QueryPubKeyRequest", QueryPubKeyRequest], - ["/fairyring.pep.RequestId", RequestId], - ["/fairyring.pep.GenEncTxExecutionQueue", GenEncTxExecutionQueue], - ["/fairyring.pep.QueryAllEncryptedTxRequest", QueryAllEncryptedTxRequest], - ["/fairyring.pep.QueryAllPepNonceResponse", QueryAllPepNonceResponse], - ["/fairyring.pep.QueryAllPepNonceRequest", QueryAllPepNonceRequest], + ["/fairyring.pep.MsgRequestPrivateIdentity", MsgRequestPrivateIdentity], + ["/fairyring.pep.RegisteredContract", RegisteredContract], + ["/fairyring.pep.QueryDecryptDataResponse", QueryDecryptDataResponse], + ["/fairyring.pep.QueryGeneralIdentityAllRequest", QueryGeneralIdentityAllRequest], + ["/fairyring.pep.QueryPepNonceAllRequest", QueryPepNonceAllRequest], + ["/fairyring.pep.MsgUnregisterContract", MsgUnregisterContract], + ["/fairyring.pep.MsgRequestPrivateDecryptionKey", MsgRequestPrivateDecryptionKey], ["/fairyring.pep.QueryLatestHeightRequest", QueryLatestHeightRequest], - ["/fairyring.pep.Params", Params], - ["/fairyring.pep.MsgGetGeneralKeyshareResponse", MsgGetGeneralKeyshareResponse], - ["/fairyring.pep.PepNonce", PepNonce], - ["/fairyring.pep.QueryGetEncryptedTxRequest", QueryGetEncryptedTxRequest], - ["/fairyring.pep.EncryptedTx", EncryptedTx], - ["/fairyring.pep.QueryAllEncryptedTxFromHeightRequest", QueryAllEncryptedTxFromHeightRequest], - ["/fairyring.pep.QueryAllKeyshareRequest", QueryAllKeyshareRequest], - ["/fairyring.pep.MsgGetGeneralKeyshare", MsgGetGeneralKeyshare], - ["/fairyring.pep.QueryAllEncryptedTxResponse", QueryAllEncryptedTxResponse], - ["/fairyring.pep.MsgSubmitGeneralEncryptedTx", MsgSubmitGeneralEncryptedTx], - ["/fairyring.pep.QueryPubKeyResponse", QueryPubKeyResponse], + ["/fairyring.pep.RequestId", RequestId], + ["/fairyring.pep.GenesisState", GenesisState], + ["/fairyring.pep.QueryEncryptedTxResponse", QueryEncryptedTxResponse], + ["/fairyring.pep.QueryPrivateIdentityResponse", QueryPrivateIdentityResponse], + ["/fairyring.pep.MsgRequestPrivateDecryptionKeyResponse", MsgRequestPrivateDecryptionKeyResponse], + ["/fairyring.pep.QueryEncryptedTxAllRequest", QueryEncryptedTxAllRequest], + ["/fairyring.pep.QueryPubkeyRequest", QueryPubkeyRequest], + ["/fairyring.pep.MsgRequestGeneralDecryptionKeyResponse", MsgRequestGeneralDecryptionKeyResponse], + ["/fairyring.pep.QueryEncryptedTxRequest", QueryEncryptedTxRequest], + ["/fairyring.pep.ExecuteContractMsg", ExecuteContractMsg], ["/fairyring.pep.MsgUpdateParams", MsgUpdateParams], - ["/fairyring.pep.QueryAllKeyshareResponse", QueryAllKeyshareResponse], + ["/fairyring.pep.QueryParamsRequest", QueryParamsRequest], + ["/fairyring.pep.EncryptedTx", EncryptedTx], + ["/fairyring.pep.QueryPepNonceResponse", QueryPepNonceResponse], + ["/fairyring.pep.QueryPubkeyResponse", QueryPubkeyResponse], + ["/fairyring.pep.QueryDecryptDataRequest", QueryDecryptDataRequest], + ["/fairyring.pep.PepNonce", PepNonce], + ["/fairyring.pep.MsgSubmitDecryptionKeyResponse", MsgSubmitDecryptionKeyResponse], + ["/fairyring.pep.MsgUnregisterContractResponse", MsgUnregisterContractResponse], + ["/fairyring.pep.QueryGeneralIdentityResponse", QueryGeneralIdentityResponse], + ["/fairyring.pep.QueryEncryptedTxAllFromHeightResponse", QueryEncryptedTxAllFromHeightResponse], + ["/fairyring.pep.DecryptionKey", DecryptionKey], + ["/fairyring.pep.QueryGeneralIdentityAllResponse", QueryGeneralIdentityAllResponse], + ["/fairyring.pep.QueryLatestHeightResponse", QueryLatestHeightResponse], + ["/fairyring.pep.QueryPrivateIdentityRequest", QueryPrivateIdentityRequest], ["/fairyring.pep.GeneralEncryptedTxArray", GeneralEncryptedTxArray], + ["/fairyring.pep.MsgSubmitEncryptedTxResponse", MsgSubmitEncryptedTxResponse], + ["/fairyring.pep.QueryParamsResponse", QueryParamsResponse], + ["/fairyring.pep.QueryGeneralIdentityRequest", QueryGeneralIdentityRequest], + ["/fairyring.pep.MsgRequestGeneralIdentity", MsgRequestGeneralIdentity], + ["/fairyring.pep.PrivateRequest", PrivateRequest], ["/fairyring.pep.EncryptedTxArray", EncryptedTxArray], - ["/fairyring.pep.GenesisState", GenesisState], - ["/fairyring.pep.AggregatedKeyShare", AggregatedKeyShare], - ["/fairyring.pep.QueryLatestHeightResponse", QueryLatestHeightResponse], - ["/fairyring.pep.QueryKeyshareRequest", QueryKeyshareRequest], - ["/fairyring.pep.QueryAllEncryptedTxFromHeightResponse", QueryAllEncryptedTxFromHeightResponse], ["/fairyring.pep.MsgSubmitEncryptedTx", MsgSubmitEncryptedTx], - ["/fairyring.pep.QueryParamsRequest", QueryParamsRequest], - ["/fairyring.pep.QueryParamsResponse", QueryParamsResponse], - ["/fairyring.pep.MsgCreateAggregatedKeyShareResponse", MsgCreateAggregatedKeyShareResponse], - ["/fairyring.pep.MsgRequestGeneralKeyshareResponse", MsgRequestGeneralKeyshareResponse], - ["/fairyring.pep.QueryGetPepNonceResponse", QueryGetPepNonceResponse], - ["/fairyring.pep.GeneralEncryptedTx", GeneralEncryptedTx], - ["/fairyring.pep.TrustedCounterParty", TrustedCounterParty], - ["/fairyring.pep.QueryKeyshareResponse", QueryKeyshareResponse], + ["/fairyring.pep.MsgSubmitGeneralEncryptedTx", MsgSubmitGeneralEncryptedTx], + ["/fairyring.pep.MsgRegisterContract", MsgRegisterContract], + ["/fairyring.pep.QueryPepNonceAllResponse", QueryPepNonceAllResponse], + ["/fairyring.pep.MsgRegisterContractResponse", MsgRegisterContractResponse], + ["/fairyring.pep.MsgRequestPrivateIdentityResponse", MsgRequestPrivateIdentityResponse], + ["/fairyring.pep.QueryEncryptedTxAllResponse", QueryEncryptedTxAllResponse], + ["/fairyring.pep.MsgSubmitGeneralEncryptedTxResponse", MsgSubmitGeneralEncryptedTxResponse], ]; diff --git a/ts-client/fairyring.pep/types/amino/amino.ts b/ts-client/fairyring.pep/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/fairyring.pep/types/amino/amino.ts +++ b/ts-client/fairyring.pep/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/fairyring.pep/types/cosmos/app/v1alpha1/module.ts b/ts-client/fairyring.pep/types/cosmos/app/v1alpha1/module.ts index 6469e9c8..f8045357 100644 --- a/ts-client/fairyring.pep/types/cosmos/app/v1alpha1/module.ts +++ b/ts-client/fairyring.pep/types/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.app.v1alpha1"; @@ -90,22 +96,22 @@ function createBaseModuleDescriptor(): ModuleDescriptor { return { goImport: "", usePackage: [], canMigrateFrom: [] }; } -export const ModuleDescriptor = { - encode(message: ModuleDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.goImport !== "") { writer.uint32(10).string(message.goImport); } for (const v of message.usePackage) { - PackageReference.encode(v!, writer.uint32(18).fork()).ldelim(); + PackageReference.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.canMigrateFrom) { - MigrateFromInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ModuleDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModuleDescriptor(); while (reader.pos < end) { @@ -136,18 +142,18 @@ export const ModuleDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ModuleDescriptor { return { - goImport: isSet(object.goImport) ? String(object.goImport) : "", - usePackage: Array.isArray(object?.usePackage) + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) : [], - canMigrateFrom: Array.isArray(object?.canMigrateFrom) + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) : [], }; @@ -183,8 +189,8 @@ function createBasePackageReference(): PackageReference { return { name: "", revision: 0 }; } -export const PackageReference = { - encode(message: PackageReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -194,8 +200,8 @@ export const PackageReference = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PackageReference { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePackageReference(); while (reader.pos < end) { @@ -219,15 +225,15 @@ export const PackageReference = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): PackageReference { return { - name: isSet(object.name) ? String(object.name) : "", - revision: isSet(object.revision) ? Number(object.revision) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, }; }, @@ -257,16 +263,16 @@ function createBaseMigrateFromInfo(): MigrateFromInfo { return { module: "" }; } -export const MigrateFromInfo = { - encode(message: MigrateFromInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MigrateFromInfo: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMigrateFromInfo(); while (reader.pos < end) { @@ -283,13 +289,13 @@ export const MigrateFromInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MigrateFromInfo { - return { module: isSet(object.module) ? String(object.module) : "" }; + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; }, toJSON(message: MigrateFromInfo): unknown { @@ -313,7 +319,8 @@ export const MigrateFromInfo = { type Builtin = 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; @@ -324,3 +331,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/fairyring.pep/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/fairyring.pep/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/fairyring.pep/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/cosmos/base/v1beta1/coin.ts b/ts-client/fairyring.pep/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/fairyring.pep/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/fairyring.pep/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/query.ts b/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/fairyring.pep/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/fairyring.pep/types/cosmos/msg/v1/msg.ts b/ts-client/fairyring.pep/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/fairyring.pep/types/cosmos/msg/v1/msg.ts +++ b/ts-client/fairyring.pep/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/fairyring.pep/types/cosmos_proto/cosmos.ts b/ts-client/fairyring.pep/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/fairyring.pep/types/cosmos_proto/cosmos.ts +++ b/ts-client/fairyring.pep/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/common/shared_types.ts b/ts-client/fairyring.pep/types/fairyring/common/shared_types.ts index d27ee23d..af855b23 100644 --- a/ts-client/fairyring.pep/types/fairyring/common/shared_types.ts +++ b/ts-client/fairyring.pep/types/fairyring/common/shared_types.ts @@ -1,51 +1,103 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Duration } from "../../google/protobuf/duration"; export const protobufPackage = "fairyring.common"; -/** RequestAggrKeyshare defines a struct for the data payload */ -export interface RequestAggrKeyshare { +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { creator: string; proposalId?: string | undefined; requestId?: string | undefined; estimatedDelay: Duration | undefined; } -export interface RequestAggrKeyshareResponse { +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { identity: string; pubkey: string; } -/** GetAggrKeyshare defines a struct for the data payload */ -export interface GetAggrKeyshare { +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { proposalId?: string | undefined; requestId?: string | undefined; identity: string; } -export interface GetAggrKeyshareResponse { +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { } +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ export interface ActivePublicKey { publicKey: string; creator: string; expiry: number; } +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ export interface QueuedPublicKey { publicKey: string; creator: string; expiry: number; } -function createBaseRequestAggrKeyshare(): RequestAggrKeyshare { +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; } -export const RequestAggrKeyshare = { - encode(message: RequestAggrKeyshare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -56,15 +108,15 @@ export const RequestAggrKeyshare = { writer.uint32(26).string(message.requestId); } if (message.estimatedDelay !== undefined) { - Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).ldelim(); + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): RequestAggrKeyshare { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestAggrKeyshare(); + const message = createBaseRequestDecryptionKey(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -100,21 +152,21 @@ export const RequestAggrKeyshare = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): RequestAggrKeyshare { + fromJSON(object: any): RequestDecryptionKey { return { - creator: isSet(object.creator) ? String(object.creator) : "", - proposalId: isSet(object.proposalId) ? String(object.proposalId) : undefined, - requestId: isSet(object.requestId) ? String(object.requestId) : undefined, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, }; }, - toJSON(message: RequestAggrKeyshare): unknown { + toJSON(message: RequestDecryptionKey): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -131,11 +183,11 @@ export const RequestAggrKeyshare = { return obj; }, - create, I>>(base?: I): RequestAggrKeyshare { - return RequestAggrKeyshare.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): RequestAggrKeyshare { - const message = createBaseRequestAggrKeyshare(); + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); message.creator = object.creator ?? ""; message.proposalId = object.proposalId ?? undefined; message.requestId = object.requestId ?? undefined; @@ -146,12 +198,12 @@ export const RequestAggrKeyshare = { }, }; -function createBaseRequestAggrKeyshareResponse(): RequestAggrKeyshareResponse { +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { return { identity: "", pubkey: "" }; } -export const RequestAggrKeyshareResponse = { - encode(message: RequestAggrKeyshareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.identity !== "") { writer.uint32(10).string(message.identity); } @@ -161,10 +213,10 @@ export const RequestAggrKeyshareResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): RequestAggrKeyshareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestAggrKeyshareResponse(); + const message = createBaseRequestDecryptionKeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -186,19 +238,19 @@ export const RequestAggrKeyshareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): RequestAggrKeyshareResponse { + fromJSON(object: any): RequestDecryptionKeyResponse { return { - identity: isSet(object.identity) ? String(object.identity) : "", - pubkey: isSet(object.pubkey) ? String(object.pubkey) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", }; }, - toJSON(message: RequestAggrKeyshareResponse): unknown { + toJSON(message: RequestDecryptionKeyResponse): unknown { const obj: any = {}; if (message.identity !== "") { obj.identity = message.identity; @@ -209,23 +261,23 @@ export const RequestAggrKeyshareResponse = { return obj; }, - create, I>>(base?: I): RequestAggrKeyshareResponse { - return RequestAggrKeyshareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): RequestAggrKeyshareResponse { - const message = createBaseRequestAggrKeyshareResponse(); + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); message.identity = object.identity ?? ""; message.pubkey = object.pubkey ?? ""; return message; }, }; -function createBaseGetAggrKeyshare(): GetAggrKeyshare { +function createBaseGetDecryptionKey(): GetDecryptionKey { return { proposalId: undefined, requestId: undefined, identity: "" }; } -export const GetAggrKeyshare = { - encode(message: GetAggrKeyshare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.proposalId !== undefined) { writer.uint32(10).string(message.proposalId); } @@ -238,10 +290,10 @@ export const GetAggrKeyshare = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GetAggrKeyshare { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAggrKeyshare(); + const message = createBaseGetDecryptionKey(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -270,20 +322,20 @@ export const GetAggrKeyshare = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): GetAggrKeyshare { + fromJSON(object: any): GetDecryptionKey { return { - proposalId: isSet(object.proposalId) ? String(object.proposalId) : undefined, - requestId: isSet(object.requestId) ? String(object.requestId) : undefined, - identity: isSet(object.identity) ? String(object.identity) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", }; }, - toJSON(message: GetAggrKeyshare): unknown { + toJSON(message: GetDecryptionKey): unknown { const obj: any = {}; if (message.proposalId !== undefined) { obj.proposalId = message.proposalId; @@ -297,11 +349,11 @@ export const GetAggrKeyshare = { return obj; }, - create, I>>(base?: I): GetAggrKeyshare { - return GetAggrKeyshare.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GetAggrKeyshare { - const message = createBaseGetAggrKeyshare(); + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); message.proposalId = object.proposalId ?? undefined; message.requestId = object.requestId ?? undefined; message.identity = object.identity ?? ""; @@ -309,19 +361,19 @@ export const GetAggrKeyshare = { }, }; -function createBaseGetAggrKeyshareResponse(): GetAggrKeyshareResponse { +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { return {}; } -export const GetAggrKeyshareResponse = { - encode(_: GetAggrKeyshareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GetAggrKeyshareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAggrKeyshareResponse(); + const message = createBaseGetDecryptionKeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -329,25 +381,188 @@ export const GetAggrKeyshareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): GetAggrKeyshareResponse { + fromJSON(_: any): GetDecryptionKeyResponse { return {}; }, - toJSON(_: GetAggrKeyshareResponse): unknown { + toJSON(_: GetDecryptionKeyResponse): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): GetAggrKeyshareResponse { - return GetAggrKeyshareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): GetAggrKeyshareResponse { - const message = createBaseGetAggrKeyshareResponse(); + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; return message; }, }; @@ -356,8 +571,8 @@ function createBaseActivePublicKey(): ActivePublicKey { return { publicKey: "", creator: "", expiry: 0 }; } -export const ActivePublicKey = { - encode(message: ActivePublicKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.publicKey !== "") { writer.uint32(10).string(message.publicKey); } @@ -370,8 +585,8 @@ export const ActivePublicKey = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ActivePublicKey { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseActivePublicKey(); while (reader.pos < end) { @@ -396,22 +611,22 @@ export const ActivePublicKey = { break; } - message.expiry = longToNumber(reader.uint64() as Long); + message.expiry = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ActivePublicKey { return { - publicKey: isSet(object.publicKey) ? String(object.publicKey) : "", - creator: isSet(object.creator) ? String(object.creator) : "", - expiry: isSet(object.expiry) ? Number(object.expiry) : 0, + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, }; }, @@ -445,8 +660,8 @@ function createBaseQueuedPublicKey(): QueuedPublicKey { return { publicKey: "", creator: "", expiry: 0 }; } -export const QueuedPublicKey = { - encode(message: QueuedPublicKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.publicKey !== "") { writer.uint32(10).string(message.publicKey); } @@ -459,8 +674,8 @@ export const QueuedPublicKey = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueuedPublicKey { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueuedPublicKey(); while (reader.pos < end) { @@ -485,22 +700,22 @@ export const QueuedPublicKey = { break; } - message.expiry = longToNumber(reader.uint64() as Long); + message.expiry = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueuedPublicKey { return { - publicKey: isSet(object.publicKey) ? String(object.publicKey) : "", - creator: isSet(object.creator) ? String(object.creator) : "", - expiry: isSet(object.expiry) ? Number(object.expiry) : 0, + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, }; }, @@ -530,29 +745,239 @@ export const QueuedPublicKey = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -560,18 +985,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/authorized_address.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/commitments.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/decryption_key.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/genesis.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/keyshare.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/module/module.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/packet.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/params.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/pubkey.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/query.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/tx.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/keyshare/validator_set.ts b/ts-client/fairyring.pep/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/pep/decryption_key.ts b/ts-client/fairyring.pep/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/fairyring.pep/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/pep/encrypted_tx.ts b/ts-client/fairyring.pep/types/fairyring/pep/encrypted_tx.ts index 182a8d8c..c3e6fabf 100644 --- a/ts-client/fairyring.pep/types/fairyring/pep/encrypted_tx.ts +++ b/ts-client/fairyring.pep/types/fairyring/pep/encrypted_tx.ts @@ -1,10 +1,19 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Coin } from "../../cosmos/base/v1beta1/coin"; export const protobufPackage = "fairyring.pep"; +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ export interface EncryptedTx { targetHeight: number; index: number; @@ -15,10 +24,15 @@ export interface EncryptedTx { expired: boolean; } +/** EncryptedTxArray defines a list of EncryptedTx */ export interface EncryptedTxArray { - encryptedTx: EncryptedTx[]; + encryptedTxs: EncryptedTx[]; } +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ export interface GeneralEncryptedTx { identity: string; index: number; @@ -27,17 +41,23 @@ export interface GeneralEncryptedTx { chargedGas: Coin | undefined; } +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ export interface GeneralEncryptedTxArray { - encryptedTx: GeneralEncryptedTx[]; + encryptedTxs: GeneralEncryptedTx[]; } -export interface GenEncTxExecutionQueue { +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { creator: string; requestId: string; identity: string; pubkey: string; txList: GeneralEncryptedTxArray | undefined; - aggrKeyshare: string; + decryptionKey: string; } function createBaseEncryptedTx(): EncryptedTx { @@ -52,8 +72,8 @@ function createBaseEncryptedTx(): EncryptedTx { }; } -export const EncryptedTx = { - encode(message: EncryptedTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.targetHeight !== 0) { writer.uint32(8).uint64(message.targetHeight); } @@ -67,19 +87,19 @@ export const EncryptedTx = { writer.uint32(34).string(message.creator); } if (message.chargedGas !== undefined) { - Coin.encode(message.chargedGas, writer.uint32(42).fork()).ldelim(); + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); } if (message.processedAtChainHeight !== 0) { writer.uint32(48).uint64(message.processedAtChainHeight); } - if (message.expired === true) { + if (message.expired !== false) { writer.uint32(56).bool(message.expired); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EncryptedTx { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEncryptedTx(); while (reader.pos < end) { @@ -90,14 +110,14 @@ export const EncryptedTx = { break; } - message.targetHeight = longToNumber(reader.uint64() as Long); + message.targetHeight = longToNumber(reader.uint64()); continue; case 2: if (tag !== 16) { break; } - message.index = longToNumber(reader.uint64() as Long); + message.index = longToNumber(reader.uint64()); continue; case 3: if (tag !== 26) { @@ -125,7 +145,7 @@ export const EncryptedTx = { break; } - message.processedAtChainHeight = longToNumber(reader.uint64() as Long); + message.processedAtChainHeight = longToNumber(reader.uint64()); continue; case 7: if (tag !== 56) { @@ -138,20 +158,22 @@ export const EncryptedTx = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EncryptedTx { return { - targetHeight: isSet(object.targetHeight) ? Number(object.targetHeight) : 0, - index: isSet(object.index) ? Number(object.index) : 0, - data: isSet(object.data) ? String(object.data) : "", - creator: isSet(object.creator) ? String(object.creator) : "", + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, - processedAtChainHeight: isSet(object.processedAtChainHeight) ? Number(object.processedAtChainHeight) : 0, - expired: isSet(object.expired) ? Boolean(object.expired) : false, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, }; }, @@ -175,7 +197,7 @@ export const EncryptedTx = { if (message.processedAtChainHeight !== 0) { obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); } - if (message.expired === true) { + if (message.expired !== false) { obj.expired = message.expired; } return obj; @@ -200,19 +222,19 @@ export const EncryptedTx = { }; function createBaseEncryptedTxArray(): EncryptedTxArray { - return { encryptedTx: [] }; + return { encryptedTxs: [] }; } -export const EncryptedTxArray = { - encode(message: EncryptedTxArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.encryptedTx) { - EncryptedTx.encode(v!, writer.uint32(10).fork()).ldelim(); +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EncryptedTxArray { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEncryptedTxArray(); while (reader.pos < end) { @@ -223,29 +245,29 @@ export const EncryptedTxArray = { break; } - message.encryptedTx.push(EncryptedTx.decode(reader, reader.uint32())); + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EncryptedTxArray { return { - encryptedTx: Array.isArray(object?.encryptedTx) - ? object.encryptedTx.map((e: any) => EncryptedTx.fromJSON(e)) + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) : [], }; }, toJSON(message: EncryptedTxArray): unknown { const obj: any = {}; - if (message.encryptedTx?.length) { - obj.encryptedTx = message.encryptedTx.map((e) => EncryptedTx.toJSON(e)); + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); } return obj; }, @@ -255,7 +277,7 @@ export const EncryptedTxArray = { }, fromPartial, I>>(object: I): EncryptedTxArray { const message = createBaseEncryptedTxArray(); - message.encryptedTx = object.encryptedTx?.map((e) => EncryptedTx.fromPartial(e)) || []; + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; return message; }, }; @@ -264,8 +286,8 @@ function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; } -export const GeneralEncryptedTx = { - encode(message: GeneralEncryptedTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.identity !== "") { writer.uint32(10).string(message.identity); } @@ -279,13 +301,13 @@ export const GeneralEncryptedTx = { writer.uint32(34).string(message.creator); } if (message.chargedGas !== undefined) { - Coin.encode(message.chargedGas, writer.uint32(42).fork()).ldelim(); + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneralEncryptedTx { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneralEncryptedTx(); while (reader.pos < end) { @@ -303,7 +325,7 @@ export const GeneralEncryptedTx = { break; } - message.index = longToNumber(reader.uint64() as Long); + message.index = longToNumber(reader.uint64()); continue; case 3: if (tag !== 26) { @@ -330,17 +352,17 @@ export const GeneralEncryptedTx = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneralEncryptedTx { return { - identity: isSet(object.identity) ? String(object.identity) : "", - index: isSet(object.index) ? Number(object.index) : 0, - data: isSet(object.data) ? String(object.data) : "", - creator: isSet(object.creator) ? String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, }; }, @@ -382,19 +404,19 @@ export const GeneralEncryptedTx = { }; function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { - return { encryptedTx: [] }; + return { encryptedTxs: [] }; } -export const GeneralEncryptedTxArray = { - encode(message: GeneralEncryptedTxArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.encryptedTx) { - GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).ldelim(); +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneralEncryptedTxArray { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneralEncryptedTxArray(); while (reader.pos < end) { @@ -405,29 +427,29 @@ export const GeneralEncryptedTxArray = { break; } - message.encryptedTx.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneralEncryptedTxArray { return { - encryptedTx: Array.isArray(object?.encryptedTx) - ? object.encryptedTx.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) : [], }; }, toJSON(message: GeneralEncryptedTxArray): unknown { const obj: any = {}; - if (message.encryptedTx?.length) { - obj.encryptedTx = message.encryptedTx.map((e) => GeneralEncryptedTx.toJSON(e)); + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); } return obj; }, @@ -437,17 +459,17 @@ export const GeneralEncryptedTxArray = { }, fromPartial, I>>(object: I): GeneralEncryptedTxArray { const message = createBaseGeneralEncryptedTxArray(); - message.encryptedTx = object.encryptedTx?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; return message; }, }; -function createBaseGenEncTxExecutionQueue(): GenEncTxExecutionQueue { - return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, aggrKeyshare: "" }; +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; } -export const GenEncTxExecutionQueue = { - encode(message: GenEncTxExecutionQueue, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -461,18 +483,18 @@ export const GenEncTxExecutionQueue = { writer.uint32(34).string(message.pubkey); } if (message.txList !== undefined) { - GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).ldelim(); + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); } - if (message.aggrKeyshare !== "") { - writer.uint32(50).string(message.aggrKeyshare); + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GenEncTxExecutionQueue { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenEncTxExecutionQueue(); + const message = createBaseIdentityExecutionEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -516,29 +538,29 @@ export const GenEncTxExecutionQueue = { break; } - message.aggrKeyshare = reader.string(); + message.decryptionKey = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): GenEncTxExecutionQueue { + fromJSON(object: any): IdentityExecutionEntry { return { - creator: isSet(object.creator) ? String(object.creator) : "", - requestId: isSet(object.requestId) ? String(object.requestId) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - pubkey: isSet(object.pubkey) ? String(object.pubkey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, - aggrKeyshare: isSet(object.aggrKeyshare) ? String(object.aggrKeyshare) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", }; }, - toJSON(message: GenEncTxExecutionQueue): unknown { + toJSON(message: IdentityExecutionEntry): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -555,17 +577,17 @@ export const GenEncTxExecutionQueue = { if (message.txList !== undefined) { obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); } - if (message.aggrKeyshare !== "") { - obj.aggrKeyshare = message.aggrKeyshare; + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; } return obj; }, - create, I>>(base?: I): GenEncTxExecutionQueue { - return GenEncTxExecutionQueue.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GenEncTxExecutionQueue { - const message = createBaseGenEncTxExecutionQueue(); + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); message.creator = object.creator ?? ""; message.requestId = object.requestId ?? ""; message.identity = object.identity ?? ""; @@ -573,34 +595,16 @@ export const GenEncTxExecutionQueue = { message.txList = (object.txList !== undefined && object.txList !== null) ? GeneralEncryptedTxArray.fromPartial(object.txList) : undefined; - message.aggrKeyshare = object.aggrKeyshare ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -608,18 +612,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/pep/genesis.ts b/ts-client/fairyring.pep/types/fairyring/pep/genesis.ts index 0fc94f87..e19062b5 100644 --- a/ts-client/fairyring.pep/types/fairyring/pep/genesis.ts +++ b/ts-client/fairyring.pep/types/fairyring/pep/genesis.ts @@ -1,8 +1,13 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; -import { AggregatedKeyShare } from "./aggregated_key_share"; +import { DecryptionKey } from "./decryption_key"; import { EncryptedTxArray } from "./encrypted_tx"; import { Params } from "./params"; import { PepNonce } from "./pep_nonce"; @@ -17,10 +22,9 @@ export interface GenesisState { portId: string; encryptedTxArray: EncryptedTxArray[]; pepNonceList: PepNonce[]; - /** this line is used by starport scaffolding # genesis/proto/state */ - aggregatedKeyShareList: AggregatedKeyShare[]; - activePubKey: ActivePublicKey | undefined; - queuedPubKey: QueuedPublicKey | undefined; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; requestCount: number; requestIdList: RequestId[]; } @@ -31,48 +35,48 @@ function createBaseGenesisState(): GenesisState { portId: "", encryptedTxArray: [], pepNonceList: [], - aggregatedKeyShareList: [], - activePubKey: undefined, - queuedPubKey: undefined, + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, requestCount: 0, requestIdList: [], }; } -export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + Params.encode(message.params, writer.uint32(10).fork()).join(); } if (message.portId !== "") { writer.uint32(18).string(message.portId); } for (const v of message.encryptedTxArray) { - EncryptedTxArray.encode(v!, writer.uint32(26).fork()).ldelim(); + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.pepNonceList) { - PepNonce.encode(v!, writer.uint32(34).fork()).ldelim(); + PepNonce.encode(v!, writer.uint32(34).fork()).join(); } - for (const v of message.aggregatedKeyShareList) { - AggregatedKeyShare.encode(v!, writer.uint32(50).fork()).ldelim(); + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); } - if (message.activePubKey !== undefined) { - ActivePublicKey.encode(message.activePubKey, writer.uint32(58).fork()).ldelim(); + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); } - if (message.queuedPubKey !== undefined) { - QueuedPublicKey.encode(message.queuedPubKey, writer.uint32(66).fork()).ldelim(); + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); } if (message.requestCount !== 0) { writer.uint32(72).uint64(message.requestCount); } for (const v of message.requestIdList) { - RequestId.encode(v!, writer.uint32(82).fork()).ldelim(); + RequestId.encode(v!, writer.uint32(82).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisState(); while (reader.pos < end) { @@ -111,28 +115,28 @@ export const GenesisState = { break; } - message.aggregatedKeyShareList.push(AggregatedKeyShare.decode(reader, reader.uint32())); + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); continue; case 7: if (tag !== 58) { break; } - message.activePubKey = ActivePublicKey.decode(reader, reader.uint32()); + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); continue; case 8: if (tag !== 66) { break; } - message.queuedPubKey = QueuedPublicKey.decode(reader, reader.uint32()); + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); continue; case 9: if (tag !== 72) { break; } - message.requestCount = longToNumber(reader.uint64() as Long); + message.requestCount = longToNumber(reader.uint64()); continue; case 10: if (tag !== 82) { @@ -145,7 +149,7 @@ export const GenesisState = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -153,20 +157,20 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - portId: isSet(object.portId) ? String(object.portId) : "", - encryptedTxArray: Array.isArray(object?.encryptedTxArray) + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) : [], - pepNonceList: Array.isArray(object?.pepNonceList) + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) : [], - aggregatedKeyShareList: Array.isArray(object?.aggregatedKeyShareList) - ? object.aggregatedKeyShareList.map((e: any) => AggregatedKeyShare.fromJSON(e)) + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) : [], - activePubKey: isSet(object.activePubKey) ? ActivePublicKey.fromJSON(object.activePubKey) : undefined, - queuedPubKey: isSet(object.queuedPubKey) ? QueuedPublicKey.fromJSON(object.queuedPubKey) : undefined, - requestCount: isSet(object.requestCount) ? Number(object.requestCount) : 0, - requestIdList: Array.isArray(object?.requestIdList) + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) : [], }; @@ -186,14 +190,14 @@ export const GenesisState = { if (message.pepNonceList?.length) { obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); } - if (message.aggregatedKeyShareList?.length) { - obj.aggregatedKeyShareList = message.aggregatedKeyShareList.map((e) => AggregatedKeyShare.toJSON(e)); + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); } - if (message.activePubKey !== undefined) { - obj.activePubKey = ActivePublicKey.toJSON(message.activePubKey); + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); } - if (message.queuedPubKey !== undefined) { - obj.queuedPubKey = QueuedPublicKey.toJSON(message.queuedPubKey); + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); } if (message.requestCount !== 0) { obj.requestCount = Math.round(message.requestCount); @@ -215,12 +219,12 @@ export const GenesisState = { message.portId = object.portId ?? ""; message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; - message.aggregatedKeyShareList = object.aggregatedKeyShareList?.map((e) => AggregatedKeyShare.fromPartial(e)) || []; - message.activePubKey = (object.activePubKey !== undefined && object.activePubKey !== null) - ? ActivePublicKey.fromPartial(object.activePubKey) + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) : undefined; - message.queuedPubKey = (object.queuedPubKey !== undefined && object.queuedPubKey !== null) - ? QueuedPublicKey.fromPartial(object.queuedPubKey) + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) : undefined; message.requestCount = object.requestCount ?? 0; message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; @@ -228,29 +232,11 @@ export const GenesisState = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -258,18 +244,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/pep/module/module.ts b/ts-client/fairyring.pep/types/fairyring/pep/module/module.ts index 9f5fdc9d..c855c4c7 100644 --- a/ts-client/fairyring.pep/types/fairyring/pep/module/module.ts +++ b/ts-client/fairyring.pep/types/fairyring/pep/module/module.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "fairyring.pep.module"; @@ -13,16 +19,16 @@ function createBaseModule(): Module { return { authority: "" }; } -export const Module = { - encode(message: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Module { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModule(); while (reader.pos < end) { @@ -39,13 +45,13 @@ export const Module = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Module { - return { authority: isSet(object.authority) ? String(object.authority) : "" }; + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; }, toJSON(message: Module): unknown { @@ -69,7 +75,8 @@ export const Module = { type Builtin = 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; @@ -80,3 +87,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/pep/params.ts b/ts-client/fairyring.pep/types/fairyring/pep/params.ts index 4e17780f..dcd4728d 100644 --- a/ts-client/fairyring.pep/types/fairyring/pep/params.ts +++ b/ts-client/fairyring.pep/types/fairyring/pep/params.ts @@ -1,18 +1,31 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Coin } from "../../cosmos/base/v1beta1/coin"; export const protobufPackage = "fairyring.pep"; /** Params defines the parameters for the module. */ export interface Params { + /** option (gogoproto.equal) = true; */ keyshareChannelId: string; isSourceChain: boolean; trustedCounterParties: TrustedCounterParty[]; trustedAddresses: string[]; minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; } +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ export interface TrustedCounterParty { clientId: string; connectionId: string; @@ -26,31 +39,35 @@ function createBaseParams(): Params { trustedCounterParties: [], trustedAddresses: [], minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, }; } -export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.keyshareChannelId !== "") { writer.uint32(10).string(message.keyshareChannelId); } - if (message.isSourceChain === true) { + if (message.isSourceChain !== false) { writer.uint32(16).bool(message.isSourceChain); } for (const v of message.trustedCounterParties) { - TrustedCounterParty.encode(v!, writer.uint32(26).fork()).ldelim(); + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.trustedAddresses) { writer.uint32(34).string(v!); } if (message.minGasPrice !== undefined) { - Coin.encode(message.minGasPrice, writer.uint32(42).fork()).ldelim(); + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseParams(); while (reader.pos < end) { @@ -91,26 +108,36 @@ export const Params = { message.minGasPrice = Coin.decode(reader, reader.uint32()); continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Params { return { - keyshareChannelId: isSet(object.keyshareChannelId) ? String(object.keyshareChannelId) : "", - isSourceChain: isSet(object.isSourceChain) ? Boolean(object.isSourceChain) : false, - trustedCounterParties: Array.isArray(object?.trustedCounterParties) + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) : [], - trustedAddresses: Array.isArray(object?.trustedAddresses) - ? object.trustedAddresses.map((e: any) => String(e)) + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) : [], minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, }; }, @@ -119,7 +146,7 @@ export const Params = { if (message.keyshareChannelId !== "") { obj.keyshareChannelId = message.keyshareChannelId; } - if (message.isSourceChain === true) { + if (message.isSourceChain !== false) { obj.isSourceChain = message.isSourceChain; } if (message.trustedCounterParties?.length) { @@ -131,6 +158,9 @@ export const Params = { if (message.minGasPrice !== undefined) { obj.minGasPrice = Coin.toJSON(message.minGasPrice); } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } return obj; }, @@ -146,6 +176,10 @@ export const Params = { message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) ? Coin.fromPartial(object.minGasPrice) : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; return message; }, }; @@ -154,8 +188,8 @@ function createBaseTrustedCounterParty(): TrustedCounterParty { return { clientId: "", connectionId: "", channelId: "" }; } -export const TrustedCounterParty = { - encode(message: TrustedCounterParty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } @@ -168,8 +202,8 @@ export const TrustedCounterParty = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): TrustedCounterParty { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTrustedCounterParty(); while (reader.pos < end) { @@ -200,16 +234,16 @@ export const TrustedCounterParty = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): TrustedCounterParty { return { - clientId: isSet(object.clientId) ? String(object.clientId) : "", - connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", - channelId: isSet(object.channelId) ? String(object.channelId) : "", + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", }; }, @@ -242,7 +276,8 @@ export const TrustedCounterParty = { type Builtin = 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; @@ -253,3 +288,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/pep/pep_nonce.ts b/ts-client/fairyring.pep/types/fairyring/pep/pep_nonce.ts index 05283a44..e522a1e5 100644 --- a/ts-client/fairyring.pep/types/fairyring/pep/pep_nonce.ts +++ b/ts-client/fairyring.pep/types/fairyring/pep/pep_nonce.ts @@ -1,9 +1,18 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "fairyring.pep"; +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ export interface PepNonce { address: string; nonce: number; @@ -13,8 +22,8 @@ function createBasePepNonce(): PepNonce { return { address: "", nonce: 0 }; } -export const PepNonce = { - encode(message: PepNonce, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } @@ -24,8 +33,8 @@ export const PepNonce = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PepNonce { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePepNonce(); while (reader.pos < end) { @@ -43,21 +52,21 @@ export const PepNonce = { break; } - message.nonce = longToNumber(reader.uint64() as Long); + message.nonce = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): PepNonce { return { - address: isSet(object.address) ? String(object.address) : "", - nonce: isSet(object.nonce) ? Number(object.nonce) : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, }; }, @@ -83,29 +92,11 @@ export const PepNonce = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -113,18 +104,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/pep/query.ts b/ts-client/fairyring.pep/types/fairyring/pep/query.ts index 3278f8de..d2781225 100644 --- a/ts-client/fairyring.pep/types/fairyring/pep/query.ts +++ b/ts-client/fairyring.pep/types/fairyring/pep/query.ts @@ -1,9 +1,14 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; -import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; -import { EncryptedTx, EncryptedTxArray, GenEncTxExecutionQueue } from "./encrypted_tx"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; import { Params } from "./params"; import { PepNonce } from "./pep_nonce"; @@ -19,92 +24,135 @@ export interface QueryParamsResponse { params: Params | undefined; } -export interface QueryKeyshareRequest { +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { reqId: string; } -export interface QueryKeyshareResponse { - keyshare: GenEncTxExecutionQueue | undefined; +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; } -export interface QueryAllKeyshareRequest { +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { pagination: PageRequest | undefined; } -export interface QueryAllKeyshareResponse { - keyshares: GenEncTxExecutionQueue[]; +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; pagination: PageResponse | undefined; } -export interface QueryGetEncryptedTxRequest { +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { targetHeight: number; index: number; } -export interface QueryGetEncryptedTxResponse { +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { encryptedTx: EncryptedTx | undefined; } -export interface QueryAllEncryptedTxRequest { +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { pagination: PageRequest | undefined; } -export interface QueryAllEncryptedTxResponse { +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { encryptedTxArray: EncryptedTxArray[]; pagination: PageResponse | undefined; } -export interface QueryAllEncryptedTxFromHeightRequest { +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { targetHeight: number; } -export interface QueryAllEncryptedTxFromHeightResponse { +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { encryptedTxArray: EncryptedTxArray | undefined; } +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ export interface QueryLatestHeightRequest { } +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ export interface QueryLatestHeightResponse { height: number; } -export interface QueryGetPepNonceRequest { +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { address: string; } -export interface QueryGetPepNonceResponse { +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { pepNonce: PepNonce | undefined; } -export interface QueryAllPepNonceRequest { +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { pagination: PageRequest | undefined; } -export interface QueryAllPepNonceResponse { +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { pepNonce: PepNonce[]; pagination: PageResponse | undefined; } -export interface QueryPubKeyRequest { +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; } -export interface QueryPubKeyResponse { - activePubKey: ActivePublicKey | undefined; - queuedPubKey: QueuedPublicKey | undefined; +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; } function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } -export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParamsRequest(); while (reader.pos < end) { @@ -114,7 +162,7 @@ export const QueryParamsRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -141,16 +189,16 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { return { params: undefined }; } -export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + Params.encode(message.params, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParamsResponse(); while (reader.pos < end) { @@ -167,7 +215,7 @@ export const QueryParamsResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -196,22 +244,22 @@ export const QueryParamsResponse = { }, }; -function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { return { reqId: "" }; } -export const QueryKeyshareRequest = { - encode(message: QueryKeyshareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.reqId !== "") { writer.uint32(10).string(message.reqId); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryKeyshareRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryKeyshareRequest(); + const message = createBaseQueryGeneralIdentityRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -226,16 +274,16 @@ export const QueryKeyshareRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryKeyshareRequest { - return { reqId: isSet(object.reqId) ? String(object.reqId) : "" }; + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; }, - toJSON(message: QueryKeyshareRequest): unknown { + toJSON(message: QueryGeneralIdentityRequest): unknown { const obj: any = {}; if (message.reqId !== "") { obj.reqId = message.reqId; @@ -243,32 +291,32 @@ export const QueryKeyshareRequest = { return obj; }, - create, I>>(base?: I): QueryKeyshareRequest { - return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryKeyshareRequest { - const message = createBaseQueryKeyshareRequest(); + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); message.reqId = object.reqId ?? ""; return message; }, }; -function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { - return { keyshare: undefined }; +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; } -export const QueryKeyshareResponse = { - encode(message: QueryKeyshareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.keyshare !== undefined) { - GenEncTxExecutionQueue.encode(message.keyshare, writer.uint32(10).fork()).ldelim(); +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryKeyshareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryKeyshareResponse(); + const message = createBaseQueryGeneralIdentityResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -277,57 +325,59 @@ export const QueryKeyshareResponse = { break; } - message.keyshare = GenEncTxExecutionQueue.decode(reader, reader.uint32()); + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryKeyshareResponse { - return { keyshare: isSet(object.keyshare) ? GenEncTxExecutionQueue.fromJSON(object.keyshare) : undefined }; + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; }, - toJSON(message: QueryKeyshareResponse): unknown { + toJSON(message: QueryGeneralIdentityResponse): unknown { const obj: any = {}; - if (message.keyshare !== undefined) { - obj.keyshare = GenEncTxExecutionQueue.toJSON(message.keyshare); + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); } return obj; }, - create, I>>(base?: I): QueryKeyshareResponse { - return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryKeyshareResponse { - const message = createBaseQueryKeyshareResponse(); - message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) - ? GenEncTxExecutionQueue.fromPartial(object.keyshare) + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) : undefined; return message; }, }; -function createBaseQueryAllKeyshareRequest(): QueryAllKeyshareRequest { +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { return { pagination: undefined }; } -export const QueryAllKeyshareRequest = { - encode(message: QueryAllKeyshareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllKeyshareRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllKeyshareRequest(); + const message = createBaseQueryGeneralIdentityAllRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -342,16 +392,16 @@ export const QueryAllKeyshareRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllKeyshareRequest { + fromJSON(object: any): QueryGeneralIdentityAllRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllKeyshareRequest): unknown { + toJSON(message: QueryGeneralIdentityAllRequest): unknown { const obj: any = {}; if (message.pagination !== undefined) { obj.pagination = PageRequest.toJSON(message.pagination); @@ -359,11 +409,13 @@ export const QueryAllKeyshareRequest = { return obj; }, - create, I>>(base?: I): QueryAllKeyshareRequest { - return QueryAllKeyshareRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllKeyshareRequest { - const message = createBaseQueryAllKeyshareRequest(); + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -371,25 +423,25 @@ export const QueryAllKeyshareRequest = { }, }; -function createBaseQueryAllKeyshareResponse(): QueryAllKeyshareResponse { - return { keyshares: [], pagination: undefined }; +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; } -export const QueryAllKeyshareResponse = { - encode(message: QueryAllKeyshareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.keyshares) { - GenEncTxExecutionQueue.encode(v!, writer.uint32(10).fork()).ldelim(); +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllKeyshareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllKeyshareResponse(); + const message = createBaseQueryGeneralIdentityAllResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -398,7 +450,7 @@ export const QueryAllKeyshareResponse = { break; } - message.keyshares.push(GenEncTxExecutionQueue.decode(reader, reader.uint32())); + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); continue; case 2: if (tag !== 18) { @@ -411,24 +463,24 @@ export const QueryAllKeyshareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllKeyshareResponse { + fromJSON(object: any): QueryGeneralIdentityAllResponse { return { - keyshares: Array.isArray(object?.keyshares) - ? object.keyshares.map((e: any) => GenEncTxExecutionQueue.fromJSON(e)) + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllKeyshareResponse): unknown { + toJSON(message: QueryGeneralIdentityAllResponse): unknown { const obj: any = {}; - if (message.keyshares?.length) { - obj.keyshares = message.keyshares.map((e) => GenEncTxExecutionQueue.toJSON(e)); + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); } if (message.pagination !== undefined) { obj.pagination = PageResponse.toJSON(message.pagination); @@ -436,12 +488,14 @@ export const QueryAllKeyshareResponse = { return obj; }, - create, I>>(base?: I): QueryAllKeyshareResponse { - return QueryAllKeyshareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllKeyshareResponse { - const message = createBaseQueryAllKeyshareResponse(); - message.keyshares = object.keyshares?.map((e) => GenEncTxExecutionQueue.fromPartial(e)) || []; + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) : undefined; @@ -449,12 +503,12 @@ export const QueryAllKeyshareResponse = { }, }; -function createBaseQueryGetEncryptedTxRequest(): QueryGetEncryptedTxRequest { +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { return { targetHeight: 0, index: 0 }; } -export const QueryGetEncryptedTxRequest = { - encode(message: QueryGetEncryptedTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.targetHeight !== 0) { writer.uint32(8).uint64(message.targetHeight); } @@ -464,10 +518,10 @@ export const QueryGetEncryptedTxRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetEncryptedTxRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetEncryptedTxRequest(); + const message = createBaseQueryEncryptedTxRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -476,32 +530,32 @@ export const QueryGetEncryptedTxRequest = { break; } - message.targetHeight = longToNumber(reader.uint64() as Long); + message.targetHeight = longToNumber(reader.uint64()); continue; case 2: if (tag !== 16) { break; } - message.index = longToNumber(reader.uint64() as Long); + message.index = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetEncryptedTxRequest { + fromJSON(object: any): QueryEncryptedTxRequest { return { - targetHeight: isSet(object.targetHeight) ? Number(object.targetHeight) : 0, - index: isSet(object.index) ? Number(object.index) : 0, + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, }; }, - toJSON(message: QueryGetEncryptedTxRequest): unknown { + toJSON(message: QueryEncryptedTxRequest): unknown { const obj: any = {}; if (message.targetHeight !== 0) { obj.targetHeight = Math.round(message.targetHeight); @@ -512,33 +566,33 @@ export const QueryGetEncryptedTxRequest = { return obj; }, - create, I>>(base?: I): QueryGetEncryptedTxRequest { - return QueryGetEncryptedTxRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryGetEncryptedTxRequest { - const message = createBaseQueryGetEncryptedTxRequest(); + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); message.targetHeight = object.targetHeight ?? 0; message.index = object.index ?? 0; return message; }, }; -function createBaseQueryGetEncryptedTxResponse(): QueryGetEncryptedTxResponse { +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { return { encryptedTx: undefined }; } -export const QueryGetEncryptedTxResponse = { - encode(message: QueryGetEncryptedTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.encryptedTx !== undefined) { - EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).ldelim(); + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetEncryptedTxResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetEncryptedTxResponse(); + const message = createBaseQueryEncryptedTxResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -553,16 +607,16 @@ export const QueryGetEncryptedTxResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetEncryptedTxResponse { + fromJSON(object: any): QueryEncryptedTxResponse { return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; }, - toJSON(message: QueryGetEncryptedTxResponse): unknown { + toJSON(message: QueryEncryptedTxResponse): unknown { const obj: any = {}; if (message.encryptedTx !== undefined) { obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); @@ -570,11 +624,11 @@ export const QueryGetEncryptedTxResponse = { return obj; }, - create, I>>(base?: I): QueryGetEncryptedTxResponse { - return QueryGetEncryptedTxResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryGetEncryptedTxResponse { - const message = createBaseQueryGetEncryptedTxResponse(); + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) ? EncryptedTx.fromPartial(object.encryptedTx) : undefined; @@ -582,22 +636,22 @@ export const QueryGetEncryptedTxResponse = { }, }; -function createBaseQueryAllEncryptedTxRequest(): QueryAllEncryptedTxRequest { +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { return { pagination: undefined }; } -export const QueryAllEncryptedTxRequest = { - encode(message: QueryAllEncryptedTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEncryptedTxRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllEncryptedTxRequest(); + const message = createBaseQueryEncryptedTxAllRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -612,16 +666,16 @@ export const QueryAllEncryptedTxRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllEncryptedTxRequest { + fromJSON(object: any): QueryEncryptedTxAllRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllEncryptedTxRequest): unknown { + toJSON(message: QueryEncryptedTxAllRequest): unknown { const obj: any = {}; if (message.pagination !== undefined) { obj.pagination = PageRequest.toJSON(message.pagination); @@ -629,11 +683,11 @@ export const QueryAllEncryptedTxRequest = { return obj; }, - create, I>>(base?: I): QueryAllEncryptedTxRequest { - return QueryAllEncryptedTxRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllEncryptedTxRequest { - const message = createBaseQueryAllEncryptedTxRequest(); + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -641,25 +695,25 @@ export const QueryAllEncryptedTxRequest = { }, }; -function createBaseQueryAllEncryptedTxResponse(): QueryAllEncryptedTxResponse { +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { return { encryptedTxArray: [], pagination: undefined }; } -export const QueryAllEncryptedTxResponse = { - encode(message: QueryAllEncryptedTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.encryptedTxArray) { - EncryptedTxArray.encode(v!, writer.uint32(10).fork()).ldelim(); + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEncryptedTxResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllEncryptedTxResponse(); + const message = createBaseQueryEncryptedTxAllResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -681,21 +735,21 @@ export const QueryAllEncryptedTxResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllEncryptedTxResponse { + fromJSON(object: any): QueryEncryptedTxAllResponse { return { - encryptedTxArray: Array.isArray(object?.encryptedTxArray) + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllEncryptedTxResponse): unknown { + toJSON(message: QueryEncryptedTxAllResponse): unknown { const obj: any = {}; if (message.encryptedTxArray?.length) { obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); @@ -706,11 +760,11 @@ export const QueryAllEncryptedTxResponse = { return obj; }, - create, I>>(base?: I): QueryAllEncryptedTxResponse { - return QueryAllEncryptedTxResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllEncryptedTxResponse { - const message = createBaseQueryAllEncryptedTxResponse(); + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) @@ -719,22 +773,22 @@ export const QueryAllEncryptedTxResponse = { }, }; -function createBaseQueryAllEncryptedTxFromHeightRequest(): QueryAllEncryptedTxFromHeightRequest { +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { return { targetHeight: 0 }; } -export const QueryAllEncryptedTxFromHeightRequest = { - encode(message: QueryAllEncryptedTxFromHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.targetHeight !== 0) { writer.uint32(8).uint64(message.targetHeight); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEncryptedTxFromHeightRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllEncryptedTxFromHeightRequest(); + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -743,22 +797,22 @@ export const QueryAllEncryptedTxFromHeightRequest = { break; } - message.targetHeight = longToNumber(reader.uint64() as Long); + message.targetHeight = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllEncryptedTxFromHeightRequest { - return { targetHeight: isSet(object.targetHeight) ? Number(object.targetHeight) : 0 }; + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; }, - toJSON(message: QueryAllEncryptedTxFromHeightRequest): unknown { + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { const obj: any = {}; if (message.targetHeight !== 0) { obj.targetHeight = Math.round(message.targetHeight); @@ -766,36 +820,36 @@ export const QueryAllEncryptedTxFromHeightRequest = { return obj; }, - create, I>>( + create, I>>( base?: I, - ): QueryAllEncryptedTxFromHeightRequest { - return QueryAllEncryptedTxFromHeightRequest.fromPartial(base ?? ({} as any)); + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllEncryptedTxFromHeightRequest { - const message = createBaseQueryAllEncryptedTxFromHeightRequest(); + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); message.targetHeight = object.targetHeight ?? 0; return message; }, }; -function createBaseQueryAllEncryptedTxFromHeightResponse(): QueryAllEncryptedTxFromHeightResponse { +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { return { encryptedTxArray: undefined }; } -export const QueryAllEncryptedTxFromHeightResponse = { - encode(message: QueryAllEncryptedTxFromHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.encryptedTxArray !== undefined) { - EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).ldelim(); + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEncryptedTxFromHeightResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllEncryptedTxFromHeightResponse(); + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -810,18 +864,18 @@ export const QueryAllEncryptedTxFromHeightResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllEncryptedTxFromHeightResponse { + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { return { encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, }; }, - toJSON(message: QueryAllEncryptedTxFromHeightResponse): unknown { + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { const obj: any = {}; if (message.encryptedTxArray !== undefined) { obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); @@ -829,15 +883,15 @@ export const QueryAllEncryptedTxFromHeightResponse = { return obj; }, - create, I>>( + create, I>>( base?: I, - ): QueryAllEncryptedTxFromHeightResponse { - return QueryAllEncryptedTxFromHeightResponse.fromPartial(base ?? ({} as any)); + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllEncryptedTxFromHeightResponse { - const message = createBaseQueryAllEncryptedTxFromHeightResponse(); + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) ? EncryptedTxArray.fromPartial(object.encryptedTxArray) : undefined; @@ -849,13 +903,13 @@ function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { return {}; } -export const QueryLatestHeightRequest = { - encode(_: QueryLatestHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryLatestHeightRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryLatestHeightRequest(); while (reader.pos < end) { @@ -865,7 +919,7 @@ export const QueryLatestHeightRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -892,16 +946,16 @@ function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { return { height: 0 }; } -export const QueryLatestHeightResponse = { - encode(message: QueryLatestHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.height !== 0) { writer.uint32(8).uint64(message.height); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryLatestHeightResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryLatestHeightResponse(); while (reader.pos < end) { @@ -912,19 +966,19 @@ export const QueryLatestHeightResponse = { break; } - message.height = longToNumber(reader.uint64() as Long); + message.height = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryLatestHeightResponse { - return { height: isSet(object.height) ? Number(object.height) : 0 }; + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; }, toJSON(message: QueryLatestHeightResponse): unknown { @@ -945,22 +999,22 @@ export const QueryLatestHeightResponse = { }, }; -function createBaseQueryGetPepNonceRequest(): QueryGetPepNonceRequest { +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { return { address: "" }; } -export const QueryGetPepNonceRequest = { - encode(message: QueryGetPepNonceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetPepNonceRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetPepNonceRequest(); + const message = createBaseQueryPepNonceRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -975,16 +1029,16 @@ export const QueryGetPepNonceRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetPepNonceRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, - toJSON(message: QueryGetPepNonceRequest): unknown { + toJSON(message: QueryPepNonceRequest): unknown { const obj: any = {}; if (message.address !== "") { obj.address = message.address; @@ -992,32 +1046,32 @@ export const QueryGetPepNonceRequest = { return obj; }, - create, I>>(base?: I): QueryGetPepNonceRequest { - return QueryGetPepNonceRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryGetPepNonceRequest { - const message = createBaseQueryGetPepNonceRequest(); + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); message.address = object.address ?? ""; return message; }, }; -function createBaseQueryGetPepNonceResponse(): QueryGetPepNonceResponse { +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { return { pepNonce: undefined }; } -export const QueryGetPepNonceResponse = { - encode(message: QueryGetPepNonceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pepNonce !== undefined) { - PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).ldelim(); + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetPepNonceResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetPepNonceResponse(); + const message = createBaseQueryPepNonceResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1032,16 +1086,16 @@ export const QueryGetPepNonceResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryGetPepNonceResponse { + fromJSON(object: any): QueryPepNonceResponse { return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; }, - toJSON(message: QueryGetPepNonceResponse): unknown { + toJSON(message: QueryPepNonceResponse): unknown { const obj: any = {}; if (message.pepNonce !== undefined) { obj.pepNonce = PepNonce.toJSON(message.pepNonce); @@ -1049,11 +1103,11 @@ export const QueryGetPepNonceResponse = { return obj; }, - create, I>>(base?: I): QueryGetPepNonceResponse { - return QueryGetPepNonceResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryGetPepNonceResponse { - const message = createBaseQueryGetPepNonceResponse(); + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) ? PepNonce.fromPartial(object.pepNonce) : undefined; @@ -1061,22 +1115,22 @@ export const QueryGetPepNonceResponse = { }, }; -function createBaseQueryAllPepNonceRequest(): QueryAllPepNonceRequest { +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { return { pagination: undefined }; } -export const QueryAllPepNonceRequest = { - encode(message: QueryAllPepNonceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllPepNonceRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllPepNonceRequest(); + const message = createBaseQueryPepNonceAllRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1091,16 +1145,16 @@ export const QueryAllPepNonceRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllPepNonceRequest { + fromJSON(object: any): QueryPepNonceAllRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllPepNonceRequest): unknown { + toJSON(message: QueryPepNonceAllRequest): unknown { const obj: any = {}; if (message.pagination !== undefined) { obj.pagination = PageRequest.toJSON(message.pagination); @@ -1108,11 +1162,11 @@ export const QueryAllPepNonceRequest = { return obj; }, - create, I>>(base?: I): QueryAllPepNonceRequest { - return QueryAllPepNonceRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllPepNonceRequest { - const message = createBaseQueryAllPepNonceRequest(); + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -1120,25 +1174,25 @@ export const QueryAllPepNonceRequest = { }, }; -function createBaseQueryAllPepNonceResponse(): QueryAllPepNonceResponse { +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { return { pepNonce: [], pagination: undefined }; } -export const QueryAllPepNonceResponse = { - encode(message: QueryAllPepNonceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.pepNonce) { - PepNonce.encode(v!, writer.uint32(10).fork()).ldelim(); + PepNonce.encode(v!, writer.uint32(10).fork()).join(); } if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllPepNonceResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllPepNonceResponse(); + const message = createBaseQueryPepNonceAllResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1160,19 +1214,19 @@ export const QueryAllPepNonceResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryAllPepNonceResponse { + fromJSON(object: any): QueryPepNonceAllResponse { return { - pepNonce: Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllPepNonceResponse): unknown { + toJSON(message: QueryPepNonceAllResponse): unknown { const obj: any = {}; if (message.pepNonce?.length) { obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); @@ -1183,11 +1237,11 @@ export const QueryAllPepNonceResponse = { return obj; }, - create, I>>(base?: I): QueryAllPepNonceResponse { - return QueryAllPepNonceResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryAllPepNonceResponse { - const message = createBaseQueryAllPepNonceResponse(); + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) @@ -1196,19 +1250,19 @@ export const QueryAllPepNonceResponse = { }, }; -function createBaseQueryPubKeyRequest(): QueryPubKeyRequest { +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { return {}; } -export const QueryPubKeyRequest = { - encode(_: QueryPubKeyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPubKeyRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryPubKeyRequest(); + const message = createBaseQueryPubkeyRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1216,48 +1270,48 @@ export const QueryPubKeyRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): QueryPubKeyRequest { + fromJSON(_: any): QueryPubkeyRequest { return {}; }, - toJSON(_: QueryPubKeyRequest): unknown { + toJSON(_: QueryPubkeyRequest): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): QueryPubKeyRequest { - return QueryPubKeyRequest.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): QueryPubKeyRequest { - const message = createBaseQueryPubKeyRequest(); + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); return message; }, }; -function createBaseQueryPubKeyResponse(): QueryPubKeyResponse { - return { activePubKey: undefined, queuedPubKey: undefined }; +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; } -export const QueryPubKeyResponse = { - encode(message: QueryPubKeyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.activePubKey !== undefined) { - ActivePublicKey.encode(message.activePubKey, writer.uint32(10).fork()).ldelim(); +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); } - if (message.queuedPubKey !== undefined) { - QueuedPublicKey.encode(message.queuedPubKey, writer.uint32(18).fork()).ldelim(); + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPubKeyResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryPubKeyResponse(); + const message = createBaseQueryPubkeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1266,79 +1320,394 @@ export const QueryPubKeyResponse = { break; } - message.activePubKey = ActivePublicKey.decode(reader, reader.uint32()); + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); continue; case 2: if (tag !== 18) { break; } - message.queuedPubKey = QueuedPublicKey.decode(reader, reader.uint32()); + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): QueryPubKeyResponse { + fromJSON(object: any): QueryPubkeyResponse { return { - activePubKey: isSet(object.activePubKey) ? ActivePublicKey.fromJSON(object.activePubKey) : undefined, - queuedPubKey: isSet(object.queuedPubKey) ? QueuedPublicKey.fromJSON(object.queuedPubKey) : undefined, + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, }; }, - toJSON(message: QueryPubKeyResponse): unknown { + toJSON(message: QueryPubkeyResponse): unknown { const obj: any = {}; - if (message.activePubKey !== undefined) { - obj.activePubKey = ActivePublicKey.toJSON(message.activePubKey); + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); } - if (message.queuedPubKey !== undefined) { - obj.queuedPubKey = QueuedPublicKey.toJSON(message.queuedPubKey); + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); } return obj; }, - create, I>>(base?: I): QueryPubKeyResponse { - return QueryPubKeyResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): QueryPubKeyResponse { - const message = createBaseQueryPubKeyResponse(); - message.activePubKey = (object.activePubKey !== undefined && object.activePubKey !== null) - ? ActivePublicKey.fromPartial(object.activePubKey) + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) : undefined; - message.queuedPubKey = (object.queuedPubKey !== undefined && object.queuedPubKey !== null) - ? QueuedPublicKey.fromPartial(object.queuedPubKey) + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) : undefined; return message; }, }; +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + /** Query defines the gRPC querier service. */ export interface Query { /** Parameters queries the parameters of the module. */ Params(request: QueryParamsRequest): Promise; /** Queries a EncryptedTx by index. */ - EncryptedTx(request: QueryGetEncryptedTxRequest): Promise; + EncryptedTx(request: QueryEncryptedTxRequest): Promise; /** Queries a list of EncryptedTx items. */ - EncryptedTxAll(request: QueryAllEncryptedTxRequest): Promise; + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; /** Queries a list of EncryptedTx items. */ EncryptedTxAllFromHeight( - request: QueryAllEncryptedTxFromHeightRequest, - ): Promise; + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; /** Queries a list of LatestHeight items. */ LatestHeight(request: QueryLatestHeightRequest): Promise; /** Queries a PepNonce by index. */ - PepNonce(request: QueryGetPepNonceRequest): Promise; + PepNonce(request: QueryPepNonceRequest): Promise; /** Queries a list of PepNonce items. */ - PepNonceAll(request: QueryAllPepNonceRequest): Promise; + PepNonceAll(request: QueryPepNonceAllRequest): Promise; /** Queries the public keys */ - PubKey(request: QueryPubKeyRequest): Promise; - KeyshareReq(request: QueryKeyshareRequest): Promise; - KeyshareReqAll(request: QueryAllKeyshareRequest): Promise; + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; } export const QueryServiceName = "fairyring.pep.Query"; @@ -1355,70 +1724,84 @@ export class QueryClientImpl implements Query { this.LatestHeight = this.LatestHeight.bind(this); this.PepNonce = this.PepNonce.bind(this); this.PepNonceAll = this.PepNonceAll.bind(this); - this.PubKey = this.PubKey.bind(this); - this.KeyshareReq = this.KeyshareReq.bind(this); - this.KeyshareReqAll = this.KeyshareReqAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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(_m0.Reader.create(data))); + return promise.then((data) => QueryParamsResponse.decode(new BinaryReader(data))); } - EncryptedTx(request: QueryGetEncryptedTxRequest): Promise { - const data = QueryGetEncryptedTxRequest.encode(request).finish(); + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "EncryptedTx", data); - return promise.then((data) => QueryGetEncryptedTxResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); } - EncryptedTxAll(request: QueryAllEncryptedTxRequest): Promise { - const data = QueryAllEncryptedTxRequest.encode(request).finish(); + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "EncryptedTxAll", data); - return promise.then((data) => QueryAllEncryptedTxResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); } EncryptedTxAllFromHeight( - request: QueryAllEncryptedTxFromHeightRequest, - ): Promise { - const data = QueryAllEncryptedTxFromHeightRequest.encode(request).finish(); + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); - return promise.then((data) => QueryAllEncryptedTxFromHeightResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); } LatestHeight(request: QueryLatestHeightRequest): Promise { const data = QueryLatestHeightRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "LatestHeight", data); - return promise.then((data) => QueryLatestHeightResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); } - PepNonce(request: QueryGetPepNonceRequest): Promise { - const data = QueryGetPepNonceRequest.encode(request).finish(); + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "PepNonce", data); - return promise.then((data) => QueryGetPepNonceResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); } - PepNonceAll(request: QueryAllPepNonceRequest): Promise { - const data = QueryAllPepNonceRequest.encode(request).finish(); + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "PepNonceAll", data); - return promise.then((data) => QueryAllPepNonceResponse.decode(_m0.Reader.create(data))); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); } - PubKey(request: QueryPubKeyRequest): Promise { - const data = QueryPubKeyRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "PubKey", data); - return promise.then((data) => QueryPubKeyResponse.decode(_m0.Reader.create(data))); + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); } - KeyshareReq(request: QueryKeyshareRequest): Promise { - const data = QueryKeyshareRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "KeyshareReq", data); - return promise.then((data) => QueryKeyshareResponse.decode(_m0.Reader.create(data))); + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); } - KeyshareReqAll(request: QueryAllKeyshareRequest): Promise { - const data = QueryAllKeyshareRequest.encode(request).finish(); - const promise = this.rpc.request(this.service, "KeyshareReqAll", data); - return promise.then((data) => QueryAllKeyshareResponse.decode(_m0.Reader.create(data))); + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(data))); } } @@ -1426,29 +1809,11 @@ interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -1456,18 +1821,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/pep/request_id.ts b/ts-client/fairyring.pep/types/fairyring/pep/request_id.ts index 5437c3ff..94fb8d6a 100644 --- a/ts-client/fairyring.pep/types/fairyring/pep/request_id.ts +++ b/ts-client/fairyring.pep/types/fairyring/pep/request_id.ts @@ -1,19 +1,67 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; export const protobufPackage = "fairyring.pep"; +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ export interface RequestId { creator: string; reqId: string; } +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + function createBaseRequestId(): RequestId { return { creator: "", reqId: "" }; } -export const RequestId = { - encode(message: RequestId, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -23,8 +71,8 @@ export const RequestId = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): RequestId { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestId(); while (reader.pos < end) { @@ -48,15 +96,15 @@ export const RequestId = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): RequestId { return { - creator: isSet(object.creator) ? String(object.creator) : "", - reqId: isSet(object.reqId) ? String(object.reqId) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", }; }, @@ -82,10 +130,356 @@ export const RequestId = { }, }; +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + 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; @@ -96,3 +490,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/fairyring/pep/tx.ts b/ts-client/fairyring.pep/types/fairyring/pep/tx.ts index a0d34f70..87ff98ff 100644 --- a/ts-client/fairyring.pep/types/fairyring/pep/tx.ts +++ b/ts-client/fairyring.pep/types/fairyring/pep/tx.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Duration } from "../../google/protobuf/duration"; import { Params } from "./params"; @@ -21,66 +26,149 @@ export interface MsgUpdateParams { export interface MsgUpdateParamsResponse { } +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ export interface MsgSubmitEncryptedTx { creator: string; data: string; targetBlockHeight: number; } +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ export interface MsgSubmitGeneralEncryptedTx { creator: string; data: string; reqId: string; } -export interface MsgSubmitEncryptedTxResponse { +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { } -/** this line is used by starport scaffolding # proto/tx/message */ -export interface MsgCreateAggregatedKeyShare { +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { creator: string; height: number; data: string; } -export interface MsgCreateAggregatedKeyShareResponse { +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { } -export interface MsgRequestGeneralKeyshare { +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { creator: string; estimatedDelay: Duration | undefined; reqId: string; } -export interface MsgRequestGeneralKeyshareResponse { +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { reqId: string; } -export interface MsgGetGeneralKeyshare { +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { creator: string; reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; } -export interface MsgGetGeneralKeyshareResponse { +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { } function createBaseMsgUpdateParams(): MsgUpdateParams { return { authority: "", params: undefined }; } -export const MsgUpdateParams = { - encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); } if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + Params.encode(message.params, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateParams(); while (reader.pos < end) { @@ -104,14 +192,14 @@ export const MsgUpdateParams = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, }; }, @@ -144,13 +232,13 @@ function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { return {}; } -export const MsgUpdateParamsResponse = { - encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateParamsResponse(); while (reader.pos < end) { @@ -160,7 +248,7 @@ export const MsgUpdateParamsResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -187,8 +275,8 @@ function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { return { creator: "", data: "", targetBlockHeight: 0 }; } -export const MsgSubmitEncryptedTx = { - encode(message: MsgSubmitEncryptedTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -201,8 +289,8 @@ export const MsgSubmitEncryptedTx = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitEncryptedTx { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitEncryptedTx(); while (reader.pos < end) { @@ -227,22 +315,22 @@ export const MsgSubmitEncryptedTx = { break; } - message.targetBlockHeight = longToNumber(reader.uint64() as Long); + message.targetBlockHeight = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgSubmitEncryptedTx { return { - creator: isSet(object.creator) ? String(object.creator) : "", - data: isSet(object.data) ? String(object.data) : "", - targetBlockHeight: isSet(object.targetBlockHeight) ? Number(object.targetBlockHeight) : 0, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, }; }, @@ -272,12 +360,55 @@ export const MsgSubmitEncryptedTx = { }, }; +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { return { creator: "", data: "", reqId: "" }; } -export const MsgSubmitGeneralEncryptedTx = { - encode(message: MsgSubmitGeneralEncryptedTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -290,8 +421,8 @@ export const MsgSubmitGeneralEncryptedTx = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitGeneralEncryptedTx(); while (reader.pos < end) { @@ -322,16 +453,16 @@ export const MsgSubmitGeneralEncryptedTx = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MsgSubmitGeneralEncryptedTx { return { - creator: isSet(object.creator) ? String(object.creator) : "", - data: isSet(object.data) ? String(object.data) : "", - reqId: isSet(object.reqId) ? String(object.reqId) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", }; }, @@ -361,19 +492,19 @@ export const MsgSubmitGeneralEncryptedTx = { }, }; -function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { return {}; } -export const MsgSubmitEncryptedTxResponse = { - encode(_: MsgSubmitEncryptedTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgSubmitEncryptedTxResponse(); + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -381,35 +512,39 @@ export const MsgSubmitEncryptedTxResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): MsgSubmitEncryptedTxResponse { + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { return {}; }, - toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): MsgSubmitEncryptedTxResponse { - return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { - const message = createBaseMsgSubmitEncryptedTxResponse(); + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); return message; }, }; -function createBaseMsgCreateAggregatedKeyShare(): MsgCreateAggregatedKeyShare { +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { return { creator: "", height: 0, data: "" }; } -export const MsgCreateAggregatedKeyShare = { - encode(message: MsgCreateAggregatedKeyShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -422,10 +557,10 @@ export const MsgCreateAggregatedKeyShare = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateAggregatedKeyShare { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateAggregatedKeyShare(); + const message = createBaseMsgSubmitDecryptionKey(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -441,7 +576,7 @@ export const MsgCreateAggregatedKeyShare = { break; } - message.height = longToNumber(reader.uint64() as Long); + message.height = longToNumber(reader.uint64()); continue; case 3: if (tag !== 26) { @@ -454,20 +589,20 @@ export const MsgCreateAggregatedKeyShare = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): MsgCreateAggregatedKeyShare { + fromJSON(object: any): MsgSubmitDecryptionKey { return { - creator: isSet(object.creator) ? String(object.creator) : "", - height: isSet(object.height) ? Number(object.height) : 0, - data: isSet(object.data) ? String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", }; }, - toJSON(message: MsgCreateAggregatedKeyShare): unknown { + toJSON(message: MsgSubmitDecryptionKey): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -481,11 +616,11 @@ export const MsgCreateAggregatedKeyShare = { return obj; }, - create, I>>(base?: I): MsgCreateAggregatedKeyShare { - return MsgCreateAggregatedKeyShare.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MsgCreateAggregatedKeyShare { - const message = createBaseMsgCreateAggregatedKeyShare(); + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); message.creator = object.creator ?? ""; message.height = object.height ?? 0; message.data = object.data ?? ""; @@ -493,19 +628,19 @@ export const MsgCreateAggregatedKeyShare = { }, }; -function createBaseMsgCreateAggregatedKeyShareResponse(): MsgCreateAggregatedKeyShareResponse { +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { return {}; } -export const MsgCreateAggregatedKeyShareResponse = { - encode(_: MsgCreateAggregatedKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateAggregatedKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateAggregatedKeyShareResponse(); + const message = createBaseMsgSubmitDecryptionKeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -513,44 +648,40 @@ export const MsgCreateAggregatedKeyShareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): MsgCreateAggregatedKeyShareResponse { + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { return {}; }, - toJSON(_: MsgCreateAggregatedKeyShareResponse): unknown { + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { const obj: any = {}; return obj; }, - create, I>>( - base?: I, - ): MsgCreateAggregatedKeyShareResponse { - return MsgCreateAggregatedKeyShareResponse.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - _: I, - ): MsgCreateAggregatedKeyShareResponse { - const message = createBaseMsgCreateAggregatedKeyShareResponse(); + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); return message; }, }; -function createBaseMsgRequestGeneralKeyshare(): MsgRequestGeneralKeyshare { +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { return { creator: "", estimatedDelay: undefined, reqId: "" }; } -export const MsgRequestGeneralKeyshare = { - encode(message: MsgRequestGeneralKeyshare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } if (message.estimatedDelay !== undefined) { - Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).ldelim(); + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); } if (message.reqId !== "") { writer.uint32(26).string(message.reqId); @@ -558,10 +689,10 @@ export const MsgRequestGeneralKeyshare = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestGeneralKeyshare { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRequestGeneralKeyshare(); + const message = createBaseMsgRequestGeneralIdentity(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -590,20 +721,20 @@ export const MsgRequestGeneralKeyshare = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): MsgRequestGeneralKeyshare { + fromJSON(object: any): MsgRequestGeneralIdentity { return { - creator: isSet(object.creator) ? String(object.creator) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, - reqId: isSet(object.reqId) ? String(object.reqId) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", }; }, - toJSON(message: MsgRequestGeneralKeyshare): unknown { + toJSON(message: MsgRequestGeneralIdentity): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -617,11 +748,11 @@ export const MsgRequestGeneralKeyshare = { return obj; }, - create, I>>(base?: I): MsgRequestGeneralKeyshare { - return MsgRequestGeneralKeyshare.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MsgRequestGeneralKeyshare { - const message = createBaseMsgRequestGeneralKeyshare(); + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); message.creator = object.creator ?? ""; message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) ? Duration.fromPartial(object.estimatedDelay) @@ -631,22 +762,22 @@ export const MsgRequestGeneralKeyshare = { }, }; -function createBaseMsgRequestGeneralKeyshareResponse(): MsgRequestGeneralKeyshareResponse { +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { return { reqId: "" }; } -export const MsgRequestGeneralKeyshareResponse = { - encode(message: MsgRequestGeneralKeyshareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.reqId !== "") { writer.uint32(10).string(message.reqId); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestGeneralKeyshareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRequestGeneralKeyshareResponse(); + const message = createBaseMsgRequestGeneralIdentityResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -661,16 +792,16 @@ export const MsgRequestGeneralKeyshareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): MsgRequestGeneralKeyshareResponse { - return { reqId: isSet(object.reqId) ? String(object.reqId) : "" }; + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; }, - toJSON(message: MsgRequestGeneralKeyshareResponse): unknown { + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { const obj: any = {}; if (message.reqId !== "") { obj.reqId = message.reqId; @@ -678,26 +809,26 @@ export const MsgRequestGeneralKeyshareResponse = { return obj; }, - create, I>>( + create, I>>( base?: I, - ): MsgRequestGeneralKeyshareResponse { - return MsgRequestGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): MsgRequestGeneralKeyshareResponse { - const message = createBaseMsgRequestGeneralKeyshareResponse(); + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); message.reqId = object.reqId ?? ""; return message; }, }; -function createBaseMsgGetGeneralKeyshare(): MsgGetGeneralKeyshare { +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { return { creator: "", reqId: "" }; } -export const MsgGetGeneralKeyshare = { - encode(message: MsgGetGeneralKeyshare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); } @@ -707,10 +838,10 @@ export const MsgGetGeneralKeyshare = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgGetGeneralKeyshare { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgGetGeneralKeyshare(); + const message = createBaseMsgRequestGeneralDecryptionKey(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -732,19 +863,19 @@ export const MsgGetGeneralKeyshare = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): MsgGetGeneralKeyshare { + fromJSON(object: any): MsgRequestGeneralDecryptionKey { return { - creator: isSet(object.creator) ? String(object.creator) : "", - reqId: isSet(object.reqId) ? String(object.reqId) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", }; }, - toJSON(message: MsgGetGeneralKeyshare): unknown { + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { const obj: any = {}; if (message.creator !== "") { obj.creator = message.creator; @@ -755,30 +886,32 @@ export const MsgGetGeneralKeyshare = { return obj; }, - create, I>>(base?: I): MsgGetGeneralKeyshare { - return MsgGetGeneralKeyshare.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MsgGetGeneralKeyshare { - const message = createBaseMsgGetGeneralKeyshare(); + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); message.creator = object.creator ?? ""; message.reqId = object.reqId ?? ""; return message; }, }; -function createBaseMsgGetGeneralKeyshareResponse(): MsgGetGeneralKeyshareResponse { +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { return {}; } -export const MsgGetGeneralKeyshareResponse = { - encode(_: MsgGetGeneralKeyshareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgGetGeneralKeyshareResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgGetGeneralKeyshareResponse(); + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -786,141 +919,747 @@ export const MsgGetGeneralKeyshareResponse = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(_: any): MsgGetGeneralKeyshareResponse { + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { return {}; }, - toJSON(_: MsgGetGeneralKeyshareResponse): unknown { + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { const obj: any = {}; return obj; }, - create, I>>(base?: I): MsgGetGeneralKeyshareResponse { - return MsgGetGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): MsgGetGeneralKeyshareResponse { - const message = createBaseMsgGetGeneralKeyshareResponse(); + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); return message; }, }; -/** Msg defines the Msg service. */ -export interface Msg { - /** - * UpdateParams defines a (governance) operation for updating the module - * parameters. The authority defaults to the x/gov module account. - */ - UpdateParams(request: MsgUpdateParams): Promise; - SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; - SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; - /** this line is used by starport scaffolding # proto/tx/rpc */ - CreateAggregatedKeyShare(request: MsgCreateAggregatedKeyShare): Promise; - RequestGeneralKeyshare(request: MsgRequestGeneralKeyshare): Promise; - GetGeneralKeyshare(request: MsgGetGeneralKeyshare): Promise; +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; } -export const MsgServiceName = "fairyring.pep.Msg"; -export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - private readonly service: string; - constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || MsgServiceName; - this.rpc = rpc; - this.UpdateParams = this.UpdateParams.bind(this); - this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); - this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); - this.CreateAggregatedKeyShare = this.CreateAggregatedKeyShare.bind(this); - this.RequestGeneralKeyshare = this.RequestGeneralKeyshare.bind(this); - this.GetGeneralKeyshare = this.GetGeneralKeyshare.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(_m0.Reader.create(data))); - } +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, - SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { - const data = MsgSubmitEncryptedTx.encode(request).finish(); - const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); - return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(_m0.Reader.create(data))); - } + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } - SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { - const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); - const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); - return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(_m0.Reader.create(data))); - } + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } - CreateAggregatedKeyShare(request: MsgCreateAggregatedKeyShare): Promise { - const data = MsgCreateAggregatedKeyShare.encode(request).finish(); - const promise = this.rpc.request(this.service, "CreateAggregatedKeyShare", data); - return promise.then((data) => MsgCreateAggregatedKeyShareResponse.decode(_m0.Reader.create(data))); - } + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, - RequestGeneralKeyshare(request: MsgRequestGeneralKeyshare): Promise { - const data = MsgRequestGeneralKeyshare.encode(request).finish(); - const promise = this.rpc.request(this.service, "RequestGeneralKeyshare", data); - return promise.then((data) => MsgRequestGeneralKeyshareResponse.decode(_m0.Reader.create(data))); - } + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, - GetGeneralKeyshare(request: MsgGetGeneralKeyshare): Promise { - const data = MsgGetGeneralKeyshare.encode(request).finish(); - const promise = this.rpc.request(this.service, "GetGeneralKeyshare", data); - return promise.then((data) => MsgGetGeneralKeyshareResponse.decode(_m0.Reader.create(data))); - } -} + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, -interface Rpc { - request(service: string, method: string, data: Uint8Array): Promise; + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; } -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); - } - return long.toNumber(); -} + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; } -function isSet(value: any): boolean { - return value !== null && value !== undefined; +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; } diff --git a/ts-client/fairyring.pep/types/gogoproto/gogo.ts b/ts-client/fairyring.pep/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/fairyring.pep/types/gogoproto/gogo.ts +++ b/ts-client/fairyring.pep/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/fairyring.pep/types/google/api/annotations.ts b/ts-client/fairyring.pep/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/fairyring.pep/types/google/api/annotations.ts +++ b/ts-client/fairyring.pep/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/fairyring.pep/types/google/api/http.ts b/ts-client/fairyring.pep/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/fairyring.pep/types/google/api/http.ts +++ b/ts-client/fairyring.pep/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/google/protobuf/descriptor.ts b/ts-client/fairyring.pep/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/fairyring.pep/types/google/protobuf/descriptor.ts +++ b/ts-client/fairyring.pep/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/google/protobuf/duration.ts b/ts-client/fairyring.pep/types/google/protobuf/duration.ts index 43469bad..8ac2b038 100644 --- a/ts-client/fairyring.pep/types/google/protobuf/duration.ts +++ b/ts-client/fairyring.pep/types/google/protobuf/duration.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; @@ -86,8 +91,8 @@ function createBaseDuration(): Duration { return { seconds: 0, nanos: 0 }; } -export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.seconds !== 0) { writer.uint32(8).int64(message.seconds); } @@ -97,8 +102,8 @@ export const Duration = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { @@ -109,7 +114,7 @@ export const Duration = { break; } - message.seconds = longToNumber(reader.int64() as Long); + message.seconds = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { @@ -122,15 +127,15 @@ export const Duration = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? Number(object.seconds) : 0, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, @@ -156,29 +161,11 @@ export const Duration = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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"; -})(); - type Builtin = 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; @@ -186,18 +173,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/fairyring.pep/types/route-name.eta b/ts-client/fairyring.pep/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/fairyring.pep/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/ibc.applications.fee.v1/module.ts b/ts-client/ibc.applications.fee.v1/module.ts index 5df4e05c..bb9b0842 100755 --- a/ts-client/ibc.applications.fee.v1/module.ts +++ b/ts-client/ibc.applications.fee.v1/module.ts @@ -6,99 +6,99 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { QueryIncentivizedPacketsForChannelRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryTotalRecvFeesRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryTotalRecvFeesResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryTotalTimeoutFeesResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryFeeEnabledChannelRequest } from "./types/ibc/applications/fee/v1/query"; -import { MsgPayPacketFeeResponse } from "./types/ibc/applications/fee/v1/tx"; -import { QueryIncentivizedPacketsRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryIncentivizedPacketResponse } from "./types/ibc/applications/fee/v1/query"; -import { Fee } from "./types/ibc/applications/fee/v1/fee"; -import { PacketFees } from "./types/ibc/applications/fee/v1/fee"; -import { Metadata } from "./types/ibc/applications/fee/v1/metadata"; -import { QueryCounterpartyPayeeRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryFeeEnabledChannelsResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryIncentivizedPacketsForChannelResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryCounterpartyPayeeResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryFeeEnabledChannelResponse } from "./types/ibc/applications/fee/v1/query"; -import { PacketFee } from "./types/ibc/applications/fee/v1/fee"; -import { GenesisState } from "./types/ibc/applications/fee/v1/genesis"; -import { ForwardRelayerAddress } from "./types/ibc/applications/fee/v1/genesis"; -import { MsgPayPacketFee } from "./types/ibc/applications/fee/v1/tx"; -import { QueryIncentivizedPacketRequest } from "./types/ibc/applications/fee/v1/query"; -import { MsgRegisterCounterpartyPayee } from "./types/ibc/applications/fee/v1/tx"; -import { QueryFeeEnabledChannelsRequest } from "./types/ibc/applications/fee/v1/query"; -import { IncentivizedAcknowledgement } from "./types/ibc/applications/fee/v1/ack"; -import { FeeEnabledChannel } from "./types/ibc/applications/fee/v1/genesis"; -import { RegisteredCounterpartyPayee } from "./types/ibc/applications/fee/v1/genesis"; -import { MsgPayPacketFeeAsync } from "./types/ibc/applications/fee/v1/tx"; -import { MsgRegisterCounterpartyPayeeResponse } from "./types/ibc/applications/fee/v1/tx"; -import { IdentifiedPacketFees } from "./types/ibc/applications/fee/v1/fee"; -import { RegisteredPayee } from "./types/ibc/applications/fee/v1/genesis"; -import { QueryIncentivizedPacketsResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryPayeeResponse } from "./types/ibc/applications/fee/v1/query"; -import { MsgRegisterPayee } from "./types/ibc/applications/fee/v1/tx"; -import { QueryTotalTimeoutFeesRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryPayeeRequest } from "./types/ibc/applications/fee/v1/query"; -import { MsgRegisterPayeeResponse } from "./types/ibc/applications/fee/v1/tx"; -import { MsgPayPacketFeeAsyncResponse } from "./types/ibc/applications/fee/v1/tx"; -import { QueryTotalAckFeesRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryTotalAckFeesResponse } from "./types/ibc/applications/fee/v1/query"; - - -export { QueryIncentivizedPacketsForChannelRequest, QueryTotalRecvFeesRequest, QueryTotalRecvFeesResponse, QueryTotalTimeoutFeesResponse, QueryFeeEnabledChannelRequest, MsgPayPacketFeeResponse, QueryIncentivizedPacketsRequest, QueryIncentivizedPacketResponse, Fee, PacketFees, Metadata, QueryCounterpartyPayeeRequest, QueryFeeEnabledChannelsResponse, QueryIncentivizedPacketsForChannelResponse, QueryCounterpartyPayeeResponse, QueryFeeEnabledChannelResponse, PacketFee, GenesisState, ForwardRelayerAddress, MsgPayPacketFee, QueryIncentivizedPacketRequest, MsgRegisterCounterpartyPayee, QueryFeeEnabledChannelsRequest, IncentivizedAcknowledgement, FeeEnabledChannel, RegisteredCounterpartyPayee, MsgPayPacketFeeAsync, MsgRegisterCounterpartyPayeeResponse, IdentifiedPacketFees, RegisteredPayee, QueryIncentivizedPacketsResponse, QueryPayeeResponse, MsgRegisterPayee, QueryTotalTimeoutFeesRequest, QueryPayeeRequest, MsgRegisterPayeeResponse, MsgPayPacketFeeAsyncResponse, QueryTotalAckFeesRequest, QueryTotalAckFeesResponse }; +import { QueryFeeEnabledChannelsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { IncentivizedAcknowledgement } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/ack"; +import { FeeEnabledChannel } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { QueryIncentivizedPacketRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryCounterpartyPayeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryTotalAckFeesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryTotalTimeoutFeesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryTotalTimeoutFeesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryFeeEnabledChannelResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { PacketFees } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/fee"; +import { MsgPayPacketFeeAsync } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { QueryTotalRecvFeesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryIncentivizedPacketsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryTotalRecvFeesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { MsgRegisterPayee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { MsgPayPacketFee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { QueryPayeeRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryFeeEnabledChannelsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { IdentifiedPacketFees } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/fee"; +import { MsgRegisterCounterpartyPayeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { MsgRegisterCounterpartyPayee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { QueryIncentivizedPacketsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { MsgPayPacketFeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { MsgPayPacketFeeAsyncResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { QueryCounterpartyPayeeRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { PacketFee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/fee"; +import { MsgRegisterPayeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { QueryTotalAckFeesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryPayeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { Fee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/fee"; +import { RegisteredCounterpartyPayee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { ForwardRelayerAddress } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { QueryIncentivizedPacketsForChannelRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryIncentivizedPacketsForChannelResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryFeeEnabledChannelRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { RegisteredPayee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { QueryIncentivizedPacketResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { Metadata } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/metadata"; + + +export { QueryFeeEnabledChannelsRequest, IncentivizedAcknowledgement, FeeEnabledChannel, QueryIncentivizedPacketRequest, QueryCounterpartyPayeeResponse, QueryTotalAckFeesResponse, QueryTotalTimeoutFeesRequest, QueryTotalTimeoutFeesResponse, QueryFeeEnabledChannelResponse, PacketFees, MsgPayPacketFeeAsync, QueryTotalRecvFeesResponse, QueryIncentivizedPacketsRequest, QueryTotalRecvFeesRequest, MsgRegisterPayee, MsgPayPacketFee, QueryPayeeRequest, QueryFeeEnabledChannelsResponse, IdentifiedPacketFees, MsgRegisterCounterpartyPayeeResponse, MsgRegisterCounterpartyPayee, QueryIncentivizedPacketsResponse, MsgPayPacketFeeResponse, MsgPayPacketFeeAsyncResponse, QueryCounterpartyPayeeRequest, PacketFee, MsgRegisterPayeeResponse, GenesisState, QueryTotalAckFeesRequest, QueryPayeeResponse, Fee, RegisteredCounterpartyPayee, ForwardRelayerAddress, QueryIncentivizedPacketsForChannelRequest, QueryIncentivizedPacketsForChannelResponse, QueryFeeEnabledChannelRequest, RegisteredPayee, QueryIncentivizedPacketResponse, Metadata }; -type sendQueryIncentivizedPacketsForChannelRequestParams = { - value: QueryIncentivizedPacketsForChannelRequest, +type sendQueryFeeEnabledChannelsRequestParams = { + value: QueryFeeEnabledChannelsRequest, fee?: StdFee, memo?: string }; -type sendQueryTotalRecvFeesRequestParams = { - value: QueryTotalRecvFeesRequest, +type sendIncentivizedAcknowledgementParams = { + value: IncentivizedAcknowledgement, fee?: StdFee, memo?: string }; -type sendQueryTotalRecvFeesResponseParams = { - value: QueryTotalRecvFeesResponse, +type sendFeeEnabledChannelParams = { + value: FeeEnabledChannel, fee?: StdFee, memo?: string }; -type sendQueryTotalTimeoutFeesResponseParams = { - value: QueryTotalTimeoutFeesResponse, +type sendQueryIncentivizedPacketRequestParams = { + value: QueryIncentivizedPacketRequest, fee?: StdFee, memo?: string }; -type sendQueryFeeEnabledChannelRequestParams = { - value: QueryFeeEnabledChannelRequest, +type sendQueryCounterpartyPayeeResponseParams = { + value: QueryCounterpartyPayeeResponse, fee?: StdFee, memo?: string }; -type sendMsgPayPacketFeeResponseParams = { - value: MsgPayPacketFeeResponse, +type sendQueryTotalAckFeesResponseParams = { + value: QueryTotalAckFeesResponse, fee?: StdFee, memo?: string }; -type sendQueryIncentivizedPacketsRequestParams = { - value: QueryIncentivizedPacketsRequest, +type sendQueryTotalTimeoutFeesRequestParams = { + value: QueryTotalTimeoutFeesRequest, fee?: StdFee, memo?: string }; -type sendQueryIncentivizedPacketResponseParams = { - value: QueryIncentivizedPacketResponse, +type sendQueryTotalTimeoutFeesResponseParams = { + value: QueryTotalTimeoutFeesResponse, fee?: StdFee, memo?: string }; -type sendFeeParams = { - value: Fee, +type sendQueryFeeEnabledChannelResponseParams = { + value: QueryFeeEnabledChannelResponse, fee?: StdFee, memo?: string }; @@ -109,335 +109,335 @@ type sendPacketFeesParams = { memo?: string }; -type sendMetadataParams = { - value: Metadata, +type sendMsgPayPacketFeeAsyncParams = { + value: MsgPayPacketFeeAsync, fee?: StdFee, memo?: string }; -type sendQueryCounterpartyPayeeRequestParams = { - value: QueryCounterpartyPayeeRequest, +type sendQueryTotalRecvFeesResponseParams = { + value: QueryTotalRecvFeesResponse, fee?: StdFee, memo?: string }; -type sendQueryFeeEnabledChannelsResponseParams = { - value: QueryFeeEnabledChannelsResponse, +type sendQueryIncentivizedPacketsRequestParams = { + value: QueryIncentivizedPacketsRequest, fee?: StdFee, memo?: string }; -type sendQueryIncentivizedPacketsForChannelResponseParams = { - value: QueryIncentivizedPacketsForChannelResponse, +type sendQueryTotalRecvFeesRequestParams = { + value: QueryTotalRecvFeesRequest, fee?: StdFee, memo?: string }; -type sendQueryCounterpartyPayeeResponseParams = { - value: QueryCounterpartyPayeeResponse, +type sendMsgRegisterPayeeParams = { + value: MsgRegisterPayee, fee?: StdFee, memo?: string }; -type sendQueryFeeEnabledChannelResponseParams = { - value: QueryFeeEnabledChannelResponse, +type sendMsgPayPacketFeeParams = { + value: MsgPayPacketFee, fee?: StdFee, memo?: string }; -type sendPacketFeeParams = { - value: PacketFee, +type sendQueryPayeeRequestParams = { + value: QueryPayeeRequest, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryFeeEnabledChannelsResponseParams = { + value: QueryFeeEnabledChannelsResponse, fee?: StdFee, memo?: string }; -type sendForwardRelayerAddressParams = { - value: ForwardRelayerAddress, +type sendIdentifiedPacketFeesParams = { + value: IdentifiedPacketFees, fee?: StdFee, memo?: string }; -type sendMsgPayPacketFeeParams = { - value: MsgPayPacketFee, +type sendMsgRegisterCounterpartyPayeeResponseParams = { + value: MsgRegisterCounterpartyPayeeResponse, fee?: StdFee, memo?: string }; -type sendQueryIncentivizedPacketRequestParams = { - value: QueryIncentivizedPacketRequest, +type sendMsgRegisterCounterpartyPayeeParams = { + value: MsgRegisterCounterpartyPayee, fee?: StdFee, memo?: string }; -type sendMsgRegisterCounterpartyPayeeParams = { - value: MsgRegisterCounterpartyPayee, +type sendQueryIncentivizedPacketsResponseParams = { + value: QueryIncentivizedPacketsResponse, fee?: StdFee, memo?: string }; -type sendQueryFeeEnabledChannelsRequestParams = { - value: QueryFeeEnabledChannelsRequest, +type sendMsgPayPacketFeeResponseParams = { + value: MsgPayPacketFeeResponse, fee?: StdFee, memo?: string }; -type sendIncentivizedAcknowledgementParams = { - value: IncentivizedAcknowledgement, +type sendMsgPayPacketFeeAsyncResponseParams = { + value: MsgPayPacketFeeAsyncResponse, fee?: StdFee, memo?: string }; -type sendFeeEnabledChannelParams = { - value: FeeEnabledChannel, +type sendQueryCounterpartyPayeeRequestParams = { + value: QueryCounterpartyPayeeRequest, fee?: StdFee, memo?: string }; -type sendRegisteredCounterpartyPayeeParams = { - value: RegisteredCounterpartyPayee, +type sendPacketFeeParams = { + value: PacketFee, fee?: StdFee, memo?: string }; -type sendMsgPayPacketFeeAsyncParams = { - value: MsgPayPacketFeeAsync, +type sendMsgRegisterPayeeResponseParams = { + value: MsgRegisterPayeeResponse, fee?: StdFee, memo?: string }; -type sendMsgRegisterCounterpartyPayeeResponseParams = { - value: MsgRegisterCounterpartyPayeeResponse, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendIdentifiedPacketFeesParams = { - value: IdentifiedPacketFees, +type sendQueryTotalAckFeesRequestParams = { + value: QueryTotalAckFeesRequest, fee?: StdFee, memo?: string }; -type sendRegisteredPayeeParams = { - value: RegisteredPayee, +type sendQueryPayeeResponseParams = { + value: QueryPayeeResponse, fee?: StdFee, memo?: string }; -type sendQueryIncentivizedPacketsResponseParams = { - value: QueryIncentivizedPacketsResponse, +type sendFeeParams = { + value: Fee, fee?: StdFee, memo?: string }; -type sendQueryPayeeResponseParams = { - value: QueryPayeeResponse, +type sendRegisteredCounterpartyPayeeParams = { + value: RegisteredCounterpartyPayee, fee?: StdFee, memo?: string }; -type sendMsgRegisterPayeeParams = { - value: MsgRegisterPayee, +type sendForwardRelayerAddressParams = { + value: ForwardRelayerAddress, fee?: StdFee, memo?: string }; -type sendQueryTotalTimeoutFeesRequestParams = { - value: QueryTotalTimeoutFeesRequest, +type sendQueryIncentivizedPacketsForChannelRequestParams = { + value: QueryIncentivizedPacketsForChannelRequest, fee?: StdFee, memo?: string }; -type sendQueryPayeeRequestParams = { - value: QueryPayeeRequest, +type sendQueryIncentivizedPacketsForChannelResponseParams = { + value: QueryIncentivizedPacketsForChannelResponse, fee?: StdFee, memo?: string }; -type sendMsgRegisterPayeeResponseParams = { - value: MsgRegisterPayeeResponse, +type sendQueryFeeEnabledChannelRequestParams = { + value: QueryFeeEnabledChannelRequest, fee?: StdFee, memo?: string }; -type sendMsgPayPacketFeeAsyncResponseParams = { - value: MsgPayPacketFeeAsyncResponse, +type sendRegisteredPayeeParams = { + value: RegisteredPayee, fee?: StdFee, memo?: string }; -type sendQueryTotalAckFeesRequestParams = { - value: QueryTotalAckFeesRequest, +type sendQueryIncentivizedPacketResponseParams = { + value: QueryIncentivizedPacketResponse, fee?: StdFee, memo?: string }; -type sendQueryTotalAckFeesResponseParams = { - value: QueryTotalAckFeesResponse, +type sendMetadataParams = { + value: Metadata, fee?: StdFee, memo?: string }; -type queryIncentivizedPacketsForChannelRequestParams = { - value: QueryIncentivizedPacketsForChannelRequest, +type queryFeeEnabledChannelsRequestParams = { + value: QueryFeeEnabledChannelsRequest, }; -type queryTotalRecvFeesRequestParams = { - value: QueryTotalRecvFeesRequest, +type incentivizedAcknowledgementParams = { + value: IncentivizedAcknowledgement, }; -type queryTotalRecvFeesResponseParams = { - value: QueryTotalRecvFeesResponse, +type feeEnabledChannelParams = { + value: FeeEnabledChannel, }; -type queryTotalTimeoutFeesResponseParams = { - value: QueryTotalTimeoutFeesResponse, +type queryIncentivizedPacketRequestParams = { + value: QueryIncentivizedPacketRequest, }; -type queryFeeEnabledChannelRequestParams = { - value: QueryFeeEnabledChannelRequest, +type queryCounterpartyPayeeResponseParams = { + value: QueryCounterpartyPayeeResponse, }; -type msgPayPacketFeeResponseParams = { - value: MsgPayPacketFeeResponse, +type queryTotalAckFeesResponseParams = { + value: QueryTotalAckFeesResponse, }; -type queryIncentivizedPacketsRequestParams = { - value: QueryIncentivizedPacketsRequest, +type queryTotalTimeoutFeesRequestParams = { + value: QueryTotalTimeoutFeesRequest, }; -type queryIncentivizedPacketResponseParams = { - value: QueryIncentivizedPacketResponse, +type queryTotalTimeoutFeesResponseParams = { + value: QueryTotalTimeoutFeesResponse, }; -type feeParams = { - value: Fee, +type queryFeeEnabledChannelResponseParams = { + value: QueryFeeEnabledChannelResponse, }; type packetFeesParams = { value: PacketFees, }; -type metadataParams = { - value: Metadata, -}; - -type queryCounterpartyPayeeRequestParams = { - value: QueryCounterpartyPayeeRequest, +type msgPayPacketFeeAsyncParams = { + value: MsgPayPacketFeeAsync, }; -type queryFeeEnabledChannelsResponseParams = { - value: QueryFeeEnabledChannelsResponse, +type queryTotalRecvFeesResponseParams = { + value: QueryTotalRecvFeesResponse, }; -type queryIncentivizedPacketsForChannelResponseParams = { - value: QueryIncentivizedPacketsForChannelResponse, +type queryIncentivizedPacketsRequestParams = { + value: QueryIncentivizedPacketsRequest, }; -type queryCounterpartyPayeeResponseParams = { - value: QueryCounterpartyPayeeResponse, +type queryTotalRecvFeesRequestParams = { + value: QueryTotalRecvFeesRequest, }; -type queryFeeEnabledChannelResponseParams = { - value: QueryFeeEnabledChannelResponse, +type msgRegisterPayeeParams = { + value: MsgRegisterPayee, }; -type packetFeeParams = { - value: PacketFee, +type msgPayPacketFeeParams = { + value: MsgPayPacketFee, }; -type genesisStateParams = { - value: GenesisState, +type queryPayeeRequestParams = { + value: QueryPayeeRequest, }; -type forwardRelayerAddressParams = { - value: ForwardRelayerAddress, +type queryFeeEnabledChannelsResponseParams = { + value: QueryFeeEnabledChannelsResponse, }; -type msgPayPacketFeeParams = { - value: MsgPayPacketFee, +type identifiedPacketFeesParams = { + value: IdentifiedPacketFees, }; -type queryIncentivizedPacketRequestParams = { - value: QueryIncentivizedPacketRequest, +type msgRegisterCounterpartyPayeeResponseParams = { + value: MsgRegisterCounterpartyPayeeResponse, }; type msgRegisterCounterpartyPayeeParams = { value: MsgRegisterCounterpartyPayee, }; -type queryFeeEnabledChannelsRequestParams = { - value: QueryFeeEnabledChannelsRequest, -}; - -type incentivizedAcknowledgementParams = { - value: IncentivizedAcknowledgement, +type queryIncentivizedPacketsResponseParams = { + value: QueryIncentivizedPacketsResponse, }; -type feeEnabledChannelParams = { - value: FeeEnabledChannel, +type msgPayPacketFeeResponseParams = { + value: MsgPayPacketFeeResponse, }; -type registeredCounterpartyPayeeParams = { - value: RegisteredCounterpartyPayee, +type msgPayPacketFeeAsyncResponseParams = { + value: MsgPayPacketFeeAsyncResponse, }; -type msgPayPacketFeeAsyncParams = { - value: MsgPayPacketFeeAsync, +type queryCounterpartyPayeeRequestParams = { + value: QueryCounterpartyPayeeRequest, }; -type msgRegisterCounterpartyPayeeResponseParams = { - value: MsgRegisterCounterpartyPayeeResponse, +type packetFeeParams = { + value: PacketFee, }; -type identifiedPacketFeesParams = { - value: IdentifiedPacketFees, +type msgRegisterPayeeResponseParams = { + value: MsgRegisterPayeeResponse, }; -type registeredPayeeParams = { - value: RegisteredPayee, +type genesisStateParams = { + value: GenesisState, }; -type queryIncentivizedPacketsResponseParams = { - value: QueryIncentivizedPacketsResponse, +type queryTotalAckFeesRequestParams = { + value: QueryTotalAckFeesRequest, }; type queryPayeeResponseParams = { value: QueryPayeeResponse, }; -type msgRegisterPayeeParams = { - value: MsgRegisterPayee, +type feeParams = { + value: Fee, }; -type queryTotalTimeoutFeesRequestParams = { - value: QueryTotalTimeoutFeesRequest, +type registeredCounterpartyPayeeParams = { + value: RegisteredCounterpartyPayee, }; -type queryPayeeRequestParams = { - value: QueryPayeeRequest, +type forwardRelayerAddressParams = { + value: ForwardRelayerAddress, }; -type msgRegisterPayeeResponseParams = { - value: MsgRegisterPayeeResponse, +type queryIncentivizedPacketsForChannelRequestParams = { + value: QueryIncentivizedPacketsForChannelRequest, }; -type msgPayPacketFeeAsyncResponseParams = { - value: MsgPayPacketFeeAsyncResponse, +type queryIncentivizedPacketsForChannelResponseParams = { + value: QueryIncentivizedPacketsForChannelResponse, }; -type queryTotalAckFeesRequestParams = { - value: QueryTotalAckFeesRequest, +type queryFeeEnabledChannelRequestParams = { + value: QueryFeeEnabledChannelRequest, }; -type queryTotalAckFeesResponseParams = { - value: QueryTotalAckFeesResponse, +type registeredPayeeParams = { + value: RegisteredPayee, +}; + +type queryIncentivizedPacketResponseParams = { + value: QueryIncentivizedPacketResponse, +}; + +type metadataParams = { + value: Metadata, }; @@ -470,129 +470,129 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendQueryIncentivizedPacketsForChannelRequest({ value, fee, memo }: sendQueryIncentivizedPacketsForChannelRequestParams): Promise { + async sendQueryFeeEnabledChannelsRequest({ value, fee, memo }: sendQueryFeeEnabledChannelsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryIncentivizedPacketsForChannelRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryFeeEnabledChannelsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryIncentivizedPacketsForChannelRequest({ value: QueryIncentivizedPacketsForChannelRequest.fromPartial(value) }) + let msg = this.queryFeeEnabledChannelsRequest({ value: QueryFeeEnabledChannelsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryIncentivizedPacketsForChannelRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryFeeEnabledChannelsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalRecvFeesRequest({ value, fee, memo }: sendQueryTotalRecvFeesRequestParams): Promise { + async sendIncentivizedAcknowledgement({ value, fee, memo }: sendIncentivizedAcknowledgementParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalRecvFeesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendIncentivizedAcknowledgement: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalRecvFeesRequest({ value: QueryTotalRecvFeesRequest.fromPartial(value) }) + let msg = this.incentivizedAcknowledgement({ value: IncentivizedAcknowledgement.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalRecvFeesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendIncentivizedAcknowledgement: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalRecvFeesResponse({ value, fee, memo }: sendQueryTotalRecvFeesResponseParams): Promise { + async sendFeeEnabledChannel({ value, fee, memo }: sendFeeEnabledChannelParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalRecvFeesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendFeeEnabledChannel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalRecvFeesResponse({ value: QueryTotalRecvFeesResponse.fromPartial(value) }) + let msg = this.feeEnabledChannel({ value: FeeEnabledChannel.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalRecvFeesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendFeeEnabledChannel: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalTimeoutFeesResponse({ value, fee, memo }: sendQueryTotalTimeoutFeesResponseParams): Promise { + async sendQueryIncentivizedPacketRequest({ value, fee, memo }: sendQueryIncentivizedPacketRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalTimeoutFeesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryIncentivizedPacketRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalTimeoutFeesResponse({ value: QueryTotalTimeoutFeesResponse.fromPartial(value) }) + let msg = this.queryIncentivizedPacketRequest({ value: QueryIncentivizedPacketRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalTimeoutFeesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryIncentivizedPacketRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryFeeEnabledChannelRequest({ value, fee, memo }: sendQueryFeeEnabledChannelRequestParams): Promise { + async sendQueryCounterpartyPayeeResponse({ value, fee, memo }: sendQueryCounterpartyPayeeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryFeeEnabledChannelRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCounterpartyPayeeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryFeeEnabledChannelRequest({ value: QueryFeeEnabledChannelRequest.fromPartial(value) }) + let msg = this.queryCounterpartyPayeeResponse({ value: QueryCounterpartyPayeeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryFeeEnabledChannelRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCounterpartyPayeeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPayPacketFeeResponse({ value, fee, memo }: sendMsgPayPacketFeeResponseParams): Promise { + async sendQueryTotalAckFeesResponse({ value, fee, memo }: sendQueryTotalAckFeesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPayPacketFeeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalAckFeesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPayPacketFeeResponse({ value: MsgPayPacketFeeResponse.fromPartial(value) }) + let msg = this.queryTotalAckFeesResponse({ value: QueryTotalAckFeesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPayPacketFeeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalAckFeesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryIncentivizedPacketsRequest({ value, fee, memo }: sendQueryIncentivizedPacketsRequestParams): Promise { + async sendQueryTotalTimeoutFeesRequest({ value, fee, memo }: sendQueryTotalTimeoutFeesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryIncentivizedPacketsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalTimeoutFeesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryIncentivizedPacketsRequest({ value: QueryIncentivizedPacketsRequest.fromPartial(value) }) + let msg = this.queryTotalTimeoutFeesRequest({ value: QueryTotalTimeoutFeesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryIncentivizedPacketsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalTimeoutFeesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryIncentivizedPacketResponse({ value, fee, memo }: sendQueryIncentivizedPacketResponseParams): Promise { + async sendQueryTotalTimeoutFeesResponse({ value, fee, memo }: sendQueryTotalTimeoutFeesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryIncentivizedPacketResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalTimeoutFeesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryIncentivizedPacketResponse({ value: QueryIncentivizedPacketResponse.fromPartial(value) }) + let msg = this.queryTotalTimeoutFeesResponse({ value: QueryTotalTimeoutFeesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryIncentivizedPacketResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalTimeoutFeesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendFee({ value, fee, memo }: sendFeeParams): Promise { + async sendQueryFeeEnabledChannelResponse({ value, fee, memo }: sendQueryFeeEnabledChannelResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendFee: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryFeeEnabledChannelResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.fee({ value: Fee.fromPartial(value) }) + let msg = this.queryFeeEnabledChannelResponse({ value: QueryFeeEnabledChannelResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendFee: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryFeeEnabledChannelResponse: Could not broadcast Tx: '+ e.message) } }, @@ -610,482 +610,482 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMetadata({ value, fee, memo }: sendMetadataParams): Promise { + async sendMsgPayPacketFeeAsync({ value, fee, memo }: sendMsgPayPacketFeeAsyncParams): Promise { if (!signer) { - throw new Error('TxClient:sendMetadata: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPayPacketFeeAsync: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.metadata({ value: Metadata.fromPartial(value) }) + let msg = this.msgPayPacketFeeAsync({ value: MsgPayPacketFeeAsync.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMetadata: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPayPacketFeeAsync: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCounterpartyPayeeRequest({ value, fee, memo }: sendQueryCounterpartyPayeeRequestParams): Promise { + async sendQueryTotalRecvFeesResponse({ value, fee, memo }: sendQueryTotalRecvFeesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCounterpartyPayeeRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalRecvFeesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCounterpartyPayeeRequest({ value: QueryCounterpartyPayeeRequest.fromPartial(value) }) + let msg = this.queryTotalRecvFeesResponse({ value: QueryTotalRecvFeesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCounterpartyPayeeRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalRecvFeesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryFeeEnabledChannelsResponse({ value, fee, memo }: sendQueryFeeEnabledChannelsResponseParams): Promise { + async sendQueryIncentivizedPacketsRequest({ value, fee, memo }: sendQueryIncentivizedPacketsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryFeeEnabledChannelsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryIncentivizedPacketsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryFeeEnabledChannelsResponse({ value: QueryFeeEnabledChannelsResponse.fromPartial(value) }) + let msg = this.queryIncentivizedPacketsRequest({ value: QueryIncentivizedPacketsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryFeeEnabledChannelsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryIncentivizedPacketsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryIncentivizedPacketsForChannelResponse({ value, fee, memo }: sendQueryIncentivizedPacketsForChannelResponseParams): Promise { + async sendQueryTotalRecvFeesRequest({ value, fee, memo }: sendQueryTotalRecvFeesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryIncentivizedPacketsForChannelResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalRecvFeesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryIncentivizedPacketsForChannelResponse({ value: QueryIncentivizedPacketsForChannelResponse.fromPartial(value) }) + let msg = this.queryTotalRecvFeesRequest({ value: QueryTotalRecvFeesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryIncentivizedPacketsForChannelResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalRecvFeesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryCounterpartyPayeeResponse({ value, fee, memo }: sendQueryCounterpartyPayeeResponseParams): Promise { + async sendMsgRegisterPayee({ value, fee, memo }: sendMsgRegisterPayeeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryCounterpartyPayeeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterPayee: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryCounterpartyPayeeResponse({ value: QueryCounterpartyPayeeResponse.fromPartial(value) }) + let msg = this.msgRegisterPayee({ value: MsgRegisterPayee.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryCounterpartyPayeeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterPayee: Could not broadcast Tx: '+ e.message) } }, - async sendQueryFeeEnabledChannelResponse({ value, fee, memo }: sendQueryFeeEnabledChannelResponseParams): Promise { + async sendMsgPayPacketFee({ value, fee, memo }: sendMsgPayPacketFeeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryFeeEnabledChannelResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPayPacketFee: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryFeeEnabledChannelResponse({ value: QueryFeeEnabledChannelResponse.fromPartial(value) }) + let msg = this.msgPayPacketFee({ value: MsgPayPacketFee.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryFeeEnabledChannelResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPayPacketFee: Could not broadcast Tx: '+ e.message) } }, - async sendPacketFee({ value, fee, memo }: sendPacketFeeParams): Promise { + async sendQueryPayeeRequest({ value, fee, memo }: sendQueryPayeeRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendPacketFee: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPayeeRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.packetFee({ value: PacketFee.fromPartial(value) }) + let msg = this.queryPayeeRequest({ value: QueryPayeeRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPacketFee: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPayeeRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryFeeEnabledChannelsResponse({ value, fee, memo }: sendQueryFeeEnabledChannelsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryFeeEnabledChannelsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryFeeEnabledChannelsResponse({ value: QueryFeeEnabledChannelsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryFeeEnabledChannelsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendForwardRelayerAddress({ value, fee, memo }: sendForwardRelayerAddressParams): Promise { + async sendIdentifiedPacketFees({ value, fee, memo }: sendIdentifiedPacketFeesParams): Promise { if (!signer) { - throw new Error('TxClient:sendForwardRelayerAddress: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendIdentifiedPacketFees: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.forwardRelayerAddress({ value: ForwardRelayerAddress.fromPartial(value) }) + let msg = this.identifiedPacketFees({ value: IdentifiedPacketFees.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendForwardRelayerAddress: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendIdentifiedPacketFees: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPayPacketFee({ value, fee, memo }: sendMsgPayPacketFeeParams): Promise { + async sendMsgRegisterCounterpartyPayeeResponse({ value, fee, memo }: sendMsgRegisterCounterpartyPayeeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPayPacketFee: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterCounterpartyPayeeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPayPacketFee({ value: MsgPayPacketFee.fromPartial(value) }) + let msg = this.msgRegisterCounterpartyPayeeResponse({ value: MsgRegisterCounterpartyPayeeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPayPacketFee: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterCounterpartyPayeeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryIncentivizedPacketRequest({ value, fee, memo }: sendQueryIncentivizedPacketRequestParams): Promise { + async sendMsgRegisterCounterpartyPayee({ value, fee, memo }: sendMsgRegisterCounterpartyPayeeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryIncentivizedPacketRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterCounterpartyPayee: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryIncentivizedPacketRequest({ value: QueryIncentivizedPacketRequest.fromPartial(value) }) + let msg = this.msgRegisterCounterpartyPayee({ value: MsgRegisterCounterpartyPayee.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryIncentivizedPacketRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterCounterpartyPayee: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRegisterCounterpartyPayee({ value, fee, memo }: sendMsgRegisterCounterpartyPayeeParams): Promise { + async sendQueryIncentivizedPacketsResponse({ value, fee, memo }: sendQueryIncentivizedPacketsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRegisterCounterpartyPayee: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryIncentivizedPacketsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRegisterCounterpartyPayee({ value: MsgRegisterCounterpartyPayee.fromPartial(value) }) + let msg = this.queryIncentivizedPacketsResponse({ value: QueryIncentivizedPacketsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRegisterCounterpartyPayee: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryIncentivizedPacketsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryFeeEnabledChannelsRequest({ value, fee, memo }: sendQueryFeeEnabledChannelsRequestParams): Promise { + async sendMsgPayPacketFeeResponse({ value, fee, memo }: sendMsgPayPacketFeeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryFeeEnabledChannelsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPayPacketFeeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryFeeEnabledChannelsRequest({ value: QueryFeeEnabledChannelsRequest.fromPartial(value) }) + let msg = this.msgPayPacketFeeResponse({ value: MsgPayPacketFeeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryFeeEnabledChannelsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPayPacketFeeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendIncentivizedAcknowledgement({ value, fee, memo }: sendIncentivizedAcknowledgementParams): Promise { + async sendMsgPayPacketFeeAsyncResponse({ value, fee, memo }: sendMsgPayPacketFeeAsyncResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendIncentivizedAcknowledgement: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPayPacketFeeAsyncResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.incentivizedAcknowledgement({ value: IncentivizedAcknowledgement.fromPartial(value) }) + let msg = this.msgPayPacketFeeAsyncResponse({ value: MsgPayPacketFeeAsyncResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendIncentivizedAcknowledgement: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPayPacketFeeAsyncResponse: Could not broadcast Tx: '+ e.message) } }, - async sendFeeEnabledChannel({ value, fee, memo }: sendFeeEnabledChannelParams): Promise { + async sendQueryCounterpartyPayeeRequest({ value, fee, memo }: sendQueryCounterpartyPayeeRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendFeeEnabledChannel: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryCounterpartyPayeeRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.feeEnabledChannel({ value: FeeEnabledChannel.fromPartial(value) }) + let msg = this.queryCounterpartyPayeeRequest({ value: QueryCounterpartyPayeeRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendFeeEnabledChannel: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryCounterpartyPayeeRequest: Could not broadcast Tx: '+ e.message) } }, - async sendRegisteredCounterpartyPayee({ value, fee, memo }: sendRegisteredCounterpartyPayeeParams): Promise { + async sendPacketFee({ value, fee, memo }: sendPacketFeeParams): Promise { if (!signer) { - throw new Error('TxClient:sendRegisteredCounterpartyPayee: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPacketFee: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.registeredCounterpartyPayee({ value: RegisteredCounterpartyPayee.fromPartial(value) }) + let msg = this.packetFee({ value: PacketFee.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendRegisteredCounterpartyPayee: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPacketFee: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPayPacketFeeAsync({ value, fee, memo }: sendMsgPayPacketFeeAsyncParams): Promise { + async sendMsgRegisterPayeeResponse({ value, fee, memo }: sendMsgRegisterPayeeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPayPacketFeeAsync: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterPayeeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPayPacketFeeAsync({ value: MsgPayPacketFeeAsync.fromPartial(value) }) + let msg = this.msgRegisterPayeeResponse({ value: MsgRegisterPayeeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPayPacketFeeAsync: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterPayeeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRegisterCounterpartyPayeeResponse({ value, fee, memo }: sendMsgRegisterCounterpartyPayeeResponseParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRegisterCounterpartyPayeeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRegisterCounterpartyPayeeResponse({ value: MsgRegisterCounterpartyPayeeResponse.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRegisterCounterpartyPayeeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendIdentifiedPacketFees({ value, fee, memo }: sendIdentifiedPacketFeesParams): Promise { + async sendQueryTotalAckFeesRequest({ value, fee, memo }: sendQueryTotalAckFeesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendIdentifiedPacketFees: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalAckFeesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.identifiedPacketFees({ value: IdentifiedPacketFees.fromPartial(value) }) + let msg = this.queryTotalAckFeesRequest({ value: QueryTotalAckFeesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendIdentifiedPacketFees: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalAckFeesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendRegisteredPayee({ value, fee, memo }: sendRegisteredPayeeParams): Promise { + async sendQueryPayeeResponse({ value, fee, memo }: sendQueryPayeeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendRegisteredPayee: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPayeeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.registeredPayee({ value: RegisteredPayee.fromPartial(value) }) + let msg = this.queryPayeeResponse({ value: QueryPayeeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendRegisteredPayee: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPayeeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryIncentivizedPacketsResponse({ value, fee, memo }: sendQueryIncentivizedPacketsResponseParams): Promise { + async sendFee({ value, fee, memo }: sendFeeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryIncentivizedPacketsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendFee: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryIncentivizedPacketsResponse({ value: QueryIncentivizedPacketsResponse.fromPartial(value) }) + let msg = this.fee({ value: Fee.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryIncentivizedPacketsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendFee: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPayeeResponse({ value, fee, memo }: sendQueryPayeeResponseParams): Promise { + async sendRegisteredCounterpartyPayee({ value, fee, memo }: sendRegisteredCounterpartyPayeeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPayeeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRegisteredCounterpartyPayee: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPayeeResponse({ value: QueryPayeeResponse.fromPartial(value) }) + let msg = this.registeredCounterpartyPayee({ value: RegisteredCounterpartyPayee.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPayeeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRegisteredCounterpartyPayee: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRegisterPayee({ value, fee, memo }: sendMsgRegisterPayeeParams): Promise { + async sendForwardRelayerAddress({ value, fee, memo }: sendForwardRelayerAddressParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRegisterPayee: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendForwardRelayerAddress: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRegisterPayee({ value: MsgRegisterPayee.fromPartial(value) }) + let msg = this.forwardRelayerAddress({ value: ForwardRelayerAddress.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRegisterPayee: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendForwardRelayerAddress: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalTimeoutFeesRequest({ value, fee, memo }: sendQueryTotalTimeoutFeesRequestParams): Promise { + async sendQueryIncentivizedPacketsForChannelRequest({ value, fee, memo }: sendQueryIncentivizedPacketsForChannelRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalTimeoutFeesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryIncentivizedPacketsForChannelRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalTimeoutFeesRequest({ value: QueryTotalTimeoutFeesRequest.fromPartial(value) }) + let msg = this.queryIncentivizedPacketsForChannelRequest({ value: QueryIncentivizedPacketsForChannelRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalTimeoutFeesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryIncentivizedPacketsForChannelRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPayeeRequest({ value, fee, memo }: sendQueryPayeeRequestParams): Promise { + async sendQueryIncentivizedPacketsForChannelResponse({ value, fee, memo }: sendQueryIncentivizedPacketsForChannelResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPayeeRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryIncentivizedPacketsForChannelResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPayeeRequest({ value: QueryPayeeRequest.fromPartial(value) }) + let msg = this.queryIncentivizedPacketsForChannelResponse({ value: QueryIncentivizedPacketsForChannelResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPayeeRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryIncentivizedPacketsForChannelResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRegisterPayeeResponse({ value, fee, memo }: sendMsgRegisterPayeeResponseParams): Promise { + async sendQueryFeeEnabledChannelRequest({ value, fee, memo }: sendQueryFeeEnabledChannelRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRegisterPayeeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryFeeEnabledChannelRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRegisterPayeeResponse({ value: MsgRegisterPayeeResponse.fromPartial(value) }) + let msg = this.queryFeeEnabledChannelRequest({ value: QueryFeeEnabledChannelRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRegisterPayeeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryFeeEnabledChannelRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPayPacketFeeAsyncResponse({ value, fee, memo }: sendMsgPayPacketFeeAsyncResponseParams): Promise { + async sendRegisteredPayee({ value, fee, memo }: sendRegisteredPayeeParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPayPacketFeeAsyncResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendRegisteredPayee: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPayPacketFeeAsyncResponse({ value: MsgPayPacketFeeAsyncResponse.fromPartial(value) }) + let msg = this.registeredPayee({ value: RegisteredPayee.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPayPacketFeeAsyncResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendRegisteredPayee: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalAckFeesRequest({ value, fee, memo }: sendQueryTotalAckFeesRequestParams): Promise { + async sendQueryIncentivizedPacketResponse({ value, fee, memo }: sendQueryIncentivizedPacketResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalAckFeesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryIncentivizedPacketResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalAckFeesRequest({ value: QueryTotalAckFeesRequest.fromPartial(value) }) + let msg = this.queryIncentivizedPacketResponse({ value: QueryIncentivizedPacketResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalAckFeesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryIncentivizedPacketResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalAckFeesResponse({ value, fee, memo }: sendQueryTotalAckFeesResponseParams): Promise { + async sendMetadata({ value, fee, memo }: sendMetadataParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalAckFeesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMetadata: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalAckFeesResponse({ value: QueryTotalAckFeesResponse.fromPartial(value) }) + let msg = this.metadata({ value: Metadata.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalAckFeesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMetadata: Could not broadcast Tx: '+ e.message) } }, - queryIncentivizedPacketsForChannelRequest({ value }: queryIncentivizedPacketsForChannelRequestParams): EncodeObject { + queryFeeEnabledChannelsRequest({ value }: queryFeeEnabledChannelsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelRequest", value: QueryIncentivizedPacketsForChannelRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryFeeEnabledChannelsRequest", value: QueryFeeEnabledChannelsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryIncentivizedPacketsForChannelRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryFeeEnabledChannelsRequest: Could not create message: ' + e.message) } }, - queryTotalRecvFeesRequest({ value }: queryTotalRecvFeesRequestParams): EncodeObject { + incentivizedAcknowledgement({ value }: incentivizedAcknowledgementParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryTotalRecvFeesRequest", value: QueryTotalRecvFeesRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.IncentivizedAcknowledgement", value: IncentivizedAcknowledgement.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalRecvFeesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:IncentivizedAcknowledgement: Could not create message: ' + e.message) } }, - queryTotalRecvFeesResponse({ value }: queryTotalRecvFeesResponseParams): EncodeObject { + feeEnabledChannel({ value }: feeEnabledChannelParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryTotalRecvFeesResponse", value: QueryTotalRecvFeesResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.FeeEnabledChannel", value: FeeEnabledChannel.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalRecvFeesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:FeeEnabledChannel: Could not create message: ' + e.message) } }, - queryTotalTimeoutFeesResponse({ value }: queryTotalTimeoutFeesResponseParams): EncodeObject { + queryIncentivizedPacketRequest({ value }: queryIncentivizedPacketRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse", value: QueryTotalTimeoutFeesResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketRequest", value: QueryIncentivizedPacketRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalTimeoutFeesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryIncentivizedPacketRequest: Could not create message: ' + e.message) } }, - queryFeeEnabledChannelRequest({ value }: queryFeeEnabledChannelRequestParams): EncodeObject { + queryCounterpartyPayeeResponse({ value }: queryCounterpartyPayeeResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryFeeEnabledChannelRequest", value: QueryFeeEnabledChannelRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryCounterpartyPayeeResponse", value: QueryCounterpartyPayeeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryFeeEnabledChannelRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCounterpartyPayeeResponse: Could not create message: ' + e.message) } }, - msgPayPacketFeeResponse({ value }: msgPayPacketFeeResponseParams): EncodeObject { + queryTotalAckFeesResponse({ value }: queryTotalAckFeesResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeResponse", value: MsgPayPacketFeeResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryTotalAckFeesResponse", value: QueryTotalAckFeesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPayPacketFeeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalAckFeesResponse: Could not create message: ' + e.message) } }, - queryIncentivizedPacketsRequest({ value }: queryIncentivizedPacketsRequestParams): EncodeObject { + queryTotalTimeoutFeesRequest({ value }: queryTotalTimeoutFeesRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketsRequest", value: QueryIncentivizedPacketsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest", value: QueryTotalTimeoutFeesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryIncentivizedPacketsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalTimeoutFeesRequest: Could not create message: ' + e.message) } }, - queryIncentivizedPacketResponse({ value }: queryIncentivizedPacketResponseParams): EncodeObject { + queryTotalTimeoutFeesResponse({ value }: queryTotalTimeoutFeesResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketResponse", value: QueryIncentivizedPacketResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse", value: QueryTotalTimeoutFeesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryIncentivizedPacketResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalTimeoutFeesResponse: Could not create message: ' + e.message) } }, - fee({ value }: feeParams): EncodeObject { + queryFeeEnabledChannelResponse({ value }: queryFeeEnabledChannelResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.Fee", value: Fee.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryFeeEnabledChannelResponse", value: QueryFeeEnabledChannelResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Fee: Could not create message: ' + e.message) + throw new Error('TxClient:QueryFeeEnabledChannelResponse: Could not create message: ' + e.message) } }, @@ -1097,235 +1097,235 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - metadata({ value }: metadataParams): EncodeObject { + msgPayPacketFeeAsync({ value }: msgPayPacketFeeAsyncParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.Metadata", value: Metadata.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeAsync", value: MsgPayPacketFeeAsync.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Metadata: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPayPacketFeeAsync: Could not create message: ' + e.message) } }, - queryCounterpartyPayeeRequest({ value }: queryCounterpartyPayeeRequestParams): EncodeObject { + queryTotalRecvFeesResponse({ value }: queryTotalRecvFeesResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryCounterpartyPayeeRequest", value: QueryCounterpartyPayeeRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryTotalRecvFeesResponse", value: QueryTotalRecvFeesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCounterpartyPayeeRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalRecvFeesResponse: Could not create message: ' + e.message) } }, - queryFeeEnabledChannelsResponse({ value }: queryFeeEnabledChannelsResponseParams): EncodeObject { + queryIncentivizedPacketsRequest({ value }: queryIncentivizedPacketsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryFeeEnabledChannelsResponse", value: QueryFeeEnabledChannelsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketsRequest", value: QueryIncentivizedPacketsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryFeeEnabledChannelsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryIncentivizedPacketsRequest: Could not create message: ' + e.message) } }, - queryIncentivizedPacketsForChannelResponse({ value }: queryIncentivizedPacketsForChannelResponseParams): EncodeObject { + queryTotalRecvFeesRequest({ value }: queryTotalRecvFeesRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelResponse", value: QueryIncentivizedPacketsForChannelResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryTotalRecvFeesRequest", value: QueryTotalRecvFeesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryIncentivizedPacketsForChannelResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalRecvFeesRequest: Could not create message: ' + e.message) } }, - queryCounterpartyPayeeResponse({ value }: queryCounterpartyPayeeResponseParams): EncodeObject { + msgRegisterPayee({ value }: msgRegisterPayeeParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryCounterpartyPayeeResponse", value: QueryCounterpartyPayeeResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.MsgRegisterPayee", value: MsgRegisterPayee.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryCounterpartyPayeeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRegisterPayee: Could not create message: ' + e.message) } }, - queryFeeEnabledChannelResponse({ value }: queryFeeEnabledChannelResponseParams): EncodeObject { + msgPayPacketFee({ value }: msgPayPacketFeeParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryFeeEnabledChannelResponse", value: QueryFeeEnabledChannelResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFee", value: MsgPayPacketFee.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryFeeEnabledChannelResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPayPacketFee: Could not create message: ' + e.message) } }, - packetFee({ value }: packetFeeParams): EncodeObject { + queryPayeeRequest({ value }: queryPayeeRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.PacketFee", value: PacketFee.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryPayeeRequest", value: QueryPayeeRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:PacketFee: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPayeeRequest: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryFeeEnabledChannelsResponse({ value }: queryFeeEnabledChannelsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryFeeEnabledChannelsResponse", value: QueryFeeEnabledChannelsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryFeeEnabledChannelsResponse: Could not create message: ' + e.message) } }, - forwardRelayerAddress({ value }: forwardRelayerAddressParams): EncodeObject { + identifiedPacketFees({ value }: identifiedPacketFeesParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.ForwardRelayerAddress", value: ForwardRelayerAddress.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.IdentifiedPacketFees", value: IdentifiedPacketFees.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ForwardRelayerAddress: Could not create message: ' + e.message) + throw new Error('TxClient:IdentifiedPacketFees: Could not create message: ' + e.message) } }, - msgPayPacketFee({ value }: msgPayPacketFeeParams): EncodeObject { + msgRegisterCounterpartyPayeeResponse({ value }: msgRegisterCounterpartyPayeeResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFee", value: MsgPayPacketFee.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayeeResponse", value: MsgRegisterCounterpartyPayeeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPayPacketFee: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRegisterCounterpartyPayeeResponse: Could not create message: ' + e.message) } }, - queryIncentivizedPacketRequest({ value }: queryIncentivizedPacketRequestParams): EncodeObject { + msgRegisterCounterpartyPayee({ value }: msgRegisterCounterpartyPayeeParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketRequest", value: QueryIncentivizedPacketRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", value: MsgRegisterCounterpartyPayee.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryIncentivizedPacketRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRegisterCounterpartyPayee: Could not create message: ' + e.message) } }, - msgRegisterCounterpartyPayee({ value }: msgRegisterCounterpartyPayeeParams): EncodeObject { + queryIncentivizedPacketsResponse({ value }: queryIncentivizedPacketsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", value: MsgRegisterCounterpartyPayee.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketsResponse", value: QueryIncentivizedPacketsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRegisterCounterpartyPayee: Could not create message: ' + e.message) + throw new Error('TxClient:QueryIncentivizedPacketsResponse: Could not create message: ' + e.message) } }, - queryFeeEnabledChannelsRequest({ value }: queryFeeEnabledChannelsRequestParams): EncodeObject { + msgPayPacketFeeResponse({ value }: msgPayPacketFeeResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryFeeEnabledChannelsRequest", value: QueryFeeEnabledChannelsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeResponse", value: MsgPayPacketFeeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryFeeEnabledChannelsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPayPacketFeeResponse: Could not create message: ' + e.message) } }, - incentivizedAcknowledgement({ value }: incentivizedAcknowledgementParams): EncodeObject { + msgPayPacketFeeAsyncResponse({ value }: msgPayPacketFeeAsyncResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.IncentivizedAcknowledgement", value: IncentivizedAcknowledgement.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeAsyncResponse", value: MsgPayPacketFeeAsyncResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:IncentivizedAcknowledgement: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPayPacketFeeAsyncResponse: Could not create message: ' + e.message) } }, - feeEnabledChannel({ value }: feeEnabledChannelParams): EncodeObject { + queryCounterpartyPayeeRequest({ value }: queryCounterpartyPayeeRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.FeeEnabledChannel", value: FeeEnabledChannel.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryCounterpartyPayeeRequest", value: QueryCounterpartyPayeeRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:FeeEnabledChannel: Could not create message: ' + e.message) + throw new Error('TxClient:QueryCounterpartyPayeeRequest: Could not create message: ' + e.message) } }, - registeredCounterpartyPayee({ value }: registeredCounterpartyPayeeParams): EncodeObject { + packetFee({ value }: packetFeeParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.RegisteredCounterpartyPayee", value: RegisteredCounterpartyPayee.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.PacketFee", value: PacketFee.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:RegisteredCounterpartyPayee: Could not create message: ' + e.message) + throw new Error('TxClient:PacketFee: Could not create message: ' + e.message) } }, - msgPayPacketFeeAsync({ value }: msgPayPacketFeeAsyncParams): EncodeObject { + msgRegisterPayeeResponse({ value }: msgRegisterPayeeResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeAsync", value: MsgPayPacketFeeAsync.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.MsgRegisterPayeeResponse", value: MsgRegisterPayeeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPayPacketFeeAsync: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRegisterPayeeResponse: Could not create message: ' + e.message) } }, - msgRegisterCounterpartyPayeeResponse({ value }: msgRegisterCounterpartyPayeeResponseParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayeeResponse", value: MsgRegisterCounterpartyPayeeResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRegisterCounterpartyPayeeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - identifiedPacketFees({ value }: identifiedPacketFeesParams): EncodeObject { + queryTotalAckFeesRequest({ value }: queryTotalAckFeesRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.IdentifiedPacketFees", value: IdentifiedPacketFees.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryTotalAckFeesRequest", value: QueryTotalAckFeesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:IdentifiedPacketFees: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalAckFeesRequest: Could not create message: ' + e.message) } }, - registeredPayee({ value }: registeredPayeeParams): EncodeObject { + queryPayeeResponse({ value }: queryPayeeResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.RegisteredPayee", value: RegisteredPayee.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryPayeeResponse", value: QueryPayeeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:RegisteredPayee: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPayeeResponse: Could not create message: ' + e.message) } }, - queryIncentivizedPacketsResponse({ value }: queryIncentivizedPacketsResponseParams): EncodeObject { + fee({ value }: feeParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketsResponse", value: QueryIncentivizedPacketsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.Fee", value: Fee.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryIncentivizedPacketsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Fee: Could not create message: ' + e.message) } }, - queryPayeeResponse({ value }: queryPayeeResponseParams): EncodeObject { + registeredCounterpartyPayee({ value }: registeredCounterpartyPayeeParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryPayeeResponse", value: QueryPayeeResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.RegisteredCounterpartyPayee", value: RegisteredCounterpartyPayee.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPayeeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:RegisteredCounterpartyPayee: Could not create message: ' + e.message) } }, - msgRegisterPayee({ value }: msgRegisterPayeeParams): EncodeObject { + forwardRelayerAddress({ value }: forwardRelayerAddressParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.MsgRegisterPayee", value: MsgRegisterPayee.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.ForwardRelayerAddress", value: ForwardRelayerAddress.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRegisterPayee: Could not create message: ' + e.message) + throw new Error('TxClient:ForwardRelayerAddress: Could not create message: ' + e.message) } }, - queryTotalTimeoutFeesRequest({ value }: queryTotalTimeoutFeesRequestParams): EncodeObject { + queryIncentivizedPacketsForChannelRequest({ value }: queryIncentivizedPacketsForChannelRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest", value: QueryTotalTimeoutFeesRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelRequest", value: QueryIncentivizedPacketsForChannelRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalTimeoutFeesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryIncentivizedPacketsForChannelRequest: Could not create message: ' + e.message) } }, - queryPayeeRequest({ value }: queryPayeeRequestParams): EncodeObject { + queryIncentivizedPacketsForChannelResponse({ value }: queryIncentivizedPacketsForChannelResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryPayeeRequest", value: QueryPayeeRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelResponse", value: QueryIncentivizedPacketsForChannelResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPayeeRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryIncentivizedPacketsForChannelResponse: Could not create message: ' + e.message) } }, - msgRegisterPayeeResponse({ value }: msgRegisterPayeeResponseParams): EncodeObject { + queryFeeEnabledChannelRequest({ value }: queryFeeEnabledChannelRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.MsgRegisterPayeeResponse", value: MsgRegisterPayeeResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryFeeEnabledChannelRequest", value: QueryFeeEnabledChannelRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRegisterPayeeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryFeeEnabledChannelRequest: Could not create message: ' + e.message) } }, - msgPayPacketFeeAsyncResponse({ value }: msgPayPacketFeeAsyncResponseParams): EncodeObject { + registeredPayee({ value }: registeredPayeeParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeAsyncResponse", value: MsgPayPacketFeeAsyncResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.RegisteredPayee", value: RegisteredPayee.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPayPacketFeeAsyncResponse: Could not create message: ' + e.message) + throw new Error('TxClient:RegisteredPayee: Could not create message: ' + e.message) } }, - queryTotalAckFeesRequest({ value }: queryTotalAckFeesRequestParams): EncodeObject { + queryIncentivizedPacketResponse({ value }: queryIncentivizedPacketResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryTotalAckFeesRequest", value: QueryTotalAckFeesRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.QueryIncentivizedPacketResponse", value: QueryIncentivizedPacketResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalAckFeesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryIncentivizedPacketResponse: Could not create message: ' + e.message) } }, - queryTotalAckFeesResponse({ value }: queryTotalAckFeesResponseParams): EncodeObject { + metadata({ value }: metadataParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.fee.v1.QueryTotalAckFeesResponse", value: QueryTotalAckFeesResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.fee.v1.Metadata", value: Metadata.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalAckFeesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Metadata: Could not create message: ' + e.message) } }, diff --git a/ts-client/ibc.applications.fee.v1/registry.ts b/ts-client/ibc.applications.fee.v1/registry.ts index d525fe26..43ae9503 100755 --- a/ts-client/ibc.applications.fee.v1/registry.ts +++ b/ts-client/ibc.applications.fee.v1/registry.ts @@ -1,84 +1,84 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { QueryIncentivizedPacketsForChannelRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryTotalRecvFeesRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryTotalRecvFeesResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryTotalTimeoutFeesResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryFeeEnabledChannelRequest } from "./types/ibc/applications/fee/v1/query"; -import { MsgPayPacketFeeResponse } from "./types/ibc/applications/fee/v1/tx"; -import { QueryIncentivizedPacketsRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryIncentivizedPacketResponse } from "./types/ibc/applications/fee/v1/query"; -import { Fee } from "./types/ibc/applications/fee/v1/fee"; -import { PacketFees } from "./types/ibc/applications/fee/v1/fee"; -import { Metadata } from "./types/ibc/applications/fee/v1/metadata"; -import { QueryCounterpartyPayeeRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryFeeEnabledChannelsResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryIncentivizedPacketsForChannelResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryCounterpartyPayeeResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryFeeEnabledChannelResponse } from "./types/ibc/applications/fee/v1/query"; -import { PacketFee } from "./types/ibc/applications/fee/v1/fee"; -import { GenesisState } from "./types/ibc/applications/fee/v1/genesis"; -import { ForwardRelayerAddress } from "./types/ibc/applications/fee/v1/genesis"; -import { MsgPayPacketFee } from "./types/ibc/applications/fee/v1/tx"; -import { QueryIncentivizedPacketRequest } from "./types/ibc/applications/fee/v1/query"; -import { MsgRegisterCounterpartyPayee } from "./types/ibc/applications/fee/v1/tx"; -import { QueryFeeEnabledChannelsRequest } from "./types/ibc/applications/fee/v1/query"; -import { IncentivizedAcknowledgement } from "./types/ibc/applications/fee/v1/ack"; -import { FeeEnabledChannel } from "./types/ibc/applications/fee/v1/genesis"; -import { RegisteredCounterpartyPayee } from "./types/ibc/applications/fee/v1/genesis"; -import { MsgPayPacketFeeAsync } from "./types/ibc/applications/fee/v1/tx"; -import { MsgRegisterCounterpartyPayeeResponse } from "./types/ibc/applications/fee/v1/tx"; -import { IdentifiedPacketFees } from "./types/ibc/applications/fee/v1/fee"; -import { RegisteredPayee } from "./types/ibc/applications/fee/v1/genesis"; -import { QueryIncentivizedPacketsResponse } from "./types/ibc/applications/fee/v1/query"; -import { QueryPayeeResponse } from "./types/ibc/applications/fee/v1/query"; -import { MsgRegisterPayee } from "./types/ibc/applications/fee/v1/tx"; -import { QueryTotalTimeoutFeesRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryPayeeRequest } from "./types/ibc/applications/fee/v1/query"; -import { MsgRegisterPayeeResponse } from "./types/ibc/applications/fee/v1/tx"; -import { MsgPayPacketFeeAsyncResponse } from "./types/ibc/applications/fee/v1/tx"; -import { QueryTotalAckFeesRequest } from "./types/ibc/applications/fee/v1/query"; -import { QueryTotalAckFeesResponse } from "./types/ibc/applications/fee/v1/query"; +import { QueryFeeEnabledChannelsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { IncentivizedAcknowledgement } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/ack"; +import { FeeEnabledChannel } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { QueryIncentivizedPacketRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryCounterpartyPayeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryTotalAckFeesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryTotalTimeoutFeesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryTotalTimeoutFeesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryFeeEnabledChannelResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { PacketFees } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/fee"; +import { MsgPayPacketFeeAsync } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { QueryTotalRecvFeesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryIncentivizedPacketsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryTotalRecvFeesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { MsgRegisterPayee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { MsgPayPacketFee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { QueryPayeeRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryFeeEnabledChannelsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { IdentifiedPacketFees } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/fee"; +import { MsgRegisterCounterpartyPayeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { MsgRegisterCounterpartyPayee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { QueryIncentivizedPacketsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { MsgPayPacketFeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { MsgPayPacketFeeAsyncResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { QueryCounterpartyPayeeRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { PacketFee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/fee"; +import { MsgRegisterPayeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { QueryTotalAckFeesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryPayeeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { Fee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/fee"; +import { RegisteredCounterpartyPayee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { ForwardRelayerAddress } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { QueryIncentivizedPacketsForChannelRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryIncentivizedPacketsForChannelResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { QueryFeeEnabledChannelRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { RegisteredPayee } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/genesis"; +import { QueryIncentivizedPacketResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/query"; +import { Metadata } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/fee/v1/metadata"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelRequest", QueryIncentivizedPacketsForChannelRequest], - ["/ibc.applications.fee.v1.QueryTotalRecvFeesRequest", QueryTotalRecvFeesRequest], - ["/ibc.applications.fee.v1.QueryTotalRecvFeesResponse", QueryTotalRecvFeesResponse], - ["/ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse", QueryTotalTimeoutFeesResponse], - ["/ibc.applications.fee.v1.QueryFeeEnabledChannelRequest", QueryFeeEnabledChannelRequest], - ["/ibc.applications.fee.v1.MsgPayPacketFeeResponse", MsgPayPacketFeeResponse], - ["/ibc.applications.fee.v1.QueryIncentivizedPacketsRequest", QueryIncentivizedPacketsRequest], - ["/ibc.applications.fee.v1.QueryIncentivizedPacketResponse", QueryIncentivizedPacketResponse], - ["/ibc.applications.fee.v1.Fee", Fee], - ["/ibc.applications.fee.v1.PacketFees", PacketFees], - ["/ibc.applications.fee.v1.Metadata", Metadata], - ["/ibc.applications.fee.v1.QueryCounterpartyPayeeRequest", QueryCounterpartyPayeeRequest], - ["/ibc.applications.fee.v1.QueryFeeEnabledChannelsResponse", QueryFeeEnabledChannelsResponse], - ["/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelResponse", QueryIncentivizedPacketsForChannelResponse], - ["/ibc.applications.fee.v1.QueryCounterpartyPayeeResponse", QueryCounterpartyPayeeResponse], - ["/ibc.applications.fee.v1.QueryFeeEnabledChannelResponse", QueryFeeEnabledChannelResponse], - ["/ibc.applications.fee.v1.PacketFee", PacketFee], - ["/ibc.applications.fee.v1.GenesisState", GenesisState], - ["/ibc.applications.fee.v1.ForwardRelayerAddress", ForwardRelayerAddress], - ["/ibc.applications.fee.v1.MsgPayPacketFee", MsgPayPacketFee], - ["/ibc.applications.fee.v1.QueryIncentivizedPacketRequest", QueryIncentivizedPacketRequest], - ["/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", MsgRegisterCounterpartyPayee], ["/ibc.applications.fee.v1.QueryFeeEnabledChannelsRequest", QueryFeeEnabledChannelsRequest], ["/ibc.applications.fee.v1.IncentivizedAcknowledgement", IncentivizedAcknowledgement], ["/ibc.applications.fee.v1.FeeEnabledChannel", FeeEnabledChannel], - ["/ibc.applications.fee.v1.RegisteredCounterpartyPayee", RegisteredCounterpartyPayee], + ["/ibc.applications.fee.v1.QueryIncentivizedPacketRequest", QueryIncentivizedPacketRequest], + ["/ibc.applications.fee.v1.QueryCounterpartyPayeeResponse", QueryCounterpartyPayeeResponse], + ["/ibc.applications.fee.v1.QueryTotalAckFeesResponse", QueryTotalAckFeesResponse], + ["/ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest", QueryTotalTimeoutFeesRequest], + ["/ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse", QueryTotalTimeoutFeesResponse], + ["/ibc.applications.fee.v1.QueryFeeEnabledChannelResponse", QueryFeeEnabledChannelResponse], + ["/ibc.applications.fee.v1.PacketFees", PacketFees], ["/ibc.applications.fee.v1.MsgPayPacketFeeAsync", MsgPayPacketFeeAsync], - ["/ibc.applications.fee.v1.MsgRegisterCounterpartyPayeeResponse", MsgRegisterCounterpartyPayeeResponse], - ["/ibc.applications.fee.v1.IdentifiedPacketFees", IdentifiedPacketFees], - ["/ibc.applications.fee.v1.RegisteredPayee", RegisteredPayee], - ["/ibc.applications.fee.v1.QueryIncentivizedPacketsResponse", QueryIncentivizedPacketsResponse], - ["/ibc.applications.fee.v1.QueryPayeeResponse", QueryPayeeResponse], + ["/ibc.applications.fee.v1.QueryTotalRecvFeesResponse", QueryTotalRecvFeesResponse], + ["/ibc.applications.fee.v1.QueryIncentivizedPacketsRequest", QueryIncentivizedPacketsRequest], + ["/ibc.applications.fee.v1.QueryTotalRecvFeesRequest", QueryTotalRecvFeesRequest], ["/ibc.applications.fee.v1.MsgRegisterPayee", MsgRegisterPayee], - ["/ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest", QueryTotalTimeoutFeesRequest], + ["/ibc.applications.fee.v1.MsgPayPacketFee", MsgPayPacketFee], ["/ibc.applications.fee.v1.QueryPayeeRequest", QueryPayeeRequest], - ["/ibc.applications.fee.v1.MsgRegisterPayeeResponse", MsgRegisterPayeeResponse], + ["/ibc.applications.fee.v1.QueryFeeEnabledChannelsResponse", QueryFeeEnabledChannelsResponse], + ["/ibc.applications.fee.v1.IdentifiedPacketFees", IdentifiedPacketFees], + ["/ibc.applications.fee.v1.MsgRegisterCounterpartyPayeeResponse", MsgRegisterCounterpartyPayeeResponse], + ["/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", MsgRegisterCounterpartyPayee], + ["/ibc.applications.fee.v1.QueryIncentivizedPacketsResponse", QueryIncentivizedPacketsResponse], + ["/ibc.applications.fee.v1.MsgPayPacketFeeResponse", MsgPayPacketFeeResponse], ["/ibc.applications.fee.v1.MsgPayPacketFeeAsyncResponse", MsgPayPacketFeeAsyncResponse], + ["/ibc.applications.fee.v1.QueryCounterpartyPayeeRequest", QueryCounterpartyPayeeRequest], + ["/ibc.applications.fee.v1.PacketFee", PacketFee], + ["/ibc.applications.fee.v1.MsgRegisterPayeeResponse", MsgRegisterPayeeResponse], + ["/ibc.applications.fee.v1.GenesisState", GenesisState], ["/ibc.applications.fee.v1.QueryTotalAckFeesRequest", QueryTotalAckFeesRequest], - ["/ibc.applications.fee.v1.QueryTotalAckFeesResponse", QueryTotalAckFeesResponse], + ["/ibc.applications.fee.v1.QueryPayeeResponse", QueryPayeeResponse], + ["/ibc.applications.fee.v1.Fee", Fee], + ["/ibc.applications.fee.v1.RegisteredCounterpartyPayee", RegisteredCounterpartyPayee], + ["/ibc.applications.fee.v1.ForwardRelayerAddress", ForwardRelayerAddress], + ["/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelRequest", QueryIncentivizedPacketsForChannelRequest], + ["/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelResponse", QueryIncentivizedPacketsForChannelResponse], + ["/ibc.applications.fee.v1.QueryFeeEnabledChannelRequest", QueryFeeEnabledChannelRequest], + ["/ibc.applications.fee.v1.RegisteredPayee", RegisteredPayee], + ["/ibc.applications.fee.v1.QueryIncentivizedPacketResponse", QueryIncentivizedPacketResponse], + ["/ibc.applications.fee.v1.Metadata", Metadata], ]; diff --git a/ts-client/ibc.applications.fee.v1/types/amino/amino.ts b/ts-client/ibc.applications.fee.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/ibc.applications.fee.v1/types/amino/amino.ts +++ b/ts-client/ibc.applications.fee.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/ibc.applications.fee.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/ibc.applications.fee.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/ibc.applications.fee.v1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/ibc.applications.fee.v1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/ibc.applications.fee.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/ibc.applications.fee.v1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/ibc.applications.fee.v1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/ibc.applications.fee.v1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/ibc.applications.fee.v1/types/cosmos/msg/v1/msg.ts b/ts-client/ibc.applications.fee.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/ibc.applications.fee.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/ibc.applications.fee.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/ibc.applications.fee.v1/types/cosmos_proto/cosmos.ts b/ts-client/ibc.applications.fee.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/ibc.applications.fee.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/ibc.applications.fee.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/common/shared_types.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/commitments.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/genesis.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/module/module.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/packet.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/params.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/query.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/tx.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/pep/decryption_key.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/pep/genesis.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/pep/module/module.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/pep/params.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/pep/query.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/pep/request_id.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/fairyring/pep/tx.ts b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/gogoproto/gogo.ts b/ts-client/ibc.applications.fee.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/ibc.applications.fee.v1/types/gogoproto/gogo.ts +++ b/ts-client/ibc.applications.fee.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/ibc.applications.fee.v1/types/google/api/annotations.ts b/ts-client/ibc.applications.fee.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/ibc.applications.fee.v1/types/google/api/annotations.ts +++ b/ts-client/ibc.applications.fee.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/ibc.applications.fee.v1/types/google/api/http.ts b/ts-client/ibc.applications.fee.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/ibc.applications.fee.v1/types/google/api/http.ts +++ b/ts-client/ibc.applications.fee.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/google/protobuf/descriptor.ts b/ts-client/ibc.applications.fee.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/ibc.applications.fee.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/ibc.applications.fee.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/google/protobuf/duration.ts b/ts-client/ibc.applications.fee.v1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.fee.v1/types/route-name.eta b/ts-client/ibc.applications.fee.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/ibc.applications.fee.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/module.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/module.ts index 6dcb413a..90193ba6 100755 --- a/ts-client/ibc.applications.interchain_accounts.controller.v1/module.ts +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/module.ts @@ -6,32 +6,20 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgSendTx } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { Params } from "./types/ibc/applications/interchain_accounts/controller/v1/controller"; -import { QueryParamsRequest } from "./types/ibc/applications/interchain_accounts/controller/v1/query"; -import { QueryParamsResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/query"; -import { QueryInterchainAccountResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/query"; -import { MsgUpdateParams } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { QueryInterchainAccountRequest } from "./types/ibc/applications/interchain_accounts/controller/v1/query"; -import { MsgRegisterInterchainAccountResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { MsgRegisterInterchainAccount } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { MsgSendTxResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/controller"; +import { MsgSendTx } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { QueryInterchainAccountResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/query"; +import { QueryInterchainAccountRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/query"; +import { MsgRegisterInterchainAccountResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { MsgSendTxResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { MsgRegisterInterchainAccount } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; -export { MsgSendTx, MsgUpdateParamsResponse, Params, QueryParamsRequest, QueryParamsResponse, QueryInterchainAccountResponse, MsgUpdateParams, QueryInterchainAccountRequest, MsgRegisterInterchainAccountResponse, MsgRegisterInterchainAccount, MsgSendTxResponse }; - -type sendMsgSendTxParams = { - value: MsgSendTx, - fee?: StdFee, - memo?: string -}; - -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, - fee?: StdFee, - memo?: string -}; +export { Params, MsgSendTx, MsgUpdateParams, QueryInterchainAccountResponse, QueryInterchainAccountRequest, MsgRegisterInterchainAccountResponse, MsgSendTxResponse, MsgRegisterInterchainAccount, QueryParamsRequest, QueryParamsResponse, MsgUpdateParamsResponse }; type sendParamsParams = { value: Params, @@ -39,14 +27,14 @@ type sendParamsParams = { memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendMsgSendTxParams = { + value: MsgSendTx, fee?: StdFee, memo?: string }; -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; @@ -57,12 +45,6 @@ type sendQueryInterchainAccountResponseParams = { memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, - fee?: StdFee, - memo?: string -}; - type sendQueryInterchainAccountRequestParams = { value: QueryInterchainAccountRequest, fee?: StdFee, @@ -75,47 +57,53 @@ type sendMsgRegisterInterchainAccountResponseParams = { memo?: string }; +type sendMsgSendTxResponseParams = { + value: MsgSendTxResponse, + fee?: StdFee, + memo?: string +}; + type sendMsgRegisterInterchainAccountParams = { value: MsgRegisterInterchainAccount, fee?: StdFee, memo?: string }; -type sendMsgSendTxResponseParams = { - value: MsgSendTxResponse, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; - -type msgSendTxParams = { - value: MsgSendTx, +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, + fee?: StdFee, + memo?: string }; -type msgUpdateParamsResponseParams = { +type sendMsgUpdateParamsResponseParams = { value: MsgUpdateParamsResponse, + fee?: StdFee, + memo?: string }; + type paramsParams = { value: Params, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type msgSendTxParams = { + value: MsgSendTx, }; -type queryParamsResponseParams = { - value: QueryParamsResponse, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; type queryInterchainAccountResponseParams = { value: QueryInterchainAccountResponse, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, -}; - type queryInterchainAccountRequestParams = { value: QueryInterchainAccountRequest, }; @@ -124,12 +112,24 @@ type msgRegisterInterchainAccountResponseParams = { value: MsgRegisterInterchainAccountResponse, }; +type msgSendTxResponseParams = { + value: MsgSendTxResponse, +}; + type msgRegisterInterchainAccountParams = { value: MsgRegisterInterchainAccount, }; -type msgSendTxResponseParams = { - value: MsgSendTxResponse, +type queryParamsRequestParams = { + value: QueryParamsRequest, +}; + +type queryParamsResponseParams = { + value: QueryParamsResponse, +}; + +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; @@ -162,177 +162,161 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgSendTx({ value, fee, memo }: sendMsgSendTxParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSendTx: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSendTx({ value: MsgSendTx.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSendTx: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendMsgSendTx({ value, fee, memo }: sendMsgSendTxParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSendTx: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.msgSendTx({ value: MsgSendTx.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSendTx: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendQueryInterchainAccountResponse({ value, fee, memo }: sendQueryInterchainAccountResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryInterchainAccountResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.queryInterchainAccountResponse({ value: QueryInterchainAccountResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryInterchainAccountResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendQueryInterchainAccountRequest({ value, fee, memo }: sendQueryInterchainAccountRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryInterchainAccountRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.queryInterchainAccountRequest({ value: QueryInterchainAccountRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryInterchainAccountRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryInterchainAccountResponse({ value, fee, memo }: sendQueryInterchainAccountResponseParams): Promise { + async sendMsgRegisterInterchainAccountResponse({ value, fee, memo }: sendMsgRegisterInterchainAccountResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryInterchainAccountResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterInterchainAccountResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryInterchainAccountResponse({ value: QueryInterchainAccountResponse.fromPartial(value) }) + let msg = this.msgRegisterInterchainAccountResponse({ value: MsgRegisterInterchainAccountResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryInterchainAccountResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterInterchainAccountResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendMsgSendTxResponse({ value, fee, memo }: sendMsgSendTxResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSendTxResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.msgSendTxResponse({ value: MsgSendTxResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSendTxResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryInterchainAccountRequest({ value, fee, memo }: sendQueryInterchainAccountRequestParams): Promise { + async sendMsgRegisterInterchainAccount({ value, fee, memo }: sendMsgRegisterInterchainAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryInterchainAccountRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterInterchainAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryInterchainAccountRequest({ value: QueryInterchainAccountRequest.fromPartial(value) }) + let msg = this.msgRegisterInterchainAccount({ value: MsgRegisterInterchainAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryInterchainAccountRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterInterchainAccount: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRegisterInterchainAccountResponse({ value, fee, memo }: sendMsgRegisterInterchainAccountResponseParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRegisterInterchainAccountResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRegisterInterchainAccountResponse({ value: MsgRegisterInterchainAccountResponse.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRegisterInterchainAccountResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRegisterInterchainAccount({ value, fee, memo }: sendMsgRegisterInterchainAccountParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRegisterInterchainAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRegisterInterchainAccount({ value: MsgRegisterInterchainAccount.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRegisterInterchainAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSendTxResponse({ value, fee, memo }: sendMsgSendTxResponseParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSendTxResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSendTxResponse({ value: MsgSendTxResponse.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSendTxResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - msgSendTx({ value }: msgSendTxParams): EncodeObject { - try { - return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", value: MsgSendTx.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgSendTx: Could not create message: ' + e.message) - } - }, - - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { - try { - return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) - } - }, - params({ value }: paramsParams): EncodeObject { try { return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.Params", value: Params.fromPartial( value ) } @@ -341,19 +325,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + msgSendTx({ value }: msgSendTxParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", value: MsgSendTx.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSendTx: Could not create message: ' + e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, @@ -365,14 +349,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { - try { - return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) - } - }, - queryInterchainAccountRequest({ value }: queryInterchainAccountRequestParams): EncodeObject { try { return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountRequest", value: QueryInterchainAccountRequest.fromPartial( value ) } @@ -389,6 +365,14 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, + msgSendTxResponse({ value }: msgSendTxResponseParams): EncodeObject { + try { + return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse", value: MsgSendTxResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgSendTxResponse: Could not create message: ' + e.message) + } + }, + msgRegisterInterchainAccount({ value }: msgRegisterInterchainAccountParams): EncodeObject { try { return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", value: MsgRegisterInterchainAccount.fromPartial( value ) } @@ -397,11 +381,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgSendTxResponse({ value }: msgSendTxResponseParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse", value: MsgSendTxResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSendTxResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + } + }, + + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + try { + return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + } + }, + + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + try { + return { typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/registry.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/registry.ts index 9989ef83..5b8e6ea7 100755 --- a/ts-client/ibc.applications.interchain_accounts.controller.v1/registry.ts +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/registry.ts @@ -1,28 +1,28 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgSendTx } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { Params } from "./types/ibc/applications/interchain_accounts/controller/v1/controller"; -import { QueryParamsRequest } from "./types/ibc/applications/interchain_accounts/controller/v1/query"; -import { QueryParamsResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/query"; -import { QueryInterchainAccountResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/query"; -import { MsgUpdateParams } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { QueryInterchainAccountRequest } from "./types/ibc/applications/interchain_accounts/controller/v1/query"; -import { MsgRegisterInterchainAccountResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { MsgRegisterInterchainAccount } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; -import { MsgSendTxResponse } from "./types/ibc/applications/interchain_accounts/controller/v1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/controller"; +import { MsgSendTx } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { QueryInterchainAccountResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/query"; +import { QueryInterchainAccountRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/query"; +import { MsgRegisterInterchainAccountResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { MsgSendTxResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { MsgRegisterInterchainAccount } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/query"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/controller/v1/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", MsgSendTx], - ["/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], ["/ibc.applications.interchain_accounts.controller.v1.Params", Params], - ["/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest", QueryParamsRequest], - ["/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse", QueryParamsResponse], - ["/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse", QueryInterchainAccountResponse], + ["/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", MsgSendTx], ["/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams", MsgUpdateParams], + ["/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse", QueryInterchainAccountResponse], ["/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountRequest", QueryInterchainAccountRequest], ["/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse", MsgRegisterInterchainAccountResponse], - ["/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", MsgRegisterInterchainAccount], ["/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse", MsgSendTxResponse], + ["/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", MsgRegisterInterchainAccount], + ["/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest", QueryParamsRequest], + ["/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse", QueryParamsResponse], + ["/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], ]; diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/amino/amino.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/amino/amino.ts +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..effd5449 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} + +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + 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(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: 0 }; +} + +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/msg/v1/msg.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos_proto/cosmos.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/common/shared_types.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/commitments.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/genesis.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/module/module.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/packet.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/params.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/query.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/tx.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/decryption_key.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/genesis.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/module/module.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/params.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/query.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/request_id.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/tx.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/gogoproto/gogo.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/gogoproto/gogo.ts +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/api/annotations.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/api/annotations.ts +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/api/http.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/api/http.ts +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/protobuf/descriptor.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/protobuf/duration.ts b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.controller.v1/types/route-name.eta b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.controller.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/module.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/module.ts index 71438889..0fda8fe9 100755 --- a/ts-client/ibc.applications.interchain_accounts.host.v1/module.ts +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/module.ts @@ -6,26 +6,14 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { QueryParamsRequest } from "./types/ibc/applications/interchain_accounts/host/v1/query"; -import { QueryParamsResponse } from "./types/ibc/applications/interchain_accounts/host/v1/query"; -import { Params } from "./types/ibc/applications/interchain_accounts/host/v1/host"; -import { MsgUpdateParams } from "./types/ibc/applications/interchain_accounts/host/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/ibc/applications/interchain_accounts/host/v1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/host"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/tx"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/query"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/query"; -export { QueryParamsRequest, QueryParamsResponse, Params, MsgUpdateParams, MsgUpdateParamsResponse }; - -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, - fee?: StdFee, - memo?: string -}; - -type sendQueryParamsResponseParams = { - value: QueryParamsResponse, - fee?: StdFee, - memo?: string -}; +export { Params, MsgUpdateParams, MsgUpdateParamsResponse, QueryParamsResponse, QueryParamsRequest }; type sendParamsParams = { value: Params, @@ -45,14 +33,18 @@ type sendMsgUpdateParamsResponseParams = { memo?: string }; +type sendQueryParamsResponseParams = { + value: QueryParamsResponse, + fee?: StdFee, + memo?: string +}; -type queryParamsRequestParams = { +type sendQueryParamsRequestParams = { value: QueryParamsRequest, + fee?: StdFee, + memo?: string }; -type queryParamsResponseParams = { - value: QueryParamsResponse, -}; type paramsParams = { value: Params, @@ -66,6 +58,14 @@ type msgUpdateParamsResponseParams = { value: MsgUpdateParamsResponse, }; +type queryParamsResponseParams = { + value: QueryParamsResponse, +}; + +type queryParamsRequestParams = { + value: QueryParamsRequest, +}; + export const registry = new Registry(msgTypes); @@ -96,114 +96,114 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendQueryParamsResponse({ value, fee, memo }: sendQueryParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.queryParamsResponse({ value: QueryParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + queryParamsResponse({ value }: queryParamsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse", value: QueryParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsResponse: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/registry.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/registry.ts index ac2c4980..5fd8fe96 100755 --- a/ts-client/ibc.applications.interchain_accounts.host.v1/registry.ts +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/registry.ts @@ -1,16 +1,16 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { QueryParamsRequest } from "./types/ibc/applications/interchain_accounts/host/v1/query"; -import { QueryParamsResponse } from "./types/ibc/applications/interchain_accounts/host/v1/query"; -import { Params } from "./types/ibc/applications/interchain_accounts/host/v1/host"; -import { MsgUpdateParams } from "./types/ibc/applications/interchain_accounts/host/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/ibc/applications/interchain_accounts/host/v1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/host"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/tx"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/query"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/interchain_accounts/host/v1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest", QueryParamsRequest], - ["/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse", QueryParamsResponse], ["/ibc.applications.interchain_accounts.host.v1.Params", Params], ["/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams", MsgUpdateParams], ["/ibc.applications.interchain_accounts.host.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], + ["/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse", QueryParamsResponse], + ["/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest", QueryParamsRequest], ]; diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/amino/amino.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/amino/amino.ts new file mode 100644 index 00000000..4a505674 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/amino/amino.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + +/* eslint-disable */ + +export const protobufPackage = "amino"; diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..effd5449 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} + +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + 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(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: 0 }; +} + +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/msg/v1/msg.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos_proto/cosmos.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos_proto/cosmos.ts new file mode 100644 index 00000000..d95b944f --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/cosmos_proto/cosmos.ts @@ -0,0 +1,302 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos_proto"; + +export enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1, +} + +export function scalarTypeFromJSON(object: any): ScalarType { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} + +export function scalarTypeToJSON(object: ScalarType): string { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} + +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { name: "", description: "" }; +} + +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + 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 ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseScalarDescriptor(): ScalarDescriptor { + return { name: "", description: "", fieldType: [] }; +} + +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag === 24) { + message.fieldType.push(reader.int32() as any); + + continue; + } + + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push(reader.int32() as any); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ScalarDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], + }; + }, + + toJSON(message: ScalarDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.fieldType?.length) { + obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e)); + } + 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 ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/common/shared_types.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/commitments.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/genesis.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/module/module.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/packet.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/params.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/query.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/tx.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/decryption_key.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/genesis.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/module/module.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/params.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/query.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/request_id.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/tx.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/gogoproto/gogo.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/ibc.applications.interchain_accounts.host.v1/types/gogoproto/gogo.ts +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/api/annotations.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/api/annotations.ts +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/api/http.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/api/http.ts +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/protobuf/descriptor.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/protobuf/duration.ts b/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.interchain_accounts.host.v1/types/route-name.eta b/ts-client/ibc.applications.interchain_accounts.host.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/ibc.applications.interchain_accounts.host.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/ibc.applications.transfer.v1/module.ts b/ts-client/ibc.applications.transfer.v1/module.ts index 6c0421c3..3a44a33c 100755 --- a/ts-client/ibc.applications.transfer.v1/module.ts +++ b/ts-client/ibc.applications.transfer.v1/module.ts @@ -6,45 +6,45 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { QueryDenomTraceRequest } from "./types/ibc/applications/transfer/v1/query"; -import { QueryDenomHashRequest } from "./types/ibc/applications/transfer/v1/query"; -import { Allocation } from "./types/ibc/applications/transfer/v1/authz"; -import { QueryParamsResponse } from "./types/ibc/applications/transfer/v1/query"; -import { QueryDenomHashResponse } from "./types/ibc/applications/transfer/v1/query"; -import { Params } from "./types/ibc/applications/transfer/v1/transfer"; -import { QueryDenomTraceResponse } from "./types/ibc/applications/transfer/v1/query"; -import { QueryDenomTracesResponse } from "./types/ibc/applications/transfer/v1/query"; -import { QueryParamsRequest } from "./types/ibc/applications/transfer/v1/query"; -import { QueryTotalEscrowForDenomResponse } from "./types/ibc/applications/transfer/v1/query"; -import { GenesisState } from "./types/ibc/applications/transfer/v1/genesis"; -import { QueryEscrowAddressRequest } from "./types/ibc/applications/transfer/v1/query"; -import { QueryEscrowAddressResponse } from "./types/ibc/applications/transfer/v1/query"; -import { QueryTotalEscrowForDenomRequest } from "./types/ibc/applications/transfer/v1/query"; -import { MsgTransferResponse } from "./types/ibc/applications/transfer/v1/tx"; -import { MsgUpdateParams } from "./types/ibc/applications/transfer/v1/tx"; -import { QueryDenomTracesRequest } from "./types/ibc/applications/transfer/v1/query"; -import { TransferAuthorization } from "./types/ibc/applications/transfer/v1/authz"; -import { MsgUpdateParamsResponse } from "./types/ibc/applications/transfer/v1/tx"; -import { MsgTransfer } from "./types/ibc/applications/transfer/v1/tx"; -import { DenomTrace } from "./types/ibc/applications/transfer/v1/transfer"; - - -export { QueryDenomTraceRequest, QueryDenomHashRequest, Allocation, QueryParamsResponse, QueryDenomHashResponse, Params, QueryDenomTraceResponse, QueryDenomTracesResponse, QueryParamsRequest, QueryTotalEscrowForDenomResponse, GenesisState, QueryEscrowAddressRequest, QueryEscrowAddressResponse, QueryTotalEscrowForDenomRequest, MsgTransferResponse, MsgUpdateParams, QueryDenomTracesRequest, TransferAuthorization, MsgUpdateParamsResponse, MsgTransfer, DenomTrace }; +import { QueryDenomTraceResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/genesis"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryEscrowAddressRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryTotalEscrowForDenomRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryDenomTraceRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryEscrowAddressResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/tx"; +import { MsgTransfer } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/tx"; +import { QueryDenomTracesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryDenomHashRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { TransferAuthorization } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/authz"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/transfer"; +import { MsgTransferResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/tx"; +import { QueryDenomTracesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryTotalEscrowForDenomResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { Allocation } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/authz"; +import { DenomTrace } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/transfer"; +import { QueryDenomHashResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; + + +export { QueryDenomTraceResponse, GenesisState, QueryParamsRequest, QueryParamsResponse, QueryEscrowAddressRequest, QueryTotalEscrowForDenomRequest, QueryDenomTraceRequest, QueryEscrowAddressResponse, MsgUpdateParams, MsgTransfer, QueryDenomTracesResponse, QueryDenomHashRequest, TransferAuthorization, Params, MsgTransferResponse, MsgUpdateParamsResponse, QueryDenomTracesRequest, QueryTotalEscrowForDenomResponse, Allocation, DenomTrace, QueryDenomHashResponse }; -type sendQueryDenomTraceRequestParams = { - value: QueryDenomTraceRequest, +type sendQueryDenomTraceResponseParams = { + value: QueryDenomTraceResponse, fee?: StdFee, memo?: string }; -type sendQueryDenomHashRequestParams = { - value: QueryDenomHashRequest, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendAllocationParams = { - value: Allocation, +type sendQueryParamsRequestParams = { + value: QueryParamsRequest, fee?: StdFee, memo?: string }; @@ -55,62 +55,62 @@ type sendQueryParamsResponseParams = { memo?: string }; -type sendQueryDenomHashResponseParams = { - value: QueryDenomHashResponse, +type sendQueryEscrowAddressRequestParams = { + value: QueryEscrowAddressRequest, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendQueryTotalEscrowForDenomRequestParams = { + value: QueryTotalEscrowForDenomRequest, fee?: StdFee, memo?: string }; -type sendQueryDenomTraceResponseParams = { - value: QueryDenomTraceResponse, +type sendQueryDenomTraceRequestParams = { + value: QueryDenomTraceRequest, fee?: StdFee, memo?: string }; -type sendQueryDenomTracesResponseParams = { - value: QueryDenomTracesResponse, +type sendQueryEscrowAddressResponseParams = { + value: QueryEscrowAddressResponse, fee?: StdFee, memo?: string }; -type sendQueryParamsRequestParams = { - value: QueryParamsRequest, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendQueryTotalEscrowForDenomResponseParams = { - value: QueryTotalEscrowForDenomResponse, +type sendMsgTransferParams = { + value: MsgTransfer, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryDenomTracesResponseParams = { + value: QueryDenomTracesResponse, fee?: StdFee, memo?: string }; -type sendQueryEscrowAddressRequestParams = { - value: QueryEscrowAddressRequest, +type sendQueryDenomHashRequestParams = { + value: QueryDenomHashRequest, fee?: StdFee, memo?: string }; -type sendQueryEscrowAddressResponseParams = { - value: QueryEscrowAddressResponse, +type sendTransferAuthorizationParams = { + value: TransferAuthorization, fee?: StdFee, memo?: string }; -type sendQueryTotalEscrowForDenomRequestParams = { - value: QueryTotalEscrowForDenomRequest, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; @@ -121,8 +121,8 @@ type sendMsgTransferResponseParams = { memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; @@ -133,115 +133,115 @@ type sendQueryDenomTracesRequestParams = { memo?: string }; -type sendTransferAuthorizationParams = { - value: TransferAuthorization, +type sendQueryTotalEscrowForDenomResponseParams = { + value: QueryTotalEscrowForDenomResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendAllocationParams = { + value: Allocation, fee?: StdFee, memo?: string }; -type sendMsgTransferParams = { - value: MsgTransfer, +type sendDenomTraceParams = { + value: DenomTrace, fee?: StdFee, memo?: string }; -type sendDenomTraceParams = { - value: DenomTrace, +type sendQueryDenomHashResponseParams = { + value: QueryDenomHashResponse, fee?: StdFee, memo?: string }; -type queryDenomTraceRequestParams = { - value: QueryDenomTraceRequest, +type queryDenomTraceResponseParams = { + value: QueryDenomTraceResponse, }; -type queryDenomHashRequestParams = { - value: QueryDenomHashRequest, +type genesisStateParams = { + value: GenesisState, }; -type allocationParams = { - value: Allocation, +type queryParamsRequestParams = { + value: QueryParamsRequest, }; type queryParamsResponseParams = { value: QueryParamsResponse, }; -type queryDenomHashResponseParams = { - value: QueryDenomHashResponse, +type queryEscrowAddressRequestParams = { + value: QueryEscrowAddressRequest, }; -type paramsParams = { - value: Params, +type queryTotalEscrowForDenomRequestParams = { + value: QueryTotalEscrowForDenomRequest, }; -type queryDenomTraceResponseParams = { - value: QueryDenomTraceResponse, +type queryDenomTraceRequestParams = { + value: QueryDenomTraceRequest, }; -type queryDenomTracesResponseParams = { - value: QueryDenomTracesResponse, +type queryEscrowAddressResponseParams = { + value: QueryEscrowAddressResponse, }; -type queryParamsRequestParams = { - value: QueryParamsRequest, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type queryTotalEscrowForDenomResponseParams = { - value: QueryTotalEscrowForDenomResponse, +type msgTransferParams = { + value: MsgTransfer, }; -type genesisStateParams = { - value: GenesisState, +type queryDenomTracesResponseParams = { + value: QueryDenomTracesResponse, }; -type queryEscrowAddressRequestParams = { - value: QueryEscrowAddressRequest, +type queryDenomHashRequestParams = { + value: QueryDenomHashRequest, }; -type queryEscrowAddressResponseParams = { - value: QueryEscrowAddressResponse, +type transferAuthorizationParams = { + value: TransferAuthorization, }; -type queryTotalEscrowForDenomRequestParams = { - value: QueryTotalEscrowForDenomRequest, +type paramsParams = { + value: Params, }; type msgTransferResponseParams = { value: MsgTransferResponse, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; type queryDenomTracesRequestParams = { value: QueryDenomTracesRequest, }; -type transferAuthorizationParams = { - value: TransferAuthorization, -}; - -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type queryTotalEscrowForDenomResponseParams = { + value: QueryTotalEscrowForDenomResponse, }; -type msgTransferParams = { - value: MsgTransfer, +type allocationParams = { + value: Allocation, }; type denomTraceParams = { value: DenomTrace, }; +type queryDenomHashResponseParams = { + value: QueryDenomHashResponse, +}; + export const registry = new Registry(msgTypes); @@ -272,45 +272,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendQueryDenomTraceRequest({ value, fee, memo }: sendQueryDenomTraceRequestParams): Promise { + async sendQueryDenomTraceResponse({ value, fee, memo }: sendQueryDenomTraceResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomTraceRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomTraceResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomTraceRequest({ value: QueryDenomTraceRequest.fromPartial(value) }) + let msg = this.queryDenomTraceResponse({ value: QueryDenomTraceResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomTraceRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomTraceResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomHashRequest({ value, fee, memo }: sendQueryDenomHashRequestParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomHashRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomHashRequest({ value: QueryDenomHashRequest.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomHashRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendAllocation({ value, fee, memo }: sendAllocationParams): Promise { + async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendAllocation: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.allocation({ value: Allocation.fromPartial(value) }) + let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAllocation: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) } }, @@ -328,143 +328,143 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryDenomHashResponse({ value, fee, memo }: sendQueryDenomHashResponseParams): Promise { + async sendQueryEscrowAddressRequest({ value, fee, memo }: sendQueryEscrowAddressRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomHashResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryEscrowAddressRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomHashResponse({ value: QueryDenomHashResponse.fromPartial(value) }) + let msg = this.queryEscrowAddressRequest({ value: QueryEscrowAddressRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomHashResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryEscrowAddressRequest: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendQueryTotalEscrowForDenomRequest({ value, fee, memo }: sendQueryTotalEscrowForDenomRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalEscrowForDenomRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.queryTotalEscrowForDenomRequest({ value: QueryTotalEscrowForDenomRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalEscrowForDenomRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomTraceResponse({ value, fee, memo }: sendQueryDenomTraceResponseParams): Promise { + async sendQueryDenomTraceRequest({ value, fee, memo }: sendQueryDenomTraceRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomTraceResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomTraceRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomTraceResponse({ value: QueryDenomTraceResponse.fromPartial(value) }) + let msg = this.queryDenomTraceRequest({ value: QueryDenomTraceRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomTraceResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomTraceRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryDenomTracesResponse({ value, fee, memo }: sendQueryDenomTracesResponseParams): Promise { + async sendQueryEscrowAddressResponse({ value, fee, memo }: sendQueryEscrowAddressResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryDenomTracesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryEscrowAddressResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryDenomTracesResponse({ value: QueryDenomTracesResponse.fromPartial(value) }) + let msg = this.queryEscrowAddressResponse({ value: QueryEscrowAddressResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryDenomTracesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryEscrowAddressResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryParamsRequest({ value, fee, memo }: sendQueryParamsRequestParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryParamsRequest({ value: QueryParamsRequest.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalEscrowForDenomResponse({ value, fee, memo }: sendQueryTotalEscrowForDenomResponseParams): Promise { + async sendMsgTransfer({ value, fee, memo }: sendMsgTransferParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalEscrowForDenomResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgTransfer: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalEscrowForDenomResponse({ value: QueryTotalEscrowForDenomResponse.fromPartial(value) }) + let msg = this.msgTransfer({ value: MsgTransfer.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalEscrowForDenomResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgTransfer: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryDenomTracesResponse({ value, fee, memo }: sendQueryDenomTracesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomTracesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryDenomTracesResponse({ value: QueryDenomTracesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomTracesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryEscrowAddressRequest({ value, fee, memo }: sendQueryEscrowAddressRequestParams): Promise { + async sendQueryDenomHashRequest({ value, fee, memo }: sendQueryDenomHashRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryEscrowAddressRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomHashRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryEscrowAddressRequest({ value: QueryEscrowAddressRequest.fromPartial(value) }) + let msg = this.queryDenomHashRequest({ value: QueryDenomHashRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryEscrowAddressRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomHashRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryEscrowAddressResponse({ value, fee, memo }: sendQueryEscrowAddressResponseParams): Promise { + async sendTransferAuthorization({ value, fee, memo }: sendTransferAuthorizationParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryEscrowAddressResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTransferAuthorization: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryEscrowAddressResponse({ value: QueryEscrowAddressResponse.fromPartial(value) }) + let msg = this.transferAuthorization({ value: TransferAuthorization.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryEscrowAddressResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTransferAuthorization: Could not broadcast Tx: '+ e.message) } }, - async sendQueryTotalEscrowForDenomRequest({ value, fee, memo }: sendQueryTotalEscrowForDenomRequestParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryTotalEscrowForDenomRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryTotalEscrowForDenomRequest({ value: QueryTotalEscrowForDenomRequest.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryTotalEscrowForDenomRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, @@ -482,17 +482,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, @@ -510,84 +510,84 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendTransferAuthorization({ value, fee, memo }: sendTransferAuthorizationParams): Promise { + async sendQueryTotalEscrowForDenomResponse({ value, fee, memo }: sendQueryTotalEscrowForDenomResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendTransferAuthorization: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryTotalEscrowForDenomResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.transferAuthorization({ value: TransferAuthorization.fromPartial(value) }) + let msg = this.queryTotalEscrowForDenomResponse({ value: QueryTotalEscrowForDenomResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTransferAuthorization: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryTotalEscrowForDenomResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendAllocation({ value, fee, memo }: sendAllocationParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAllocation: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.allocation({ value: Allocation.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAllocation: Could not broadcast Tx: '+ e.message) } }, - async sendMsgTransfer({ value, fee, memo }: sendMsgTransferParams): Promise { + async sendDenomTrace({ value, fee, memo }: sendDenomTraceParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgTransfer: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendDenomTrace: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgTransfer({ value: MsgTransfer.fromPartial(value) }) + let msg = this.denomTrace({ value: DenomTrace.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgTransfer: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendDenomTrace: Could not broadcast Tx: '+ e.message) } }, - async sendDenomTrace({ value, fee, memo }: sendDenomTraceParams): Promise { + async sendQueryDenomHashResponse({ value, fee, memo }: sendQueryDenomHashResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendDenomTrace: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryDenomHashResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.denomTrace({ value: DenomTrace.fromPartial(value) }) + let msg = this.queryDenomHashResponse({ value: QueryDenomHashResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendDenomTrace: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryDenomHashResponse: Could not broadcast Tx: '+ e.message) } }, - queryDenomTraceRequest({ value }: queryDenomTraceRequestParams): EncodeObject { + queryDenomTraceResponse({ value }: queryDenomTraceResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", value: QueryDenomTraceRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", value: QueryDenomTraceResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomTraceRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomTraceResponse: Could not create message: ' + e.message) } }, - queryDenomHashRequest({ value }: queryDenomHashRequestParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashRequest", value: QueryDenomHashRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomHashRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - allocation({ value }: allocationParams): EncodeObject { + queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.Allocation", value: Allocation.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Allocation: Could not create message: ' + e.message) + throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) } }, @@ -599,83 +599,83 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryDenomHashResponse({ value }: queryDenomHashResponseParams): EncodeObject { + queryEscrowAddressRequest({ value }: queryEscrowAddressRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashResponse", value: QueryDenomHashResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressRequest", value: QueryEscrowAddressRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomHashResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryEscrowAddressRequest: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + queryTotalEscrowForDenomRequest({ value }: queryTotalEscrowForDenomRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest", value: QueryTotalEscrowForDenomRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalEscrowForDenomRequest: Could not create message: ' + e.message) } }, - queryDenomTraceResponse({ value }: queryDenomTraceResponseParams): EncodeObject { + queryDenomTraceRequest({ value }: queryDenomTraceRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", value: QueryDenomTraceResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", value: QueryDenomTraceRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomTraceResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomTraceRequest: Could not create message: ' + e.message) } }, - queryDenomTracesResponse({ value }: queryDenomTracesResponseParams): EncodeObject { + queryEscrowAddressResponse({ value }: queryEscrowAddressResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", value: QueryDenomTracesResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressResponse", value: QueryEscrowAddressResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryDenomTracesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryEscrowAddressResponse: Could not create message: ' + e.message) } }, - queryParamsRequest({ value }: queryParamsRequestParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", value: QueryParamsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - queryTotalEscrowForDenomResponse({ value }: queryTotalEscrowForDenomResponseParams): EncodeObject { + msgTransfer({ value }: msgTransferParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse", value: QueryTotalEscrowForDenomResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: MsgTransfer.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalEscrowForDenomResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgTransfer: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryDenomTracesResponse({ value }: queryDenomTracesResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", value: QueryDenomTracesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomTracesResponse: Could not create message: ' + e.message) } }, - queryEscrowAddressRequest({ value }: queryEscrowAddressRequestParams): EncodeObject { + queryDenomHashRequest({ value }: queryDenomHashRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressRequest", value: QueryEscrowAddressRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashRequest", value: QueryDenomHashRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryEscrowAddressRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomHashRequest: Could not create message: ' + e.message) } }, - queryEscrowAddressResponse({ value }: queryEscrowAddressResponseParams): EncodeObject { + transferAuthorization({ value }: transferAuthorizationParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressResponse", value: QueryEscrowAddressResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.TransferAuthorization", value: TransferAuthorization.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryEscrowAddressResponse: Could not create message: ' + e.message) + throw new Error('TxClient:TransferAuthorization: Could not create message: ' + e.message) } }, - queryTotalEscrowForDenomRequest({ value }: queryTotalEscrowForDenomRequestParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest", value: QueryTotalEscrowForDenomRequest.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryTotalEscrowForDenomRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, @@ -687,11 +687,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, @@ -703,35 +703,35 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - transferAuthorization({ value }: transferAuthorizationParams): EncodeObject { + queryTotalEscrowForDenomResponse({ value }: queryTotalEscrowForDenomResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.TransferAuthorization", value: TransferAuthorization.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse", value: QueryTotalEscrowForDenomResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:TransferAuthorization: Could not create message: ' + e.message) + throw new Error('TxClient:QueryTotalEscrowForDenomResponse: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + allocation({ value }: allocationParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.Allocation", value: Allocation.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Allocation: Could not create message: ' + e.message) } }, - msgTransfer({ value }: msgTransferParams): EncodeObject { + denomTrace({ value }: denomTraceParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: MsgTransfer.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.DenomTrace", value: DenomTrace.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgTransfer: Could not create message: ' + e.message) + throw new Error('TxClient:DenomTrace: Could not create message: ' + e.message) } }, - denomTrace({ value }: denomTraceParams): EncodeObject { + queryDenomHashResponse({ value }: queryDenomHashResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.applications.transfer.v1.DenomTrace", value: DenomTrace.fromPartial( value ) } + return { typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashResponse", value: QueryDenomHashResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:DenomTrace: Could not create message: ' + e.message) + throw new Error('TxClient:QueryDenomHashResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/ibc.applications.transfer.v1/registry.ts b/ts-client/ibc.applications.transfer.v1/registry.ts index a00caecb..36ac251e 100755 --- a/ts-client/ibc.applications.transfer.v1/registry.ts +++ b/ts-client/ibc.applications.transfer.v1/registry.ts @@ -1,48 +1,48 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { QueryDenomTraceRequest } from "./types/ibc/applications/transfer/v1/query"; -import { QueryDenomHashRequest } from "./types/ibc/applications/transfer/v1/query"; -import { Allocation } from "./types/ibc/applications/transfer/v1/authz"; -import { QueryParamsResponse } from "./types/ibc/applications/transfer/v1/query"; -import { QueryDenomHashResponse } from "./types/ibc/applications/transfer/v1/query"; -import { Params } from "./types/ibc/applications/transfer/v1/transfer"; -import { QueryDenomTraceResponse } from "./types/ibc/applications/transfer/v1/query"; -import { QueryDenomTracesResponse } from "./types/ibc/applications/transfer/v1/query"; -import { QueryParamsRequest } from "./types/ibc/applications/transfer/v1/query"; -import { QueryTotalEscrowForDenomResponse } from "./types/ibc/applications/transfer/v1/query"; -import { GenesisState } from "./types/ibc/applications/transfer/v1/genesis"; -import { QueryEscrowAddressRequest } from "./types/ibc/applications/transfer/v1/query"; -import { QueryEscrowAddressResponse } from "./types/ibc/applications/transfer/v1/query"; -import { QueryTotalEscrowForDenomRequest } from "./types/ibc/applications/transfer/v1/query"; -import { MsgTransferResponse } from "./types/ibc/applications/transfer/v1/tx"; -import { MsgUpdateParams } from "./types/ibc/applications/transfer/v1/tx"; -import { QueryDenomTracesRequest } from "./types/ibc/applications/transfer/v1/query"; -import { TransferAuthorization } from "./types/ibc/applications/transfer/v1/authz"; -import { MsgUpdateParamsResponse } from "./types/ibc/applications/transfer/v1/tx"; -import { MsgTransfer } from "./types/ibc/applications/transfer/v1/tx"; -import { DenomTrace } from "./types/ibc/applications/transfer/v1/transfer"; +import { QueryDenomTraceResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/genesis"; +import { QueryParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryEscrowAddressRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryTotalEscrowForDenomRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryDenomTraceRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryEscrowAddressResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/tx"; +import { MsgTransfer } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/tx"; +import { QueryDenomTracesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryDenomHashRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { TransferAuthorization } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/authz"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/transfer"; +import { MsgTransferResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/tx"; +import { QueryDenomTracesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { QueryTotalEscrowForDenomResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; +import { Allocation } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/authz"; +import { DenomTrace } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/transfer"; +import { QueryDenomHashResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/applications/transfer/v1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/ibc.applications.transfer.v1.QueryDenomTraceRequest", QueryDenomTraceRequest], - ["/ibc.applications.transfer.v1.QueryDenomHashRequest", QueryDenomHashRequest], - ["/ibc.applications.transfer.v1.Allocation", Allocation], - ["/ibc.applications.transfer.v1.QueryParamsResponse", QueryParamsResponse], - ["/ibc.applications.transfer.v1.QueryDenomHashResponse", QueryDenomHashResponse], - ["/ibc.applications.transfer.v1.Params", Params], ["/ibc.applications.transfer.v1.QueryDenomTraceResponse", QueryDenomTraceResponse], - ["/ibc.applications.transfer.v1.QueryDenomTracesResponse", QueryDenomTracesResponse], - ["/ibc.applications.transfer.v1.QueryParamsRequest", QueryParamsRequest], - ["/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse", QueryTotalEscrowForDenomResponse], ["/ibc.applications.transfer.v1.GenesisState", GenesisState], + ["/ibc.applications.transfer.v1.QueryParamsRequest", QueryParamsRequest], + ["/ibc.applications.transfer.v1.QueryParamsResponse", QueryParamsResponse], ["/ibc.applications.transfer.v1.QueryEscrowAddressRequest", QueryEscrowAddressRequest], - ["/ibc.applications.transfer.v1.QueryEscrowAddressResponse", QueryEscrowAddressResponse], ["/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest", QueryTotalEscrowForDenomRequest], - ["/ibc.applications.transfer.v1.MsgTransferResponse", MsgTransferResponse], + ["/ibc.applications.transfer.v1.QueryDenomTraceRequest", QueryDenomTraceRequest], + ["/ibc.applications.transfer.v1.QueryEscrowAddressResponse", QueryEscrowAddressResponse], ["/ibc.applications.transfer.v1.MsgUpdateParams", MsgUpdateParams], - ["/ibc.applications.transfer.v1.QueryDenomTracesRequest", QueryDenomTracesRequest], + ["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer], + ["/ibc.applications.transfer.v1.QueryDenomTracesResponse", QueryDenomTracesResponse], + ["/ibc.applications.transfer.v1.QueryDenomHashRequest", QueryDenomHashRequest], ["/ibc.applications.transfer.v1.TransferAuthorization", TransferAuthorization], + ["/ibc.applications.transfer.v1.Params", Params], + ["/ibc.applications.transfer.v1.MsgTransferResponse", MsgTransferResponse], ["/ibc.applications.transfer.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer], + ["/ibc.applications.transfer.v1.QueryDenomTracesRequest", QueryDenomTracesRequest], + ["/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse", QueryTotalEscrowForDenomResponse], + ["/ibc.applications.transfer.v1.Allocation", Allocation], ["/ibc.applications.transfer.v1.DenomTrace", DenomTrace], + ["/ibc.applications.transfer.v1.QueryDenomHashResponse", QueryDenomHashResponse], ]; diff --git a/ts-client/ibc.applications.transfer.v1/types/amino/amino.ts b/ts-client/ibc.applications.transfer.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/ibc.applications.transfer.v1/types/amino/amino.ts +++ b/ts-client/ibc.applications.transfer.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/ibc.applications.transfer.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/ibc.applications.transfer.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/ibc.applications.transfer.v1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/ibc.applications.transfer.v1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/ibc.applications.transfer.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/ibc.applications.transfer.v1/types/cosmos/base/v1beta1/coin.ts index 430ad537..84a52e28 100644 --- a/ts-client/ibc.applications.transfer.v1/types/cosmos/base/v1beta1/coin.ts +++ b/ts-client/ibc.applications.transfer.v1/types/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.v1beta1"; @@ -29,8 +35,8 @@ function createBaseCoin(): Coin { return { denom: "", amount: "" }; } -export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -40,8 +46,8 @@ export const Coin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCoin(); while (reader.pos < end) { @@ -65,15 +71,15 @@ export const Coin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -103,8 +109,8 @@ function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } -export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } @@ -114,8 +120,8 @@ export const DecCoin = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecCoin(); while (reader.pos < end) { @@ -139,15 +145,15 @@ export const DecCoin = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -176,7 +182,8 @@ export const DecCoin = { type Builtin = 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; @@ -187,3 +194,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/ibc.applications.transfer.v1/types/cosmos/msg/v1/msg.ts b/ts-client/ibc.applications.transfer.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/ibc.applications.transfer.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/ibc.applications.transfer.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/ibc.applications.transfer.v1/types/cosmos_proto/cosmos.ts b/ts-client/ibc.applications.transfer.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/ibc.applications.transfer.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/ibc.applications.transfer.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/common/shared_types.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/commitments.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/genesis.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/module/module.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/packet.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/params.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/query.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/tx.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/decryption_key.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/genesis.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/module/module.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/params.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/query.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/request_id.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/tx.ts b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/gogoproto/gogo.ts b/ts-client/ibc.applications.transfer.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/ibc.applications.transfer.v1/types/gogoproto/gogo.ts +++ b/ts-client/ibc.applications.transfer.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/ibc.applications.transfer.v1/types/google/api/annotations.ts b/ts-client/ibc.applications.transfer.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/ibc.applications.transfer.v1/types/google/api/annotations.ts +++ b/ts-client/ibc.applications.transfer.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/ibc.applications.transfer.v1/types/google/api/http.ts b/ts-client/ibc.applications.transfer.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/ibc.applications.transfer.v1/types/google/api/http.ts +++ b/ts-client/ibc.applications.transfer.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/google/protobuf/descriptor.ts b/ts-client/ibc.applications.transfer.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/ibc.applications.transfer.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/ibc.applications.transfer.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/google/protobuf/duration.ts b/ts-client/ibc.applications.transfer.v1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.applications.transfer.v1/types/route-name.eta b/ts-client/ibc.applications.transfer.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/ibc.applications.transfer.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/ibc.core.channel.v1/module.ts b/ts-client/ibc.core.channel.v1/module.ts index 4311d809..d0096bb8 100755 --- a/ts-client/ibc.core.channel.v1/module.ts +++ b/ts-client/ibc.core.channel.v1/module.ts @@ -6,98 +6,104 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { Counterparty } from "./types/ibc/core/channel/v1/channel"; -import { Packet } from "./types/ibc/core/channel/v1/channel"; -import { MsgChannelUpgradeAck } from "./types/ibc/core/channel/v1/tx"; -import { QueryUnreceivedPacketsResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelOpenConfirmResponse } from "./types/ibc/core/channel/v1/tx"; -import { GenesisState } from "./types/ibc/core/channel/v1/genesis"; -import { MsgChannelUpgradeOpen } from "./types/ibc/core/channel/v1/tx"; -import { QueryPacketCommitmentsResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryPacketAcknowledgementsRequest } from "./types/ibc/core/channel/v1/query"; -import { ErrorReceipt } from "./types/ibc/core/channel/v1/upgrade"; -import { QueryPacketAcknowledgementsResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelOpenTryResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryChannelsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryPacketCommitmentResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelCloseInitResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgRecvPacketResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeout } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelConsensusStateRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryUpgradeErrorRequest } from "./types/ibc/core/channel/v1/query"; -import { Upgrade } from "./types/ibc/core/channel/v1/upgrade"; -import { UpgradeFields } from "./types/ibc/core/channel/v1/upgrade"; -import { MsgPruneAcknowledgementsResponse } from "./types/ibc/core/channel/v1/tx"; -import { QueryUnreceivedAcksRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryUpgradeRequest } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelUpgradeTimeoutResponse } from "./types/ibc/core/channel/v1/tx"; -import { PacketId } from "./types/ibc/core/channel/v1/channel"; -import { PacketSequence } from "./types/ibc/core/channel/v1/genesis"; -import { MsgChannelOpenTry } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeInit } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelParamsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryChannelParamsResponse } from "./types/ibc/core/channel/v1/query"; -import { PacketState } from "./types/ibc/core/channel/v1/channel"; -import { MsgRecvPacket } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelRequest } from "./types/ibc/core/channel/v1/query"; -import { MsgTimeoutOnClose } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeTimeout } from "./types/ibc/core/channel/v1/tx"; -import { QueryPacketReceiptRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryUpgradeResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelUpgradeConfirmResponse } from "./types/ibc/core/channel/v1/tx"; -import { Timeout } from "./types/ibc/core/channel/v1/channel"; -import { MsgChannelCloseConfirm } from "./types/ibc/core/channel/v1/tx"; -import { QueryConnectionChannelsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryChannelClientStateResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryPacketAcknowledgementResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryUnreceivedPacketsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryPacketAcknowledgementRequest } from "./types/ibc/core/channel/v1/query"; -import { Channel } from "./types/ibc/core/channel/v1/channel"; -import { MsgChannelOpenInit } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenConfirm } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeTry } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeCancel } from "./types/ibc/core/channel/v1/tx"; -import { MsgPruneAcknowledgements } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelConsensusStateResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryNextSequenceReceiveResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryUpgradeErrorResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelCloseConfirmResponse } from "./types/ibc/core/channel/v1/tx"; -import { Acknowledgement } from "./types/ibc/core/channel/v1/channel"; -import { QueryPacketCommitmentsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryNextSequenceReceiveRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryNextSequenceSendRequest } from "./types/ibc/core/channel/v1/query"; -import { IdentifiedChannel } from "./types/ibc/core/channel/v1/channel"; -import { MsgChannelOpenAck } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeConfirm } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelsResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgTimeoutOnCloseResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeCancelResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenInitResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelCloseInit } from "./types/ibc/core/channel/v1/tx"; -import { MsgAcknowledgement } from "./types/ibc/core/channel/v1/tx"; -import { MsgUpdateParams } from "./types/ibc/core/channel/v1/tx"; -import { QueryConnectionChannelsResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryChannelClientStateRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryUnreceivedAcksResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryNextSequenceSendResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgAcknowledgementResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeAckResponse } from "./types/ibc/core/channel/v1/tx"; -import { Params } from "./types/ibc/core/channel/v1/channel"; -import { QueryPacketReceiptResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelOpenAckResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeoutResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeInitResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeTryResponse } from "./types/ibc/core/channel/v1/tx"; -import { QueryPacketCommitmentRequest } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelUpgradeOpenResponse } from "./types/ibc/core/channel/v1/tx"; - - -export { Counterparty, Packet, MsgChannelUpgradeAck, QueryUnreceivedPacketsResponse, MsgChannelOpenConfirmResponse, GenesisState, MsgChannelUpgradeOpen, QueryPacketCommitmentsResponse, QueryPacketAcknowledgementsRequest, ErrorReceipt, QueryPacketAcknowledgementsResponse, MsgChannelOpenTryResponse, MsgUpdateParamsResponse, QueryChannelResponse, QueryChannelsRequest, QueryPacketCommitmentResponse, MsgChannelCloseInitResponse, MsgRecvPacketResponse, MsgTimeout, QueryChannelConsensusStateRequest, QueryUpgradeErrorRequest, Upgrade, UpgradeFields, MsgPruneAcknowledgementsResponse, QueryUnreceivedAcksRequest, QueryUpgradeRequest, MsgChannelUpgradeTimeoutResponse, PacketId, PacketSequence, MsgChannelOpenTry, MsgChannelUpgradeInit, QueryChannelParamsRequest, QueryChannelParamsResponse, PacketState, MsgRecvPacket, QueryChannelRequest, MsgTimeoutOnClose, MsgChannelUpgradeTimeout, QueryPacketReceiptRequest, QueryUpgradeResponse, MsgChannelUpgradeConfirmResponse, Timeout, MsgChannelCloseConfirm, QueryConnectionChannelsRequest, QueryChannelClientStateResponse, QueryPacketAcknowledgementResponse, QueryUnreceivedPacketsRequest, QueryPacketAcknowledgementRequest, Channel, MsgChannelOpenInit, MsgChannelOpenConfirm, MsgChannelUpgradeTry, MsgChannelUpgradeCancel, MsgPruneAcknowledgements, QueryChannelConsensusStateResponse, QueryNextSequenceReceiveResponse, QueryUpgradeErrorResponse, MsgChannelCloseConfirmResponse, Acknowledgement, QueryPacketCommitmentsRequest, QueryNextSequenceReceiveRequest, QueryNextSequenceSendRequest, IdentifiedChannel, MsgChannelOpenAck, MsgChannelUpgradeConfirm, QueryChannelsResponse, MsgTimeoutOnCloseResponse, MsgChannelUpgradeCancelResponse, MsgChannelOpenInitResponse, MsgChannelCloseInit, MsgAcknowledgement, MsgUpdateParams, QueryConnectionChannelsResponse, QueryChannelClientStateRequest, QueryUnreceivedAcksResponse, QueryNextSequenceSendResponse, MsgAcknowledgementResponse, MsgChannelUpgradeAckResponse, Params, QueryPacketReceiptResponse, MsgChannelOpenAckResponse, MsgTimeoutResponse, MsgChannelUpgradeInitResponse, MsgChannelUpgradeTryResponse, QueryPacketCommitmentRequest, MsgChannelUpgradeOpenResponse }; +import { MsgTimeoutOnClose } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { Channel } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { Packet } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryPacketCommitmentsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelOpenConfirm } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelOpenConfirmResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgTimeoutResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeTimeoutResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeConfirmResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeCancel } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryChannelsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryChannelClientStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryNextSequenceReceiveRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelOpenTry } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelOpenAck } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeInit } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryConnectionChannelsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketCommitmentResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelUpgradeAckResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { IdentifiedChannel } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { PacketId } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryChannelConsensusStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryChannelParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUpgradeErrorRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { Counterparty } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryPacketCommitmentRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketAcknowledgementsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUnreceivedAcksResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryNextSequenceSendResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelOpenInitResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelOpenTryResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgTimeoutOnCloseResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryUpgradeErrorResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketAcknowledgementsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUpgradeRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelUpgradeInitResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeConfirm } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeTimeout } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgPruneAcknowledgements } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryPacketAcknowledgementRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelCloseConfirmResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeAck } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { Acknowledgement } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryChannelResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketAcknowledgementResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUnreceivedAcksRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryChannelsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryNextSequenceSendRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelCloseInit } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgRecvPacket } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgAcknowledgementResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeTry } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { UpgradeFields } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/upgrade"; +import { PacketState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { MsgChannelCloseInitResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgTimeout } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeTryResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeOpen } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeOpenResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgPruneAcknowledgementsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryPacketReceiptRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUnreceivedPacketsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryChannelParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelUpgradeCancelResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/genesis"; +import { PacketSequence } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/genesis"; +import { QueryChannelRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryConnectionChannelsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketCommitmentsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelCloseConfirm } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { Upgrade } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/upgrade"; +import { QueryChannelConsensusStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryNextSequenceReceiveResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUpgradeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUnreceivedPacketsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelOpenInit } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgRecvPacketResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgAcknowledgement } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { ErrorReceipt } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/upgrade"; +import { MsgChannelOpenAckResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { Timeout } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryChannelClientStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketReceiptResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; + + +export { MsgTimeoutOnClose, Channel, Packet, QueryPacketCommitmentsResponse, MsgChannelOpenConfirm, MsgChannelOpenConfirmResponse, MsgTimeoutResponse, MsgChannelUpgradeTimeoutResponse, MsgChannelUpgradeConfirmResponse, MsgChannelUpgradeCancel, MsgUpdateParams, QueryChannelsResponse, QueryChannelClientStateRequest, QueryNextSequenceReceiveRequest, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelUpgradeInit, QueryConnectionChannelsRequest, QueryPacketCommitmentResponse, MsgChannelUpgradeAckResponse, IdentifiedChannel, PacketId, QueryChannelConsensusStateResponse, QueryChannelParamsRequest, QueryUpgradeErrorRequest, Counterparty, QueryPacketCommitmentRequest, QueryPacketAcknowledgementsResponse, QueryUnreceivedAcksResponse, QueryNextSequenceSendResponse, MsgChannelOpenInitResponse, MsgChannelOpenTryResponse, MsgTimeoutOnCloseResponse, QueryUpgradeErrorResponse, QueryPacketAcknowledgementsRequest, QueryUpgradeRequest, MsgChannelUpgradeInitResponse, MsgChannelUpgradeConfirm, MsgChannelUpgradeTimeout, MsgPruneAcknowledgements, QueryPacketAcknowledgementRequest, MsgChannelCloseConfirmResponse, MsgChannelUpgradeAck, Acknowledgement, QueryChannelResponse, QueryPacketAcknowledgementResponse, QueryUnreceivedAcksRequest, QueryChannelsRequest, QueryNextSequenceSendRequest, MsgChannelCloseInit, MsgRecvPacket, MsgAcknowledgementResponse, MsgChannelUpgradeTry, MsgUpdateParamsResponse, UpgradeFields, PacketState, MsgChannelCloseInitResponse, MsgTimeout, MsgChannelUpgradeTryResponse, MsgChannelUpgradeOpen, MsgChannelUpgradeOpenResponse, MsgPruneAcknowledgementsResponse, QueryPacketReceiptRequest, QueryUnreceivedPacketsRequest, QueryChannelParamsResponse, MsgChannelUpgradeCancelResponse, GenesisState, PacketSequence, QueryChannelRequest, QueryConnectionChannelsResponse, QueryPacketCommitmentsRequest, MsgChannelCloseConfirm, Upgrade, QueryChannelConsensusStateRequest, QueryNextSequenceReceiveResponse, QueryUpgradeResponse, QueryUnreceivedPacketsResponse, MsgChannelOpenInit, MsgRecvPacketResponse, MsgAcknowledgement, ErrorReceipt, MsgChannelOpenAckResponse, Params, Timeout, QueryChannelClientStateResponse, QueryPacketReceiptResponse }; -type sendCounterpartyParams = { - value: Counterparty, +type sendMsgTimeoutOnCloseParams = { + value: MsgTimeoutOnClose, + fee?: StdFee, + memo?: string +}; + +type sendChannelParams = { + value: Channel, fee?: StdFee, memo?: string }; @@ -108,14 +114,14 @@ type sendPacketParams = { memo?: string }; -type sendMsgChannelUpgradeAckParams = { - value: MsgChannelUpgradeAck, +type sendQueryPacketCommitmentsResponseParams = { + value: QueryPacketCommitmentsResponse, fee?: StdFee, memo?: string }; -type sendQueryUnreceivedPacketsResponseParams = { - value: QueryUnreceivedPacketsResponse, +type sendMsgChannelOpenConfirmParams = { + value: MsgChannelOpenConfirm, fee?: StdFee, memo?: string }; @@ -126,194 +132,194 @@ type sendMsgChannelOpenConfirmResponseParams = { memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendMsgTimeoutResponseParams = { + value: MsgTimeoutResponse, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeOpenParams = { - value: MsgChannelUpgradeOpen, +type sendMsgChannelUpgradeTimeoutResponseParams = { + value: MsgChannelUpgradeTimeoutResponse, fee?: StdFee, memo?: string }; -type sendQueryPacketCommitmentsResponseParams = { - value: QueryPacketCommitmentsResponse, +type sendMsgChannelUpgradeConfirmResponseParams = { + value: MsgChannelUpgradeConfirmResponse, fee?: StdFee, memo?: string }; -type sendQueryPacketAcknowledgementsRequestParams = { - value: QueryPacketAcknowledgementsRequest, +type sendMsgChannelUpgradeCancelParams = { + value: MsgChannelUpgradeCancel, fee?: StdFee, memo?: string }; -type sendErrorReceiptParams = { - value: ErrorReceipt, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendQueryPacketAcknowledgementsResponseParams = { - value: QueryPacketAcknowledgementsResponse, +type sendQueryChannelsResponseParams = { + value: QueryChannelsResponse, fee?: StdFee, memo?: string }; -type sendMsgChannelOpenTryResponseParams = { - value: MsgChannelOpenTryResponse, +type sendQueryChannelClientStateRequestParams = { + value: QueryChannelClientStateRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendQueryNextSequenceReceiveRequestParams = { + value: QueryNextSequenceReceiveRequest, fee?: StdFee, memo?: string }; -type sendQueryChannelResponseParams = { - value: QueryChannelResponse, +type sendMsgChannelOpenTryParams = { + value: MsgChannelOpenTry, fee?: StdFee, memo?: string }; -type sendQueryChannelsRequestParams = { - value: QueryChannelsRequest, +type sendMsgChannelOpenAckParams = { + value: MsgChannelOpenAck, fee?: StdFee, memo?: string }; -type sendQueryPacketCommitmentResponseParams = { - value: QueryPacketCommitmentResponse, +type sendMsgChannelUpgradeInitParams = { + value: MsgChannelUpgradeInit, fee?: StdFee, memo?: string }; -type sendMsgChannelCloseInitResponseParams = { - value: MsgChannelCloseInitResponse, +type sendQueryConnectionChannelsRequestParams = { + value: QueryConnectionChannelsRequest, fee?: StdFee, memo?: string }; -type sendMsgRecvPacketResponseParams = { - value: MsgRecvPacketResponse, +type sendQueryPacketCommitmentResponseParams = { + value: QueryPacketCommitmentResponse, fee?: StdFee, memo?: string }; -type sendMsgTimeoutParams = { - value: MsgTimeout, +type sendMsgChannelUpgradeAckResponseParams = { + value: MsgChannelUpgradeAckResponse, fee?: StdFee, memo?: string }; -type sendQueryChannelConsensusStateRequestParams = { - value: QueryChannelConsensusStateRequest, +type sendIdentifiedChannelParams = { + value: IdentifiedChannel, fee?: StdFee, memo?: string }; -type sendQueryUpgradeErrorRequestParams = { - value: QueryUpgradeErrorRequest, +type sendPacketIdParams = { + value: PacketId, fee?: StdFee, memo?: string }; -type sendUpgradeParams = { - value: Upgrade, +type sendQueryChannelConsensusStateResponseParams = { + value: QueryChannelConsensusStateResponse, fee?: StdFee, memo?: string }; -type sendUpgradeFieldsParams = { - value: UpgradeFields, +type sendQueryChannelParamsRequestParams = { + value: QueryChannelParamsRequest, fee?: StdFee, memo?: string }; -type sendMsgPruneAcknowledgementsResponseParams = { - value: MsgPruneAcknowledgementsResponse, +type sendQueryUpgradeErrorRequestParams = { + value: QueryUpgradeErrorRequest, fee?: StdFee, memo?: string }; -type sendQueryUnreceivedAcksRequestParams = { - value: QueryUnreceivedAcksRequest, +type sendCounterpartyParams = { + value: Counterparty, fee?: StdFee, memo?: string }; -type sendQueryUpgradeRequestParams = { - value: QueryUpgradeRequest, +type sendQueryPacketCommitmentRequestParams = { + value: QueryPacketCommitmentRequest, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeTimeoutResponseParams = { - value: MsgChannelUpgradeTimeoutResponse, +type sendQueryPacketAcknowledgementsResponseParams = { + value: QueryPacketAcknowledgementsResponse, fee?: StdFee, memo?: string }; -type sendPacketIdParams = { - value: PacketId, +type sendQueryUnreceivedAcksResponseParams = { + value: QueryUnreceivedAcksResponse, fee?: StdFee, memo?: string }; -type sendPacketSequenceParams = { - value: PacketSequence, +type sendQueryNextSequenceSendResponseParams = { + value: QueryNextSequenceSendResponse, fee?: StdFee, memo?: string }; -type sendMsgChannelOpenTryParams = { - value: MsgChannelOpenTry, +type sendMsgChannelOpenInitResponseParams = { + value: MsgChannelOpenInitResponse, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeInitParams = { - value: MsgChannelUpgradeInit, +type sendMsgChannelOpenTryResponseParams = { + value: MsgChannelOpenTryResponse, fee?: StdFee, memo?: string }; -type sendQueryChannelParamsRequestParams = { - value: QueryChannelParamsRequest, +type sendMsgTimeoutOnCloseResponseParams = { + value: MsgTimeoutOnCloseResponse, fee?: StdFee, memo?: string }; -type sendQueryChannelParamsResponseParams = { - value: QueryChannelParamsResponse, +type sendQueryUpgradeErrorResponseParams = { + value: QueryUpgradeErrorResponse, fee?: StdFee, memo?: string }; -type sendPacketStateParams = { - value: PacketState, +type sendQueryPacketAcknowledgementsRequestParams = { + value: QueryPacketAcknowledgementsRequest, fee?: StdFee, memo?: string }; -type sendMsgRecvPacketParams = { - value: MsgRecvPacket, +type sendQueryUpgradeRequestParams = { + value: QueryUpgradeRequest, fee?: StdFee, memo?: string }; -type sendQueryChannelRequestParams = { - value: QueryChannelRequest, +type sendMsgChannelUpgradeInitResponseParams = { + value: MsgChannelUpgradeInitResponse, fee?: StdFee, memo?: string }; -type sendMsgTimeoutOnCloseParams = { - value: MsgTimeoutOnClose, +type sendMsgChannelUpgradeConfirmParams = { + value: MsgChannelUpgradeConfirm, fee?: StdFee, memo?: string }; @@ -324,80 +330,80 @@ type sendMsgChannelUpgradeTimeoutParams = { memo?: string }; -type sendQueryPacketReceiptRequestParams = { - value: QueryPacketReceiptRequest, +type sendMsgPruneAcknowledgementsParams = { + value: MsgPruneAcknowledgements, fee?: StdFee, memo?: string }; -type sendQueryUpgradeResponseParams = { - value: QueryUpgradeResponse, +type sendQueryPacketAcknowledgementRequestParams = { + value: QueryPacketAcknowledgementRequest, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeConfirmResponseParams = { - value: MsgChannelUpgradeConfirmResponse, +type sendMsgChannelCloseConfirmResponseParams = { + value: MsgChannelCloseConfirmResponse, fee?: StdFee, memo?: string }; -type sendTimeoutParams = { - value: Timeout, +type sendMsgChannelUpgradeAckParams = { + value: MsgChannelUpgradeAck, fee?: StdFee, memo?: string }; -type sendMsgChannelCloseConfirmParams = { - value: MsgChannelCloseConfirm, +type sendAcknowledgementParams = { + value: Acknowledgement, fee?: StdFee, memo?: string }; -type sendQueryConnectionChannelsRequestParams = { - value: QueryConnectionChannelsRequest, +type sendQueryChannelResponseParams = { + value: QueryChannelResponse, fee?: StdFee, memo?: string }; -type sendQueryChannelClientStateResponseParams = { - value: QueryChannelClientStateResponse, +type sendQueryPacketAcknowledgementResponseParams = { + value: QueryPacketAcknowledgementResponse, fee?: StdFee, memo?: string }; -type sendQueryPacketAcknowledgementResponseParams = { - value: QueryPacketAcknowledgementResponse, +type sendQueryUnreceivedAcksRequestParams = { + value: QueryUnreceivedAcksRequest, fee?: StdFee, memo?: string }; -type sendQueryUnreceivedPacketsRequestParams = { - value: QueryUnreceivedPacketsRequest, +type sendQueryChannelsRequestParams = { + value: QueryChannelsRequest, fee?: StdFee, memo?: string }; -type sendQueryPacketAcknowledgementRequestParams = { - value: QueryPacketAcknowledgementRequest, +type sendQueryNextSequenceSendRequestParams = { + value: QueryNextSequenceSendRequest, fee?: StdFee, memo?: string }; -type sendChannelParams = { - value: Channel, +type sendMsgChannelCloseInitParams = { + value: MsgChannelCloseInit, fee?: StdFee, memo?: string }; -type sendMsgChannelOpenInitParams = { - value: MsgChannelOpenInit, +type sendMsgRecvPacketParams = { + value: MsgRecvPacket, fee?: StdFee, memo?: string }; -type sendMsgChannelOpenConfirmParams = { - value: MsgChannelOpenConfirm, +type sendMsgAcknowledgementResponseParams = { + value: MsgAcknowledgementResponse, fee?: StdFee, memo?: string }; @@ -408,170 +414,170 @@ type sendMsgChannelUpgradeTryParams = { memo?: string }; -type sendMsgChannelUpgradeCancelParams = { - value: MsgChannelUpgradeCancel, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendMsgPruneAcknowledgementsParams = { - value: MsgPruneAcknowledgements, +type sendUpgradeFieldsParams = { + value: UpgradeFields, fee?: StdFee, memo?: string }; -type sendQueryChannelConsensusStateResponseParams = { - value: QueryChannelConsensusStateResponse, +type sendPacketStateParams = { + value: PacketState, fee?: StdFee, memo?: string }; -type sendQueryNextSequenceReceiveResponseParams = { - value: QueryNextSequenceReceiveResponse, +type sendMsgChannelCloseInitResponseParams = { + value: MsgChannelCloseInitResponse, fee?: StdFee, memo?: string }; -type sendQueryUpgradeErrorResponseParams = { - value: QueryUpgradeErrorResponse, +type sendMsgTimeoutParams = { + value: MsgTimeout, fee?: StdFee, memo?: string }; -type sendMsgChannelCloseConfirmResponseParams = { - value: MsgChannelCloseConfirmResponse, +type sendMsgChannelUpgradeTryResponseParams = { + value: MsgChannelUpgradeTryResponse, fee?: StdFee, memo?: string }; -type sendAcknowledgementParams = { - value: Acknowledgement, +type sendMsgChannelUpgradeOpenParams = { + value: MsgChannelUpgradeOpen, fee?: StdFee, memo?: string }; -type sendQueryPacketCommitmentsRequestParams = { - value: QueryPacketCommitmentsRequest, +type sendMsgChannelUpgradeOpenResponseParams = { + value: MsgChannelUpgradeOpenResponse, fee?: StdFee, memo?: string }; -type sendQueryNextSequenceReceiveRequestParams = { - value: QueryNextSequenceReceiveRequest, +type sendMsgPruneAcknowledgementsResponseParams = { + value: MsgPruneAcknowledgementsResponse, fee?: StdFee, memo?: string }; -type sendQueryNextSequenceSendRequestParams = { - value: QueryNextSequenceSendRequest, +type sendQueryPacketReceiptRequestParams = { + value: QueryPacketReceiptRequest, fee?: StdFee, memo?: string }; -type sendIdentifiedChannelParams = { - value: IdentifiedChannel, +type sendQueryUnreceivedPacketsRequestParams = { + value: QueryUnreceivedPacketsRequest, fee?: StdFee, memo?: string }; -type sendMsgChannelOpenAckParams = { - value: MsgChannelOpenAck, +type sendQueryChannelParamsResponseParams = { + value: QueryChannelParamsResponse, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeConfirmParams = { - value: MsgChannelUpgradeConfirm, +type sendMsgChannelUpgradeCancelResponseParams = { + value: MsgChannelUpgradeCancelResponse, fee?: StdFee, memo?: string }; -type sendQueryChannelsResponseParams = { - value: QueryChannelsResponse, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendMsgTimeoutOnCloseResponseParams = { - value: MsgTimeoutOnCloseResponse, +type sendPacketSequenceParams = { + value: PacketSequence, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeCancelResponseParams = { - value: MsgChannelUpgradeCancelResponse, +type sendQueryChannelRequestParams = { + value: QueryChannelRequest, fee?: StdFee, memo?: string }; -type sendMsgChannelOpenInitResponseParams = { - value: MsgChannelOpenInitResponse, +type sendQueryConnectionChannelsResponseParams = { + value: QueryConnectionChannelsResponse, fee?: StdFee, memo?: string }; -type sendMsgChannelCloseInitParams = { - value: MsgChannelCloseInit, +type sendQueryPacketCommitmentsRequestParams = { + value: QueryPacketCommitmentsRequest, fee?: StdFee, memo?: string }; -type sendMsgAcknowledgementParams = { - value: MsgAcknowledgement, +type sendMsgChannelCloseConfirmParams = { + value: MsgChannelCloseConfirm, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendUpgradeParams = { + value: Upgrade, fee?: StdFee, memo?: string }; -type sendQueryConnectionChannelsResponseParams = { - value: QueryConnectionChannelsResponse, +type sendQueryChannelConsensusStateRequestParams = { + value: QueryChannelConsensusStateRequest, fee?: StdFee, memo?: string }; -type sendQueryChannelClientStateRequestParams = { - value: QueryChannelClientStateRequest, +type sendQueryNextSequenceReceiveResponseParams = { + value: QueryNextSequenceReceiveResponse, fee?: StdFee, memo?: string }; -type sendQueryUnreceivedAcksResponseParams = { - value: QueryUnreceivedAcksResponse, +type sendQueryUpgradeResponseParams = { + value: QueryUpgradeResponse, fee?: StdFee, memo?: string }; -type sendQueryNextSequenceSendResponseParams = { - value: QueryNextSequenceSendResponse, +type sendQueryUnreceivedPacketsResponseParams = { + value: QueryUnreceivedPacketsResponse, fee?: StdFee, memo?: string }; -type sendMsgAcknowledgementResponseParams = { - value: MsgAcknowledgementResponse, +type sendMsgChannelOpenInitParams = { + value: MsgChannelOpenInit, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeAckResponseParams = { - value: MsgChannelUpgradeAckResponse, +type sendMsgRecvPacketResponseParams = { + value: MsgRecvPacketResponse, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendMsgAcknowledgementParams = { + value: MsgAcknowledgement, fee?: StdFee, memo?: string }; -type sendQueryPacketReceiptResponseParams = { - value: QueryPacketReceiptResponse, +type sendErrorReceiptParams = { + value: ErrorReceipt, fee?: StdFee, memo?: string }; @@ -582,379 +588,373 @@ type sendMsgChannelOpenAckResponseParams = { memo?: string }; -type sendMsgTimeoutResponseParams = { - value: MsgTimeoutResponse, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeInitResponseParams = { - value: MsgChannelUpgradeInitResponse, +type sendTimeoutParams = { + value: Timeout, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeTryResponseParams = { - value: MsgChannelUpgradeTryResponse, +type sendQueryChannelClientStateResponseParams = { + value: QueryChannelClientStateResponse, fee?: StdFee, memo?: string }; -type sendQueryPacketCommitmentRequestParams = { - value: QueryPacketCommitmentRequest, +type sendQueryPacketReceiptResponseParams = { + value: QueryPacketReceiptResponse, fee?: StdFee, memo?: string }; -type sendMsgChannelUpgradeOpenResponseParams = { - value: MsgChannelUpgradeOpenResponse, - fee?: StdFee, - memo?: string -}; +type msgTimeoutOnCloseParams = { + value: MsgTimeoutOnClose, +}; -type counterpartyParams = { - value: Counterparty, +type channelParams = { + value: Channel, }; type packetParams = { value: Packet, }; -type msgChannelUpgradeAckParams = { - value: MsgChannelUpgradeAck, +type queryPacketCommitmentsResponseParams = { + value: QueryPacketCommitmentsResponse, }; -type queryUnreceivedPacketsResponseParams = { - value: QueryUnreceivedPacketsResponse, +type msgChannelOpenConfirmParams = { + value: MsgChannelOpenConfirm, }; type msgChannelOpenConfirmResponseParams = { value: MsgChannelOpenConfirmResponse, }; -type genesisStateParams = { - value: GenesisState, +type msgTimeoutResponseParams = { + value: MsgTimeoutResponse, }; -type msgChannelUpgradeOpenParams = { - value: MsgChannelUpgradeOpen, +type msgChannelUpgradeTimeoutResponseParams = { + value: MsgChannelUpgradeTimeoutResponse, }; -type queryPacketCommitmentsResponseParams = { - value: QueryPacketCommitmentsResponse, +type msgChannelUpgradeConfirmResponseParams = { + value: MsgChannelUpgradeConfirmResponse, }; -type queryPacketAcknowledgementsRequestParams = { - value: QueryPacketAcknowledgementsRequest, +type msgChannelUpgradeCancelParams = { + value: MsgChannelUpgradeCancel, }; -type errorReceiptParams = { - value: ErrorReceipt, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type queryPacketAcknowledgementsResponseParams = { - value: QueryPacketAcknowledgementsResponse, +type queryChannelsResponseParams = { + value: QueryChannelsResponse, }; -type msgChannelOpenTryResponseParams = { - value: MsgChannelOpenTryResponse, +type queryChannelClientStateRequestParams = { + value: QueryChannelClientStateRequest, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type queryNextSequenceReceiveRequestParams = { + value: QueryNextSequenceReceiveRequest, }; -type queryChannelResponseParams = { - value: QueryChannelResponse, +type msgChannelOpenTryParams = { + value: MsgChannelOpenTry, }; -type queryChannelsRequestParams = { - value: QueryChannelsRequest, +type msgChannelOpenAckParams = { + value: MsgChannelOpenAck, }; -type queryPacketCommitmentResponseParams = { - value: QueryPacketCommitmentResponse, +type msgChannelUpgradeInitParams = { + value: MsgChannelUpgradeInit, }; -type msgChannelCloseInitResponseParams = { - value: MsgChannelCloseInitResponse, +type queryConnectionChannelsRequestParams = { + value: QueryConnectionChannelsRequest, }; -type msgRecvPacketResponseParams = { - value: MsgRecvPacketResponse, +type queryPacketCommitmentResponseParams = { + value: QueryPacketCommitmentResponse, }; -type msgTimeoutParams = { - value: MsgTimeout, +type msgChannelUpgradeAckResponseParams = { + value: MsgChannelUpgradeAckResponse, }; -type queryChannelConsensusStateRequestParams = { - value: QueryChannelConsensusStateRequest, +type identifiedChannelParams = { + value: IdentifiedChannel, }; -type queryUpgradeErrorRequestParams = { - value: QueryUpgradeErrorRequest, +type packetIdParams = { + value: PacketId, }; -type upgradeParams = { - value: Upgrade, +type queryChannelConsensusStateResponseParams = { + value: QueryChannelConsensusStateResponse, }; -type upgradeFieldsParams = { - value: UpgradeFields, +type queryChannelParamsRequestParams = { + value: QueryChannelParamsRequest, }; -type msgPruneAcknowledgementsResponseParams = { - value: MsgPruneAcknowledgementsResponse, +type queryUpgradeErrorRequestParams = { + value: QueryUpgradeErrorRequest, }; -type queryUnreceivedAcksRequestParams = { - value: QueryUnreceivedAcksRequest, +type counterpartyParams = { + value: Counterparty, }; -type queryUpgradeRequestParams = { - value: QueryUpgradeRequest, +type queryPacketCommitmentRequestParams = { + value: QueryPacketCommitmentRequest, }; -type msgChannelUpgradeTimeoutResponseParams = { - value: MsgChannelUpgradeTimeoutResponse, +type queryPacketAcknowledgementsResponseParams = { + value: QueryPacketAcknowledgementsResponse, }; -type packetIdParams = { - value: PacketId, +type queryUnreceivedAcksResponseParams = { + value: QueryUnreceivedAcksResponse, }; -type packetSequenceParams = { - value: PacketSequence, +type queryNextSequenceSendResponseParams = { + value: QueryNextSequenceSendResponse, }; -type msgChannelOpenTryParams = { - value: MsgChannelOpenTry, +type msgChannelOpenInitResponseParams = { + value: MsgChannelOpenInitResponse, }; -type msgChannelUpgradeInitParams = { - value: MsgChannelUpgradeInit, +type msgChannelOpenTryResponseParams = { + value: MsgChannelOpenTryResponse, }; -type queryChannelParamsRequestParams = { - value: QueryChannelParamsRequest, +type msgTimeoutOnCloseResponseParams = { + value: MsgTimeoutOnCloseResponse, }; -type queryChannelParamsResponseParams = { - value: QueryChannelParamsResponse, +type queryUpgradeErrorResponseParams = { + value: QueryUpgradeErrorResponse, }; -type packetStateParams = { - value: PacketState, +type queryPacketAcknowledgementsRequestParams = { + value: QueryPacketAcknowledgementsRequest, }; -type msgRecvPacketParams = { - value: MsgRecvPacket, +type queryUpgradeRequestParams = { + value: QueryUpgradeRequest, }; -type queryChannelRequestParams = { - value: QueryChannelRequest, +type msgChannelUpgradeInitResponseParams = { + value: MsgChannelUpgradeInitResponse, }; -type msgTimeoutOnCloseParams = { - value: MsgTimeoutOnClose, +type msgChannelUpgradeConfirmParams = { + value: MsgChannelUpgradeConfirm, }; type msgChannelUpgradeTimeoutParams = { value: MsgChannelUpgradeTimeout, }; -type queryPacketReceiptRequestParams = { - value: QueryPacketReceiptRequest, -}; - -type queryUpgradeResponseParams = { - value: QueryUpgradeResponse, +type msgPruneAcknowledgementsParams = { + value: MsgPruneAcknowledgements, }; -type msgChannelUpgradeConfirmResponseParams = { - value: MsgChannelUpgradeConfirmResponse, +type queryPacketAcknowledgementRequestParams = { + value: QueryPacketAcknowledgementRequest, }; -type timeoutParams = { - value: Timeout, +type msgChannelCloseConfirmResponseParams = { + value: MsgChannelCloseConfirmResponse, }; -type msgChannelCloseConfirmParams = { - value: MsgChannelCloseConfirm, +type msgChannelUpgradeAckParams = { + value: MsgChannelUpgradeAck, }; -type queryConnectionChannelsRequestParams = { - value: QueryConnectionChannelsRequest, +type acknowledgementParams = { + value: Acknowledgement, }; -type queryChannelClientStateResponseParams = { - value: QueryChannelClientStateResponse, +type queryChannelResponseParams = { + value: QueryChannelResponse, }; type queryPacketAcknowledgementResponseParams = { value: QueryPacketAcknowledgementResponse, }; -type queryUnreceivedPacketsRequestParams = { - value: QueryUnreceivedPacketsRequest, +type queryUnreceivedAcksRequestParams = { + value: QueryUnreceivedAcksRequest, }; -type queryPacketAcknowledgementRequestParams = { - value: QueryPacketAcknowledgementRequest, +type queryChannelsRequestParams = { + value: QueryChannelsRequest, }; -type channelParams = { - value: Channel, +type queryNextSequenceSendRequestParams = { + value: QueryNextSequenceSendRequest, }; -type msgChannelOpenInitParams = { - value: MsgChannelOpenInit, +type msgChannelCloseInitParams = { + value: MsgChannelCloseInit, }; -type msgChannelOpenConfirmParams = { - value: MsgChannelOpenConfirm, +type msgRecvPacketParams = { + value: MsgRecvPacket, +}; + +type msgAcknowledgementResponseParams = { + value: MsgAcknowledgementResponse, }; type msgChannelUpgradeTryParams = { value: MsgChannelUpgradeTry, }; -type msgChannelUpgradeCancelParams = { - value: MsgChannelUpgradeCancel, +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; -type msgPruneAcknowledgementsParams = { - value: MsgPruneAcknowledgements, +type upgradeFieldsParams = { + value: UpgradeFields, }; -type queryChannelConsensusStateResponseParams = { - value: QueryChannelConsensusStateResponse, +type packetStateParams = { + value: PacketState, }; -type queryNextSequenceReceiveResponseParams = { - value: QueryNextSequenceReceiveResponse, +type msgChannelCloseInitResponseParams = { + value: MsgChannelCloseInitResponse, }; -type queryUpgradeErrorResponseParams = { - value: QueryUpgradeErrorResponse, +type msgTimeoutParams = { + value: MsgTimeout, }; -type msgChannelCloseConfirmResponseParams = { - value: MsgChannelCloseConfirmResponse, +type msgChannelUpgradeTryResponseParams = { + value: MsgChannelUpgradeTryResponse, }; -type acknowledgementParams = { - value: Acknowledgement, +type msgChannelUpgradeOpenParams = { + value: MsgChannelUpgradeOpen, }; -type queryPacketCommitmentsRequestParams = { - value: QueryPacketCommitmentsRequest, +type msgChannelUpgradeOpenResponseParams = { + value: MsgChannelUpgradeOpenResponse, }; -type queryNextSequenceReceiveRequestParams = { - value: QueryNextSequenceReceiveRequest, +type msgPruneAcknowledgementsResponseParams = { + value: MsgPruneAcknowledgementsResponse, }; -type queryNextSequenceSendRequestParams = { - value: QueryNextSequenceSendRequest, +type queryPacketReceiptRequestParams = { + value: QueryPacketReceiptRequest, }; -type identifiedChannelParams = { - value: IdentifiedChannel, +type queryUnreceivedPacketsRequestParams = { + value: QueryUnreceivedPacketsRequest, }; -type msgChannelOpenAckParams = { - value: MsgChannelOpenAck, +type queryChannelParamsResponseParams = { + value: QueryChannelParamsResponse, }; -type msgChannelUpgradeConfirmParams = { - value: MsgChannelUpgradeConfirm, +type msgChannelUpgradeCancelResponseParams = { + value: MsgChannelUpgradeCancelResponse, }; -type queryChannelsResponseParams = { - value: QueryChannelsResponse, +type genesisStateParams = { + value: GenesisState, }; -type msgTimeoutOnCloseResponseParams = { - value: MsgTimeoutOnCloseResponse, +type packetSequenceParams = { + value: PacketSequence, }; -type msgChannelUpgradeCancelResponseParams = { - value: MsgChannelUpgradeCancelResponse, +type queryChannelRequestParams = { + value: QueryChannelRequest, }; -type msgChannelOpenInitResponseParams = { - value: MsgChannelOpenInitResponse, +type queryConnectionChannelsResponseParams = { + value: QueryConnectionChannelsResponse, }; -type msgChannelCloseInitParams = { - value: MsgChannelCloseInit, +type queryPacketCommitmentsRequestParams = { + value: QueryPacketCommitmentsRequest, }; -type msgAcknowledgementParams = { - value: MsgAcknowledgement, +type msgChannelCloseConfirmParams = { + value: MsgChannelCloseConfirm, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type upgradeParams = { + value: Upgrade, }; -type queryConnectionChannelsResponseParams = { - value: QueryConnectionChannelsResponse, +type queryChannelConsensusStateRequestParams = { + value: QueryChannelConsensusStateRequest, }; -type queryChannelClientStateRequestParams = { - value: QueryChannelClientStateRequest, +type queryNextSequenceReceiveResponseParams = { + value: QueryNextSequenceReceiveResponse, }; -type queryUnreceivedAcksResponseParams = { - value: QueryUnreceivedAcksResponse, +type queryUpgradeResponseParams = { + value: QueryUpgradeResponse, }; -type queryNextSequenceSendResponseParams = { - value: QueryNextSequenceSendResponse, +type queryUnreceivedPacketsResponseParams = { + value: QueryUnreceivedPacketsResponse, }; -type msgAcknowledgementResponseParams = { - value: MsgAcknowledgementResponse, +type msgChannelOpenInitParams = { + value: MsgChannelOpenInit, }; -type msgChannelUpgradeAckResponseParams = { - value: MsgChannelUpgradeAckResponse, +type msgRecvPacketResponseParams = { + value: MsgRecvPacketResponse, }; -type paramsParams = { - value: Params, +type msgAcknowledgementParams = { + value: MsgAcknowledgement, }; -type queryPacketReceiptResponseParams = { - value: QueryPacketReceiptResponse, +type errorReceiptParams = { + value: ErrorReceipt, }; type msgChannelOpenAckResponseParams = { value: MsgChannelOpenAckResponse, }; -type msgTimeoutResponseParams = { - value: MsgTimeoutResponse, -}; - -type msgChannelUpgradeInitResponseParams = { - value: MsgChannelUpgradeInitResponse, +type paramsParams = { + value: Params, }; -type msgChannelUpgradeTryResponseParams = { - value: MsgChannelUpgradeTryResponse, +type timeoutParams = { + value: Timeout, }; -type queryPacketCommitmentRequestParams = { - value: QueryPacketCommitmentRequest, +type queryChannelClientStateResponseParams = { + value: QueryChannelClientStateResponse, }; -type msgChannelUpgradeOpenResponseParams = { - value: MsgChannelUpgradeOpenResponse, +type queryPacketReceiptResponseParams = { + value: QueryPacketReceiptResponse, }; @@ -987,633 +987,633 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendCounterparty({ value, fee, memo }: sendCounterpartyParams): Promise { + async sendMsgTimeoutOnClose({ value, fee, memo }: sendMsgTimeoutOnCloseParams): Promise { if (!signer) { - throw new Error('TxClient:sendCounterparty: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgTimeoutOnClose: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.counterparty({ value: Counterparty.fromPartial(value) }) + let msg = this.msgTimeoutOnClose({ value: MsgTimeoutOnClose.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCounterparty: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgTimeoutOnClose: Could not broadcast Tx: '+ e.message) } }, - async sendPacket({ value, fee, memo }: sendPacketParams): Promise { + async sendChannel({ value, fee, memo }: sendChannelParams): Promise { if (!signer) { - throw new Error('TxClient:sendPacket: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendChannel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.packet({ value: Packet.fromPartial(value) }) + let msg = this.channel({ value: Channel.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPacket: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendChannel: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeAck({ value, fee, memo }: sendMsgChannelUpgradeAckParams): Promise { + async sendPacket({ value, fee, memo }: sendPacketParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeAck: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPacket: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeAck({ value: MsgChannelUpgradeAck.fromPartial(value) }) + let msg = this.packet({ value: Packet.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeAck: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPacket: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUnreceivedPacketsResponse({ value, fee, memo }: sendQueryUnreceivedPacketsResponseParams): Promise { + async sendQueryPacketCommitmentsResponse({ value, fee, memo }: sendQueryPacketCommitmentsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUnreceivedPacketsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPacketCommitmentsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUnreceivedPacketsResponse({ value: QueryUnreceivedPacketsResponse.fromPartial(value) }) + let msg = this.queryPacketCommitmentsResponse({ value: QueryPacketCommitmentsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUnreceivedPacketsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPacketCommitmentsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelOpenConfirmResponse({ value, fee, memo }: sendMsgChannelOpenConfirmResponseParams): Promise { + async sendMsgChannelOpenConfirm({ value, fee, memo }: sendMsgChannelOpenConfirmParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelOpenConfirmResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelOpenConfirm: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelOpenConfirmResponse({ value: MsgChannelOpenConfirmResponse.fromPartial(value) }) + let msg = this.msgChannelOpenConfirm({ value: MsgChannelOpenConfirm.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelOpenConfirmResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelOpenConfirm: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendMsgChannelOpenConfirmResponse({ value, fee, memo }: sendMsgChannelOpenConfirmResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelOpenConfirmResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.msgChannelOpenConfirmResponse({ value: MsgChannelOpenConfirmResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelOpenConfirmResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeOpen({ value, fee, memo }: sendMsgChannelUpgradeOpenParams): Promise { + async sendMsgTimeoutResponse({ value, fee, memo }: sendMsgTimeoutResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeOpen: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgTimeoutResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeOpen({ value: MsgChannelUpgradeOpen.fromPartial(value) }) + let msg = this.msgTimeoutResponse({ value: MsgTimeoutResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeOpen: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgTimeoutResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPacketCommitmentsResponse({ value, fee, memo }: sendQueryPacketCommitmentsResponseParams): Promise { + async sendMsgChannelUpgradeTimeoutResponse({ value, fee, memo }: sendMsgChannelUpgradeTimeoutResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPacketCommitmentsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeTimeoutResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPacketCommitmentsResponse({ value: QueryPacketCommitmentsResponse.fromPartial(value) }) + let msg = this.msgChannelUpgradeTimeoutResponse({ value: MsgChannelUpgradeTimeoutResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPacketCommitmentsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeTimeoutResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPacketAcknowledgementsRequest({ value, fee, memo }: sendQueryPacketAcknowledgementsRequestParams): Promise { + async sendMsgChannelUpgradeConfirmResponse({ value, fee, memo }: sendMsgChannelUpgradeConfirmResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPacketAcknowledgementsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeConfirmResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPacketAcknowledgementsRequest({ value: QueryPacketAcknowledgementsRequest.fromPartial(value) }) + let msg = this.msgChannelUpgradeConfirmResponse({ value: MsgChannelUpgradeConfirmResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPacketAcknowledgementsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeConfirmResponse: Could not broadcast Tx: '+ e.message) } }, - async sendErrorReceipt({ value, fee, memo }: sendErrorReceiptParams): Promise { + async sendMsgChannelUpgradeCancel({ value, fee, memo }: sendMsgChannelUpgradeCancelParams): Promise { if (!signer) { - throw new Error('TxClient:sendErrorReceipt: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeCancel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.errorReceipt({ value: ErrorReceipt.fromPartial(value) }) + let msg = this.msgChannelUpgradeCancel({ value: MsgChannelUpgradeCancel.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendErrorReceipt: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeCancel: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPacketAcknowledgementsResponse({ value, fee, memo }: sendQueryPacketAcknowledgementsResponseParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPacketAcknowledgementsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPacketAcknowledgementsResponse({ value: QueryPacketAcknowledgementsResponse.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPacketAcknowledgementsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelOpenTryResponse({ value, fee, memo }: sendMsgChannelOpenTryResponseParams): Promise { + async sendQueryChannelsResponse({ value, fee, memo }: sendQueryChannelsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelOpenTryResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelOpenTryResponse({ value: MsgChannelOpenTryResponse.fromPartial(value) }) + let msg = this.queryChannelsResponse({ value: QueryChannelsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelOpenTryResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendQueryChannelClientStateRequest({ value, fee, memo }: sendQueryChannelClientStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelClientStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.queryChannelClientStateRequest({ value: QueryChannelClientStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelClientStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelResponse({ value, fee, memo }: sendQueryChannelResponseParams): Promise { + async sendQueryNextSequenceReceiveRequest({ value, fee, memo }: sendQueryNextSequenceReceiveRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryNextSequenceReceiveRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelResponse({ value: QueryChannelResponse.fromPartial(value) }) + let msg = this.queryNextSequenceReceiveRequest({ value: QueryNextSequenceReceiveRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryNextSequenceReceiveRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelsRequest({ value, fee, memo }: sendQueryChannelsRequestParams): Promise { + async sendMsgChannelOpenTry({ value, fee, memo }: sendMsgChannelOpenTryParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelOpenTry: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelsRequest({ value: QueryChannelsRequest.fromPartial(value) }) + let msg = this.msgChannelOpenTry({ value: MsgChannelOpenTry.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelOpenTry: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPacketCommitmentResponse({ value, fee, memo }: sendQueryPacketCommitmentResponseParams): Promise { + async sendMsgChannelOpenAck({ value, fee, memo }: sendMsgChannelOpenAckParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPacketCommitmentResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelOpenAck: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPacketCommitmentResponse({ value: QueryPacketCommitmentResponse.fromPartial(value) }) + let msg = this.msgChannelOpenAck({ value: MsgChannelOpenAck.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPacketCommitmentResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelOpenAck: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelCloseInitResponse({ value, fee, memo }: sendMsgChannelCloseInitResponseParams): Promise { + async sendMsgChannelUpgradeInit({ value, fee, memo }: sendMsgChannelUpgradeInitParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelCloseInitResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeInit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelCloseInitResponse({ value: MsgChannelCloseInitResponse.fromPartial(value) }) + let msg = this.msgChannelUpgradeInit({ value: MsgChannelUpgradeInit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelCloseInitResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeInit: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRecvPacketResponse({ value, fee, memo }: sendMsgRecvPacketResponseParams): Promise { + async sendQueryConnectionChannelsRequest({ value, fee, memo }: sendQueryConnectionChannelsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRecvPacketResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConnectionChannelsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRecvPacketResponse({ value: MsgRecvPacketResponse.fromPartial(value) }) + let msg = this.queryConnectionChannelsRequest({ value: QueryConnectionChannelsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRecvPacketResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConnectionChannelsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgTimeout({ value, fee, memo }: sendMsgTimeoutParams): Promise { + async sendQueryPacketCommitmentResponse({ value, fee, memo }: sendQueryPacketCommitmentResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgTimeout: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPacketCommitmentResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgTimeout({ value: MsgTimeout.fromPartial(value) }) + let msg = this.queryPacketCommitmentResponse({ value: QueryPacketCommitmentResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgTimeout: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPacketCommitmentResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelConsensusStateRequest({ value, fee, memo }: sendQueryChannelConsensusStateRequestParams): Promise { + async sendMsgChannelUpgradeAckResponse({ value, fee, memo }: sendMsgChannelUpgradeAckResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelConsensusStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeAckResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelConsensusStateRequest({ value: QueryChannelConsensusStateRequest.fromPartial(value) }) + let msg = this.msgChannelUpgradeAckResponse({ value: MsgChannelUpgradeAckResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelConsensusStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeAckResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUpgradeErrorRequest({ value, fee, memo }: sendQueryUpgradeErrorRequestParams): Promise { + async sendIdentifiedChannel({ value, fee, memo }: sendIdentifiedChannelParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradeErrorRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendIdentifiedChannel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradeErrorRequest({ value: QueryUpgradeErrorRequest.fromPartial(value) }) + let msg = this.identifiedChannel({ value: IdentifiedChannel.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradeErrorRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendIdentifiedChannel: Could not broadcast Tx: '+ e.message) } }, - async sendUpgrade({ value, fee, memo }: sendUpgradeParams): Promise { + async sendPacketId({ value, fee, memo }: sendPacketIdParams): Promise { if (!signer) { - throw new Error('TxClient:sendUpgrade: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPacketId: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.upgrade({ value: Upgrade.fromPartial(value) }) + let msg = this.packetId({ value: PacketId.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendUpgrade: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPacketId: Could not broadcast Tx: '+ e.message) } }, - async sendUpgradeFields({ value, fee, memo }: sendUpgradeFieldsParams): Promise { + async sendQueryChannelConsensusStateResponse({ value, fee, memo }: sendQueryChannelConsensusStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendUpgradeFields: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelConsensusStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.upgradeFields({ value: UpgradeFields.fromPartial(value) }) + let msg = this.queryChannelConsensusStateResponse({ value: QueryChannelConsensusStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendUpgradeFields: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelConsensusStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPruneAcknowledgementsResponse({ value, fee, memo }: sendMsgPruneAcknowledgementsResponseParams): Promise { + async sendQueryChannelParamsRequest({ value, fee, memo }: sendQueryChannelParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPruneAcknowledgementsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPruneAcknowledgementsResponse({ value: MsgPruneAcknowledgementsResponse.fromPartial(value) }) + let msg = this.queryChannelParamsRequest({ value: QueryChannelParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPruneAcknowledgementsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUnreceivedAcksRequest({ value, fee, memo }: sendQueryUnreceivedAcksRequestParams): Promise { + async sendQueryUpgradeErrorRequest({ value, fee, memo }: sendQueryUpgradeErrorRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUnreceivedAcksRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradeErrorRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUnreceivedAcksRequest({ value: QueryUnreceivedAcksRequest.fromPartial(value) }) + let msg = this.queryUpgradeErrorRequest({ value: QueryUpgradeErrorRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUnreceivedAcksRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradeErrorRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUpgradeRequest({ value, fee, memo }: sendQueryUpgradeRequestParams): Promise { + async sendCounterparty({ value, fee, memo }: sendCounterpartyParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradeRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCounterparty: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradeRequest({ value: QueryUpgradeRequest.fromPartial(value) }) + let msg = this.counterparty({ value: Counterparty.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradeRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCounterparty: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeTimeoutResponse({ value, fee, memo }: sendMsgChannelUpgradeTimeoutResponseParams): Promise { + async sendQueryPacketCommitmentRequest({ value, fee, memo }: sendQueryPacketCommitmentRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeTimeoutResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPacketCommitmentRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeTimeoutResponse({ value: MsgChannelUpgradeTimeoutResponse.fromPartial(value) }) + let msg = this.queryPacketCommitmentRequest({ value: QueryPacketCommitmentRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeTimeoutResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPacketCommitmentRequest: Could not broadcast Tx: '+ e.message) } }, - async sendPacketId({ value, fee, memo }: sendPacketIdParams): Promise { + async sendQueryPacketAcknowledgementsResponse({ value, fee, memo }: sendQueryPacketAcknowledgementsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendPacketId: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPacketAcknowledgementsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.packetId({ value: PacketId.fromPartial(value) }) + let msg = this.queryPacketAcknowledgementsResponse({ value: QueryPacketAcknowledgementsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPacketId: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPacketAcknowledgementsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendPacketSequence({ value, fee, memo }: sendPacketSequenceParams): Promise { + async sendQueryUnreceivedAcksResponse({ value, fee, memo }: sendQueryUnreceivedAcksResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendPacketSequence: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUnreceivedAcksResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.packetSequence({ value: PacketSequence.fromPartial(value) }) + let msg = this.queryUnreceivedAcksResponse({ value: QueryUnreceivedAcksResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPacketSequence: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUnreceivedAcksResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelOpenTry({ value, fee, memo }: sendMsgChannelOpenTryParams): Promise { + async sendQueryNextSequenceSendResponse({ value, fee, memo }: sendQueryNextSequenceSendResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelOpenTry: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryNextSequenceSendResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelOpenTry({ value: MsgChannelOpenTry.fromPartial(value) }) + let msg = this.queryNextSequenceSendResponse({ value: QueryNextSequenceSendResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelOpenTry: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryNextSequenceSendResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeInit({ value, fee, memo }: sendMsgChannelUpgradeInitParams): Promise { + async sendMsgChannelOpenInitResponse({ value, fee, memo }: sendMsgChannelOpenInitResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeInit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelOpenInitResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeInit({ value: MsgChannelUpgradeInit.fromPartial(value) }) + let msg = this.msgChannelOpenInitResponse({ value: MsgChannelOpenInitResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeInit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelOpenInitResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelParamsRequest({ value, fee, memo }: sendQueryChannelParamsRequestParams): Promise { + async sendMsgChannelOpenTryResponse({ value, fee, memo }: sendMsgChannelOpenTryResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelOpenTryResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelParamsRequest({ value: QueryChannelParamsRequest.fromPartial(value) }) + let msg = this.msgChannelOpenTryResponse({ value: MsgChannelOpenTryResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelOpenTryResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelParamsResponse({ value, fee, memo }: sendQueryChannelParamsResponseParams): Promise { + async sendMsgTimeoutOnCloseResponse({ value, fee, memo }: sendMsgTimeoutOnCloseResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgTimeoutOnCloseResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelParamsResponse({ value: QueryChannelParamsResponse.fromPartial(value) }) + let msg = this.msgTimeoutOnCloseResponse({ value: MsgTimeoutOnCloseResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgTimeoutOnCloseResponse: Could not broadcast Tx: '+ e.message) } }, - async sendPacketState({ value, fee, memo }: sendPacketStateParams): Promise { + async sendQueryUpgradeErrorResponse({ value, fee, memo }: sendQueryUpgradeErrorResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendPacketState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradeErrorResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.packetState({ value: PacketState.fromPartial(value) }) + let msg = this.queryUpgradeErrorResponse({ value: QueryUpgradeErrorResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendPacketState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradeErrorResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRecvPacket({ value, fee, memo }: sendMsgRecvPacketParams): Promise { + async sendQueryPacketAcknowledgementsRequest({ value, fee, memo }: sendQueryPacketAcknowledgementsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRecvPacket: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPacketAcknowledgementsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRecvPacket({ value: MsgRecvPacket.fromPartial(value) }) + let msg = this.queryPacketAcknowledgementsRequest({ value: QueryPacketAcknowledgementsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRecvPacket: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPacketAcknowledgementsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelRequest({ value, fee, memo }: sendQueryChannelRequestParams): Promise { + async sendQueryUpgradeRequest({ value, fee, memo }: sendQueryUpgradeRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradeRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelRequest({ value: QueryChannelRequest.fromPartial(value) }) + let msg = this.queryUpgradeRequest({ value: QueryUpgradeRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradeRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgTimeoutOnClose({ value, fee, memo }: sendMsgTimeoutOnCloseParams): Promise { + async sendMsgChannelUpgradeInitResponse({ value, fee, memo }: sendMsgChannelUpgradeInitResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgTimeoutOnClose: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeInitResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgTimeoutOnClose({ value: MsgTimeoutOnClose.fromPartial(value) }) + let msg = this.msgChannelUpgradeInitResponse({ value: MsgChannelUpgradeInitResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgTimeoutOnClose: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeInitResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeTimeout({ value, fee, memo }: sendMsgChannelUpgradeTimeoutParams): Promise { + async sendMsgChannelUpgradeConfirm({ value, fee, memo }: sendMsgChannelUpgradeConfirmParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeTimeout: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeConfirm: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeTimeout({ value: MsgChannelUpgradeTimeout.fromPartial(value) }) + let msg = this.msgChannelUpgradeConfirm({ value: MsgChannelUpgradeConfirm.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeTimeout: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeConfirm: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPacketReceiptRequest({ value, fee, memo }: sendQueryPacketReceiptRequestParams): Promise { + async sendMsgChannelUpgradeTimeout({ value, fee, memo }: sendMsgChannelUpgradeTimeoutParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPacketReceiptRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeTimeout: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPacketReceiptRequest({ value: QueryPacketReceiptRequest.fromPartial(value) }) + let msg = this.msgChannelUpgradeTimeout({ value: MsgChannelUpgradeTimeout.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPacketReceiptRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeTimeout: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUpgradeResponse({ value, fee, memo }: sendQueryUpgradeResponseParams): Promise { + async sendMsgPruneAcknowledgements({ value, fee, memo }: sendMsgPruneAcknowledgementsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPruneAcknowledgements: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradeResponse({ value: QueryUpgradeResponse.fromPartial(value) }) + let msg = this.msgPruneAcknowledgements({ value: MsgPruneAcknowledgements.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPruneAcknowledgements: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeConfirmResponse({ value, fee, memo }: sendMsgChannelUpgradeConfirmResponseParams): Promise { + async sendQueryPacketAcknowledgementRequest({ value, fee, memo }: sendQueryPacketAcknowledgementRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeConfirmResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPacketAcknowledgementRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeConfirmResponse({ value: MsgChannelUpgradeConfirmResponse.fromPartial(value) }) + let msg = this.queryPacketAcknowledgementRequest({ value: QueryPacketAcknowledgementRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeConfirmResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPacketAcknowledgementRequest: Could not broadcast Tx: '+ e.message) } }, - async sendTimeout({ value, fee, memo }: sendTimeoutParams): Promise { + async sendMsgChannelCloseConfirmResponse({ value, fee, memo }: sendMsgChannelCloseConfirmResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendTimeout: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelCloseConfirmResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.timeout({ value: Timeout.fromPartial(value) }) + let msg = this.msgChannelCloseConfirmResponse({ value: MsgChannelCloseConfirmResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendTimeout: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelCloseConfirmResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelCloseConfirm({ value, fee, memo }: sendMsgChannelCloseConfirmParams): Promise { + async sendMsgChannelUpgradeAck({ value, fee, memo }: sendMsgChannelUpgradeAckParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelCloseConfirm: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeAck: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelCloseConfirm({ value: MsgChannelCloseConfirm.fromPartial(value) }) + let msg = this.msgChannelUpgradeAck({ value: MsgChannelUpgradeAck.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelCloseConfirm: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeAck: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConnectionChannelsRequest({ value, fee, memo }: sendQueryConnectionChannelsRequestParams): Promise { + async sendAcknowledgement({ value, fee, memo }: sendAcknowledgementParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConnectionChannelsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendAcknowledgement: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConnectionChannelsRequest({ value: QueryConnectionChannelsRequest.fromPartial(value) }) + let msg = this.acknowledgement({ value: Acknowledgement.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConnectionChannelsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendAcknowledgement: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelClientStateResponse({ value, fee, memo }: sendQueryChannelClientStateResponseParams): Promise { + async sendQueryChannelResponse({ value, fee, memo }: sendQueryChannelResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelClientStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelClientStateResponse({ value: QueryChannelClientStateResponse.fromPartial(value) }) + let msg = this.queryChannelResponse({ value: QueryChannelResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelClientStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelResponse: Could not broadcast Tx: '+ e.message) } }, @@ -1631,572 +1631,580 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryUnreceivedPacketsRequest({ value, fee, memo }: sendQueryUnreceivedPacketsRequestParams): Promise { + async sendQueryUnreceivedAcksRequest({ value, fee, memo }: sendQueryUnreceivedAcksRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUnreceivedPacketsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUnreceivedAcksRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUnreceivedPacketsRequest({ value: QueryUnreceivedPacketsRequest.fromPartial(value) }) + let msg = this.queryUnreceivedAcksRequest({ value: QueryUnreceivedAcksRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUnreceivedPacketsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUnreceivedAcksRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPacketAcknowledgementRequest({ value, fee, memo }: sendQueryPacketAcknowledgementRequestParams): Promise { + async sendQueryChannelsRequest({ value, fee, memo }: sendQueryChannelsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPacketAcknowledgementRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPacketAcknowledgementRequest({ value: QueryPacketAcknowledgementRequest.fromPartial(value) }) + let msg = this.queryChannelsRequest({ value: QueryChannelsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPacketAcknowledgementRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendChannel({ value, fee, memo }: sendChannelParams): Promise { + async sendQueryNextSequenceSendRequest({ value, fee, memo }: sendQueryNextSequenceSendRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendChannel: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryNextSequenceSendRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.channel({ value: Channel.fromPartial(value) }) + let msg = this.queryNextSequenceSendRequest({ value: QueryNextSequenceSendRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendChannel: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryNextSequenceSendRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelOpenInit({ value, fee, memo }: sendMsgChannelOpenInitParams): Promise { + async sendMsgChannelCloseInit({ value, fee, memo }: sendMsgChannelCloseInitParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelOpenInit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelCloseInit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelOpenInit({ value: MsgChannelOpenInit.fromPartial(value) }) + let msg = this.msgChannelCloseInit({ value: MsgChannelCloseInit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelOpenInit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelCloseInit: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelOpenConfirm({ value, fee, memo }: sendMsgChannelOpenConfirmParams): Promise { + async sendMsgRecvPacket({ value, fee, memo }: sendMsgRecvPacketParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelOpenConfirm: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRecvPacket: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelOpenConfirm({ value: MsgChannelOpenConfirm.fromPartial(value) }) + let msg = this.msgRecvPacket({ value: MsgRecvPacket.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelOpenConfirm: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRecvPacket: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeTry({ value, fee, memo }: sendMsgChannelUpgradeTryParams): Promise { + async sendMsgAcknowledgementResponse({ value, fee, memo }: sendMsgAcknowledgementResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeTry: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAcknowledgementResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeTry({ value: MsgChannelUpgradeTry.fromPartial(value) }) + let msg = this.msgAcknowledgementResponse({ value: MsgAcknowledgementResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeTry: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAcknowledgementResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeCancel({ value, fee, memo }: sendMsgChannelUpgradeCancelParams): Promise { + async sendMsgChannelUpgradeTry({ value, fee, memo }: sendMsgChannelUpgradeTryParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeCancel: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeTry: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeCancel({ value: MsgChannelUpgradeCancel.fromPartial(value) }) + let msg = this.msgChannelUpgradeTry({ value: MsgChannelUpgradeTry.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeCancel: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeTry: Could not broadcast Tx: '+ e.message) } }, - async sendMsgPruneAcknowledgements({ value, fee, memo }: sendMsgPruneAcknowledgementsParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgPruneAcknowledgements: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgPruneAcknowledgements({ value: MsgPruneAcknowledgements.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgPruneAcknowledgements: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelConsensusStateResponse({ value, fee, memo }: sendQueryChannelConsensusStateResponseParams): Promise { + async sendUpgradeFields({ value, fee, memo }: sendUpgradeFieldsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelConsensusStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendUpgradeFields: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelConsensusStateResponse({ value: QueryChannelConsensusStateResponse.fromPartial(value) }) + let msg = this.upgradeFields({ value: UpgradeFields.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelConsensusStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendUpgradeFields: Could not broadcast Tx: '+ e.message) } }, - async sendQueryNextSequenceReceiveResponse({ value, fee, memo }: sendQueryNextSequenceReceiveResponseParams): Promise { + async sendPacketState({ value, fee, memo }: sendPacketStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryNextSequenceReceiveResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPacketState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryNextSequenceReceiveResponse({ value: QueryNextSequenceReceiveResponse.fromPartial(value) }) + let msg = this.packetState({ value: PacketState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryNextSequenceReceiveResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPacketState: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUpgradeErrorResponse({ value, fee, memo }: sendQueryUpgradeErrorResponseParams): Promise { + async sendMsgChannelCloseInitResponse({ value, fee, memo }: sendMsgChannelCloseInitResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradeErrorResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelCloseInitResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradeErrorResponse({ value: QueryUpgradeErrorResponse.fromPartial(value) }) + let msg = this.msgChannelCloseInitResponse({ value: MsgChannelCloseInitResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradeErrorResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelCloseInitResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelCloseConfirmResponse({ value, fee, memo }: sendMsgChannelCloseConfirmResponseParams): Promise { + async sendMsgTimeout({ value, fee, memo }: sendMsgTimeoutParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelCloseConfirmResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgTimeout: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelCloseConfirmResponse({ value: MsgChannelCloseConfirmResponse.fromPartial(value) }) + let msg = this.msgTimeout({ value: MsgTimeout.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelCloseConfirmResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgTimeout: Could not broadcast Tx: '+ e.message) } }, - async sendAcknowledgement({ value, fee, memo }: sendAcknowledgementParams): Promise { + async sendMsgChannelUpgradeTryResponse({ value, fee, memo }: sendMsgChannelUpgradeTryResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendAcknowledgement: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeTryResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.acknowledgement({ value: Acknowledgement.fromPartial(value) }) + let msg = this.msgChannelUpgradeTryResponse({ value: MsgChannelUpgradeTryResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendAcknowledgement: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeTryResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPacketCommitmentsRequest({ value, fee, memo }: sendQueryPacketCommitmentsRequestParams): Promise { + async sendMsgChannelUpgradeOpen({ value, fee, memo }: sendMsgChannelUpgradeOpenParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPacketCommitmentsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeOpen: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPacketCommitmentsRequest({ value: QueryPacketCommitmentsRequest.fromPartial(value) }) + let msg = this.msgChannelUpgradeOpen({ value: MsgChannelUpgradeOpen.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPacketCommitmentsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeOpen: Could not broadcast Tx: '+ e.message) } }, - async sendQueryNextSequenceReceiveRequest({ value, fee, memo }: sendQueryNextSequenceReceiveRequestParams): Promise { + async sendMsgChannelUpgradeOpenResponse({ value, fee, memo }: sendMsgChannelUpgradeOpenResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryNextSequenceReceiveRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeOpenResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryNextSequenceReceiveRequest({ value: QueryNextSequenceReceiveRequest.fromPartial(value) }) + let msg = this.msgChannelUpgradeOpenResponse({ value: MsgChannelUpgradeOpenResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryNextSequenceReceiveRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeOpenResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryNextSequenceSendRequest({ value, fee, memo }: sendQueryNextSequenceSendRequestParams): Promise { + async sendMsgPruneAcknowledgementsResponse({ value, fee, memo }: sendMsgPruneAcknowledgementsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryNextSequenceSendRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgPruneAcknowledgementsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryNextSequenceSendRequest({ value: QueryNextSequenceSendRequest.fromPartial(value) }) + let msg = this.msgPruneAcknowledgementsResponse({ value: MsgPruneAcknowledgementsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryNextSequenceSendRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgPruneAcknowledgementsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendIdentifiedChannel({ value, fee, memo }: sendIdentifiedChannelParams): Promise { + async sendQueryPacketReceiptRequest({ value, fee, memo }: sendQueryPacketReceiptRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendIdentifiedChannel: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPacketReceiptRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.identifiedChannel({ value: IdentifiedChannel.fromPartial(value) }) + let msg = this.queryPacketReceiptRequest({ value: QueryPacketReceiptRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendIdentifiedChannel: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPacketReceiptRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelOpenAck({ value, fee, memo }: sendMsgChannelOpenAckParams): Promise { + async sendQueryUnreceivedPacketsRequest({ value, fee, memo }: sendQueryUnreceivedPacketsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelOpenAck: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUnreceivedPacketsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelOpenAck({ value: MsgChannelOpenAck.fromPartial(value) }) + let msg = this.queryUnreceivedPacketsRequest({ value: QueryUnreceivedPacketsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelOpenAck: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUnreceivedPacketsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeConfirm({ value, fee, memo }: sendMsgChannelUpgradeConfirmParams): Promise { + async sendQueryChannelParamsResponse({ value, fee, memo }: sendQueryChannelParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeConfirm: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeConfirm({ value: MsgChannelUpgradeConfirm.fromPartial(value) }) + let msg = this.queryChannelParamsResponse({ value: QueryChannelParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeConfirm: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelsResponse({ value, fee, memo }: sendQueryChannelsResponseParams): Promise { + async sendMsgChannelUpgradeCancelResponse({ value, fee, memo }: sendMsgChannelUpgradeCancelResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelUpgradeCancelResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelsResponse({ value: QueryChannelsResponse.fromPartial(value) }) + let msg = this.msgChannelUpgradeCancelResponse({ value: MsgChannelUpgradeCancelResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelUpgradeCancelResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgTimeoutOnCloseResponse({ value, fee, memo }: sendMsgTimeoutOnCloseResponseParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgTimeoutOnCloseResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgTimeoutOnCloseResponse({ value: MsgTimeoutOnCloseResponse.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgTimeoutOnCloseResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeCancelResponse({ value, fee, memo }: sendMsgChannelUpgradeCancelResponseParams): Promise { + async sendPacketSequence({ value, fee, memo }: sendPacketSequenceParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeCancelResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendPacketSequence: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeCancelResponse({ value: MsgChannelUpgradeCancelResponse.fromPartial(value) }) + let msg = this.packetSequence({ value: PacketSequence.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeCancelResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendPacketSequence: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelOpenInitResponse({ value, fee, memo }: sendMsgChannelOpenInitResponseParams): Promise { + async sendQueryChannelRequest({ value, fee, memo }: sendQueryChannelRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelOpenInitResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelOpenInitResponse({ value: MsgChannelOpenInitResponse.fromPartial(value) }) + let msg = this.queryChannelRequest({ value: QueryChannelRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelOpenInitResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelCloseInit({ value, fee, memo }: sendMsgChannelCloseInitParams): Promise { + async sendQueryConnectionChannelsResponse({ value, fee, memo }: sendQueryConnectionChannelsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelCloseInit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConnectionChannelsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelCloseInit({ value: MsgChannelCloseInit.fromPartial(value) }) + let msg = this.queryConnectionChannelsResponse({ value: QueryConnectionChannelsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelCloseInit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConnectionChannelsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAcknowledgement({ value, fee, memo }: sendMsgAcknowledgementParams): Promise { + async sendQueryPacketCommitmentsRequest({ value, fee, memo }: sendQueryPacketCommitmentsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAcknowledgement: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPacketCommitmentsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgAcknowledgement({ value: MsgAcknowledgement.fromPartial(value) }) + let msg = this.queryPacketCommitmentsRequest({ value: QueryPacketCommitmentsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAcknowledgement: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPacketCommitmentsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendMsgChannelCloseConfirm({ value, fee, memo }: sendMsgChannelCloseConfirmParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelCloseConfirm: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.msgChannelCloseConfirm({ value: MsgChannelCloseConfirm.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelCloseConfirm: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConnectionChannelsResponse({ value, fee, memo }: sendQueryConnectionChannelsResponseParams): Promise { + async sendUpgrade({ value, fee, memo }: sendUpgradeParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConnectionChannelsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendUpgrade: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConnectionChannelsResponse({ value: QueryConnectionChannelsResponse.fromPartial(value) }) + let msg = this.upgrade({ value: Upgrade.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConnectionChannelsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendUpgrade: Could not broadcast Tx: '+ e.message) } }, - async sendQueryChannelClientStateRequest({ value, fee, memo }: sendQueryChannelClientStateRequestParams): Promise { + async sendQueryChannelConsensusStateRequest({ value, fee, memo }: sendQueryChannelConsensusStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryChannelClientStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelConsensusStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryChannelClientStateRequest({ value: QueryChannelClientStateRequest.fromPartial(value) }) + let msg = this.queryChannelConsensusStateRequest({ value: QueryChannelConsensusStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryChannelClientStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelConsensusStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUnreceivedAcksResponse({ value, fee, memo }: sendQueryUnreceivedAcksResponseParams): Promise { + async sendQueryNextSequenceReceiveResponse({ value, fee, memo }: sendQueryNextSequenceReceiveResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUnreceivedAcksResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryNextSequenceReceiveResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUnreceivedAcksResponse({ value: QueryUnreceivedAcksResponse.fromPartial(value) }) + let msg = this.queryNextSequenceReceiveResponse({ value: QueryNextSequenceReceiveResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUnreceivedAcksResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryNextSequenceReceiveResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryNextSequenceSendResponse({ value, fee, memo }: sendQueryNextSequenceSendResponseParams): Promise { + async sendQueryUpgradeResponse({ value, fee, memo }: sendQueryUpgradeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryNextSequenceSendResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryNextSequenceSendResponse({ value: QueryNextSequenceSendResponse.fromPartial(value) }) + let msg = this.queryUpgradeResponse({ value: QueryUpgradeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryNextSequenceSendResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAcknowledgementResponse({ value, fee, memo }: sendMsgAcknowledgementResponseParams): Promise { + async sendQueryUnreceivedPacketsResponse({ value, fee, memo }: sendQueryUnreceivedPacketsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAcknowledgementResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUnreceivedPacketsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgAcknowledgementResponse({ value: MsgAcknowledgementResponse.fromPartial(value) }) + let msg = this.queryUnreceivedPacketsResponse({ value: QueryUnreceivedPacketsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAcknowledgementResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUnreceivedPacketsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeAckResponse({ value, fee, memo }: sendMsgChannelUpgradeAckResponseParams): Promise { + async sendMsgChannelOpenInit({ value, fee, memo }: sendMsgChannelOpenInitParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeAckResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelOpenInit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeAckResponse({ value: MsgChannelUpgradeAckResponse.fromPartial(value) }) + let msg = this.msgChannelOpenInit({ value: MsgChannelOpenInit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeAckResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelOpenInit: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendMsgRecvPacketResponse({ value, fee, memo }: sendMsgRecvPacketResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRecvPacketResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.msgRecvPacketResponse({ value: MsgRecvPacketResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRecvPacketResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPacketReceiptResponse({ value, fee, memo }: sendQueryPacketReceiptResponseParams): Promise { + async sendMsgAcknowledgement({ value, fee, memo }: sendMsgAcknowledgementParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPacketReceiptResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAcknowledgement: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPacketReceiptResponse({ value: QueryPacketReceiptResponse.fromPartial(value) }) + let msg = this.msgAcknowledgement({ value: MsgAcknowledgement.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPacketReceiptResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAcknowledgement: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelOpenAckResponse({ value, fee, memo }: sendMsgChannelOpenAckResponseParams): Promise { + async sendErrorReceipt({ value, fee, memo }: sendErrorReceiptParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelOpenAckResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendErrorReceipt: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelOpenAckResponse({ value: MsgChannelOpenAckResponse.fromPartial(value) }) + let msg = this.errorReceipt({ value: ErrorReceipt.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelOpenAckResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendErrorReceipt: Could not broadcast Tx: '+ e.message) } }, - async sendMsgTimeoutResponse({ value, fee, memo }: sendMsgTimeoutResponseParams): Promise { + async sendMsgChannelOpenAckResponse({ value, fee, memo }: sendMsgChannelOpenAckResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgTimeoutResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgChannelOpenAckResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgTimeoutResponse({ value: MsgTimeoutResponse.fromPartial(value) }) + let msg = this.msgChannelOpenAckResponse({ value: MsgChannelOpenAckResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgTimeoutResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgChannelOpenAckResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeInitResponse({ value, fee, memo }: sendMsgChannelUpgradeInitResponseParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeInitResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeInitResponse({ value: MsgChannelUpgradeInitResponse.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeInitResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeTryResponse({ value, fee, memo }: sendMsgChannelUpgradeTryResponseParams): Promise { + async sendTimeout({ value, fee, memo }: sendTimeoutParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeTryResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendTimeout: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeTryResponse({ value: MsgChannelUpgradeTryResponse.fromPartial(value) }) + let msg = this.timeout({ value: Timeout.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeTryResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendTimeout: Could not broadcast Tx: '+ e.message) } }, - async sendQueryPacketCommitmentRequest({ value, fee, memo }: sendQueryPacketCommitmentRequestParams): Promise { + async sendQueryChannelClientStateResponse({ value, fee, memo }: sendQueryChannelClientStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryPacketCommitmentRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryChannelClientStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryPacketCommitmentRequest({ value: QueryPacketCommitmentRequest.fromPartial(value) }) + let msg = this.queryChannelClientStateResponse({ value: QueryChannelClientStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryPacketCommitmentRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryChannelClientStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgChannelUpgradeOpenResponse({ value, fee, memo }: sendMsgChannelUpgradeOpenResponseParams): Promise { + async sendQueryPacketReceiptResponse({ value, fee, memo }: sendQueryPacketReceiptResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgChannelUpgradeOpenResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryPacketReceiptResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgChannelUpgradeOpenResponse({ value: MsgChannelUpgradeOpenResponse.fromPartial(value) }) + let msg = this.queryPacketReceiptResponse({ value: QueryPacketReceiptResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgChannelUpgradeOpenResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryPacketReceiptResponse: Could not broadcast Tx: '+ e.message) } }, - counterparty({ value }: counterpartyParams): EncodeObject { + msgTimeoutOnClose({ value }: msgTimeoutOnCloseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.Counterparty", value: Counterparty.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: MsgTimeoutOnClose.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Counterparty: Could not create message: ' + e.message) + throw new Error('TxClient:MsgTimeoutOnClose: Could not create message: ' + e.message) + } + }, + + channel({ value }: channelParams): EncodeObject { + try { + return { typeUrl: "/ibc.core.channel.v1.Channel", value: Channel.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:Channel: Could not create message: ' + e.message) } }, @@ -2208,19 +2216,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgChannelUpgradeAck({ value }: msgChannelUpgradeAckParams): EncodeObject { + queryPacketCommitmentsResponse({ value }: queryPacketCommitmentsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAck", value: MsgChannelUpgradeAck.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", value: QueryPacketCommitmentsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeAck: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPacketCommitmentsResponse: Could not create message: ' + e.message) } }, - queryUnreceivedPacketsResponse({ value }: queryUnreceivedPacketsResponseParams): EncodeObject { + msgChannelOpenConfirm({ value }: msgChannelOpenConfirmParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", value: QueryUnreceivedPacketsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value: MsgChannelOpenConfirm.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUnreceivedPacketsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelOpenConfirm: Could not create message: ' + e.message) } }, @@ -2232,259 +2240,259 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - genesisState({ value }: genesisStateParams): EncodeObject { + msgTimeoutResponse({ value }: msgTimeoutResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", value: MsgTimeoutResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:MsgTimeoutResponse: Could not create message: ' + e.message) } }, - msgChannelUpgradeOpen({ value }: msgChannelUpgradeOpenParams): EncodeObject { + msgChannelUpgradeTimeoutResponse({ value }: msgChannelUpgradeTimeoutResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpen", value: MsgChannelUpgradeOpen.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTimeoutResponse", value: MsgChannelUpgradeTimeoutResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeOpen: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeTimeoutResponse: Could not create message: ' + e.message) } }, - queryPacketCommitmentsResponse({ value }: queryPacketCommitmentsResponseParams): EncodeObject { + msgChannelUpgradeConfirmResponse({ value }: msgChannelUpgradeConfirmResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", value: QueryPacketCommitmentsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirmResponse", value: MsgChannelUpgradeConfirmResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPacketCommitmentsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeConfirmResponse: Could not create message: ' + e.message) } }, - queryPacketAcknowledgementsRequest({ value }: queryPacketAcknowledgementsRequestParams): EncodeObject { + msgChannelUpgradeCancel({ value }: msgChannelUpgradeCancelParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", value: QueryPacketAcknowledgementsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancel", value: MsgChannelUpgradeCancel.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPacketAcknowledgementsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeCancel: Could not create message: ' + e.message) } }, - errorReceipt({ value }: errorReceiptParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.ErrorReceipt", value: ErrorReceipt.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ErrorReceipt: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - queryPacketAcknowledgementsResponse({ value }: queryPacketAcknowledgementsResponseParams): EncodeObject { + queryChannelsResponse({ value }: queryChannelsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", value: QueryPacketAcknowledgementsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", value: QueryChannelsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPacketAcknowledgementsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelsResponse: Could not create message: ' + e.message) } }, - msgChannelOpenTryResponse({ value }: msgChannelOpenTryResponseParams): EncodeObject { + queryChannelClientStateRequest({ value }: queryChannelClientStateRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", value: MsgChannelOpenTryResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", value: QueryChannelClientStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelOpenTryResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelClientStateRequest: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + queryNextSequenceReceiveRequest({ value }: queryNextSequenceReceiveRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", value: QueryNextSequenceReceiveRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryNextSequenceReceiveRequest: Could not create message: ' + e.message) } }, - queryChannelResponse({ value }: queryChannelResponseParams): EncodeObject { + msgChannelOpenTry({ value }: msgChannelOpenTryParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", value: QueryChannelResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: MsgChannelOpenTry.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelOpenTry: Could not create message: ' + e.message) } }, - queryChannelsRequest({ value }: queryChannelsRequestParams): EncodeObject { + msgChannelOpenAck({ value }: msgChannelOpenAckParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", value: QueryChannelsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: MsgChannelOpenAck.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelOpenAck: Could not create message: ' + e.message) } }, - queryPacketCommitmentResponse({ value }: queryPacketCommitmentResponseParams): EncodeObject { + msgChannelUpgradeInit({ value }: msgChannelUpgradeInitParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", value: QueryPacketCommitmentResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInit", value: MsgChannelUpgradeInit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPacketCommitmentResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeInit: Could not create message: ' + e.message) } }, - msgChannelCloseInitResponse({ value }: msgChannelCloseInitResponseParams): EncodeObject { + queryConnectionChannelsRequest({ value }: queryConnectionChannelsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", value: MsgChannelCloseInitResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", value: QueryConnectionChannelsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelCloseInitResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConnectionChannelsRequest: Could not create message: ' + e.message) } }, - msgRecvPacketResponse({ value }: msgRecvPacketResponseParams): EncodeObject { + queryPacketCommitmentResponse({ value }: queryPacketCommitmentResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", value: MsgRecvPacketResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", value: QueryPacketCommitmentResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRecvPacketResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPacketCommitmentResponse: Could not create message: ' + e.message) } }, - msgTimeout({ value }: msgTimeoutParams): EncodeObject { + msgChannelUpgradeAckResponse({ value }: msgChannelUpgradeAckResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: MsgTimeout.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAckResponse", value: MsgChannelUpgradeAckResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgTimeout: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeAckResponse: Could not create message: ' + e.message) } }, - queryChannelConsensusStateRequest({ value }: queryChannelConsensusStateRequestParams): EncodeObject { + identifiedChannel({ value }: identifiedChannelParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", value: QueryChannelConsensusStateRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", value: IdentifiedChannel.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelConsensusStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:IdentifiedChannel: Could not create message: ' + e.message) } }, - queryUpgradeErrorRequest({ value }: queryUpgradeErrorRequestParams): EncodeObject { + packetId({ value }: packetIdParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryUpgradeErrorRequest", value: QueryUpgradeErrorRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.PacketId", value: PacketId.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradeErrorRequest: Could not create message: ' + e.message) + throw new Error('TxClient:PacketId: Could not create message: ' + e.message) } }, - upgrade({ value }: upgradeParams): EncodeObject { + queryChannelConsensusStateResponse({ value }: queryChannelConsensusStateResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.Upgrade", value: Upgrade.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", value: QueryChannelConsensusStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Upgrade: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelConsensusStateResponse: Could not create message: ' + e.message) } }, - upgradeFields({ value }: upgradeFieldsParams): EncodeObject { + queryChannelParamsRequest({ value }: queryChannelParamsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.UpgradeFields", value: UpgradeFields.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelParamsRequest", value: QueryChannelParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:UpgradeFields: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelParamsRequest: Could not create message: ' + e.message) } }, - msgPruneAcknowledgementsResponse({ value }: msgPruneAcknowledgementsResponseParams): EncodeObject { + queryUpgradeErrorRequest({ value }: queryUpgradeErrorRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgementsResponse", value: MsgPruneAcknowledgementsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryUpgradeErrorRequest", value: QueryUpgradeErrorRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPruneAcknowledgementsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradeErrorRequest: Could not create message: ' + e.message) } }, - queryUnreceivedAcksRequest({ value }: queryUnreceivedAcksRequestParams): EncodeObject { + counterparty({ value }: counterpartyParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", value: QueryUnreceivedAcksRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.Counterparty", value: Counterparty.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUnreceivedAcksRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Counterparty: Could not create message: ' + e.message) } }, - queryUpgradeRequest({ value }: queryUpgradeRequestParams): EncodeObject { + queryPacketCommitmentRequest({ value }: queryPacketCommitmentRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryUpgradeRequest", value: QueryUpgradeRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", value: QueryPacketCommitmentRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradeRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPacketCommitmentRequest: Could not create message: ' + e.message) } }, - msgChannelUpgradeTimeoutResponse({ value }: msgChannelUpgradeTimeoutResponseParams): EncodeObject { + queryPacketAcknowledgementsResponse({ value }: queryPacketAcknowledgementsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTimeoutResponse", value: MsgChannelUpgradeTimeoutResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", value: QueryPacketAcknowledgementsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeTimeoutResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPacketAcknowledgementsResponse: Could not create message: ' + e.message) } }, - packetId({ value }: packetIdParams): EncodeObject { + queryUnreceivedAcksResponse({ value }: queryUnreceivedAcksResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.PacketId", value: PacketId.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", value: QueryUnreceivedAcksResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:PacketId: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUnreceivedAcksResponse: Could not create message: ' + e.message) } }, - packetSequence({ value }: packetSequenceParams): EncodeObject { + queryNextSequenceSendResponse({ value }: queryNextSequenceSendResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.PacketSequence", value: PacketSequence.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceSendResponse", value: QueryNextSequenceSendResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:PacketSequence: Could not create message: ' + e.message) + throw new Error('TxClient:QueryNextSequenceSendResponse: Could not create message: ' + e.message) } }, - msgChannelOpenTry({ value }: msgChannelOpenTryParams): EncodeObject { + msgChannelOpenInitResponse({ value }: msgChannelOpenInitResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: MsgChannelOpenTry.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", value: MsgChannelOpenInitResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelOpenTry: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelOpenInitResponse: Could not create message: ' + e.message) } }, - msgChannelUpgradeInit({ value }: msgChannelUpgradeInitParams): EncodeObject { + msgChannelOpenTryResponse({ value }: msgChannelOpenTryResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInit", value: MsgChannelUpgradeInit.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", value: MsgChannelOpenTryResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeInit: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelOpenTryResponse: Could not create message: ' + e.message) } }, - queryChannelParamsRequest({ value }: queryChannelParamsRequestParams): EncodeObject { + msgTimeoutOnCloseResponse({ value }: msgTimeoutOnCloseResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelParamsRequest", value: QueryChannelParamsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", value: MsgTimeoutOnCloseResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgTimeoutOnCloseResponse: Could not create message: ' + e.message) } }, - queryChannelParamsResponse({ value }: queryChannelParamsResponseParams): EncodeObject { + queryUpgradeErrorResponse({ value }: queryUpgradeErrorResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelParamsResponse", value: QueryChannelParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryUpgradeErrorResponse", value: QueryUpgradeErrorResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradeErrorResponse: Could not create message: ' + e.message) } }, - packetState({ value }: packetStateParams): EncodeObject { + queryPacketAcknowledgementsRequest({ value }: queryPacketAcknowledgementsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.PacketState", value: PacketState.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", value: QueryPacketAcknowledgementsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:PacketState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPacketAcknowledgementsRequest: Could not create message: ' + e.message) } }, - msgRecvPacket({ value }: msgRecvPacketParams): EncodeObject { + queryUpgradeRequest({ value }: queryUpgradeRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: MsgRecvPacket.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryUpgradeRequest", value: QueryUpgradeRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRecvPacket: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradeRequest: Could not create message: ' + e.message) } }, - queryChannelRequest({ value }: queryChannelRequestParams): EncodeObject { + msgChannelUpgradeInitResponse({ value }: msgChannelUpgradeInitResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", value: QueryChannelRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInitResponse", value: MsgChannelUpgradeInitResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeInitResponse: Could not create message: ' + e.message) } }, - msgTimeoutOnClose({ value }: msgTimeoutOnCloseParams): EncodeObject { + msgChannelUpgradeConfirm({ value }: msgChannelUpgradeConfirmParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: MsgTimeoutOnClose.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirm", value: MsgChannelUpgradeConfirm.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgTimeoutOnClose: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeConfirm: Could not create message: ' + e.message) } }, @@ -2496,59 +2504,51 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryPacketReceiptRequest({ value }: queryPacketReceiptRequestParams): EncodeObject { - try { - return { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", value: QueryPacketReceiptRequest.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:QueryPacketReceiptRequest: Could not create message: ' + e.message) - } - }, - - queryUpgradeResponse({ value }: queryUpgradeResponseParams): EncodeObject { + msgPruneAcknowledgements({ value }: msgPruneAcknowledgementsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryUpgradeResponse", value: QueryUpgradeResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgements", value: MsgPruneAcknowledgements.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPruneAcknowledgements: Could not create message: ' + e.message) } }, - msgChannelUpgradeConfirmResponse({ value }: msgChannelUpgradeConfirmResponseParams): EncodeObject { + queryPacketAcknowledgementRequest({ value }: queryPacketAcknowledgementRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirmResponse", value: MsgChannelUpgradeConfirmResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", value: QueryPacketAcknowledgementRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeConfirmResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPacketAcknowledgementRequest: Could not create message: ' + e.message) } }, - timeout({ value }: timeoutParams): EncodeObject { + msgChannelCloseConfirmResponse({ value }: msgChannelCloseConfirmResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.Timeout", value: Timeout.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", value: MsgChannelCloseConfirmResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Timeout: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelCloseConfirmResponse: Could not create message: ' + e.message) } }, - msgChannelCloseConfirm({ value }: msgChannelCloseConfirmParams): EncodeObject { + msgChannelUpgradeAck({ value }: msgChannelUpgradeAckParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value: MsgChannelCloseConfirm.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAck", value: MsgChannelUpgradeAck.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelCloseConfirm: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeAck: Could not create message: ' + e.message) } }, - queryConnectionChannelsRequest({ value }: queryConnectionChannelsRequestParams): EncodeObject { + acknowledgement({ value }: acknowledgementParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", value: QueryConnectionChannelsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.Acknowledgement", value: Acknowledgement.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConnectionChannelsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Acknowledgement: Could not create message: ' + e.message) } }, - queryChannelClientStateResponse({ value }: queryChannelClientStateResponseParams): EncodeObject { + queryChannelResponse({ value }: queryChannelResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", value: QueryChannelClientStateResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", value: QueryChannelResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelClientStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelResponse: Could not create message: ' + e.message) } }, @@ -2560,43 +2560,51 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryUnreceivedPacketsRequest({ value }: queryUnreceivedPacketsRequestParams): EncodeObject { + queryUnreceivedAcksRequest({ value }: queryUnreceivedAcksRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", value: QueryUnreceivedPacketsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", value: QueryUnreceivedAcksRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUnreceivedPacketsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUnreceivedAcksRequest: Could not create message: ' + e.message) } }, - queryPacketAcknowledgementRequest({ value }: queryPacketAcknowledgementRequestParams): EncodeObject { + queryChannelsRequest({ value }: queryChannelsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", value: QueryPacketAcknowledgementRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", value: QueryChannelsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPacketAcknowledgementRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelsRequest: Could not create message: ' + e.message) } }, - channel({ value }: channelParams): EncodeObject { + queryNextSequenceSendRequest({ value }: queryNextSequenceSendRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.Channel", value: Channel.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceSendRequest", value: QueryNextSequenceSendRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Channel: Could not create message: ' + e.message) + throw new Error('TxClient:QueryNextSequenceSendRequest: Could not create message: ' + e.message) } }, - msgChannelOpenInit({ value }: msgChannelOpenInitParams): EncodeObject { + msgChannelCloseInit({ value }: msgChannelCloseInitParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", value: MsgChannelOpenInit.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value: MsgChannelCloseInit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelOpenInit: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelCloseInit: Could not create message: ' + e.message) } }, - msgChannelOpenConfirm({ value }: msgChannelOpenConfirmParams): EncodeObject { + msgRecvPacket({ value }: msgRecvPacketParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value: MsgChannelOpenConfirm.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: MsgRecvPacket.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelOpenConfirm: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRecvPacket: Could not create message: ' + e.message) + } + }, + + msgAcknowledgementResponse({ value }: msgAcknowledgementResponseParams): EncodeObject { + try { + return { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", value: MsgAcknowledgementResponse.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgAcknowledgementResponse: Could not create message: ' + e.message) } }, @@ -2608,227 +2616,227 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgChannelUpgradeCancel({ value }: msgChannelUpgradeCancelParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancel", value: MsgChannelUpgradeCancel.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeCancel: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - msgPruneAcknowledgements({ value }: msgPruneAcknowledgementsParams): EncodeObject { + upgradeFields({ value }: upgradeFieldsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgements", value: MsgPruneAcknowledgements.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.UpgradeFields", value: UpgradeFields.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgPruneAcknowledgements: Could not create message: ' + e.message) + throw new Error('TxClient:UpgradeFields: Could not create message: ' + e.message) } }, - queryChannelConsensusStateResponse({ value }: queryChannelConsensusStateResponseParams): EncodeObject { + packetState({ value }: packetStateParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", value: QueryChannelConsensusStateResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.PacketState", value: PacketState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelConsensusStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:PacketState: Could not create message: ' + e.message) } }, - queryNextSequenceReceiveResponse({ value }: queryNextSequenceReceiveResponseParams): EncodeObject { + msgChannelCloseInitResponse({ value }: msgChannelCloseInitResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", value: QueryNextSequenceReceiveResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", value: MsgChannelCloseInitResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryNextSequenceReceiveResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelCloseInitResponse: Could not create message: ' + e.message) } }, - queryUpgradeErrorResponse({ value }: queryUpgradeErrorResponseParams): EncodeObject { + msgTimeout({ value }: msgTimeoutParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryUpgradeErrorResponse", value: QueryUpgradeErrorResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: MsgTimeout.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradeErrorResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgTimeout: Could not create message: ' + e.message) } }, - msgChannelCloseConfirmResponse({ value }: msgChannelCloseConfirmResponseParams): EncodeObject { + msgChannelUpgradeTryResponse({ value }: msgChannelUpgradeTryResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", value: MsgChannelCloseConfirmResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTryResponse", value: MsgChannelUpgradeTryResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelCloseConfirmResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeTryResponse: Could not create message: ' + e.message) } }, - acknowledgement({ value }: acknowledgementParams): EncodeObject { + msgChannelUpgradeOpen({ value }: msgChannelUpgradeOpenParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.Acknowledgement", value: Acknowledgement.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpen", value: MsgChannelUpgradeOpen.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Acknowledgement: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeOpen: Could not create message: ' + e.message) } }, - queryPacketCommitmentsRequest({ value }: queryPacketCommitmentsRequestParams): EncodeObject { + msgChannelUpgradeOpenResponse({ value }: msgChannelUpgradeOpenResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", value: QueryPacketCommitmentsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpenResponse", value: MsgChannelUpgradeOpenResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPacketCommitmentsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeOpenResponse: Could not create message: ' + e.message) } }, - queryNextSequenceReceiveRequest({ value }: queryNextSequenceReceiveRequestParams): EncodeObject { + msgPruneAcknowledgementsResponse({ value }: msgPruneAcknowledgementsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", value: QueryNextSequenceReceiveRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgementsResponse", value: MsgPruneAcknowledgementsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryNextSequenceReceiveRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgPruneAcknowledgementsResponse: Could not create message: ' + e.message) } }, - queryNextSequenceSendRequest({ value }: queryNextSequenceSendRequestParams): EncodeObject { + queryPacketReceiptRequest({ value }: queryPacketReceiptRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceSendRequest", value: QueryNextSequenceSendRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", value: QueryPacketReceiptRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryNextSequenceSendRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPacketReceiptRequest: Could not create message: ' + e.message) } }, - identifiedChannel({ value }: identifiedChannelParams): EncodeObject { + queryUnreceivedPacketsRequest({ value }: queryUnreceivedPacketsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", value: IdentifiedChannel.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", value: QueryUnreceivedPacketsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:IdentifiedChannel: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUnreceivedPacketsRequest: Could not create message: ' + e.message) } }, - msgChannelOpenAck({ value }: msgChannelOpenAckParams): EncodeObject { + queryChannelParamsResponse({ value }: queryChannelParamsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: MsgChannelOpenAck.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelParamsResponse", value: QueryChannelParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelOpenAck: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelParamsResponse: Could not create message: ' + e.message) } }, - msgChannelUpgradeConfirm({ value }: msgChannelUpgradeConfirmParams): EncodeObject { + msgChannelUpgradeCancelResponse({ value }: msgChannelUpgradeCancelResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirm", value: MsgChannelUpgradeConfirm.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancelResponse", value: MsgChannelUpgradeCancelResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeConfirm: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelUpgradeCancelResponse: Could not create message: ' + e.message) } }, - queryChannelsResponse({ value }: queryChannelsResponseParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", value: QueryChannelsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - msgTimeoutOnCloseResponse({ value }: msgTimeoutOnCloseResponseParams): EncodeObject { + packetSequence({ value }: packetSequenceParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", value: MsgTimeoutOnCloseResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.PacketSequence", value: PacketSequence.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgTimeoutOnCloseResponse: Could not create message: ' + e.message) + throw new Error('TxClient:PacketSequence: Could not create message: ' + e.message) } }, - msgChannelUpgradeCancelResponse({ value }: msgChannelUpgradeCancelResponseParams): EncodeObject { + queryChannelRequest({ value }: queryChannelRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancelResponse", value: MsgChannelUpgradeCancelResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", value: QueryChannelRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeCancelResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelRequest: Could not create message: ' + e.message) } }, - msgChannelOpenInitResponse({ value }: msgChannelOpenInitResponseParams): EncodeObject { + queryConnectionChannelsResponse({ value }: queryConnectionChannelsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", value: MsgChannelOpenInitResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", value: QueryConnectionChannelsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelOpenInitResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConnectionChannelsResponse: Could not create message: ' + e.message) } }, - msgChannelCloseInit({ value }: msgChannelCloseInitParams): EncodeObject { + queryPacketCommitmentsRequest({ value }: queryPacketCommitmentsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value: MsgChannelCloseInit.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", value: QueryPacketCommitmentsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelCloseInit: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPacketCommitmentsRequest: Could not create message: ' + e.message) } }, - msgAcknowledgement({ value }: msgAcknowledgementParams): EncodeObject { + msgChannelCloseConfirm({ value }: msgChannelCloseConfirmParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", value: MsgAcknowledgement.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value: MsgChannelCloseConfirm.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAcknowledgement: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelCloseConfirm: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + upgrade({ value }: upgradeParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.Upgrade", value: Upgrade.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:Upgrade: Could not create message: ' + e.message) } }, - queryConnectionChannelsResponse({ value }: queryConnectionChannelsResponseParams): EncodeObject { + queryChannelConsensusStateRequest({ value }: queryChannelConsensusStateRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", value: QueryConnectionChannelsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", value: QueryChannelConsensusStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConnectionChannelsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelConsensusStateRequest: Could not create message: ' + e.message) } }, - queryChannelClientStateRequest({ value }: queryChannelClientStateRequestParams): EncodeObject { + queryNextSequenceReceiveResponse({ value }: queryNextSequenceReceiveResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", value: QueryChannelClientStateRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", value: QueryNextSequenceReceiveResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryChannelClientStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryNextSequenceReceiveResponse: Could not create message: ' + e.message) } }, - queryUnreceivedAcksResponse({ value }: queryUnreceivedAcksResponseParams): EncodeObject { + queryUpgradeResponse({ value }: queryUpgradeResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", value: QueryUnreceivedAcksResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryUpgradeResponse", value: QueryUpgradeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUnreceivedAcksResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradeResponse: Could not create message: ' + e.message) } }, - queryNextSequenceSendResponse({ value }: queryNextSequenceSendResponseParams): EncodeObject { + queryUnreceivedPacketsResponse({ value }: queryUnreceivedPacketsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceSendResponse", value: QueryNextSequenceSendResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", value: QueryUnreceivedPacketsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryNextSequenceSendResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUnreceivedPacketsResponse: Could not create message: ' + e.message) } }, - msgAcknowledgementResponse({ value }: msgAcknowledgementResponseParams): EncodeObject { + msgChannelOpenInit({ value }: msgChannelOpenInitParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", value: MsgAcknowledgementResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", value: MsgChannelOpenInit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAcknowledgementResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgChannelOpenInit: Could not create message: ' + e.message) } }, - msgChannelUpgradeAckResponse({ value }: msgChannelUpgradeAckResponseParams): EncodeObject { + msgRecvPacketResponse({ value }: msgRecvPacketResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAckResponse", value: MsgChannelUpgradeAckResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", value: MsgRecvPacketResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeAckResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRecvPacketResponse: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + msgAcknowledgement({ value }: msgAcknowledgementParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", value: MsgAcknowledgement.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAcknowledgement: Could not create message: ' + e.message) } }, - queryPacketReceiptResponse({ value }: queryPacketReceiptResponseParams): EncodeObject { + errorReceipt({ value }: errorReceiptParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", value: QueryPacketReceiptResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.ErrorReceipt", value: ErrorReceipt.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPacketReceiptResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ErrorReceipt: Could not create message: ' + e.message) } }, @@ -2840,43 +2848,35 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgTimeoutResponse({ value }: msgTimeoutResponseParams): EncodeObject { - try { - return { typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", value: MsgTimeoutResponse.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgTimeoutResponse: Could not create message: ' + e.message) - } - }, - - msgChannelUpgradeInitResponse({ value }: msgChannelUpgradeInitResponseParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInitResponse", value: MsgChannelUpgradeInitResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeInitResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - msgChannelUpgradeTryResponse({ value }: msgChannelUpgradeTryResponseParams): EncodeObject { + timeout({ value }: timeoutParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTryResponse", value: MsgChannelUpgradeTryResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.Timeout", value: Timeout.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeTryResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Timeout: Could not create message: ' + e.message) } }, - queryPacketCommitmentRequest({ value }: queryPacketCommitmentRequestParams): EncodeObject { + queryChannelClientStateResponse({ value }: queryChannelClientStateResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", value: QueryPacketCommitmentRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", value: QueryChannelClientStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryPacketCommitmentRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryChannelClientStateResponse: Could not create message: ' + e.message) } }, - msgChannelUpgradeOpenResponse({ value }: msgChannelUpgradeOpenResponseParams): EncodeObject { + queryPacketReceiptResponse({ value }: queryPacketReceiptResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpenResponse", value: MsgChannelUpgradeOpenResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", value: QueryPacketReceiptResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgChannelUpgradeOpenResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryPacketReceiptResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/ibc.core.channel.v1/registry.ts b/ts-client/ibc.core.channel.v1/registry.ts index 08437633..cdf7d8b2 100755 --- a/ts-client/ibc.core.channel.v1/registry.ts +++ b/ts-client/ibc.core.channel.v1/registry.ts @@ -1,178 +1,178 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { Counterparty } from "./types/ibc/core/channel/v1/channel"; -import { Packet } from "./types/ibc/core/channel/v1/channel"; -import { MsgChannelUpgradeAck } from "./types/ibc/core/channel/v1/tx"; -import { QueryUnreceivedPacketsResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelOpenConfirmResponse } from "./types/ibc/core/channel/v1/tx"; -import { GenesisState } from "./types/ibc/core/channel/v1/genesis"; -import { MsgChannelUpgradeOpen } from "./types/ibc/core/channel/v1/tx"; -import { QueryPacketCommitmentsResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryPacketAcknowledgementsRequest } from "./types/ibc/core/channel/v1/query"; -import { ErrorReceipt } from "./types/ibc/core/channel/v1/upgrade"; -import { QueryPacketAcknowledgementsResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelOpenTryResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryChannelsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryPacketCommitmentResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelCloseInitResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgRecvPacketResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeout } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelConsensusStateRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryUpgradeErrorRequest } from "./types/ibc/core/channel/v1/query"; -import { Upgrade } from "./types/ibc/core/channel/v1/upgrade"; -import { UpgradeFields } from "./types/ibc/core/channel/v1/upgrade"; -import { MsgPruneAcknowledgementsResponse } from "./types/ibc/core/channel/v1/tx"; -import { QueryUnreceivedAcksRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryUpgradeRequest } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelUpgradeTimeoutResponse } from "./types/ibc/core/channel/v1/tx"; -import { PacketId } from "./types/ibc/core/channel/v1/channel"; -import { PacketSequence } from "./types/ibc/core/channel/v1/genesis"; -import { MsgChannelOpenTry } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeInit } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelParamsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryChannelParamsResponse } from "./types/ibc/core/channel/v1/query"; -import { PacketState } from "./types/ibc/core/channel/v1/channel"; -import { MsgRecvPacket } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelRequest } from "./types/ibc/core/channel/v1/query"; -import { MsgTimeoutOnClose } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeTimeout } from "./types/ibc/core/channel/v1/tx"; -import { QueryPacketReceiptRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryUpgradeResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelUpgradeConfirmResponse } from "./types/ibc/core/channel/v1/tx"; -import { Timeout } from "./types/ibc/core/channel/v1/channel"; -import { MsgChannelCloseConfirm } from "./types/ibc/core/channel/v1/tx"; -import { QueryConnectionChannelsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryChannelClientStateResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryPacketAcknowledgementResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryUnreceivedPacketsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryPacketAcknowledgementRequest } from "./types/ibc/core/channel/v1/query"; -import { Channel } from "./types/ibc/core/channel/v1/channel"; -import { MsgChannelOpenInit } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenConfirm } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeTry } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeCancel } from "./types/ibc/core/channel/v1/tx"; -import { MsgPruneAcknowledgements } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelConsensusStateResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryNextSequenceReceiveResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryUpgradeErrorResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelCloseConfirmResponse } from "./types/ibc/core/channel/v1/tx"; -import { Acknowledgement } from "./types/ibc/core/channel/v1/channel"; -import { QueryPacketCommitmentsRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryNextSequenceReceiveRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryNextSequenceSendRequest } from "./types/ibc/core/channel/v1/query"; -import { IdentifiedChannel } from "./types/ibc/core/channel/v1/channel"; -import { MsgChannelOpenAck } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeConfirm } from "./types/ibc/core/channel/v1/tx"; -import { QueryChannelsResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgTimeoutOnCloseResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeCancelResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenInitResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelCloseInit } from "./types/ibc/core/channel/v1/tx"; -import { MsgAcknowledgement } from "./types/ibc/core/channel/v1/tx"; -import { MsgUpdateParams } from "./types/ibc/core/channel/v1/tx"; -import { QueryConnectionChannelsResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryChannelClientStateRequest } from "./types/ibc/core/channel/v1/query"; -import { QueryUnreceivedAcksResponse } from "./types/ibc/core/channel/v1/query"; -import { QueryNextSequenceSendResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgAcknowledgementResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeAckResponse } from "./types/ibc/core/channel/v1/tx"; -import { Params } from "./types/ibc/core/channel/v1/channel"; -import { QueryPacketReceiptResponse } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelOpenAckResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeoutResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeInitResponse } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelUpgradeTryResponse } from "./types/ibc/core/channel/v1/tx"; -import { QueryPacketCommitmentRequest } from "./types/ibc/core/channel/v1/query"; -import { MsgChannelUpgradeOpenResponse } from "./types/ibc/core/channel/v1/tx"; +import { MsgTimeoutOnClose } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { Channel } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { Packet } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryPacketCommitmentsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelOpenConfirm } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelOpenConfirmResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgTimeoutResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeTimeoutResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeConfirmResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeCancel } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryChannelsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryChannelClientStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryNextSequenceReceiveRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelOpenTry } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelOpenAck } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeInit } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryConnectionChannelsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketCommitmentResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelUpgradeAckResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { IdentifiedChannel } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { PacketId } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryChannelConsensusStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryChannelParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUpgradeErrorRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { Counterparty } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryPacketCommitmentRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketAcknowledgementsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUnreceivedAcksResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryNextSequenceSendResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelOpenInitResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelOpenTryResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgTimeoutOnCloseResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryUpgradeErrorResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketAcknowledgementsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUpgradeRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelUpgradeInitResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeConfirm } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeTimeout } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgPruneAcknowledgements } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryPacketAcknowledgementRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelCloseConfirmResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeAck } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { Acknowledgement } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryChannelResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketAcknowledgementResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUnreceivedAcksRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryChannelsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryNextSequenceSendRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelCloseInit } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgRecvPacket } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgAcknowledgementResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeTry } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { UpgradeFields } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/upgrade"; +import { PacketState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { MsgChannelCloseInitResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgTimeout } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeTryResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeOpen } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgChannelUpgradeOpenResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgPruneAcknowledgementsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { QueryPacketReceiptRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUnreceivedPacketsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryChannelParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelUpgradeCancelResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/genesis"; +import { PacketSequence } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/genesis"; +import { QueryChannelRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryConnectionChannelsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketCommitmentsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelCloseConfirm } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { Upgrade } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/upgrade"; +import { QueryChannelConsensusStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryNextSequenceReceiveResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUpgradeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryUnreceivedPacketsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { MsgChannelOpenInit } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgRecvPacketResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { MsgAcknowledgement } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { ErrorReceipt } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/upgrade"; +import { MsgChannelOpenAckResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/tx"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { Timeout } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/channel"; +import { QueryChannelClientStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; +import { QueryPacketReceiptResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/channel/v1/query"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/ibc.core.channel.v1.Counterparty", Counterparty], + ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], + ["/ibc.core.channel.v1.Channel", Channel], ["/ibc.core.channel.v1.Packet", Packet], - ["/ibc.core.channel.v1.MsgChannelUpgradeAck", MsgChannelUpgradeAck], - ["/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", QueryUnreceivedPacketsResponse], - ["/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", MsgChannelOpenConfirmResponse], - ["/ibc.core.channel.v1.GenesisState", GenesisState], - ["/ibc.core.channel.v1.MsgChannelUpgradeOpen", MsgChannelUpgradeOpen], ["/ibc.core.channel.v1.QueryPacketCommitmentsResponse", QueryPacketCommitmentsResponse], - ["/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", QueryPacketAcknowledgementsRequest], - ["/ibc.core.channel.v1.ErrorReceipt", ErrorReceipt], + ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], + ["/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", MsgChannelOpenConfirmResponse], + ["/ibc.core.channel.v1.MsgTimeoutResponse", MsgTimeoutResponse], + ["/ibc.core.channel.v1.MsgChannelUpgradeTimeoutResponse", MsgChannelUpgradeTimeoutResponse], + ["/ibc.core.channel.v1.MsgChannelUpgradeConfirmResponse", MsgChannelUpgradeConfirmResponse], + ["/ibc.core.channel.v1.MsgChannelUpgradeCancel", MsgChannelUpgradeCancel], + ["/ibc.core.channel.v1.MsgUpdateParams", MsgUpdateParams], + ["/ibc.core.channel.v1.QueryChannelsResponse", QueryChannelsResponse], + ["/ibc.core.channel.v1.QueryChannelClientStateRequest", QueryChannelClientStateRequest], + ["/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", QueryNextSequenceReceiveRequest], + ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], + ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], + ["/ibc.core.channel.v1.MsgChannelUpgradeInit", MsgChannelUpgradeInit], + ["/ibc.core.channel.v1.QueryConnectionChannelsRequest", QueryConnectionChannelsRequest], + ["/ibc.core.channel.v1.QueryPacketCommitmentResponse", QueryPacketCommitmentResponse], + ["/ibc.core.channel.v1.MsgChannelUpgradeAckResponse", MsgChannelUpgradeAckResponse], + ["/ibc.core.channel.v1.IdentifiedChannel", IdentifiedChannel], + ["/ibc.core.channel.v1.PacketId", PacketId], + ["/ibc.core.channel.v1.QueryChannelConsensusStateResponse", QueryChannelConsensusStateResponse], + ["/ibc.core.channel.v1.QueryChannelParamsRequest", QueryChannelParamsRequest], + ["/ibc.core.channel.v1.QueryUpgradeErrorRequest", QueryUpgradeErrorRequest], + ["/ibc.core.channel.v1.Counterparty", Counterparty], + ["/ibc.core.channel.v1.QueryPacketCommitmentRequest", QueryPacketCommitmentRequest], ["/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", QueryPacketAcknowledgementsResponse], + ["/ibc.core.channel.v1.QueryUnreceivedAcksResponse", QueryUnreceivedAcksResponse], + ["/ibc.core.channel.v1.QueryNextSequenceSendResponse", QueryNextSequenceSendResponse], + ["/ibc.core.channel.v1.MsgChannelOpenInitResponse", MsgChannelOpenInitResponse], ["/ibc.core.channel.v1.MsgChannelOpenTryResponse", MsgChannelOpenTryResponse], - ["/ibc.core.channel.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], + ["/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", MsgTimeoutOnCloseResponse], + ["/ibc.core.channel.v1.QueryUpgradeErrorResponse", QueryUpgradeErrorResponse], + ["/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", QueryPacketAcknowledgementsRequest], + ["/ibc.core.channel.v1.QueryUpgradeRequest", QueryUpgradeRequest], + ["/ibc.core.channel.v1.MsgChannelUpgradeInitResponse", MsgChannelUpgradeInitResponse], + ["/ibc.core.channel.v1.MsgChannelUpgradeConfirm", MsgChannelUpgradeConfirm], + ["/ibc.core.channel.v1.MsgChannelUpgradeTimeout", MsgChannelUpgradeTimeout], + ["/ibc.core.channel.v1.MsgPruneAcknowledgements", MsgPruneAcknowledgements], + ["/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", QueryPacketAcknowledgementRequest], + ["/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", MsgChannelCloseConfirmResponse], + ["/ibc.core.channel.v1.MsgChannelUpgradeAck", MsgChannelUpgradeAck], + ["/ibc.core.channel.v1.Acknowledgement", Acknowledgement], ["/ibc.core.channel.v1.QueryChannelResponse", QueryChannelResponse], + ["/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", QueryPacketAcknowledgementResponse], + ["/ibc.core.channel.v1.QueryUnreceivedAcksRequest", QueryUnreceivedAcksRequest], ["/ibc.core.channel.v1.QueryChannelsRequest", QueryChannelsRequest], - ["/ibc.core.channel.v1.QueryPacketCommitmentResponse", QueryPacketCommitmentResponse], + ["/ibc.core.channel.v1.QueryNextSequenceSendRequest", QueryNextSequenceSendRequest], + ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], + ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], + ["/ibc.core.channel.v1.MsgAcknowledgementResponse", MsgAcknowledgementResponse], + ["/ibc.core.channel.v1.MsgChannelUpgradeTry", MsgChannelUpgradeTry], + ["/ibc.core.channel.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], + ["/ibc.core.channel.v1.UpgradeFields", UpgradeFields], + ["/ibc.core.channel.v1.PacketState", PacketState], ["/ibc.core.channel.v1.MsgChannelCloseInitResponse", MsgChannelCloseInitResponse], - ["/ibc.core.channel.v1.MsgRecvPacketResponse", MsgRecvPacketResponse], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], - ["/ibc.core.channel.v1.QueryChannelConsensusStateRequest", QueryChannelConsensusStateRequest], - ["/ibc.core.channel.v1.QueryUpgradeErrorRequest", QueryUpgradeErrorRequest], - ["/ibc.core.channel.v1.Upgrade", Upgrade], - ["/ibc.core.channel.v1.UpgradeFields", UpgradeFields], + ["/ibc.core.channel.v1.MsgChannelUpgradeTryResponse", MsgChannelUpgradeTryResponse], + ["/ibc.core.channel.v1.MsgChannelUpgradeOpen", MsgChannelUpgradeOpen], + ["/ibc.core.channel.v1.MsgChannelUpgradeOpenResponse", MsgChannelUpgradeOpenResponse], ["/ibc.core.channel.v1.MsgPruneAcknowledgementsResponse", MsgPruneAcknowledgementsResponse], - ["/ibc.core.channel.v1.QueryUnreceivedAcksRequest", QueryUnreceivedAcksRequest], - ["/ibc.core.channel.v1.QueryUpgradeRequest", QueryUpgradeRequest], - ["/ibc.core.channel.v1.MsgChannelUpgradeTimeoutResponse", MsgChannelUpgradeTimeoutResponse], - ["/ibc.core.channel.v1.PacketId", PacketId], - ["/ibc.core.channel.v1.PacketSequence", PacketSequence], - ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], - ["/ibc.core.channel.v1.MsgChannelUpgradeInit", MsgChannelUpgradeInit], - ["/ibc.core.channel.v1.QueryChannelParamsRequest", QueryChannelParamsRequest], + ["/ibc.core.channel.v1.QueryPacketReceiptRequest", QueryPacketReceiptRequest], + ["/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", QueryUnreceivedPacketsRequest], ["/ibc.core.channel.v1.QueryChannelParamsResponse", QueryChannelParamsResponse], - ["/ibc.core.channel.v1.PacketState", PacketState], - ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], + ["/ibc.core.channel.v1.MsgChannelUpgradeCancelResponse", MsgChannelUpgradeCancelResponse], + ["/ibc.core.channel.v1.GenesisState", GenesisState], + ["/ibc.core.channel.v1.PacketSequence", PacketSequence], ["/ibc.core.channel.v1.QueryChannelRequest", QueryChannelRequest], - ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], - ["/ibc.core.channel.v1.MsgChannelUpgradeTimeout", MsgChannelUpgradeTimeout], - ["/ibc.core.channel.v1.QueryPacketReceiptRequest", QueryPacketReceiptRequest], - ["/ibc.core.channel.v1.QueryUpgradeResponse", QueryUpgradeResponse], - ["/ibc.core.channel.v1.MsgChannelUpgradeConfirmResponse", MsgChannelUpgradeConfirmResponse], - ["/ibc.core.channel.v1.Timeout", Timeout], + ["/ibc.core.channel.v1.QueryConnectionChannelsResponse", QueryConnectionChannelsResponse], + ["/ibc.core.channel.v1.QueryPacketCommitmentsRequest", QueryPacketCommitmentsRequest], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], - ["/ibc.core.channel.v1.QueryConnectionChannelsRequest", QueryConnectionChannelsRequest], - ["/ibc.core.channel.v1.QueryChannelClientStateResponse", QueryChannelClientStateResponse], - ["/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", QueryPacketAcknowledgementResponse], - ["/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", QueryUnreceivedPacketsRequest], - ["/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", QueryPacketAcknowledgementRequest], - ["/ibc.core.channel.v1.Channel", Channel], - ["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], - ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], - ["/ibc.core.channel.v1.MsgChannelUpgradeTry", MsgChannelUpgradeTry], - ["/ibc.core.channel.v1.MsgChannelUpgradeCancel", MsgChannelUpgradeCancel], - ["/ibc.core.channel.v1.MsgPruneAcknowledgements", MsgPruneAcknowledgements], - ["/ibc.core.channel.v1.QueryChannelConsensusStateResponse", QueryChannelConsensusStateResponse], + ["/ibc.core.channel.v1.Upgrade", Upgrade], + ["/ibc.core.channel.v1.QueryChannelConsensusStateRequest", QueryChannelConsensusStateRequest], ["/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", QueryNextSequenceReceiveResponse], - ["/ibc.core.channel.v1.QueryUpgradeErrorResponse", QueryUpgradeErrorResponse], - ["/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", MsgChannelCloseConfirmResponse], - ["/ibc.core.channel.v1.Acknowledgement", Acknowledgement], - ["/ibc.core.channel.v1.QueryPacketCommitmentsRequest", QueryPacketCommitmentsRequest], - ["/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", QueryNextSequenceReceiveRequest], - ["/ibc.core.channel.v1.QueryNextSequenceSendRequest", QueryNextSequenceSendRequest], - ["/ibc.core.channel.v1.IdentifiedChannel", IdentifiedChannel], - ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], - ["/ibc.core.channel.v1.MsgChannelUpgradeConfirm", MsgChannelUpgradeConfirm], - ["/ibc.core.channel.v1.QueryChannelsResponse", QueryChannelsResponse], - ["/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", MsgTimeoutOnCloseResponse], - ["/ibc.core.channel.v1.MsgChannelUpgradeCancelResponse", MsgChannelUpgradeCancelResponse], - ["/ibc.core.channel.v1.MsgChannelOpenInitResponse", MsgChannelOpenInitResponse], - ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], + ["/ibc.core.channel.v1.QueryUpgradeResponse", QueryUpgradeResponse], + ["/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", QueryUnreceivedPacketsResponse], + ["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], + ["/ibc.core.channel.v1.MsgRecvPacketResponse", MsgRecvPacketResponse], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement], - ["/ibc.core.channel.v1.MsgUpdateParams", MsgUpdateParams], - ["/ibc.core.channel.v1.QueryConnectionChannelsResponse", QueryConnectionChannelsResponse], - ["/ibc.core.channel.v1.QueryChannelClientStateRequest", QueryChannelClientStateRequest], - ["/ibc.core.channel.v1.QueryUnreceivedAcksResponse", QueryUnreceivedAcksResponse], - ["/ibc.core.channel.v1.QueryNextSequenceSendResponse", QueryNextSequenceSendResponse], - ["/ibc.core.channel.v1.MsgAcknowledgementResponse", MsgAcknowledgementResponse], - ["/ibc.core.channel.v1.MsgChannelUpgradeAckResponse", MsgChannelUpgradeAckResponse], + ["/ibc.core.channel.v1.ErrorReceipt", ErrorReceipt], + ["/ibc.core.channel.v1.MsgChannelOpenAckResponse", MsgChannelOpenAckResponse], ["/ibc.core.channel.v1.Params", Params], + ["/ibc.core.channel.v1.Timeout", Timeout], + ["/ibc.core.channel.v1.QueryChannelClientStateResponse", QueryChannelClientStateResponse], ["/ibc.core.channel.v1.QueryPacketReceiptResponse", QueryPacketReceiptResponse], - ["/ibc.core.channel.v1.MsgChannelOpenAckResponse", MsgChannelOpenAckResponse], - ["/ibc.core.channel.v1.MsgTimeoutResponse", MsgTimeoutResponse], - ["/ibc.core.channel.v1.MsgChannelUpgradeInitResponse", MsgChannelUpgradeInitResponse], - ["/ibc.core.channel.v1.MsgChannelUpgradeTryResponse", MsgChannelUpgradeTryResponse], - ["/ibc.core.channel.v1.QueryPacketCommitmentRequest", QueryPacketCommitmentRequest], - ["/ibc.core.channel.v1.MsgChannelUpgradeOpenResponse", MsgChannelUpgradeOpenResponse], ]; diff --git a/ts-client/ibc.core.channel.v1/types/amino/amino.ts b/ts-client/ibc.core.channel.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/ibc.core.channel.v1/types/amino/amino.ts +++ b/ts-client/ibc.core.channel.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/ibc.core.channel.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/ibc.core.channel.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/ibc.core.channel.v1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/ibc.core.channel.v1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/ibc.core.channel.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/ibc.core.channel.v1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/ibc.core.channel.v1/types/cosmos/msg/v1/msg.ts b/ts-client/ibc.core.channel.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/ibc.core.channel.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/ibc.core.channel.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/ibc.core.channel.v1/types/cosmos_proto/cosmos.ts b/ts-client/ibc.core.channel.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/ibc.core.channel.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/ibc.core.channel.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/common/shared_types.ts b/ts-client/ibc.core.channel.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/commitments.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/genesis.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/module/module.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/packet.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/params.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/query.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/tx.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/pep/decryption_key.ts b/ts-client/ibc.core.channel.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/ibc.core.channel.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/pep/genesis.ts b/ts-client/ibc.core.channel.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/pep/module/module.ts b/ts-client/ibc.core.channel.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/pep/params.ts b/ts-client/ibc.core.channel.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/ibc.core.channel.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/pep/query.ts b/ts-client/ibc.core.channel.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/pep/request_id.ts b/ts-client/ibc.core.channel.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/fairyring/pep/tx.ts b/ts-client/ibc.core.channel.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/gogoproto/gogo.ts b/ts-client/ibc.core.channel.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/ibc.core.channel.v1/types/gogoproto/gogo.ts +++ b/ts-client/ibc.core.channel.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/ibc.core.channel.v1/types/google/api/annotations.ts b/ts-client/ibc.core.channel.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/ibc.core.channel.v1/types/google/api/annotations.ts +++ b/ts-client/ibc.core.channel.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/ibc.core.channel.v1/types/google/api/http.ts b/ts-client/ibc.core.channel.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/ibc.core.channel.v1/types/google/api/http.ts +++ b/ts-client/ibc.core.channel.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/google/protobuf/descriptor.ts b/ts-client/ibc.core.channel.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/ibc.core.channel.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/ibc.core.channel.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/google/protobuf/duration.ts b/ts-client/ibc.core.channel.v1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.channel.v1/types/route-name.eta b/ts-client/ibc.core.channel.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/ibc.core.channel.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/ibc.core.client.v1/module.ts b/ts-client/ibc.core.client.v1/module.ts index 46efb847..3c93794f 100755 --- a/ts-client/ibc.core.client.v1/module.ts +++ b/ts-client/ibc.core.client.v1/module.ts @@ -6,270 +6,270 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { ClientConsensusStates } from "./types/ibc/core/client/v1/client"; -import { QueryConsensusStateRequest } from "./types/ibc/core/client/v1/query"; -import { QueryUpgradedConsensusStateRequest } from "./types/ibc/core/client/v1/query"; -import { MsgCreateClient } from "./types/ibc/core/client/v1/tx"; -import { MsgUpgradeClientResponse } from "./types/ibc/core/client/v1/tx"; -import { MsgRecoverClient } from "./types/ibc/core/client/v1/tx"; -import { Params } from "./types/ibc/core/client/v1/client"; -import { MsgUpdateParamsResponse } from "./types/ibc/core/client/v1/tx"; -import { QueryClientStatesResponse } from "./types/ibc/core/client/v1/query"; -import { ClientUpdateProposal } from "./types/ibc/core/client/v1/client"; -import { UpgradeProposal } from "./types/ibc/core/client/v1/client"; -import { QueryClientStateRequest } from "./types/ibc/core/client/v1/query"; -import { QueryConsensusStateHeightsRequest } from "./types/ibc/core/client/v1/query"; -import { QueryClientStatusRequest } from "./types/ibc/core/client/v1/query"; -import { GenesisState } from "./types/ibc/core/client/v1/genesis"; -import { ConsensusStateWithHeight } from "./types/ibc/core/client/v1/client"; -import { Height } from "./types/ibc/core/client/v1/client"; -import { QueryConsensusStatesRequest } from "./types/ibc/core/client/v1/query"; -import { QueryClientParamsRequest } from "./types/ibc/core/client/v1/query"; -import { QueryUpgradedClientStateResponse } from "./types/ibc/core/client/v1/query"; -import { MsgCreateClientResponse } from "./types/ibc/core/client/v1/tx"; -import { MsgIBCSoftwareUpgrade } from "./types/ibc/core/client/v1/tx"; -import { IdentifiedClientState } from "./types/ibc/core/client/v1/client"; -import { QueryConsensusStateHeightsResponse } from "./types/ibc/core/client/v1/query"; -import { QueryClientParamsResponse } from "./types/ibc/core/client/v1/query"; -import { QueryUpgradedClientStateRequest } from "./types/ibc/core/client/v1/query"; -import { MsgUpdateClientResponse } from "./types/ibc/core/client/v1/tx"; -import { MsgIBCSoftwareUpgradeResponse } from "./types/ibc/core/client/v1/tx"; -import { QueryConsensusStateResponse } from "./types/ibc/core/client/v1/query"; -import { QueryConsensusStatesResponse } from "./types/ibc/core/client/v1/query"; -import { IdentifiedGenesisMetadata } from "./types/ibc/core/client/v1/genesis"; -import { QueryClientStateResponse } from "./types/ibc/core/client/v1/query"; -import { MsgRecoverClientResponse } from "./types/ibc/core/client/v1/tx"; -import { MsgUpdateParams } from "./types/ibc/core/client/v1/tx"; -import { GenesisMetadata } from "./types/ibc/core/client/v1/genesis"; -import { MsgSubmitMisbehaviourResponse } from "./types/ibc/core/client/v1/tx"; -import { QueryClientStatesRequest } from "./types/ibc/core/client/v1/query"; -import { QueryClientStatusResponse } from "./types/ibc/core/client/v1/query"; -import { MsgUpdateClient } from "./types/ibc/core/client/v1/tx"; -import { MsgUpgradeClient } from "./types/ibc/core/client/v1/tx"; -import { MsgSubmitMisbehaviour } from "./types/ibc/core/client/v1/tx"; -import { QueryUpgradedConsensusStateResponse } from "./types/ibc/core/client/v1/query"; - - -export { ClientConsensusStates, QueryConsensusStateRequest, QueryUpgradedConsensusStateRequest, MsgCreateClient, MsgUpgradeClientResponse, MsgRecoverClient, Params, MsgUpdateParamsResponse, QueryClientStatesResponse, ClientUpdateProposal, UpgradeProposal, QueryClientStateRequest, QueryConsensusStateHeightsRequest, QueryClientStatusRequest, GenesisState, ConsensusStateWithHeight, Height, QueryConsensusStatesRequest, QueryClientParamsRequest, QueryUpgradedClientStateResponse, MsgCreateClientResponse, MsgIBCSoftwareUpgrade, IdentifiedClientState, QueryConsensusStateHeightsResponse, QueryClientParamsResponse, QueryUpgradedClientStateRequest, MsgUpdateClientResponse, MsgIBCSoftwareUpgradeResponse, QueryConsensusStateResponse, QueryConsensusStatesResponse, IdentifiedGenesisMetadata, QueryClientStateResponse, MsgRecoverClientResponse, MsgUpdateParams, GenesisMetadata, MsgSubmitMisbehaviourResponse, QueryClientStatesRequest, QueryClientStatusResponse, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour, QueryUpgradedConsensusStateResponse }; +import { IdentifiedGenesisMetadata } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/genesis"; +import { MsgCreateClientResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgIBCSoftwareUpgradeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryConsensusStateHeightsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { ClientConsensusStates } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { QueryClientStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { ConsensusStateWithHeight } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { MsgUpdateClientResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgSubmitMisbehaviourResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgRecoverClientResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgUpdateClient } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgRecoverClient } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryConsensusStatesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { MsgUpgradeClient } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { UpgradeProposal } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { QueryClientParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { GenesisMetadata } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/genesis"; +import { MsgSubmitMisbehaviour } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryConsensusStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { IdentifiedClientState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { QueryClientStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryConsensusStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { Height } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { MsgIBCSoftwareUpgrade } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryUpgradedConsensusStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryClientStatusRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryUpgradedClientStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryClientStatesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryClientParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryUpgradedClientStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryConsensusStatesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/genesis"; +import { MsgUpgradeClientResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryConsensusStateHeightsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryClientStatusResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryUpgradedConsensusStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { ClientUpdateProposal } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { MsgCreateClient } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryClientStatesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; + + +export { IdentifiedGenesisMetadata, MsgCreateClientResponse, MsgIBCSoftwareUpgradeResponse, QueryConsensusStateHeightsRequest, ClientConsensusStates, QueryClientStateResponse, ConsensusStateWithHeight, MsgUpdateClientResponse, MsgSubmitMisbehaviourResponse, MsgRecoverClientResponse, MsgUpdateParamsResponse, MsgUpdateClient, MsgRecoverClient, QueryConsensusStatesRequest, MsgUpgradeClient, MsgUpdateParams, UpgradeProposal, QueryClientParamsResponse, GenesisMetadata, MsgSubmitMisbehaviour, QueryConsensusStateResponse, IdentifiedClientState, Params, QueryClientStateRequest, QueryConsensusStateRequest, Height, MsgIBCSoftwareUpgrade, QueryUpgradedConsensusStateRequest, QueryClientStatusRequest, QueryUpgradedClientStateResponse, QueryClientStatesRequest, QueryClientParamsRequest, QueryUpgradedClientStateRequest, QueryConsensusStatesResponse, GenesisState, MsgUpgradeClientResponse, QueryConsensusStateHeightsResponse, QueryClientStatusResponse, QueryUpgradedConsensusStateResponse, ClientUpdateProposal, MsgCreateClient, QueryClientStatesResponse }; -type sendClientConsensusStatesParams = { - value: ClientConsensusStates, +type sendIdentifiedGenesisMetadataParams = { + value: IdentifiedGenesisMetadata, fee?: StdFee, memo?: string }; -type sendQueryConsensusStateRequestParams = { - value: QueryConsensusStateRequest, +type sendMsgCreateClientResponseParams = { + value: MsgCreateClientResponse, fee?: StdFee, memo?: string }; -type sendQueryUpgradedConsensusStateRequestParams = { - value: QueryUpgradedConsensusStateRequest, +type sendMsgIBCSoftwareUpgradeResponseParams = { + value: MsgIBCSoftwareUpgradeResponse, fee?: StdFee, memo?: string }; -type sendMsgCreateClientParams = { - value: MsgCreateClient, +type sendQueryConsensusStateHeightsRequestParams = { + value: QueryConsensusStateHeightsRequest, fee?: StdFee, memo?: string }; -type sendMsgUpgradeClientResponseParams = { - value: MsgUpgradeClientResponse, +type sendClientConsensusStatesParams = { + value: ClientConsensusStates, fee?: StdFee, memo?: string }; -type sendMsgRecoverClientParams = { - value: MsgRecoverClient, +type sendQueryClientStateResponseParams = { + value: QueryClientStateResponse, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendConsensusStateWithHeightParams = { + value: ConsensusStateWithHeight, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendMsgUpdateClientResponseParams = { + value: MsgUpdateClientResponse, fee?: StdFee, memo?: string }; -type sendQueryClientStatesResponseParams = { - value: QueryClientStatesResponse, +type sendMsgSubmitMisbehaviourResponseParams = { + value: MsgSubmitMisbehaviourResponse, fee?: StdFee, memo?: string }; -type sendClientUpdateProposalParams = { - value: ClientUpdateProposal, +type sendMsgRecoverClientResponseParams = { + value: MsgRecoverClientResponse, fee?: StdFee, memo?: string }; -type sendUpgradeProposalParams = { - value: UpgradeProposal, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryClientStateRequestParams = { - value: QueryClientStateRequest, +type sendMsgUpdateClientParams = { + value: MsgUpdateClient, fee?: StdFee, memo?: string }; -type sendQueryConsensusStateHeightsRequestParams = { - value: QueryConsensusStateHeightsRequest, +type sendMsgRecoverClientParams = { + value: MsgRecoverClient, fee?: StdFee, memo?: string }; -type sendQueryClientStatusRequestParams = { - value: QueryClientStatusRequest, +type sendQueryConsensusStatesRequestParams = { + value: QueryConsensusStatesRequest, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendMsgUpgradeClientParams = { + value: MsgUpgradeClient, fee?: StdFee, memo?: string }; -type sendConsensusStateWithHeightParams = { - value: ConsensusStateWithHeight, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; -type sendHeightParams = { - value: Height, +type sendUpgradeProposalParams = { + value: UpgradeProposal, fee?: StdFee, memo?: string }; -type sendQueryConsensusStatesRequestParams = { - value: QueryConsensusStatesRequest, +type sendQueryClientParamsResponseParams = { + value: QueryClientParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryClientParamsRequestParams = { - value: QueryClientParamsRequest, +type sendGenesisMetadataParams = { + value: GenesisMetadata, fee?: StdFee, memo?: string }; -type sendQueryUpgradedClientStateResponseParams = { - value: QueryUpgradedClientStateResponse, +type sendMsgSubmitMisbehaviourParams = { + value: MsgSubmitMisbehaviour, fee?: StdFee, memo?: string }; -type sendMsgCreateClientResponseParams = { - value: MsgCreateClientResponse, +type sendQueryConsensusStateResponseParams = { + value: QueryConsensusStateResponse, fee?: StdFee, memo?: string }; -type sendMsgIBCSoftwareUpgradeParams = { - value: MsgIBCSoftwareUpgrade, +type sendIdentifiedClientStateParams = { + value: IdentifiedClientState, fee?: StdFee, memo?: string }; -type sendIdentifiedClientStateParams = { - value: IdentifiedClientState, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; -type sendQueryConsensusStateHeightsResponseParams = { - value: QueryConsensusStateHeightsResponse, +type sendQueryClientStateRequestParams = { + value: QueryClientStateRequest, fee?: StdFee, memo?: string }; -type sendQueryClientParamsResponseParams = { - value: QueryClientParamsResponse, +type sendQueryConsensusStateRequestParams = { + value: QueryConsensusStateRequest, fee?: StdFee, memo?: string }; -type sendQueryUpgradedClientStateRequestParams = { - value: QueryUpgradedClientStateRequest, +type sendHeightParams = { + value: Height, fee?: StdFee, memo?: string }; -type sendMsgUpdateClientResponseParams = { - value: MsgUpdateClientResponse, +type sendMsgIBCSoftwareUpgradeParams = { + value: MsgIBCSoftwareUpgrade, fee?: StdFee, memo?: string }; -type sendMsgIBCSoftwareUpgradeResponseParams = { - value: MsgIBCSoftwareUpgradeResponse, +type sendQueryUpgradedConsensusStateRequestParams = { + value: QueryUpgradedConsensusStateRequest, fee?: StdFee, memo?: string }; -type sendQueryConsensusStateResponseParams = { - value: QueryConsensusStateResponse, +type sendQueryClientStatusRequestParams = { + value: QueryClientStatusRequest, fee?: StdFee, memo?: string }; -type sendQueryConsensusStatesResponseParams = { - value: QueryConsensusStatesResponse, +type sendQueryUpgradedClientStateResponseParams = { + value: QueryUpgradedClientStateResponse, fee?: StdFee, memo?: string }; -type sendIdentifiedGenesisMetadataParams = { - value: IdentifiedGenesisMetadata, +type sendQueryClientStatesRequestParams = { + value: QueryClientStatesRequest, fee?: StdFee, memo?: string }; -type sendQueryClientStateResponseParams = { - value: QueryClientStateResponse, +type sendQueryClientParamsRequestParams = { + value: QueryClientParamsRequest, fee?: StdFee, memo?: string }; -type sendMsgRecoverClientResponseParams = { - value: MsgRecoverClientResponse, +type sendQueryUpgradedClientStateRequestParams = { + value: QueryUpgradedClientStateRequest, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendQueryConsensusStatesResponseParams = { + value: QueryConsensusStatesResponse, fee?: StdFee, memo?: string }; -type sendGenesisMetadataParams = { - value: GenesisMetadata, +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; -type sendMsgSubmitMisbehaviourResponseParams = { - value: MsgSubmitMisbehaviourResponse, +type sendMsgUpgradeClientResponseParams = { + value: MsgUpgradeClientResponse, fee?: StdFee, memo?: string }; -type sendQueryClientStatesRequestParams = { - value: QueryClientStatesRequest, +type sendQueryConsensusStateHeightsResponseParams = { + value: QueryConsensusStateHeightsResponse, fee?: StdFee, memo?: string }; @@ -280,197 +280,197 @@ type sendQueryClientStatusResponseParams = { memo?: string }; -type sendMsgUpdateClientParams = { - value: MsgUpdateClient, +type sendQueryUpgradedConsensusStateResponseParams = { + value: QueryUpgradedConsensusStateResponse, fee?: StdFee, memo?: string }; -type sendMsgUpgradeClientParams = { - value: MsgUpgradeClient, +type sendClientUpdateProposalParams = { + value: ClientUpdateProposal, fee?: StdFee, memo?: string }; -type sendMsgSubmitMisbehaviourParams = { - value: MsgSubmitMisbehaviour, +type sendMsgCreateClientParams = { + value: MsgCreateClient, fee?: StdFee, memo?: string }; -type sendQueryUpgradedConsensusStateResponseParams = { - value: QueryUpgradedConsensusStateResponse, +type sendQueryClientStatesResponseParams = { + value: QueryClientStatesResponse, fee?: StdFee, memo?: string }; -type clientConsensusStatesParams = { - value: ClientConsensusStates, -}; - -type queryConsensusStateRequestParams = { - value: QueryConsensusStateRequest, +type identifiedGenesisMetadataParams = { + value: IdentifiedGenesisMetadata, }; -type queryUpgradedConsensusStateRequestParams = { - value: QueryUpgradedConsensusStateRequest, +type msgCreateClientResponseParams = { + value: MsgCreateClientResponse, }; -type msgCreateClientParams = { - value: MsgCreateClient, +type msgIbcsoftwareUpgradeResponseParams = { + value: MsgIBCSoftwareUpgradeResponse, }; -type msgUpgradeClientResponseParams = { - value: MsgUpgradeClientResponse, +type queryConsensusStateHeightsRequestParams = { + value: QueryConsensusStateHeightsRequest, }; -type msgRecoverClientParams = { - value: MsgRecoverClient, +type clientConsensusStatesParams = { + value: ClientConsensusStates, }; -type paramsParams = { - value: Params, +type queryClientStateResponseParams = { + value: QueryClientStateResponse, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type consensusStateWithHeightParams = { + value: ConsensusStateWithHeight, }; -type queryClientStatesResponseParams = { - value: QueryClientStatesResponse, +type msgUpdateClientResponseParams = { + value: MsgUpdateClientResponse, }; -type clientUpdateProposalParams = { - value: ClientUpdateProposal, +type msgSubmitMisbehaviourResponseParams = { + value: MsgSubmitMisbehaviourResponse, }; -type upgradeProposalParams = { - value: UpgradeProposal, +type msgRecoverClientResponseParams = { + value: MsgRecoverClientResponse, }; -type queryClientStateRequestParams = { - value: QueryClientStateRequest, +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, }; -type queryConsensusStateHeightsRequestParams = { - value: QueryConsensusStateHeightsRequest, +type msgUpdateClientParams = { + value: MsgUpdateClient, }; -type queryClientStatusRequestParams = { - value: QueryClientStatusRequest, +type msgRecoverClientParams = { + value: MsgRecoverClient, }; -type genesisStateParams = { - value: GenesisState, +type queryConsensusStatesRequestParams = { + value: QueryConsensusStatesRequest, }; -type consensusStateWithHeightParams = { - value: ConsensusStateWithHeight, +type msgUpgradeClientParams = { + value: MsgUpgradeClient, }; -type heightParams = { - value: Height, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; -type queryConsensusStatesRequestParams = { - value: QueryConsensusStatesRequest, +type upgradeProposalParams = { + value: UpgradeProposal, }; -type queryClientParamsRequestParams = { - value: QueryClientParamsRequest, +type queryClientParamsResponseParams = { + value: QueryClientParamsResponse, }; -type queryUpgradedClientStateResponseParams = { - value: QueryUpgradedClientStateResponse, +type genesisMetadataParams = { + value: GenesisMetadata, }; -type msgCreateClientResponseParams = { - value: MsgCreateClientResponse, +type msgSubmitMisbehaviourParams = { + value: MsgSubmitMisbehaviour, }; -type msgIbcsoftwareUpgradeParams = { - value: MsgIBCSoftwareUpgrade, +type queryConsensusStateResponseParams = { + value: QueryConsensusStateResponse, }; type identifiedClientStateParams = { value: IdentifiedClientState, }; -type queryConsensusStateHeightsResponseParams = { - value: QueryConsensusStateHeightsResponse, +type paramsParams = { + value: Params, }; -type queryClientParamsResponseParams = { - value: QueryClientParamsResponse, +type queryClientStateRequestParams = { + value: QueryClientStateRequest, }; -type queryUpgradedClientStateRequestParams = { - value: QueryUpgradedClientStateRequest, +type queryConsensusStateRequestParams = { + value: QueryConsensusStateRequest, }; -type msgUpdateClientResponseParams = { - value: MsgUpdateClientResponse, +type heightParams = { + value: Height, }; -type msgIbcsoftwareUpgradeResponseParams = { - value: MsgIBCSoftwareUpgradeResponse, +type msgIbcsoftwareUpgradeParams = { + value: MsgIBCSoftwareUpgrade, }; -type queryConsensusStateResponseParams = { - value: QueryConsensusStateResponse, +type queryUpgradedConsensusStateRequestParams = { + value: QueryUpgradedConsensusStateRequest, }; -type queryConsensusStatesResponseParams = { - value: QueryConsensusStatesResponse, +type queryClientStatusRequestParams = { + value: QueryClientStatusRequest, }; -type identifiedGenesisMetadataParams = { - value: IdentifiedGenesisMetadata, +type queryUpgradedClientStateResponseParams = { + value: QueryUpgradedClientStateResponse, }; -type queryClientStateResponseParams = { - value: QueryClientStateResponse, +type queryClientStatesRequestParams = { + value: QueryClientStatesRequest, }; -type msgRecoverClientResponseParams = { - value: MsgRecoverClientResponse, +type queryClientParamsRequestParams = { + value: QueryClientParamsRequest, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type queryUpgradedClientStateRequestParams = { + value: QueryUpgradedClientStateRequest, }; -type genesisMetadataParams = { - value: GenesisMetadata, +type queryConsensusStatesResponseParams = { + value: QueryConsensusStatesResponse, }; -type msgSubmitMisbehaviourResponseParams = { - value: MsgSubmitMisbehaviourResponse, +type genesisStateParams = { + value: GenesisState, }; -type queryClientStatesRequestParams = { - value: QueryClientStatesRequest, +type msgUpgradeClientResponseParams = { + value: MsgUpgradeClientResponse, +}; + +type queryConsensusStateHeightsResponseParams = { + value: QueryConsensusStateHeightsResponse, }; type queryClientStatusResponseParams = { value: QueryClientStatusResponse, }; -type msgUpdateClientParams = { - value: MsgUpdateClient, +type queryUpgradedConsensusStateResponseParams = { + value: QueryUpgradedConsensusStateResponse, }; -type msgUpgradeClientParams = { - value: MsgUpgradeClient, +type clientUpdateProposalParams = { + value: ClientUpdateProposal, }; -type msgSubmitMisbehaviourParams = { - value: MsgSubmitMisbehaviour, +type msgCreateClientParams = { + value: MsgCreateClient, }; -type queryUpgradedConsensusStateResponseParams = { - value: QueryUpgradedConsensusStateResponse, +type queryClientStatesResponseParams = { + value: QueryClientStatesResponse, }; @@ -503,521 +503,521 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendClientConsensusStates({ value, fee, memo }: sendClientConsensusStatesParams): Promise { + async sendIdentifiedGenesisMetadata({ value, fee, memo }: sendIdentifiedGenesisMetadataParams): Promise { if (!signer) { - throw new Error('TxClient:sendClientConsensusStates: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendIdentifiedGenesisMetadata: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.clientConsensusStates({ value: ClientConsensusStates.fromPartial(value) }) + let msg = this.identifiedGenesisMetadata({ value: IdentifiedGenesisMetadata.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendClientConsensusStates: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendIdentifiedGenesisMetadata: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConsensusStateRequest({ value, fee, memo }: sendQueryConsensusStateRequestParams): Promise { + async sendMsgCreateClientResponse({ value, fee, memo }: sendMsgCreateClientResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConsensusStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateClientResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConsensusStateRequest({ value: QueryConsensusStateRequest.fromPartial(value) }) + let msg = this.msgCreateClientResponse({ value: MsgCreateClientResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConsensusStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateClientResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUpgradedConsensusStateRequest({ value, fee, memo }: sendQueryUpgradedConsensusStateRequestParams): Promise { + async sendMsgIBCSoftwareUpgradeResponse({ value, fee, memo }: sendMsgIBCSoftwareUpgradeResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradedConsensusStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgIBCSoftwareUpgradeResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradedConsensusStateRequest({ value: QueryUpgradedConsensusStateRequest.fromPartial(value) }) + let msg = this.msgIbcsoftwareUpgradeResponse({ value: MsgIBCSoftwareUpgradeResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradedConsensusStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgIBCSoftwareUpgradeResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateClient({ value, fee, memo }: sendMsgCreateClientParams): Promise { + async sendQueryConsensusStateHeightsRequest({ value, fee, memo }: sendQueryConsensusStateHeightsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateClient: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConsensusStateHeightsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateClient({ value: MsgCreateClient.fromPartial(value) }) + let msg = this.queryConsensusStateHeightsRequest({ value: QueryConsensusStateHeightsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateClient: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConsensusStateHeightsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpgradeClientResponse({ value, fee, memo }: sendMsgUpgradeClientResponseParams): Promise { + async sendClientConsensusStates({ value, fee, memo }: sendClientConsensusStatesParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpgradeClientResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendClientConsensusStates: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpgradeClientResponse({ value: MsgUpgradeClientResponse.fromPartial(value) }) + let msg = this.clientConsensusStates({ value: ClientConsensusStates.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpgradeClientResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendClientConsensusStates: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRecoverClient({ value, fee, memo }: sendMsgRecoverClientParams): Promise { + async sendQueryClientStateResponse({ value, fee, memo }: sendQueryClientStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRecoverClient: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClientStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRecoverClient({ value: MsgRecoverClient.fromPartial(value) }) + let msg = this.queryClientStateResponse({ value: QueryClientStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRecoverClient: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClientStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendConsensusStateWithHeight({ value, fee, memo }: sendConsensusStateWithHeightParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendConsensusStateWithHeight: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.consensusStateWithHeight({ value: ConsensusStateWithHeight.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendConsensusStateWithHeight: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendMsgUpdateClientResponse({ value, fee, memo }: sendMsgUpdateClientResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateClientResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.msgUpdateClientResponse({ value: MsgUpdateClientResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateClientResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClientStatesResponse({ value, fee, memo }: sendQueryClientStatesResponseParams): Promise { + async sendMsgSubmitMisbehaviourResponse({ value, fee, memo }: sendMsgSubmitMisbehaviourResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClientStatesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitMisbehaviourResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClientStatesResponse({ value: QueryClientStatesResponse.fromPartial(value) }) + let msg = this.msgSubmitMisbehaviourResponse({ value: MsgSubmitMisbehaviourResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClientStatesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitMisbehaviourResponse: Could not broadcast Tx: '+ e.message) } }, - async sendClientUpdateProposal({ value, fee, memo }: sendClientUpdateProposalParams): Promise { + async sendMsgRecoverClientResponse({ value, fee, memo }: sendMsgRecoverClientResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendClientUpdateProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRecoverClientResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.clientUpdateProposal({ value: ClientUpdateProposal.fromPartial(value) }) + let msg = this.msgRecoverClientResponse({ value: MsgRecoverClientResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendClientUpdateProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRecoverClientResponse: Could not broadcast Tx: '+ e.message) } }, - async sendUpgradeProposal({ value, fee, memo }: sendUpgradeProposalParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendUpgradeProposal: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.upgradeProposal({ value: UpgradeProposal.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendUpgradeProposal: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClientStateRequest({ value, fee, memo }: sendQueryClientStateRequestParams): Promise { + async sendMsgUpdateClient({ value, fee, memo }: sendMsgUpdateClientParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClientStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateClient: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClientStateRequest({ value: QueryClientStateRequest.fromPartial(value) }) + let msg = this.msgUpdateClient({ value: MsgUpdateClient.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClientStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateClient: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConsensusStateHeightsRequest({ value, fee, memo }: sendQueryConsensusStateHeightsRequestParams): Promise { + async sendMsgRecoverClient({ value, fee, memo }: sendMsgRecoverClientParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConsensusStateHeightsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRecoverClient: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConsensusStateHeightsRequest({ value: QueryConsensusStateHeightsRequest.fromPartial(value) }) + let msg = this.msgRecoverClient({ value: MsgRecoverClient.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConsensusStateHeightsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRecoverClient: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClientStatusRequest({ value, fee, memo }: sendQueryClientStatusRequestParams): Promise { + async sendQueryConsensusStatesRequest({ value, fee, memo }: sendQueryConsensusStatesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClientStatusRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConsensusStatesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClientStatusRequest({ value: QueryClientStatusRequest.fromPartial(value) }) + let msg = this.queryConsensusStatesRequest({ value: QueryConsensusStatesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClientStatusRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConsensusStatesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendMsgUpgradeClient({ value, fee, memo }: sendMsgUpgradeClientParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpgradeClient: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.msgUpgradeClient({ value: MsgUpgradeClient.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpgradeClient: Could not broadcast Tx: '+ e.message) } }, - async sendConsensusStateWithHeight({ value, fee, memo }: sendConsensusStateWithHeightParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendConsensusStateWithHeight: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.consensusStateWithHeight({ value: ConsensusStateWithHeight.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendConsensusStateWithHeight: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, - async sendHeight({ value, fee, memo }: sendHeightParams): Promise { + async sendUpgradeProposal({ value, fee, memo }: sendUpgradeProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendHeight: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendUpgradeProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.height({ value: Height.fromPartial(value) }) + let msg = this.upgradeProposal({ value: UpgradeProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendHeight: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendUpgradeProposal: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConsensusStatesRequest({ value, fee, memo }: sendQueryConsensusStatesRequestParams): Promise { + async sendQueryClientParamsResponse({ value, fee, memo }: sendQueryClientParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConsensusStatesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClientParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConsensusStatesRequest({ value: QueryConsensusStatesRequest.fromPartial(value) }) + let msg = this.queryClientParamsResponse({ value: QueryClientParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConsensusStatesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClientParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClientParamsRequest({ value, fee, memo }: sendQueryClientParamsRequestParams): Promise { + async sendGenesisMetadata({ value, fee, memo }: sendGenesisMetadataParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClientParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisMetadata: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClientParamsRequest({ value: QueryClientParamsRequest.fromPartial(value) }) + let msg = this.genesisMetadata({ value: GenesisMetadata.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClientParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisMetadata: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUpgradedClientStateResponse({ value, fee, memo }: sendQueryUpgradedClientStateResponseParams): Promise { + async sendMsgSubmitMisbehaviour({ value, fee, memo }: sendMsgSubmitMisbehaviourParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradedClientStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitMisbehaviour: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradedClientStateResponse({ value: QueryUpgradedClientStateResponse.fromPartial(value) }) + let msg = this.msgSubmitMisbehaviour({ value: MsgSubmitMisbehaviour.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradedClientStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitMisbehaviour: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateClientResponse({ value, fee, memo }: sendMsgCreateClientResponseParams): Promise { + async sendQueryConsensusStateResponse({ value, fee, memo }: sendQueryConsensusStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateClientResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConsensusStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgCreateClientResponse({ value: MsgCreateClientResponse.fromPartial(value) }) + let msg = this.queryConsensusStateResponse({ value: QueryConsensusStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateClientResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConsensusStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgIBCSoftwareUpgrade({ value, fee, memo }: sendMsgIBCSoftwareUpgradeParams): Promise { + async sendIdentifiedClientState({ value, fee, memo }: sendIdentifiedClientStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgIBCSoftwareUpgrade: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendIdentifiedClientState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgIbcsoftwareUpgrade({ value: MsgIBCSoftwareUpgrade.fromPartial(value) }) + let msg = this.identifiedClientState({ value: IdentifiedClientState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgIBCSoftwareUpgrade: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendIdentifiedClientState: Could not broadcast Tx: '+ e.message) } }, - async sendIdentifiedClientState({ value, fee, memo }: sendIdentifiedClientStateParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendIdentifiedClientState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.identifiedClientState({ value: IdentifiedClientState.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendIdentifiedClientState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConsensusStateHeightsResponse({ value, fee, memo }: sendQueryConsensusStateHeightsResponseParams): Promise { + async sendQueryClientStateRequest({ value, fee, memo }: sendQueryClientStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConsensusStateHeightsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClientStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConsensusStateHeightsResponse({ value: QueryConsensusStateHeightsResponse.fromPartial(value) }) + let msg = this.queryClientStateRequest({ value: QueryClientStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConsensusStateHeightsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClientStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClientParamsResponse({ value, fee, memo }: sendQueryClientParamsResponseParams): Promise { + async sendQueryConsensusStateRequest({ value, fee, memo }: sendQueryConsensusStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClientParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConsensusStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClientParamsResponse({ value: QueryClientParamsResponse.fromPartial(value) }) + let msg = this.queryConsensusStateRequest({ value: QueryConsensusStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClientParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConsensusStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUpgradedClientStateRequest({ value, fee, memo }: sendQueryUpgradedClientStateRequestParams): Promise { + async sendHeight({ value, fee, memo }: sendHeightParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradedClientStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendHeight: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradedClientStateRequest({ value: QueryUpgradedClientStateRequest.fromPartial(value) }) + let msg = this.height({ value: Height.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradedClientStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendHeight: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateClientResponse({ value, fee, memo }: sendMsgUpdateClientResponseParams): Promise { + async sendMsgIBCSoftwareUpgrade({ value, fee, memo }: sendMsgIBCSoftwareUpgradeParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateClientResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgIBCSoftwareUpgrade: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateClientResponse({ value: MsgUpdateClientResponse.fromPartial(value) }) + let msg = this.msgIbcsoftwareUpgrade({ value: MsgIBCSoftwareUpgrade.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateClientResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgIBCSoftwareUpgrade: Could not broadcast Tx: '+ e.message) } }, - async sendMsgIBCSoftwareUpgradeResponse({ value, fee, memo }: sendMsgIBCSoftwareUpgradeResponseParams): Promise { + async sendQueryUpgradedConsensusStateRequest({ value, fee, memo }: sendQueryUpgradedConsensusStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgIBCSoftwareUpgradeResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradedConsensusStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgIbcsoftwareUpgradeResponse({ value: MsgIBCSoftwareUpgradeResponse.fromPartial(value) }) + let msg = this.queryUpgradedConsensusStateRequest({ value: QueryUpgradedConsensusStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgIBCSoftwareUpgradeResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradedConsensusStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConsensusStateResponse({ value, fee, memo }: sendQueryConsensusStateResponseParams): Promise { + async sendQueryClientStatusRequest({ value, fee, memo }: sendQueryClientStatusRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConsensusStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClientStatusRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConsensusStateResponse({ value: QueryConsensusStateResponse.fromPartial(value) }) + let msg = this.queryClientStatusRequest({ value: QueryClientStatusRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConsensusStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClientStatusRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConsensusStatesResponse({ value, fee, memo }: sendQueryConsensusStatesResponseParams): Promise { + async sendQueryUpgradedClientStateResponse({ value, fee, memo }: sendQueryUpgradedClientStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConsensusStatesResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradedClientStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConsensusStatesResponse({ value: QueryConsensusStatesResponse.fromPartial(value) }) + let msg = this.queryUpgradedClientStateResponse({ value: QueryUpgradedClientStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConsensusStatesResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradedClientStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendIdentifiedGenesisMetadata({ value, fee, memo }: sendIdentifiedGenesisMetadataParams): Promise { + async sendQueryClientStatesRequest({ value, fee, memo }: sendQueryClientStatesRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendIdentifiedGenesisMetadata: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClientStatesRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.identifiedGenesisMetadata({ value: IdentifiedGenesisMetadata.fromPartial(value) }) + let msg = this.queryClientStatesRequest({ value: QueryClientStatesRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendIdentifiedGenesisMetadata: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClientStatesRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClientStateResponse({ value, fee, memo }: sendQueryClientStateResponseParams): Promise { + async sendQueryClientParamsRequest({ value, fee, memo }: sendQueryClientParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClientStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClientParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClientStateResponse({ value: QueryClientStateResponse.fromPartial(value) }) + let msg = this.queryClientParamsRequest({ value: QueryClientParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClientStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClientParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRecoverClientResponse({ value, fee, memo }: sendMsgRecoverClientResponseParams): Promise { + async sendQueryUpgradedClientStateRequest({ value, fee, memo }: sendQueryUpgradedClientStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRecoverClientResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradedClientStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgRecoverClientResponse({ value: MsgRecoverClientResponse.fromPartial(value) }) + let msg = this.queryUpgradedClientStateRequest({ value: QueryUpgradedClientStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRecoverClientResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradedClientStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendQueryConsensusStatesResponse({ value, fee, memo }: sendQueryConsensusStatesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConsensusStatesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.queryConsensusStatesResponse({ value: QueryConsensusStatesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConsensusStatesResponse: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisMetadata({ value, fee, memo }: sendGenesisMetadataParams): Promise { + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisMetadata: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisMetadata({ value: GenesisMetadata.fromPartial(value) }) + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisMetadata: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitMisbehaviourResponse({ value, fee, memo }: sendMsgSubmitMisbehaviourResponseParams): Promise { + async sendMsgUpgradeClientResponse({ value, fee, memo }: sendMsgUpgradeClientResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitMisbehaviourResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpgradeClientResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitMisbehaviourResponse({ value: MsgSubmitMisbehaviourResponse.fromPartial(value) }) + let msg = this.msgUpgradeClientResponse({ value: MsgUpgradeClientResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitMisbehaviourResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpgradeClientResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClientStatesRequest({ value, fee, memo }: sendQueryClientStatesRequestParams): Promise { + async sendQueryConsensusStateHeightsResponse({ value, fee, memo }: sendQueryConsensusStateHeightsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClientStatesRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConsensusStateHeightsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClientStatesRequest({ value: QueryClientStatesRequest.fromPartial(value) }) + let msg = this.queryConsensusStateHeightsResponse({ value: QueryConsensusStateHeightsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClientStatesRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConsensusStateHeightsResponse: Could not broadcast Tx: '+ e.message) } }, @@ -1035,356 +1035,356 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgUpdateClient({ value, fee, memo }: sendMsgUpdateClientParams): Promise { + async sendQueryUpgradedConsensusStateResponse({ value, fee, memo }: sendQueryUpgradedConsensusStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateClient: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryUpgradedConsensusStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateClient({ value: MsgUpdateClient.fromPartial(value) }) + let msg = this.queryUpgradedConsensusStateResponse({ value: QueryUpgradedConsensusStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateClient: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryUpgradedConsensusStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpgradeClient({ value, fee, memo }: sendMsgUpgradeClientParams): Promise { + async sendClientUpdateProposal({ value, fee, memo }: sendClientUpdateProposalParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpgradeClient: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendClientUpdateProposal: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpgradeClient({ value: MsgUpgradeClient.fromPartial(value) }) + let msg = this.clientUpdateProposal({ value: ClientUpdateProposal.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpgradeClient: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendClientUpdateProposal: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitMisbehaviour({ value, fee, memo }: sendMsgSubmitMisbehaviourParams): Promise { + async sendMsgCreateClient({ value, fee, memo }: sendMsgCreateClientParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitMisbehaviour: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateClient: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgSubmitMisbehaviour({ value: MsgSubmitMisbehaviour.fromPartial(value) }) + let msg = this.msgCreateClient({ value: MsgCreateClient.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitMisbehaviour: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateClient: Could not broadcast Tx: '+ e.message) } }, - async sendQueryUpgradedConsensusStateResponse({ value, fee, memo }: sendQueryUpgradedConsensusStateResponseParams): Promise { + async sendQueryClientStatesResponse({ value, fee, memo }: sendQueryClientStatesResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryUpgradedConsensusStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClientStatesResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryUpgradedConsensusStateResponse({ value: QueryUpgradedConsensusStateResponse.fromPartial(value) }) + let msg = this.queryClientStatesResponse({ value: QueryClientStatesResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryUpgradedConsensusStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClientStatesResponse: Could not broadcast Tx: '+ e.message) } }, - clientConsensusStates({ value }: clientConsensusStatesParams): EncodeObject { + identifiedGenesisMetadata({ value }: identifiedGenesisMetadataParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.ClientConsensusStates", value: ClientConsensusStates.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", value: IdentifiedGenesisMetadata.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ClientConsensusStates: Could not create message: ' + e.message) + throw new Error('TxClient:IdentifiedGenesisMetadata: Could not create message: ' + e.message) } }, - queryConsensusStateRequest({ value }: queryConsensusStateRequestParams): EncodeObject { + msgCreateClientResponse({ value }: msgCreateClientResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", value: QueryConsensusStateRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", value: MsgCreateClientResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConsensusStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateClientResponse: Could not create message: ' + e.message) } }, - queryUpgradedConsensusStateRequest({ value }: queryUpgradedConsensusStateRequestParams): EncodeObject { + msgIbcsoftwareUpgradeResponse({ value }: msgIbcsoftwareUpgradeResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", value: QueryUpgradedConsensusStateRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse", value: MsgIBCSoftwareUpgradeResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradedConsensusStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgIBCSoftwareUpgradeResponse: Could not create message: ' + e.message) } }, - msgCreateClient({ value }: msgCreateClientParams): EncodeObject { + queryConsensusStateHeightsRequest({ value }: queryConsensusStateHeightsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgCreateClient", value: MsgCreateClient.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsRequest", value: QueryConsensusStateHeightsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateClient: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConsensusStateHeightsRequest: Could not create message: ' + e.message) } }, - msgUpgradeClientResponse({ value }: msgUpgradeClientResponseParams): EncodeObject { + clientConsensusStates({ value }: clientConsensusStatesParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", value: MsgUpgradeClientResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.ClientConsensusStates", value: ClientConsensusStates.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpgradeClientResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ClientConsensusStates: Could not create message: ' + e.message) } }, - msgRecoverClient({ value }: msgRecoverClientParams): EncodeObject { + queryClientStateResponse({ value }: queryClientStateResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgRecoverClient", value: MsgRecoverClient.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", value: QueryClientStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRecoverClient: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClientStateResponse: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + consensusStateWithHeight({ value }: consensusStateWithHeightParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", value: ConsensusStateWithHeight.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:ConsensusStateWithHeight: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + msgUpdateClientResponse({ value }: msgUpdateClientResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", value: MsgUpdateClientResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateClientResponse: Could not create message: ' + e.message) } }, - queryClientStatesResponse({ value }: queryClientStatesResponseParams): EncodeObject { + msgSubmitMisbehaviourResponse({ value }: msgSubmitMisbehaviourResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", value: QueryClientStatesResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", value: MsgSubmitMisbehaviourResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClientStatesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitMisbehaviourResponse: Could not create message: ' + e.message) } }, - clientUpdateProposal({ value }: clientUpdateProposalParams): EncodeObject { + msgRecoverClientResponse({ value }: msgRecoverClientResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", value: ClientUpdateProposal.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgRecoverClientResponse", value: MsgRecoverClientResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ClientUpdateProposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRecoverClientResponse: Could not create message: ' + e.message) } }, - upgradeProposal({ value }: upgradeProposalParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.UpgradeProposal", value: UpgradeProposal.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:UpgradeProposal: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - queryClientStateRequest({ value }: queryClientStateRequestParams): EncodeObject { + msgUpdateClient({ value }: msgUpdateClientParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", value: QueryClientStateRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", value: MsgUpdateClient.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClientStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateClient: Could not create message: ' + e.message) } }, - queryConsensusStateHeightsRequest({ value }: queryConsensusStateHeightsRequestParams): EncodeObject { + msgRecoverClient({ value }: msgRecoverClientParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsRequest", value: QueryConsensusStateHeightsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgRecoverClient", value: MsgRecoverClient.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConsensusStateHeightsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRecoverClient: Could not create message: ' + e.message) } }, - queryClientStatusRequest({ value }: queryClientStatusRequestParams): EncodeObject { + queryConsensusStatesRequest({ value }: queryConsensusStatesRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", value: QueryClientStatusRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", value: QueryConsensusStatesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClientStatusRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConsensusStatesRequest: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + msgUpgradeClient({ value }: msgUpgradeClientParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", value: MsgUpgradeClient.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpgradeClient: Could not create message: ' + e.message) } }, - consensusStateWithHeight({ value }: consensusStateWithHeightParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", value: ConsensusStateWithHeight.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ConsensusStateWithHeight: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, - height({ value }: heightParams): EncodeObject { + upgradeProposal({ value }: upgradeProposalParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.Height", value: Height.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.UpgradeProposal", value: UpgradeProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Height: Could not create message: ' + e.message) + throw new Error('TxClient:UpgradeProposal: Could not create message: ' + e.message) } }, - queryConsensusStatesRequest({ value }: queryConsensusStatesRequestParams): EncodeObject { + queryClientParamsResponse({ value }: queryClientParamsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", value: QueryConsensusStatesRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", value: QueryClientParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConsensusStatesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClientParamsResponse: Could not create message: ' + e.message) } }, - queryClientParamsRequest({ value }: queryClientParamsRequestParams): EncodeObject { + genesisMetadata({ value }: genesisMetadataParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", value: QueryClientParamsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.GenesisMetadata", value: GenesisMetadata.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClientParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisMetadata: Could not create message: ' + e.message) } }, - queryUpgradedClientStateResponse({ value }: queryUpgradedClientStateResponseParams): EncodeObject { + msgSubmitMisbehaviour({ value }: msgSubmitMisbehaviourParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", value: QueryUpgradedClientStateResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", value: MsgSubmitMisbehaviour.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradedClientStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitMisbehaviour: Could not create message: ' + e.message) } }, - msgCreateClientResponse({ value }: msgCreateClientResponseParams): EncodeObject { + queryConsensusStateResponse({ value }: queryConsensusStateResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", value: MsgCreateClientResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", value: QueryConsensusStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateClientResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConsensusStateResponse: Could not create message: ' + e.message) } }, - msgIbcsoftwareUpgrade({ value }: msgIbcsoftwareUpgradeParams): EncodeObject { + identifiedClientState({ value }: identifiedClientStateParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", value: MsgIBCSoftwareUpgrade.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.IdentifiedClientState", value: IdentifiedClientState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgIBCSoftwareUpgrade: Could not create message: ' + e.message) + throw new Error('TxClient:IdentifiedClientState: Could not create message: ' + e.message) } }, - identifiedClientState({ value }: identifiedClientStateParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.IdentifiedClientState", value: IdentifiedClientState.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:IdentifiedClientState: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, - queryConsensusStateHeightsResponse({ value }: queryConsensusStateHeightsResponseParams): EncodeObject { + queryClientStateRequest({ value }: queryClientStateRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsResponse", value: QueryConsensusStateHeightsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", value: QueryClientStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConsensusStateHeightsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClientStateRequest: Could not create message: ' + e.message) } }, - queryClientParamsResponse({ value }: queryClientParamsResponseParams): EncodeObject { + queryConsensusStateRequest({ value }: queryConsensusStateRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", value: QueryClientParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", value: QueryConsensusStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClientParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConsensusStateRequest: Could not create message: ' + e.message) } }, - queryUpgradedClientStateRequest({ value }: queryUpgradedClientStateRequestParams): EncodeObject { + height({ value }: heightParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", value: QueryUpgradedClientStateRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.Height", value: Height.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradedClientStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Height: Could not create message: ' + e.message) } }, - msgUpdateClientResponse({ value }: msgUpdateClientResponseParams): EncodeObject { + msgIbcsoftwareUpgrade({ value }: msgIbcsoftwareUpgradeParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", value: MsgUpdateClientResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", value: MsgIBCSoftwareUpgrade.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateClientResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgIBCSoftwareUpgrade: Could not create message: ' + e.message) } }, - msgIbcsoftwareUpgradeResponse({ value }: msgIbcsoftwareUpgradeResponseParams): EncodeObject { + queryUpgradedConsensusStateRequest({ value }: queryUpgradedConsensusStateRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse", value: MsgIBCSoftwareUpgradeResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", value: QueryUpgradedConsensusStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgIBCSoftwareUpgradeResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradedConsensusStateRequest: Could not create message: ' + e.message) } }, - queryConsensusStateResponse({ value }: queryConsensusStateResponseParams): EncodeObject { + queryClientStatusRequest({ value }: queryClientStatusRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", value: QueryConsensusStateResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", value: QueryClientStatusRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConsensusStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClientStatusRequest: Could not create message: ' + e.message) } }, - queryConsensusStatesResponse({ value }: queryConsensusStatesResponseParams): EncodeObject { + queryUpgradedClientStateResponse({ value }: queryUpgradedClientStateResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", value: QueryConsensusStatesResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", value: QueryUpgradedClientStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConsensusStatesResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradedClientStateResponse: Could not create message: ' + e.message) } }, - identifiedGenesisMetadata({ value }: identifiedGenesisMetadataParams): EncodeObject { + queryClientStatesRequest({ value }: queryClientStatesRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", value: IdentifiedGenesisMetadata.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", value: QueryClientStatesRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:IdentifiedGenesisMetadata: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClientStatesRequest: Could not create message: ' + e.message) } }, - queryClientStateResponse({ value }: queryClientStateResponseParams): EncodeObject { + queryClientParamsRequest({ value }: queryClientParamsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", value: QueryClientStateResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", value: QueryClientParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClientStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClientParamsRequest: Could not create message: ' + e.message) } }, - msgRecoverClientResponse({ value }: msgRecoverClientResponseParams): EncodeObject { + queryUpgradedClientStateRequest({ value }: queryUpgradedClientStateRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgRecoverClientResponse", value: MsgRecoverClientResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", value: QueryUpgradedClientStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRecoverClientResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradedClientStateRequest: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + queryConsensusStatesResponse({ value }: queryConsensusStatesResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", value: QueryConsensusStatesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConsensusStatesResponse: Could not create message: ' + e.message) } }, - genesisMetadata({ value }: genesisMetadataParams): EncodeObject { + genesisState({ value }: genesisStateParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.GenesisMetadata", value: GenesisMetadata.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.GenesisState", value: GenesisState.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisMetadata: Could not create message: ' + e.message) + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, - msgSubmitMisbehaviourResponse({ value }: msgSubmitMisbehaviourResponseParams): EncodeObject { + msgUpgradeClientResponse({ value }: msgUpgradeClientResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", value: MsgSubmitMisbehaviourResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", value: MsgUpgradeClientResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitMisbehaviourResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpgradeClientResponse: Could not create message: ' + e.message) } }, - queryClientStatesRequest({ value }: queryClientStatesRequestParams): EncodeObject { + queryConsensusStateHeightsResponse({ value }: queryConsensusStateHeightsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", value: QueryClientStatesRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsResponse", value: QueryConsensusStateHeightsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClientStatesRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConsensusStateHeightsResponse: Could not create message: ' + e.message) } }, @@ -1396,35 +1396,35 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgUpdateClient({ value }: msgUpdateClientParams): EncodeObject { + queryUpgradedConsensusStateResponse({ value }: queryUpgradedConsensusStateResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", value: MsgUpdateClient.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", value: QueryUpgradedConsensusStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateClient: Could not create message: ' + e.message) + throw new Error('TxClient:QueryUpgradedConsensusStateResponse: Could not create message: ' + e.message) } }, - msgUpgradeClient({ value }: msgUpgradeClientParams): EncodeObject { + clientUpdateProposal({ value }: clientUpdateProposalParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", value: MsgUpgradeClient.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", value: ClientUpdateProposal.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpgradeClient: Could not create message: ' + e.message) + throw new Error('TxClient:ClientUpdateProposal: Could not create message: ' + e.message) } }, - msgSubmitMisbehaviour({ value }: msgSubmitMisbehaviourParams): EncodeObject { + msgCreateClient({ value }: msgCreateClientParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", value: MsgSubmitMisbehaviour.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.MsgCreateClient", value: MsgCreateClient.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitMisbehaviour: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateClient: Could not create message: ' + e.message) } }, - queryUpgradedConsensusStateResponse({ value }: queryUpgradedConsensusStateResponseParams): EncodeObject { + queryClientStatesResponse({ value }: queryClientStatesResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", value: QueryUpgradedConsensusStateResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", value: QueryClientStatesResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryUpgradedConsensusStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClientStatesResponse: Could not create message: ' + e.message) } }, diff --git a/ts-client/ibc.core.client.v1/registry.ts b/ts-client/ibc.core.client.v1/registry.ts index 8321ed8c..fb73bb71 100755 --- a/ts-client/ibc.core.client.v1/registry.ts +++ b/ts-client/ibc.core.client.v1/registry.ts @@ -1,90 +1,90 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { ClientConsensusStates } from "./types/ibc/core/client/v1/client"; -import { QueryConsensusStateRequest } from "./types/ibc/core/client/v1/query"; -import { QueryUpgradedConsensusStateRequest } from "./types/ibc/core/client/v1/query"; -import { MsgCreateClient } from "./types/ibc/core/client/v1/tx"; -import { MsgUpgradeClientResponse } from "./types/ibc/core/client/v1/tx"; -import { MsgRecoverClient } from "./types/ibc/core/client/v1/tx"; -import { Params } from "./types/ibc/core/client/v1/client"; -import { MsgUpdateParamsResponse } from "./types/ibc/core/client/v1/tx"; -import { QueryClientStatesResponse } from "./types/ibc/core/client/v1/query"; -import { ClientUpdateProposal } from "./types/ibc/core/client/v1/client"; -import { UpgradeProposal } from "./types/ibc/core/client/v1/client"; -import { QueryClientStateRequest } from "./types/ibc/core/client/v1/query"; -import { QueryConsensusStateHeightsRequest } from "./types/ibc/core/client/v1/query"; -import { QueryClientStatusRequest } from "./types/ibc/core/client/v1/query"; -import { GenesisState } from "./types/ibc/core/client/v1/genesis"; -import { ConsensusStateWithHeight } from "./types/ibc/core/client/v1/client"; -import { Height } from "./types/ibc/core/client/v1/client"; -import { QueryConsensusStatesRequest } from "./types/ibc/core/client/v1/query"; -import { QueryClientParamsRequest } from "./types/ibc/core/client/v1/query"; -import { QueryUpgradedClientStateResponse } from "./types/ibc/core/client/v1/query"; -import { MsgCreateClientResponse } from "./types/ibc/core/client/v1/tx"; -import { MsgIBCSoftwareUpgrade } from "./types/ibc/core/client/v1/tx"; -import { IdentifiedClientState } from "./types/ibc/core/client/v1/client"; -import { QueryConsensusStateHeightsResponse } from "./types/ibc/core/client/v1/query"; -import { QueryClientParamsResponse } from "./types/ibc/core/client/v1/query"; -import { QueryUpgradedClientStateRequest } from "./types/ibc/core/client/v1/query"; -import { MsgUpdateClientResponse } from "./types/ibc/core/client/v1/tx"; -import { MsgIBCSoftwareUpgradeResponse } from "./types/ibc/core/client/v1/tx"; -import { QueryConsensusStateResponse } from "./types/ibc/core/client/v1/query"; -import { QueryConsensusStatesResponse } from "./types/ibc/core/client/v1/query"; -import { IdentifiedGenesisMetadata } from "./types/ibc/core/client/v1/genesis"; -import { QueryClientStateResponse } from "./types/ibc/core/client/v1/query"; -import { MsgRecoverClientResponse } from "./types/ibc/core/client/v1/tx"; -import { MsgUpdateParams } from "./types/ibc/core/client/v1/tx"; -import { GenesisMetadata } from "./types/ibc/core/client/v1/genesis"; -import { MsgSubmitMisbehaviourResponse } from "./types/ibc/core/client/v1/tx"; -import { QueryClientStatesRequest } from "./types/ibc/core/client/v1/query"; -import { QueryClientStatusResponse } from "./types/ibc/core/client/v1/query"; -import { MsgUpdateClient } from "./types/ibc/core/client/v1/tx"; -import { MsgUpgradeClient } from "./types/ibc/core/client/v1/tx"; -import { MsgSubmitMisbehaviour } from "./types/ibc/core/client/v1/tx"; -import { QueryUpgradedConsensusStateResponse } from "./types/ibc/core/client/v1/query"; +import { IdentifiedGenesisMetadata } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/genesis"; +import { MsgCreateClientResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgIBCSoftwareUpgradeResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryConsensusStateHeightsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { ClientConsensusStates } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { QueryClientStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { ConsensusStateWithHeight } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { MsgUpdateClientResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgSubmitMisbehaviourResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgRecoverClientResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgUpdateClient } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgRecoverClient } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryConsensusStatesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { MsgUpgradeClient } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { UpgradeProposal } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { QueryClientParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { GenesisMetadata } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/genesis"; +import { MsgSubmitMisbehaviour } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryConsensusStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { IdentifiedClientState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { QueryClientStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryConsensusStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { Height } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { MsgIBCSoftwareUpgrade } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryUpgradedConsensusStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryClientStatusRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryUpgradedClientStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryClientStatesRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryClientParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryUpgradedClientStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryConsensusStatesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/genesis"; +import { MsgUpgradeClientResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryConsensusStateHeightsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryClientStatusResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { QueryUpgradedConsensusStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; +import { ClientUpdateProposal } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/client"; +import { MsgCreateClient } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/tx"; +import { QueryClientStatesResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/client/v1/query"; const msgTypes: Array<[string, GeneratedType]> = [ + ["/ibc.core.client.v1.IdentifiedGenesisMetadata", IdentifiedGenesisMetadata], + ["/ibc.core.client.v1.MsgCreateClientResponse", MsgCreateClientResponse], + ["/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse", MsgIBCSoftwareUpgradeResponse], + ["/ibc.core.client.v1.QueryConsensusStateHeightsRequest", QueryConsensusStateHeightsRequest], ["/ibc.core.client.v1.ClientConsensusStates", ClientConsensusStates], - ["/ibc.core.client.v1.QueryConsensusStateRequest", QueryConsensusStateRequest], - ["/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", QueryUpgradedConsensusStateRequest], - ["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], - ["/ibc.core.client.v1.MsgUpgradeClientResponse", MsgUpgradeClientResponse], - ["/ibc.core.client.v1.MsgRecoverClient", MsgRecoverClient], - ["/ibc.core.client.v1.Params", Params], + ["/ibc.core.client.v1.QueryClientStateResponse", QueryClientStateResponse], + ["/ibc.core.client.v1.ConsensusStateWithHeight", ConsensusStateWithHeight], + ["/ibc.core.client.v1.MsgUpdateClientResponse", MsgUpdateClientResponse], + ["/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", MsgSubmitMisbehaviourResponse], + ["/ibc.core.client.v1.MsgRecoverClientResponse", MsgRecoverClientResponse], ["/ibc.core.client.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/ibc.core.client.v1.QueryClientStatesResponse", QueryClientStatesResponse], - ["/ibc.core.client.v1.ClientUpdateProposal", ClientUpdateProposal], + ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], + ["/ibc.core.client.v1.MsgRecoverClient", MsgRecoverClient], + ["/ibc.core.client.v1.QueryConsensusStatesRequest", QueryConsensusStatesRequest], + ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], + ["/ibc.core.client.v1.MsgUpdateParams", MsgUpdateParams], ["/ibc.core.client.v1.UpgradeProposal", UpgradeProposal], + ["/ibc.core.client.v1.QueryClientParamsResponse", QueryClientParamsResponse], + ["/ibc.core.client.v1.GenesisMetadata", GenesisMetadata], + ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour], + ["/ibc.core.client.v1.QueryConsensusStateResponse", QueryConsensusStateResponse], + ["/ibc.core.client.v1.IdentifiedClientState", IdentifiedClientState], + ["/ibc.core.client.v1.Params", Params], ["/ibc.core.client.v1.QueryClientStateRequest", QueryClientStateRequest], - ["/ibc.core.client.v1.QueryConsensusStateHeightsRequest", QueryConsensusStateHeightsRequest], - ["/ibc.core.client.v1.QueryClientStatusRequest", QueryClientStatusRequest], - ["/ibc.core.client.v1.GenesisState", GenesisState], - ["/ibc.core.client.v1.ConsensusStateWithHeight", ConsensusStateWithHeight], + ["/ibc.core.client.v1.QueryConsensusStateRequest", QueryConsensusStateRequest], ["/ibc.core.client.v1.Height", Height], - ["/ibc.core.client.v1.QueryConsensusStatesRequest", QueryConsensusStatesRequest], - ["/ibc.core.client.v1.QueryClientParamsRequest", QueryClientParamsRequest], - ["/ibc.core.client.v1.QueryUpgradedClientStateResponse", QueryUpgradedClientStateResponse], - ["/ibc.core.client.v1.MsgCreateClientResponse", MsgCreateClientResponse], ["/ibc.core.client.v1.MsgIBCSoftwareUpgrade", MsgIBCSoftwareUpgrade], - ["/ibc.core.client.v1.IdentifiedClientState", IdentifiedClientState], - ["/ibc.core.client.v1.QueryConsensusStateHeightsResponse", QueryConsensusStateHeightsResponse], - ["/ibc.core.client.v1.QueryClientParamsResponse", QueryClientParamsResponse], + ["/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", QueryUpgradedConsensusStateRequest], + ["/ibc.core.client.v1.QueryClientStatusRequest", QueryClientStatusRequest], + ["/ibc.core.client.v1.QueryUpgradedClientStateResponse", QueryUpgradedClientStateResponse], + ["/ibc.core.client.v1.QueryClientStatesRequest", QueryClientStatesRequest], + ["/ibc.core.client.v1.QueryClientParamsRequest", QueryClientParamsRequest], ["/ibc.core.client.v1.QueryUpgradedClientStateRequest", QueryUpgradedClientStateRequest], - ["/ibc.core.client.v1.MsgUpdateClientResponse", MsgUpdateClientResponse], - ["/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse", MsgIBCSoftwareUpgradeResponse], - ["/ibc.core.client.v1.QueryConsensusStateResponse", QueryConsensusStateResponse], ["/ibc.core.client.v1.QueryConsensusStatesResponse", QueryConsensusStatesResponse], - ["/ibc.core.client.v1.IdentifiedGenesisMetadata", IdentifiedGenesisMetadata], - ["/ibc.core.client.v1.QueryClientStateResponse", QueryClientStateResponse], - ["/ibc.core.client.v1.MsgRecoverClientResponse", MsgRecoverClientResponse], - ["/ibc.core.client.v1.MsgUpdateParams", MsgUpdateParams], - ["/ibc.core.client.v1.GenesisMetadata", GenesisMetadata], - ["/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", MsgSubmitMisbehaviourResponse], - ["/ibc.core.client.v1.QueryClientStatesRequest", QueryClientStatesRequest], + ["/ibc.core.client.v1.GenesisState", GenesisState], + ["/ibc.core.client.v1.MsgUpgradeClientResponse", MsgUpgradeClientResponse], + ["/ibc.core.client.v1.QueryConsensusStateHeightsResponse", QueryConsensusStateHeightsResponse], ["/ibc.core.client.v1.QueryClientStatusResponse", QueryClientStatusResponse], - ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], - ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], - ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour], ["/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", QueryUpgradedConsensusStateResponse], + ["/ibc.core.client.v1.ClientUpdateProposal", ClientUpdateProposal], + ["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], + ["/ibc.core.client.v1.QueryClientStatesResponse", QueryClientStatesResponse], ]; diff --git a/ts-client/ibc.core.client.v1/types/amino/amino.ts b/ts-client/ibc.core.client.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/ibc.core.client.v1/types/amino/amino.ts +++ b/ts-client/ibc.core.client.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/ibc.core.client.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/ibc.core.client.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/ibc.core.client.v1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/ibc.core.client.v1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/ibc.core.client.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/ibc.core.client.v1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/ibc.core.client.v1/types/cosmos/msg/v1/msg.ts b/ts-client/ibc.core.client.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/ibc.core.client.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/ibc.core.client.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/ibc.core.client.v1/types/cosmos_proto/cosmos.ts b/ts-client/ibc.core.client.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/ibc.core.client.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/ibc.core.client.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/common/shared_types.ts b/ts-client/ibc.core.client.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/commitments.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/genesis.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/module/module.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/packet.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/params.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/query.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/tx.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/pep/decryption_key.ts b/ts-client/ibc.core.client.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/ibc.core.client.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/pep/genesis.ts b/ts-client/ibc.core.client.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/pep/module/module.ts b/ts-client/ibc.core.client.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/pep/params.ts b/ts-client/ibc.core.client.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/ibc.core.client.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/pep/query.ts b/ts-client/ibc.core.client.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/pep/request_id.ts b/ts-client/ibc.core.client.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/fairyring/pep/tx.ts b/ts-client/ibc.core.client.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/gogoproto/gogo.ts b/ts-client/ibc.core.client.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/ibc.core.client.v1/types/gogoproto/gogo.ts +++ b/ts-client/ibc.core.client.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/ibc.core.client.v1/types/google/api/annotations.ts b/ts-client/ibc.core.client.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/ibc.core.client.v1/types/google/api/annotations.ts +++ b/ts-client/ibc.core.client.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/ibc.core.client.v1/types/google/api/http.ts b/ts-client/ibc.core.client.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/ibc.core.client.v1/types/google/api/http.ts +++ b/ts-client/ibc.core.client.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/google/protobuf/descriptor.ts b/ts-client/ibc.core.client.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/ibc.core.client.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/ibc.core.client.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/google/protobuf/duration.ts b/ts-client/ibc.core.client.v1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.client.v1/types/route-name.eta b/ts-client/ibc.core.client.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/ibc.core.client.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file diff --git a/ts-client/ibc.core.connection.v1/module.ts b/ts-client/ibc.core.connection.v1/module.ts index e98ef8a1..50763933 100755 --- a/ts-client/ibc.core.connection.v1/module.ts +++ b/ts-client/ibc.core.connection.v1/module.ts @@ -6,48 +6,54 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { Counterparty } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionsResponse } from "./types/ibc/core/connection/v1/query"; -import { QueryClientConnectionsRequest } from "./types/ibc/core/connection/v1/query"; -import { MsgConnectionOpenTryResponse } from "./types/ibc/core/connection/v1/tx"; -import { IdentifiedConnection } from "./types/ibc/core/connection/v1/connection"; -import { MsgConnectionOpenTry } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenConfirm } from "./types/ibc/core/connection/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/ibc/core/connection/v1/tx"; -import { Params } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionRequest } from "./types/ibc/core/connection/v1/query"; -import { QueryConnectionConsensusStateRequest } from "./types/ibc/core/connection/v1/query"; -import { ConnectionPaths } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionClientStateRequest } from "./types/ibc/core/connection/v1/query"; -import { QueryConnectionParamsRequest } from "./types/ibc/core/connection/v1/query"; -import { MsgUpdateParams } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenConfirmResponse } from "./types/ibc/core/connection/v1/tx"; -import { QueryConnectionsRequest } from "./types/ibc/core/connection/v1/query"; -import { MsgConnectionOpenAck } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenAckResponse } from "./types/ibc/core/connection/v1/tx"; -import { ConnectionEnd } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionConsensusStateResponse } from "./types/ibc/core/connection/v1/query"; -import { QueryClientConnectionsResponse } from "./types/ibc/core/connection/v1/query"; -import { QueryConnectionParamsResponse } from "./types/ibc/core/connection/v1/query"; -import { ClientPaths } from "./types/ibc/core/connection/v1/connection"; -import { GenesisState } from "./types/ibc/core/connection/v1/genesis"; -import { Version } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionClientStateResponse } from "./types/ibc/core/connection/v1/query"; -import { QueryConnectionResponse } from "./types/ibc/core/connection/v1/query"; -import { MsgConnectionOpenInitResponse } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenInit } from "./types/ibc/core/connection/v1/tx"; - - -export { Counterparty, QueryConnectionsResponse, QueryClientConnectionsRequest, MsgConnectionOpenTryResponse, IdentifiedConnection, MsgConnectionOpenTry, MsgConnectionOpenConfirm, MsgUpdateParamsResponse, Params, QueryConnectionRequest, QueryConnectionConsensusStateRequest, ConnectionPaths, QueryConnectionClientStateRequest, QueryConnectionParamsRequest, MsgUpdateParams, MsgConnectionOpenConfirmResponse, QueryConnectionsRequest, MsgConnectionOpenAck, MsgConnectionOpenAckResponse, ConnectionEnd, QueryConnectionConsensusStateResponse, QueryClientConnectionsResponse, QueryConnectionParamsResponse, ClientPaths, GenesisState, Version, QueryConnectionClientStateResponse, QueryConnectionResponse, MsgConnectionOpenInitResponse, MsgConnectionOpenInit }; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenConfirmResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/genesis"; +import { QueryClientConnectionsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryClientConnectionsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { ClientPaths } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { MsgConnectionOpenAck } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenAckResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenTryResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { QueryConnectionRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { Version } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { QueryConnectionClientStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionConsensusStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionClientStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { IdentifiedConnection } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { QueryConnectionsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { MsgConnectionOpenInitResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { QueryConnectionResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { Counterparty } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { ConnectionPaths } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { MsgConnectionOpenInit } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { QueryConnectionsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionConsensusStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { ConnectionEnd } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { MsgConnectionOpenTry } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenConfirm } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; + + +export { MsgUpdateParamsResponse, MsgConnectionOpenConfirmResponse, GenesisState, QueryClientConnectionsRequest, QueryClientConnectionsResponse, ClientPaths, MsgConnectionOpenAck, MsgConnectionOpenAckResponse, MsgConnectionOpenTryResponse, MsgUpdateParams, QueryConnectionRequest, Version, Params, QueryConnectionClientStateRequest, QueryConnectionConsensusStateResponse, QueryConnectionClientStateResponse, IdentifiedConnection, QueryConnectionsRequest, QueryConnectionParamsResponse, MsgConnectionOpenInitResponse, QueryConnectionResponse, Counterparty, ConnectionPaths, MsgConnectionOpenInit, QueryConnectionsResponse, QueryConnectionParamsRequest, QueryConnectionConsensusStateRequest, ConnectionEnd, MsgConnectionOpenTry, MsgConnectionOpenConfirm }; -type sendCounterpartyParams = { - value: Counterparty, +type sendMsgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, fee?: StdFee, memo?: string }; -type sendQueryConnectionsResponseParams = { - value: QueryConnectionsResponse, +type sendMsgConnectionOpenConfirmResponseParams = { + value: MsgConnectionOpenConfirmResponse, + fee?: StdFee, + memo?: string +}; + +type sendGenesisStateParams = { + value: GenesisState, fee?: StdFee, memo?: string }; @@ -58,38 +64,38 @@ type sendQueryClientConnectionsRequestParams = { memo?: string }; -type sendMsgConnectionOpenTryResponseParams = { - value: MsgConnectionOpenTryResponse, +type sendQueryClientConnectionsResponseParams = { + value: QueryClientConnectionsResponse, fee?: StdFee, memo?: string }; -type sendIdentifiedConnectionParams = { - value: IdentifiedConnection, +type sendClientPathsParams = { + value: ClientPaths, fee?: StdFee, memo?: string }; -type sendMsgConnectionOpenTryParams = { - value: MsgConnectionOpenTry, +type sendMsgConnectionOpenAckParams = { + value: MsgConnectionOpenAck, fee?: StdFee, memo?: string }; -type sendMsgConnectionOpenConfirmParams = { - value: MsgConnectionOpenConfirm, +type sendMsgConnectionOpenAckResponseParams = { + value: MsgConnectionOpenAckResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type sendMsgConnectionOpenTryResponseParams = { + value: MsgConnectionOpenTryResponse, fee?: StdFee, memo?: string }; -type sendParamsParams = { - value: Params, +type sendMsgUpdateParamsParams = { + value: MsgUpdateParams, fee?: StdFee, memo?: string }; @@ -100,14 +106,14 @@ type sendQueryConnectionRequestParams = { memo?: string }; -type sendQueryConnectionConsensusStateRequestParams = { - value: QueryConnectionConsensusStateRequest, +type sendVersionParams = { + value: Version, fee?: StdFee, memo?: string }; -type sendConnectionPathsParams = { - value: ConnectionPaths, +type sendParamsParams = { + value: Params, fee?: StdFee, memo?: string }; @@ -118,20 +124,20 @@ type sendQueryConnectionClientStateRequestParams = { memo?: string }; -type sendQueryConnectionParamsRequestParams = { - value: QueryConnectionParamsRequest, +type sendQueryConnectionConsensusStateResponseParams = { + value: QueryConnectionConsensusStateResponse, fee?: StdFee, memo?: string }; -type sendMsgUpdateParamsParams = { - value: MsgUpdateParams, +type sendQueryConnectionClientStateResponseParams = { + value: QueryConnectionClientStateResponse, fee?: StdFee, memo?: string }; -type sendMsgConnectionOpenConfirmResponseParams = { - value: MsgConnectionOpenConfirmResponse, +type sendIdentifiedConnectionParams = { + value: IdentifiedConnection, fee?: StdFee, memo?: string }; @@ -142,203 +148,197 @@ type sendQueryConnectionsRequestParams = { memo?: string }; -type sendMsgConnectionOpenAckParams = { - value: MsgConnectionOpenAck, +type sendQueryConnectionParamsResponseParams = { + value: QueryConnectionParamsResponse, fee?: StdFee, memo?: string }; -type sendMsgConnectionOpenAckResponseParams = { - value: MsgConnectionOpenAckResponse, +type sendMsgConnectionOpenInitResponseParams = { + value: MsgConnectionOpenInitResponse, fee?: StdFee, memo?: string }; -type sendConnectionEndParams = { - value: ConnectionEnd, +type sendQueryConnectionResponseParams = { + value: QueryConnectionResponse, fee?: StdFee, memo?: string }; -type sendQueryConnectionConsensusStateResponseParams = { - value: QueryConnectionConsensusStateResponse, +type sendCounterpartyParams = { + value: Counterparty, fee?: StdFee, memo?: string }; -type sendQueryClientConnectionsResponseParams = { - value: QueryClientConnectionsResponse, +type sendConnectionPathsParams = { + value: ConnectionPaths, fee?: StdFee, memo?: string }; -type sendQueryConnectionParamsResponseParams = { - value: QueryConnectionParamsResponse, +type sendMsgConnectionOpenInitParams = { + value: MsgConnectionOpenInit, fee?: StdFee, memo?: string }; -type sendClientPathsParams = { - value: ClientPaths, +type sendQueryConnectionsResponseParams = { + value: QueryConnectionsResponse, fee?: StdFee, memo?: string }; -type sendGenesisStateParams = { - value: GenesisState, +type sendQueryConnectionParamsRequestParams = { + value: QueryConnectionParamsRequest, fee?: StdFee, memo?: string }; -type sendVersionParams = { - value: Version, +type sendQueryConnectionConsensusStateRequestParams = { + value: QueryConnectionConsensusStateRequest, fee?: StdFee, memo?: string }; -type sendQueryConnectionClientStateResponseParams = { - value: QueryConnectionClientStateResponse, +type sendConnectionEndParams = { + value: ConnectionEnd, fee?: StdFee, memo?: string }; -type sendQueryConnectionResponseParams = { - value: QueryConnectionResponse, +type sendMsgConnectionOpenTryParams = { + value: MsgConnectionOpenTry, fee?: StdFee, memo?: string }; -type sendMsgConnectionOpenInitResponseParams = { - value: MsgConnectionOpenInitResponse, +type sendMsgConnectionOpenConfirmParams = { + value: MsgConnectionOpenConfirm, fee?: StdFee, memo?: string }; -type sendMsgConnectionOpenInitParams = { - value: MsgConnectionOpenInit, - fee?: StdFee, - memo?: string -}; +type msgUpdateParamsResponseParams = { + value: MsgUpdateParamsResponse, +}; -type counterpartyParams = { - value: Counterparty, +type msgConnectionOpenConfirmResponseParams = { + value: MsgConnectionOpenConfirmResponse, }; -type queryConnectionsResponseParams = { - value: QueryConnectionsResponse, +type genesisStateParams = { + value: GenesisState, }; type queryClientConnectionsRequestParams = { value: QueryClientConnectionsRequest, }; -type msgConnectionOpenTryResponseParams = { - value: MsgConnectionOpenTryResponse, +type queryClientConnectionsResponseParams = { + value: QueryClientConnectionsResponse, }; -type identifiedConnectionParams = { - value: IdentifiedConnection, +type clientPathsParams = { + value: ClientPaths, }; -type msgConnectionOpenTryParams = { - value: MsgConnectionOpenTry, +type msgConnectionOpenAckParams = { + value: MsgConnectionOpenAck, }; -type msgConnectionOpenConfirmParams = { - value: MsgConnectionOpenConfirm, +type msgConnectionOpenAckResponseParams = { + value: MsgConnectionOpenAckResponse, }; -type msgUpdateParamsResponseParams = { - value: MsgUpdateParamsResponse, +type msgConnectionOpenTryResponseParams = { + value: MsgConnectionOpenTryResponse, }; -type paramsParams = { - value: Params, +type msgUpdateParamsParams = { + value: MsgUpdateParams, }; type queryConnectionRequestParams = { value: QueryConnectionRequest, }; -type queryConnectionConsensusStateRequestParams = { - value: QueryConnectionConsensusStateRequest, +type versionParams = { + value: Version, }; -type connectionPathsParams = { - value: ConnectionPaths, +type paramsParams = { + value: Params, }; type queryConnectionClientStateRequestParams = { value: QueryConnectionClientStateRequest, }; -type queryConnectionParamsRequestParams = { - value: QueryConnectionParamsRequest, +type queryConnectionConsensusStateResponseParams = { + value: QueryConnectionConsensusStateResponse, }; -type msgUpdateParamsParams = { - value: MsgUpdateParams, +type queryConnectionClientStateResponseParams = { + value: QueryConnectionClientStateResponse, }; -type msgConnectionOpenConfirmResponseParams = { - value: MsgConnectionOpenConfirmResponse, +type identifiedConnectionParams = { + value: IdentifiedConnection, }; type queryConnectionsRequestParams = { value: QueryConnectionsRequest, }; -type msgConnectionOpenAckParams = { - value: MsgConnectionOpenAck, -}; - -type msgConnectionOpenAckResponseParams = { - value: MsgConnectionOpenAckResponse, +type queryConnectionParamsResponseParams = { + value: QueryConnectionParamsResponse, }; -type connectionEndParams = { - value: ConnectionEnd, +type msgConnectionOpenInitResponseParams = { + value: MsgConnectionOpenInitResponse, }; -type queryConnectionConsensusStateResponseParams = { - value: QueryConnectionConsensusStateResponse, +type queryConnectionResponseParams = { + value: QueryConnectionResponse, }; -type queryClientConnectionsResponseParams = { - value: QueryClientConnectionsResponse, +type counterpartyParams = { + value: Counterparty, }; -type queryConnectionParamsResponseParams = { - value: QueryConnectionParamsResponse, +type connectionPathsParams = { + value: ConnectionPaths, }; -type clientPathsParams = { - value: ClientPaths, +type msgConnectionOpenInitParams = { + value: MsgConnectionOpenInit, }; -type genesisStateParams = { - value: GenesisState, +type queryConnectionsResponseParams = { + value: QueryConnectionsResponse, }; -type versionParams = { - value: Version, +type queryConnectionParamsRequestParams = { + value: QueryConnectionParamsRequest, }; -type queryConnectionClientStateResponseParams = { - value: QueryConnectionClientStateResponse, +type queryConnectionConsensusStateRequestParams = { + value: QueryConnectionConsensusStateRequest, }; -type queryConnectionResponseParams = { - value: QueryConnectionResponse, +type connectionEndParams = { + value: ConnectionEnd, }; -type msgConnectionOpenInitResponseParams = { - value: MsgConnectionOpenInitResponse, +type msgConnectionOpenTryParams = { + value: MsgConnectionOpenTry, }; -type msgConnectionOpenInitParams = { - value: MsgConnectionOpenInit, +type msgConnectionOpenConfirmParams = { + value: MsgConnectionOpenConfirm, }; @@ -371,31 +371,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendCounterparty({ value, fee, memo }: sendCounterpartyParams): Promise { + async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendCounterparty: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.counterparty({ value: Counterparty.fromPartial(value) }) + let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendCounterparty: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConnectionsResponse({ value, fee, memo }: sendQueryConnectionsResponseParams): Promise { + async sendMsgConnectionOpenConfirmResponse({ value, fee, memo }: sendMsgConnectionOpenConfirmResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConnectionsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgConnectionOpenConfirmResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConnectionsResponse({ value: QueryConnectionsResponse.fromPartial(value) }) + let msg = this.msgConnectionOpenConfirmResponse({ value: MsgConnectionOpenConfirmResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConnectionsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgConnectionOpenConfirmResponse: Could not broadcast Tx: '+ e.message) + } + }, + + async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + if (!signer) { + throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); + let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) + } catch (e: any) { + throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) } }, @@ -413,87 +427,87 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgConnectionOpenTryResponse({ value, fee, memo }: sendMsgConnectionOpenTryResponseParams): Promise { + async sendQueryClientConnectionsResponse({ value, fee, memo }: sendQueryClientConnectionsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgConnectionOpenTryResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryClientConnectionsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgConnectionOpenTryResponse({ value: MsgConnectionOpenTryResponse.fromPartial(value) }) + let msg = this.queryClientConnectionsResponse({ value: QueryClientConnectionsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgConnectionOpenTryResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryClientConnectionsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendIdentifiedConnection({ value, fee, memo }: sendIdentifiedConnectionParams): Promise { + async sendClientPaths({ value, fee, memo }: sendClientPathsParams): Promise { if (!signer) { - throw new Error('TxClient:sendIdentifiedConnection: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendClientPaths: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.identifiedConnection({ value: IdentifiedConnection.fromPartial(value) }) + let msg = this.clientPaths({ value: ClientPaths.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendIdentifiedConnection: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendClientPaths: Could not broadcast Tx: '+ e.message) } }, - async sendMsgConnectionOpenTry({ value, fee, memo }: sendMsgConnectionOpenTryParams): Promise { + async sendMsgConnectionOpenAck({ value, fee, memo }: sendMsgConnectionOpenAckParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgConnectionOpenTry: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgConnectionOpenAck: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgConnectionOpenTry({ value: MsgConnectionOpenTry.fromPartial(value) }) + let msg = this.msgConnectionOpenAck({ value: MsgConnectionOpenAck.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgConnectionOpenTry: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgConnectionOpenAck: Could not broadcast Tx: '+ e.message) } }, - async sendMsgConnectionOpenConfirm({ value, fee, memo }: sendMsgConnectionOpenConfirmParams): Promise { + async sendMsgConnectionOpenAckResponse({ value, fee, memo }: sendMsgConnectionOpenAckResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgConnectionOpenConfirm: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgConnectionOpenAckResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgConnectionOpenConfirm({ value: MsgConnectionOpenConfirm.fromPartial(value) }) + let msg = this.msgConnectionOpenAckResponse({ value: MsgConnectionOpenAckResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgConnectionOpenConfirm: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgConnectionOpenAckResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParamsResponse({ value, fee, memo }: sendMsgUpdateParamsResponseParams): Promise { + async sendMsgConnectionOpenTryResponse({ value, fee, memo }: sendMsgConnectionOpenTryResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgConnectionOpenTryResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParamsResponse({ value: MsgUpdateParamsResponse.fromPartial(value) }) + let msg = this.msgConnectionOpenTryResponse({ value: MsgConnectionOpenTryResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgConnectionOpenTryResponse: Could not broadcast Tx: '+ e.message) } }, - async sendParams({ value, fee, memo }: sendParamsParams): Promise { + async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.params({ value: Params.fromPartial(value) }) + let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) } }, @@ -511,31 +525,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryConnectionConsensusStateRequest({ value, fee, memo }: sendQueryConnectionConsensusStateRequestParams): Promise { + async sendVersion({ value, fee, memo }: sendVersionParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConnectionConsensusStateRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendVersion: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConnectionConsensusStateRequest({ value: QueryConnectionConsensusStateRequest.fromPartial(value) }) + let msg = this.version({ value: Version.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConnectionConsensusStateRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendVersion: Could not broadcast Tx: '+ e.message) } }, - async sendConnectionPaths({ value, fee, memo }: sendConnectionPathsParams): Promise { + async sendParams({ value, fee, memo }: sendParamsParams): Promise { if (!signer) { - throw new Error('TxClient:sendConnectionPaths: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendParams: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.connectionPaths({ value: ConnectionPaths.fromPartial(value) }) + let msg = this.params({ value: Params.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendConnectionPaths: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendParams: Could not broadcast Tx: '+ e.message) } }, @@ -553,45 +567,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendQueryConnectionParamsRequest({ value, fee, memo }: sendQueryConnectionParamsRequestParams): Promise { + async sendQueryConnectionConsensusStateResponse({ value, fee, memo }: sendQueryConnectionConsensusStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConnectionParamsRequest: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConnectionConsensusStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConnectionParamsRequest({ value: QueryConnectionParamsRequest.fromPartial(value) }) + let msg = this.queryConnectionConsensusStateResponse({ value: QueryConnectionConsensusStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConnectionParamsRequest: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConnectionConsensusStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateParams({ value, fee, memo }: sendMsgUpdateParamsParams): Promise { + async sendQueryConnectionClientStateResponse({ value, fee, memo }: sendQueryConnectionClientStateResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateParams: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConnectionClientStateResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgUpdateParams({ value: MsgUpdateParams.fromPartial(value) }) + let msg = this.queryConnectionClientStateResponse({ value: QueryConnectionClientStateResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateParams: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConnectionClientStateResponse: Could not broadcast Tx: '+ e.message) } }, - async sendMsgConnectionOpenConfirmResponse({ value, fee, memo }: sendMsgConnectionOpenConfirmResponseParams): Promise { + async sendIdentifiedConnection({ value, fee, memo }: sendIdentifiedConnectionParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgConnectionOpenConfirmResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendIdentifiedConnection: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgConnectionOpenConfirmResponse({ value: MsgConnectionOpenConfirmResponse.fromPartial(value) }) + let msg = this.identifiedConnection({ value: IdentifiedConnection.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgConnectionOpenConfirmResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendIdentifiedConnection: Could not broadcast Tx: '+ e.message) } }, @@ -609,202 +623,196 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgConnectionOpenAck({ value, fee, memo }: sendMsgConnectionOpenAckParams): Promise { - if (!signer) { - throw new Error('TxClient:sendMsgConnectionOpenAck: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgConnectionOpenAck({ value: MsgConnectionOpenAck.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendMsgConnectionOpenAck: Could not broadcast Tx: '+ e.message) - } - }, - - async sendMsgConnectionOpenAckResponse({ value, fee, memo }: sendMsgConnectionOpenAckResponseParams): Promise { + async sendQueryConnectionParamsResponse({ value, fee, memo }: sendQueryConnectionParamsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgConnectionOpenAckResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConnectionParamsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgConnectionOpenAckResponse({ value: MsgConnectionOpenAckResponse.fromPartial(value) }) + let msg = this.queryConnectionParamsResponse({ value: QueryConnectionParamsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgConnectionOpenAckResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConnectionParamsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendConnectionEnd({ value, fee, memo }: sendConnectionEndParams): Promise { + async sendMsgConnectionOpenInitResponse({ value, fee, memo }: sendMsgConnectionOpenInitResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendConnectionEnd: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgConnectionOpenInitResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.connectionEnd({ value: ConnectionEnd.fromPartial(value) }) + let msg = this.msgConnectionOpenInitResponse({ value: MsgConnectionOpenInitResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendConnectionEnd: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgConnectionOpenInitResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConnectionConsensusStateResponse({ value, fee, memo }: sendQueryConnectionConsensusStateResponseParams): Promise { + async sendQueryConnectionResponse({ value, fee, memo }: sendQueryConnectionResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConnectionConsensusStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConnectionResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConnectionConsensusStateResponse({ value: QueryConnectionConsensusStateResponse.fromPartial(value) }) + let msg = this.queryConnectionResponse({ value: QueryConnectionResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConnectionConsensusStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConnectionResponse: Could not broadcast Tx: '+ e.message) } }, - async sendQueryClientConnectionsResponse({ value, fee, memo }: sendQueryClientConnectionsResponseParams): Promise { + async sendCounterparty({ value, fee, memo }: sendCounterpartyParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryClientConnectionsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendCounterparty: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryClientConnectionsResponse({ value: QueryClientConnectionsResponse.fromPartial(value) }) + let msg = this.counterparty({ value: Counterparty.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryClientConnectionsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendCounterparty: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConnectionParamsResponse({ value, fee, memo }: sendQueryConnectionParamsResponseParams): Promise { + async sendConnectionPaths({ value, fee, memo }: sendConnectionPathsParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConnectionParamsResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendConnectionPaths: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConnectionParamsResponse({ value: QueryConnectionParamsResponse.fromPartial(value) }) + let msg = this.connectionPaths({ value: ConnectionPaths.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConnectionParamsResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendConnectionPaths: Could not broadcast Tx: '+ e.message) } }, - async sendClientPaths({ value, fee, memo }: sendClientPathsParams): Promise { + async sendMsgConnectionOpenInit({ value, fee, memo }: sendMsgConnectionOpenInitParams): Promise { if (!signer) { - throw new Error('TxClient:sendClientPaths: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgConnectionOpenInit: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.clientPaths({ value: ClientPaths.fromPartial(value) }) + let msg = this.msgConnectionOpenInit({ value: MsgConnectionOpenInit.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendClientPaths: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgConnectionOpenInit: Could not broadcast Tx: '+ e.message) } }, - async sendGenesisState({ value, fee, memo }: sendGenesisStateParams): Promise { + async sendQueryConnectionsResponse({ value, fee, memo }: sendQueryConnectionsResponseParams): Promise { if (!signer) { - throw new Error('TxClient:sendGenesisState: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConnectionsResponse: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.genesisState({ value: GenesisState.fromPartial(value) }) + let msg = this.queryConnectionsResponse({ value: QueryConnectionsResponse.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendGenesisState: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConnectionsResponse: Could not broadcast Tx: '+ e.message) } }, - async sendVersion({ value, fee, memo }: sendVersionParams): Promise { + async sendQueryConnectionParamsRequest({ value, fee, memo }: sendQueryConnectionParamsRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendVersion: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConnectionParamsRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.version({ value: Version.fromPartial(value) }) + let msg = this.queryConnectionParamsRequest({ value: QueryConnectionParamsRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendVersion: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConnectionParamsRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConnectionClientStateResponse({ value, fee, memo }: sendQueryConnectionClientStateResponseParams): Promise { + async sendQueryConnectionConsensusStateRequest({ value, fee, memo }: sendQueryConnectionConsensusStateRequestParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConnectionClientStateResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendQueryConnectionConsensusStateRequest: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConnectionClientStateResponse({ value: QueryConnectionClientStateResponse.fromPartial(value) }) + let msg = this.queryConnectionConsensusStateRequest({ value: QueryConnectionConsensusStateRequest.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConnectionClientStateResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendQueryConnectionConsensusStateRequest: Could not broadcast Tx: '+ e.message) } }, - async sendQueryConnectionResponse({ value, fee, memo }: sendQueryConnectionResponseParams): Promise { + async sendConnectionEnd({ value, fee, memo }: sendConnectionEndParams): Promise { if (!signer) { - throw new Error('TxClient:sendQueryConnectionResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendConnectionEnd: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.queryConnectionResponse({ value: QueryConnectionResponse.fromPartial(value) }) + let msg = this.connectionEnd({ value: ConnectionEnd.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendQueryConnectionResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendConnectionEnd: Could not broadcast Tx: '+ e.message) } }, - async sendMsgConnectionOpenInitResponse({ value, fee, memo }: sendMsgConnectionOpenInitResponseParams): Promise { + async sendMsgConnectionOpenTry({ value, fee, memo }: sendMsgConnectionOpenTryParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgConnectionOpenInitResponse: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgConnectionOpenTry: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgConnectionOpenInitResponse({ value: MsgConnectionOpenInitResponse.fromPartial(value) }) + let msg = this.msgConnectionOpenTry({ value: MsgConnectionOpenTry.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgConnectionOpenInitResponse: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgConnectionOpenTry: Could not broadcast Tx: '+ e.message) } }, - async sendMsgConnectionOpenInit({ value, fee, memo }: sendMsgConnectionOpenInitParams): Promise { + async sendMsgConnectionOpenConfirm({ value, fee, memo }: sendMsgConnectionOpenConfirmParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgConnectionOpenInit: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgConnectionOpenConfirm: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry}); - let msg = this.msgConnectionOpenInit({ value: MsgConnectionOpenInit.fromPartial(value) }) + let msg = this.msgConnectionOpenConfirm({ value: MsgConnectionOpenConfirm.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgConnectionOpenInit: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgConnectionOpenConfirm: Could not broadcast Tx: '+ e.message) } }, - counterparty({ value }: counterpartyParams): EncodeObject { + msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.Counterparty", value: Counterparty.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Counterparty: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) } }, - queryConnectionsResponse({ value }: queryConnectionsResponseParams): EncodeObject { + msgConnectionOpenConfirmResponse({ value }: msgConnectionOpenConfirmResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", value: QueryConnectionsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", value: MsgConnectionOpenConfirmResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConnectionsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgConnectionOpenConfirmResponse: Could not create message: ' + e.message) + } + }, + + genesisState({ value }: genesisStateParams): EncodeObject { + try { + return { typeUrl: "/ibc.core.connection.v1.GenesisState", value: GenesisState.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) } }, @@ -816,51 +824,51 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgConnectionOpenTryResponse({ value }: msgConnectionOpenTryResponseParams): EncodeObject { + queryClientConnectionsResponse({ value }: queryClientConnectionsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", value: MsgConnectionOpenTryResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", value: QueryClientConnectionsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgConnectionOpenTryResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryClientConnectionsResponse: Could not create message: ' + e.message) } }, - identifiedConnection({ value }: identifiedConnectionParams): EncodeObject { + clientPaths({ value }: clientPathsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", value: IdentifiedConnection.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.ClientPaths", value: ClientPaths.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:IdentifiedConnection: Could not create message: ' + e.message) + throw new Error('TxClient:ClientPaths: Could not create message: ' + e.message) } }, - msgConnectionOpenTry({ value }: msgConnectionOpenTryParams): EncodeObject { + msgConnectionOpenAck({ value }: msgConnectionOpenAckParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value: MsgConnectionOpenTry.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: MsgConnectionOpenAck.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgConnectionOpenTry: Could not create message: ' + e.message) + throw new Error('TxClient:MsgConnectionOpenAck: Could not create message: ' + e.message) } }, - msgConnectionOpenConfirm({ value }: msgConnectionOpenConfirmParams): EncodeObject { + msgConnectionOpenAckResponse({ value }: msgConnectionOpenAckResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: MsgConnectionOpenConfirm.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", value: MsgConnectionOpenAckResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgConnectionOpenConfirm: Could not create message: ' + e.message) + throw new Error('TxClient:MsgConnectionOpenAckResponse: Could not create message: ' + e.message) } }, - msgUpdateParamsResponse({ value }: msgUpdateParamsResponseParams): EncodeObject { + msgConnectionOpenTryResponse({ value }: msgConnectionOpenTryResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", value: MsgConnectionOpenTryResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgConnectionOpenTryResponse: Could not create message: ' + e.message) } }, - params({ value }: paramsParams): EncodeObject { + msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.Params", value: Params.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Params: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) } }, @@ -872,19 +880,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryConnectionConsensusStateRequest({ value }: queryConnectionConsensusStateRequestParams): EncodeObject { + version({ value }: versionParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", value: QueryConnectionConsensusStateRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.Version", value: Version.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConnectionConsensusStateRequest: Could not create message: ' + e.message) + throw new Error('TxClient:Version: Could not create message: ' + e.message) } }, - connectionPaths({ value }: connectionPathsParams): EncodeObject { + params({ value }: paramsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.ConnectionPaths", value: ConnectionPaths.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.Params", value: Params.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ConnectionPaths: Could not create message: ' + e.message) + throw new Error('TxClient:Params: Could not create message: ' + e.message) } }, @@ -896,27 +904,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - queryConnectionParamsRequest({ value }: queryConnectionParamsRequestParams): EncodeObject { + queryConnectionConsensusStateResponse({ value }: queryConnectionConsensusStateResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsRequest", value: QueryConnectionParamsRequest.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", value: QueryConnectionConsensusStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConnectionParamsRequest: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConnectionConsensusStateResponse: Could not create message: ' + e.message) } }, - msgUpdateParams({ value }: msgUpdateParamsParams): EncodeObject { + queryConnectionClientStateResponse({ value }: queryConnectionClientStateResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", value: MsgUpdateParams.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", value: QueryConnectionClientStateResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateParams: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConnectionClientStateResponse: Could not create message: ' + e.message) } }, - msgConnectionOpenConfirmResponse({ value }: msgConnectionOpenConfirmResponseParams): EncodeObject { + identifiedConnection({ value }: identifiedConnectionParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", value: MsgConnectionOpenConfirmResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", value: IdentifiedConnection.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgConnectionOpenConfirmResponse: Could not create message: ' + e.message) + throw new Error('TxClient:IdentifiedConnection: Could not create message: ' + e.message) } }, @@ -928,107 +936,99 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgConnectionOpenAck({ value }: msgConnectionOpenAckParams): EncodeObject { - try { - return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: MsgConnectionOpenAck.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgConnectionOpenAck: Could not create message: ' + e.message) - } - }, - - msgConnectionOpenAckResponse({ value }: msgConnectionOpenAckResponseParams): EncodeObject { + queryConnectionParamsResponse({ value }: queryConnectionParamsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", value: MsgConnectionOpenAckResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsResponse", value: QueryConnectionParamsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgConnectionOpenAckResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConnectionParamsResponse: Could not create message: ' + e.message) } }, - connectionEnd({ value }: connectionEndParams): EncodeObject { + msgConnectionOpenInitResponse({ value }: msgConnectionOpenInitResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.ConnectionEnd", value: ConnectionEnd.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", value: MsgConnectionOpenInitResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ConnectionEnd: Could not create message: ' + e.message) + throw new Error('TxClient:MsgConnectionOpenInitResponse: Could not create message: ' + e.message) } }, - queryConnectionConsensusStateResponse({ value }: queryConnectionConsensusStateResponseParams): EncodeObject { + queryConnectionResponse({ value }: queryConnectionResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", value: QueryConnectionConsensusStateResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", value: QueryConnectionResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConnectionConsensusStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConnectionResponse: Could not create message: ' + e.message) } }, - queryClientConnectionsResponse({ value }: queryClientConnectionsResponseParams): EncodeObject { + counterparty({ value }: counterpartyParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", value: QueryClientConnectionsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.Counterparty", value: Counterparty.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryClientConnectionsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:Counterparty: Could not create message: ' + e.message) } }, - queryConnectionParamsResponse({ value }: queryConnectionParamsResponseParams): EncodeObject { + connectionPaths({ value }: connectionPathsParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsResponse", value: QueryConnectionParamsResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.ConnectionPaths", value: ConnectionPaths.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConnectionParamsResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ConnectionPaths: Could not create message: ' + e.message) } }, - clientPaths({ value }: clientPathsParams): EncodeObject { + msgConnectionOpenInit({ value }: msgConnectionOpenInitParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.ClientPaths", value: ClientPaths.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", value: MsgConnectionOpenInit.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:ClientPaths: Could not create message: ' + e.message) + throw new Error('TxClient:MsgConnectionOpenInit: Could not create message: ' + e.message) } }, - genesisState({ value }: genesisStateParams): EncodeObject { + queryConnectionsResponse({ value }: queryConnectionsResponseParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.GenesisState", value: GenesisState.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", value: QueryConnectionsResponse.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:GenesisState: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConnectionsResponse: Could not create message: ' + e.message) } }, - version({ value }: versionParams): EncodeObject { + queryConnectionParamsRequest({ value }: queryConnectionParamsRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.Version", value: Version.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsRequest", value: QueryConnectionParamsRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:Version: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConnectionParamsRequest: Could not create message: ' + e.message) } }, - queryConnectionClientStateResponse({ value }: queryConnectionClientStateResponseParams): EncodeObject { + queryConnectionConsensusStateRequest({ value }: queryConnectionConsensusStateRequestParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", value: QueryConnectionClientStateResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", value: QueryConnectionConsensusStateRequest.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConnectionClientStateResponse: Could not create message: ' + e.message) + throw new Error('TxClient:QueryConnectionConsensusStateRequest: Could not create message: ' + e.message) } }, - queryConnectionResponse({ value }: queryConnectionResponseParams): EncodeObject { + connectionEnd({ value }: connectionEndParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", value: QueryConnectionResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.ConnectionEnd", value: ConnectionEnd.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:QueryConnectionResponse: Could not create message: ' + e.message) + throw new Error('TxClient:ConnectionEnd: Could not create message: ' + e.message) } }, - msgConnectionOpenInitResponse({ value }: msgConnectionOpenInitResponseParams): EncodeObject { + msgConnectionOpenTry({ value }: msgConnectionOpenTryParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", value: MsgConnectionOpenInitResponse.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value: MsgConnectionOpenTry.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgConnectionOpenInitResponse: Could not create message: ' + e.message) + throw new Error('TxClient:MsgConnectionOpenTry: Could not create message: ' + e.message) } }, - msgConnectionOpenInit({ value }: msgConnectionOpenInitParams): EncodeObject { + msgConnectionOpenConfirm({ value }: msgConnectionOpenConfirmParams): EncodeObject { try { - return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", value: MsgConnectionOpenInit.fromPartial( value ) } + return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: MsgConnectionOpenConfirm.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgConnectionOpenInit: Could not create message: ' + e.message) + throw new Error('TxClient:MsgConnectionOpenConfirm: Could not create message: ' + e.message) } }, diff --git a/ts-client/ibc.core.connection.v1/registry.ts b/ts-client/ibc.core.connection.v1/registry.ts index eaad9d9d..8cd08fb4 100755 --- a/ts-client/ibc.core.connection.v1/registry.ts +++ b/ts-client/ibc.core.connection.v1/registry.ts @@ -1,66 +1,66 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { Counterparty } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionsResponse } from "./types/ibc/core/connection/v1/query"; -import { QueryClientConnectionsRequest } from "./types/ibc/core/connection/v1/query"; -import { MsgConnectionOpenTryResponse } from "./types/ibc/core/connection/v1/tx"; -import { IdentifiedConnection } from "./types/ibc/core/connection/v1/connection"; -import { MsgConnectionOpenTry } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenConfirm } from "./types/ibc/core/connection/v1/tx"; -import { MsgUpdateParamsResponse } from "./types/ibc/core/connection/v1/tx"; -import { Params } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionRequest } from "./types/ibc/core/connection/v1/query"; -import { QueryConnectionConsensusStateRequest } from "./types/ibc/core/connection/v1/query"; -import { ConnectionPaths } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionClientStateRequest } from "./types/ibc/core/connection/v1/query"; -import { QueryConnectionParamsRequest } from "./types/ibc/core/connection/v1/query"; -import { MsgUpdateParams } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenConfirmResponse } from "./types/ibc/core/connection/v1/tx"; -import { QueryConnectionsRequest } from "./types/ibc/core/connection/v1/query"; -import { MsgConnectionOpenAck } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenAckResponse } from "./types/ibc/core/connection/v1/tx"; -import { ConnectionEnd } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionConsensusStateResponse } from "./types/ibc/core/connection/v1/query"; -import { QueryClientConnectionsResponse } from "./types/ibc/core/connection/v1/query"; -import { QueryConnectionParamsResponse } from "./types/ibc/core/connection/v1/query"; -import { ClientPaths } from "./types/ibc/core/connection/v1/connection"; -import { GenesisState } from "./types/ibc/core/connection/v1/genesis"; -import { Version } from "./types/ibc/core/connection/v1/connection"; -import { QueryConnectionClientStateResponse } from "./types/ibc/core/connection/v1/query"; -import { QueryConnectionResponse } from "./types/ibc/core/connection/v1/query"; -import { MsgConnectionOpenInitResponse } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenInit } from "./types/ibc/core/connection/v1/tx"; +import { MsgUpdateParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenConfirmResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { GenesisState } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/genesis"; +import { QueryClientConnectionsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryClientConnectionsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { ClientPaths } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { MsgConnectionOpenAck } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenAckResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenTryResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgUpdateParams } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { QueryConnectionRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { Version } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { Params } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { QueryConnectionClientStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionConsensusStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionClientStateResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { IdentifiedConnection } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { QueryConnectionsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionParamsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { MsgConnectionOpenInitResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { QueryConnectionResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { Counterparty } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { ConnectionPaths } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { MsgConnectionOpenInit } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { QueryConnectionsResponse } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionParamsRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { QueryConnectionConsensusStateRequest } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/query"; +import { ConnectionEnd } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/connection"; +import { MsgConnectionOpenTry } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenConfirm } from "./types/../../../../../pkg/mod/github.com/cosmos/ibc-go/v8@v8.2.1/proto/ibc/core/connection/v1/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/ibc.core.connection.v1.Counterparty", Counterparty], - ["/ibc.core.connection.v1.QueryConnectionsResponse", QueryConnectionsResponse], - ["/ibc.core.connection.v1.QueryClientConnectionsRequest", QueryClientConnectionsRequest], - ["/ibc.core.connection.v1.MsgConnectionOpenTryResponse", MsgConnectionOpenTryResponse], - ["/ibc.core.connection.v1.IdentifiedConnection", IdentifiedConnection], - ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], - ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm], ["/ibc.core.connection.v1.MsgUpdateParamsResponse", MsgUpdateParamsResponse], - ["/ibc.core.connection.v1.Params", Params], - ["/ibc.core.connection.v1.QueryConnectionRequest", QueryConnectionRequest], - ["/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", QueryConnectionConsensusStateRequest], - ["/ibc.core.connection.v1.ConnectionPaths", ConnectionPaths], - ["/ibc.core.connection.v1.QueryConnectionClientStateRequest", QueryConnectionClientStateRequest], - ["/ibc.core.connection.v1.QueryConnectionParamsRequest", QueryConnectionParamsRequest], - ["/ibc.core.connection.v1.MsgUpdateParams", MsgUpdateParams], ["/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", MsgConnectionOpenConfirmResponse], - ["/ibc.core.connection.v1.QueryConnectionsRequest", QueryConnectionsRequest], - ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], - ["/ibc.core.connection.v1.MsgConnectionOpenAckResponse", MsgConnectionOpenAckResponse], - ["/ibc.core.connection.v1.ConnectionEnd", ConnectionEnd], - ["/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", QueryConnectionConsensusStateResponse], + ["/ibc.core.connection.v1.GenesisState", GenesisState], + ["/ibc.core.connection.v1.QueryClientConnectionsRequest", QueryClientConnectionsRequest], ["/ibc.core.connection.v1.QueryClientConnectionsResponse", QueryClientConnectionsResponse], - ["/ibc.core.connection.v1.QueryConnectionParamsResponse", QueryConnectionParamsResponse], ["/ibc.core.connection.v1.ClientPaths", ClientPaths], - ["/ibc.core.connection.v1.GenesisState", GenesisState], + ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], + ["/ibc.core.connection.v1.MsgConnectionOpenAckResponse", MsgConnectionOpenAckResponse], + ["/ibc.core.connection.v1.MsgConnectionOpenTryResponse", MsgConnectionOpenTryResponse], + ["/ibc.core.connection.v1.MsgUpdateParams", MsgUpdateParams], + ["/ibc.core.connection.v1.QueryConnectionRequest", QueryConnectionRequest], ["/ibc.core.connection.v1.Version", Version], + ["/ibc.core.connection.v1.Params", Params], + ["/ibc.core.connection.v1.QueryConnectionClientStateRequest", QueryConnectionClientStateRequest], + ["/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", QueryConnectionConsensusStateResponse], ["/ibc.core.connection.v1.QueryConnectionClientStateResponse", QueryConnectionClientStateResponse], - ["/ibc.core.connection.v1.QueryConnectionResponse", QueryConnectionResponse], + ["/ibc.core.connection.v1.IdentifiedConnection", IdentifiedConnection], + ["/ibc.core.connection.v1.QueryConnectionsRequest", QueryConnectionsRequest], + ["/ibc.core.connection.v1.QueryConnectionParamsResponse", QueryConnectionParamsResponse], ["/ibc.core.connection.v1.MsgConnectionOpenInitResponse", MsgConnectionOpenInitResponse], + ["/ibc.core.connection.v1.QueryConnectionResponse", QueryConnectionResponse], + ["/ibc.core.connection.v1.Counterparty", Counterparty], + ["/ibc.core.connection.v1.ConnectionPaths", ConnectionPaths], ["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], + ["/ibc.core.connection.v1.QueryConnectionsResponse", QueryConnectionsResponse], + ["/ibc.core.connection.v1.QueryConnectionParamsRequest", QueryConnectionParamsRequest], + ["/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", QueryConnectionConsensusStateRequest], + ["/ibc.core.connection.v1.ConnectionEnd", ConnectionEnd], + ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], + ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm], ]; diff --git a/ts-client/ibc.core.connection.v1/types/amino/amino.ts b/ts-client/ibc.core.connection.v1/types/amino/amino.ts index 54af2e62..4a505674 100644 --- a/ts-client/ibc.core.connection.v1/types/amino/amino.ts +++ b/ts-client/ibc.core.connection.v1/types/amino/amino.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: amino/amino.proto + /* eslint-disable */ export const protobufPackage = "amino"; diff --git a/ts-client/ibc.core.connection.v1/types/cosmos/app/v1alpha1/module.ts b/ts-client/ibc.core.connection.v1/types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..f8045357 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/app/v1alpha1/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +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. It is required to make debugging + * of configuration errors easier for users. + */ + goImport: 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. + */ + usePackage: 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. + */ + canMigrateFrom: 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 files containing the + * text "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 { goImport: "", usePackage: [], canMigrateFrom: [] }; +} + +export const ModuleDescriptor: MessageFns = { + encode(message: ModuleDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.goImport = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + goImport: isSet(object.goImport) ? globalThis.String(object.goImport) : "", + usePackage: globalThis.Array.isArray(object?.usePackage) + ? object.usePackage.map((e: any) => PackageReference.fromJSON(e)) + : [], + canMigrateFrom: globalThis.Array.isArray(object?.canMigrateFrom) + ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + if (message.goImport !== "") { + obj.goImport = message.goImport; + } + if (message.usePackage?.length) { + obj.usePackage = message.usePackage.map((e) => PackageReference.toJSON(e)); + } + if (message.canMigrateFrom?.length) { + obj.canMigrateFrom = message.canMigrateFrom.map((e) => MigrateFromInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModuleDescriptor { + return ModuleDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map((e) => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference: MessageFns = { + encode(message: PackageReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.revision = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): PackageReference { + return PackageReference.fromPartial(base ?? ({} as any)); + }, + 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: MessageFns = { + encode(message: MigrateFromInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? globalThis.String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + return obj; + }, + + create, I>>(base?: I): MigrateFromInfo { + return MigrateFromInfo.fromPartial(base ?? ({} as any)); + }, + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/cosmos/base/query/v1beta1/pagination.ts b/ts-client/ibc.core.connection.v1/types/cosmos/base/query/v1beta1/pagination.ts index ae0841d5..effd5449 100644 --- a/ts-client/ibc.core.connection.v1/types/cosmos/base/query/v1beta1/pagination.ts +++ b/ts-client/ibc.core.connection.v1/types/cosmos/base/query/v1beta1/pagination.ts @@ -1,6 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/query/v1beta1/pagination.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos.base.query.v1beta1"; @@ -73,8 +78,8 @@ function createBasePageRequest(): PageRequest { return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; } -export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageRequest: MessageFns = { + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } @@ -84,17 +89,17 @@ export const PageRequest = { if (message.limit !== 0) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { + if (message.reverse !== false) { writer.uint32(40).bool(message.reverse); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageRequest(); while (reader.pos < end) { @@ -112,14 +117,14 @@ export const PageRequest = { break; } - message.offset = longToNumber(reader.uint64() as Long); + message.offset = longToNumber(reader.uint64()); continue; case 3: if (tag !== 24) { break; } - message.limit = longToNumber(reader.uint64() as Long); + message.limit = longToNumber(reader.uint64()); continue; case 4: if (tag !== 32) { @@ -139,7 +144,7 @@ export const PageRequest = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -147,10 +152,10 @@ export const PageRequest = { fromJSON(object: any): PageRequest { return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), - offset: isSet(object.offset) ? Number(object.offset) : 0, - limit: isSet(object.limit) ? Number(object.limit) : 0, - countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, - reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, }; }, @@ -165,10 +170,10 @@ export const PageRequest = { if (message.limit !== 0) { obj.limit = Math.round(message.limit); } - if (message.countTotal === true) { + if (message.countTotal !== false) { obj.countTotal = message.countTotal; } - if (message.reverse === true) { + if (message.reverse !== false) { obj.reverse = message.reverse; } return obj; @@ -192,8 +197,8 @@ function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(0), total: 0 }; } -export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const PageResponse: MessageFns = { + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } @@ -203,8 +208,8 @@ export const PageResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); while (reader.pos < end) { @@ -222,13 +227,13 @@ export const PageResponse = { break; } - message.total = longToNumber(reader.uint64() as Long); + message.total = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -236,7 +241,7 @@ export const PageResponse = { fromJSON(object: any): PageResponse { return { nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), - total: isSet(object.total) ? Number(object.total) : 0, + total: isSet(object.total) ? globalThis.Number(object.total) : 0, }; }, @@ -262,30 +267,11 @@ export const PageResponse = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -295,21 +281,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -317,18 +304,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/cosmos/base/v1beta1/coin.ts b/ts-client/ibc.core.connection.v1/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..84a52e28 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/base/v1beta1/coin.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin: MessageFns = { + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin: MessageFns = { + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + 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 ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/distribution.ts b/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..baac952e --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1150 @@ +/* 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 { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + * + * @deprecated + */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} + +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} + +/** + * 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: number; +} + +/** + * 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 { + validatorPeriod: number; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: 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. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + * + * @deprecated + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: number; + stake: string; + height: number; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: 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 { communityTax: "", baseProposerReward: "", bonusProposerReward: "", withdrawAddrEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + 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.communityTax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseProposerReward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonusProposerReward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdrawAddrEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + communityTax: isSet(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: isSet(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: isSet(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.communityTax !== "") { + obj.communityTax = message.communityTax; + } + if (message.baseProposerReward !== "") { + obj.baseProposerReward = message.baseProposerReward; + } + if (message.bonusProposerReward !== "") { + obj.bonusProposerReward = message.bonusProposerReward; + } + if (message.withdrawAddrEnabled === true) { + obj.withdrawAddrEnabled = message.withdrawAddrEnabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulativeRewardRatio: [], referenceCount: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.referenceCount = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e: any) => DecCoin.fromJSON(e)) + : [], + referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulativeRewardRatio?.length) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => DecCoin.toJSON(e)); + } + if (message.referenceCount !== 0) { + obj.referenceCount = Math.round(message.referenceCount); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validatorPeriod: 0, fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorPeriod !== 0) { + writer.uint32(8).uint64(message.validatorPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.validatorPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validatorPeriod: isSet(object.validatorPeriod) ? Number(object.validatorPeriod) : 0, + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validatorPeriod !== 0) { + obj.validatorPeriod = Math.round(message.validatorPeriod); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validatorSlashEvents: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validatorSlashEvents) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { communityPool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.communityPool) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.communityPool?.length) { + obj.communityPool = message.communityPool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + 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 { previousPeriod: 0, stake: "", height: 0 }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previousPeriod !== 0) { + writer.uint32(8).uint64(message.previousPeriod); + } + 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 : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.previousPeriod = longToNumber(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previousPeriod: isSet(object.previousPeriod) ? Number(object.previousPeriod) : 0, + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previousPeriod !== 0) { + obj.previousPeriod = Math.round(message.previousPeriod); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validatorAddress: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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 = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>( + base?: I, + ): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/genesis.ts b/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..e58f3850 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1005 @@ +/* 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. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission | undefined; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards | undefined; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards | undefined; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo | undefined; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent | undefined; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: + | Params + | undefined; + /** fee_pool defines the fee pool at genesis. */ + feePool: + | FeePool + | undefined; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validatorAddress: "", outstandingRewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validatorAddress: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validatorAddress: "", period: 0, rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + period: isSet(object.period) ? Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period ?? 0; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validatorAddress: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegatorAddress: "", validatorAddress: "", startingInfo: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingInfo !== undefined) { + obj.startingInfo = DelegatorStartingInfo.toJSON(message.startingInfo); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = (object.startingInfo !== undefined && object.startingInfo !== null) + ? DelegatorStartingInfo.fromPartial(object.startingInfo) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validatorAddress: "", height: 0, period: 0, validatorSlashEvent: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + height: isSet(object.height) ? Number(object.height) : 0, + period: isSet(object.period) ? Number(object.period) : 0, + validatorSlashEvent: isSet(object.validatorSlashEvent) + ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validatorSlashEvent !== undefined) { + obj.validatorSlashEvent = ValidatorSlashEvent.toJSON(message.validatorSlashEvent); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validatorSlashEvent = (object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null) + ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feePool: undefined, + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [], + }; +} + +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.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + 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 : _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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feePool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previousProposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validatorAccumulatedCommissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feePool: isSet(object.feePool) ? FeePool.fromJSON(object.feePool) : undefined, + delegatorWithdrawInfos: Array.isArray(object?.delegatorWithdrawInfos) + ? object.delegatorWithdrawInfos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previousProposer: isSet(object.previousProposer) ? String(object.previousProposer) : "", + outstandingRewards: Array.isArray(object?.outstandingRewards) + ? object.outstandingRewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validatorAccumulatedCommissions: Array.isArray(object?.validatorAccumulatedCommissions) + ? object.validatorAccumulatedCommissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validatorHistoricalRewards: Array.isArray(object?.validatorHistoricalRewards) + ? object.validatorHistoricalRewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validatorCurrentRewards: Array.isArray(object?.validatorCurrentRewards) + ? object.validatorCurrentRewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegatorStartingInfos: Array.isArray(object?.delegatorStartingInfos) + ? object.delegatorStartingInfos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feePool !== undefined) { + obj.feePool = FeePool.toJSON(message.feePool); + } + if (message.delegatorWithdrawInfos?.length) { + obj.delegatorWithdrawInfos = message.delegatorWithdrawInfos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previousProposer !== "") { + obj.previousProposer = message.previousProposer; + } + if (message.outstandingRewards?.length) { + obj.outstandingRewards = message.outstandingRewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validatorAccumulatedCommissions?.length) { + obj.validatorAccumulatedCommissions = message.validatorAccumulatedCommissions.map((e) => + ValidatorAccumulatedCommissionRecord.toJSON(e) + ); + } + if (message.validatorHistoricalRewards?.length) { + obj.validatorHistoricalRewards = message.validatorHistoricalRewards.map((e) => + ValidatorHistoricalRewardsRecord.toJSON(e) + ); + } + if (message.validatorCurrentRewards?.length) { + obj.validatorCurrentRewards = message.validatorCurrentRewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegatorStartingInfos?.length) { + obj.delegatorStartingInfos = message.delegatorStartingInfos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validatorSlashEvents?.length) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => ValidatorSlashEventRecord.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) + ? Params.fromPartial(object.params) + : undefined; + message.feePool = (object.feePool !== undefined && object.feePool !== null) + ? FeePool.fromPartial(object.feePool) + : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || + []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = + object.outstandingRewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = + object.validatorAccumulatedCommissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = + object.validatorHistoricalRewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = + object.validatorCurrentRewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = + object.delegatorStartingInfos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || + []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/query.ts b/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..fde0b7b6 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1669 @@ +/* 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 | undefined; +} + +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards | undefined; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission | undefined; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight: number; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} + +/** + * 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 | undefined; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: 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. */ + delegatorAddress: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: 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 : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _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()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorDistributionInfoRequest = { + encode(message: QueryValidatorDistributionInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorDistributionInfoRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { operatorAddress: "", selfBondRewards: [], commission: [] }; +} + +export const QueryValidatorDistributionInfoResponse = { + encode(message: QueryValidatorDistributionInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", + selfBondRewards: Array.isArray(object?.selfBondRewards) + ? object.selfBondRewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryValidatorDistributionInfoResponse): unknown { + const obj: any = {}; + if (message.operatorAddress !== "") { + obj.operatorAddress = message.operatorAddress; + } + if (message.selfBondRewards?.length) { + obj.selfBondRewards = message.selfBondRewards.map((e) => DecCoin.toJSON(e)); + } + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 { validatorAddress: "", startingHeight: 0, endingHeight: 0, pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== 0) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== 0) { + writer.uint32(24).uint64(message.endingHeight); + } + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.startingHeight = longToNumber(reader.uint64() as Long); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.endingHeight = longToNumber(reader.uint64() as Long); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: isSet(object.startingHeight) ? Number(object.startingHeight) : 0, + endingHeight: isSet(object.endingHeight) ? Number(object.endingHeight) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.startingHeight !== 0) { + obj.startingHeight = Math.round(message.startingHeight); + } + if (message.endingHeight !== 0) { + obj.endingHeight = Math.round(message.endingHeight); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight ?? 0; + message.endingHeight = object.endingHeight ?? 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "", validatorAddress: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + 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 { delegatorAddress: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + 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; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): 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 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 const QueryServiceName = "cosmos.distribution.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 || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorDistributionInfo = this.ValidatorDistributionInfo.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(_m0.Reader.create(data))); + } + + ValidatorDistributionInfo( + request: QueryValidatorDistributionInfoRequest, + ): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDistributionInfo", data); + return promise.then((data) => QueryValidatorDistributionInfoResponse.decode(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: 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"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +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/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/tx.ts b/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..3b18389d --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1145 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Params } from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: 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 { + delegatorAddress: string; + validatorAddress: string; +} + +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} + +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + 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 { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} + +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse { +} + +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} + +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegatorAddress: "", withdrawAddress: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdrawAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.withdrawAddress !== "") { + obj.withdrawAddress = message.withdrawAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegatorAddress: "", validatorAddress: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.delegatorAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegatorAddress !== "") { + obj.delegatorAddress = message.delegatorAddress; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validatorAddress: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + 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?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + 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 : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + 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(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + 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) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _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) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { authority: "", recipient: "", amount: [] }; +} + +export const MsgCommunityPoolSpend = { + encode(message: MsgCommunityPoolSpend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCommunityPoolSpend { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCommunityPoolSpend): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} + +export const MsgCommunityPoolSpendResponse = { + encode(_: MsgCommunityPoolSpendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCommunityPoolSpendResponse { + return {}; + }, + + toJSON(_: MsgCommunityPoolSpendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { depositor: "", validatorAddress: "", amount: [] }; +} + +export const MsgDepositValidatorRewardsPool = { + encode(message: MsgDepositValidatorRewardsPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.depositor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDepositValidatorRewardsPool { + return { + depositor: isSet(object.depositor) ? String(object.depositor) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDepositValidatorRewardsPool): unknown { + const obj: any = {}; + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.validatorAddress !== "") { + obj.validatorAddress = message.validatorAddress; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} + +export const MsgDepositValidatorRewardsPoolResponse = { + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositValidatorRewardsPoolResponse { + return {}; + }, + + toJSON(_: MsgDepositValidatorRewardsPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + 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; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + * + * Since: cosmos-sdk 0.50 + */ + DepositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; +} + +export const MsgServiceName = "cosmos.distribution.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 || MsgServiceName; + 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); + this.UpdateParams = this.UpdateParams.bind(this); + this.CommunityPoolSpend = this.CommunityPoolSpend.bind(this); + this.DepositValidatorRewardsPool = this.DepositValidatorRewardsPool.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(_m0.Reader.create(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(_m0.Reader.create(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(_m0.Reader.create(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(_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(_m0.Reader.create(data))); + } + + CommunityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPoolSpend", data); + return promise.then((data) => MsgCommunityPoolSpendResponse.decode(_m0.Reader.create(data))); + } + + DepositValidatorRewardsPool( + request: MsgDepositValidatorRewardsPool, + ): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DepositValidatorRewardsPool", data); + return promise.then((data) => MsgDepositValidatorRewardsPoolResponse.decode(_m0.Reader.create(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/ts-client/ibc.core.connection.v1/types/cosmos/msg/v1/msg.ts b/ts-client/ibc.core.connection.v1/types/cosmos/msg/v1/msg.ts index 093dfbba..7a993ec3 100644 --- a/ts-client/ibc.core.connection.v1/types/cosmos/msg/v1/msg.ts +++ b/ts-client/ibc.core.connection.v1/types/cosmos/msg/v1/msg.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos/msg/v1/msg.proto + /* eslint-disable */ export const protobufPackage = "cosmos.msg.v1"; diff --git a/ts-client/ibc.core.connection.v1/types/cosmos_proto/cosmos.ts b/ts-client/ibc.core.connection.v1/types/cosmos_proto/cosmos.ts index 8f5aa393..d95b944f 100644 --- a/ts-client/ibc.core.connection.v1/types/cosmos_proto/cosmos.ts +++ b/ts-client/ibc.core.connection.v1/types/cosmos_proto/cosmos.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: cosmos_proto/cosmos.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "cosmos_proto"; @@ -97,8 +103,8 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } -export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const InterfaceDescriptor: MessageFns = { + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -108,8 +114,8 @@ export const InterfaceDescriptor = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); while (reader.pos < end) { @@ -133,15 +139,15 @@ export const InterfaceDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", }; }, @@ -171,8 +177,8 @@ function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", description: "", fieldType: [] }; } -export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ScalarDescriptor: MessageFns = { + encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } @@ -183,12 +189,12 @@ export const ScalarDescriptor = { for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); + writer.join(); return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseScalarDescriptor(); while (reader.pos < end) { @@ -229,16 +235,18 @@ export const ScalarDescriptor = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ScalarDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) + : [], }; }, @@ -271,7 +279,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; @@ -282,3 +291,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/common/shared_types.ts b/ts-client/ibc.core.connection.v1/types/fairyring/common/shared_types.ts new file mode 100644 index 00000000..af855b23 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/common/shared_types.ts @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/common/shared_types.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "fairyring.common"; + +/** RequestDecryptionKey defines a struct for the data payload */ +export interface RequestDecryptionKey { + creator: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestDecryptionKeyResponse defines the response to the RequestDecryptionKey message */ +export interface RequestDecryptionKeyResponse { + identity: string; + pubkey: string; +} + +/** GetDecryptionKey defines a struct for the data payload */ +export interface GetDecryptionKey { + proposalId?: string | undefined; + requestId?: string | undefined; + identity: string; +} + +/** GetDecryptionKeyResponse defines the response to the GetDecryptionKey message */ +export interface GetDecryptionKeyResponse { +} + +/** GetPrivateDecryptionKey defines a struct for the data payload */ +export interface GetPrivateDecryptionKey { + requestId: string; + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateDecryptionKeyResponse defines the response to the GetPrivateDecryptionKey message */ +export interface GetPrivateDecryptionKeyResponse { + pubkey: string; +} + +/** ActivePublicKey defines the pubkey currently in use */ +export interface ActivePublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * QueuedPublicKey defines the pubkey that (when set) will replace the acive pubkey + * when it expires + */ +export interface QueuedPublicKey { + publicKey: string; + creator: string; + expiry: number; +} + +/** + * RequestPrivateDecryptionKey defines the structure to request for + * encrypted and unaggregated keyshares + */ +export interface RequestPrivateDecryptionKey { + creator: string; + requestId: string; +} + +/** + * PrivateDecryptionKey defines the storage structure for + * the list of encrypted keyshares (unaggregated) + */ +export interface PrivateDecryptionKey { + requester: string; + privateKeyshares: IndexedEncryptedKeyshare[]; +} + +/** + * IndexedEncryptedKeyshare defines the storage of submitted encrypted + * keyshares along with their indices (can be decrypted and aggregated) + */ +export interface IndexedEncryptedKeyshare { + encryptedKeyshareValue: string; + encryptedKeyshareIndex: number; +} + +function createBaseRequestDecryptionKey(): RequestDecryptionKey { + return { creator: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKey: MessageFns = { + encode(message: RequestDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKey { + return RequestDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKey { + const message = createBaseRequestDecryptionKey(); + message.creator = object.creator ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestDecryptionKeyResponse(): RequestDecryptionKeyResponse { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyResponse: MessageFns = { + encode(message: RequestDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyResponse { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyResponse { + return RequestDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestDecryptionKeyResponse { + const message = createBaseRequestDecryptionKeyResponse(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKey(): GetDecryptionKey { + return { proposalId: undefined, requestId: undefined, identity: "" }; +} + +export const GetDecryptionKey: MessageFns = { + encode(message: GetDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposalId !== undefined) { + writer.uint32(10).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposalId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKey { + return { + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: GetDecryptionKey): unknown { + const obj: any = {}; + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKey { + return GetDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKey { + const message = createBaseGetDecryptionKey(); + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyResponse(): GetDecryptionKeyResponse { + return {}; +} + +export const GetDecryptionKeyResponse: MessageFns = { + encode(_: GetDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyResponse { + return {}; + }, + + toJSON(_: GetDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyResponse { + return GetDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyResponse { + const message = createBaseGetDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKey(): GetPrivateDecryptionKey { + return { requestId: "", identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKey: MessageFns = { + encode(message: GetPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestId !== "") { + writer.uint32(10).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(26).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(34).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requester = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKey { + return { + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKey { + return GetPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetPrivateDecryptionKey { + const message = createBaseGetPrivateDecryptionKey(); + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyResponse(): GetPrivateDecryptionKeyResponse { + return { pubkey: "" }; +} + +export const GetPrivateDecryptionKeyResponse: MessageFns = { + encode(message: GetPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyResponse { + return { pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "" }; + }, + + toJSON(message: GetPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): GetPrivateDecryptionKeyResponse { + return GetPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyResponse { + const message = createBaseGetPrivateDecryptionKeyResponse(); + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseActivePublicKey(): ActivePublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const ActivePublicKey: MessageFns = { + encode(message: ActivePublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: ActivePublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): ActivePublicKey { + return ActivePublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePublicKey { + const message = createBaseActivePublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseQueuedPublicKey(): QueuedPublicKey { + return { publicKey: "", creator: "", expiry: 0 }; +} + +export const QueuedPublicKey: MessageFns = { + encode(message: QueuedPublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPublicKey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + }; + }, + + toJSON(message: QueuedPublicKey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + return obj; + }, + + create, I>>(base?: I): QueuedPublicKey { + return QueuedPublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPublicKey { + const message = createBaseQueuedPublicKey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKey(): RequestPrivateDecryptionKey { + return { creator: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKey: MessageFns = { + encode(message: RequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>(base?: I): RequestPrivateDecryptionKey { + return RequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrivateDecryptionKey { + const message = createBaseRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKey(): PrivateDecryptionKey { + return { requester: "", privateKeyshares: [] }; +} + +export const PrivateDecryptionKey: MessageFns = { + encode(message: PrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + for (const v of message.privateKeyshares) { + IndexedEncryptedKeyshare.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.privateKeyshares.push(IndexedEncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKey { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + privateKeyshares: globalThis.Array.isArray(object?.privateKeyshares) + ? object.privateKeyshares.map((e: any) => IndexedEncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.privateKeyshares?.length) { + obj.privateKeyshares = message.privateKeyshares.map((e) => IndexedEncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKey { + return PrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKey { + const message = createBasePrivateDecryptionKey(); + message.requester = object.requester ?? ""; + message.privateKeyshares = object.privateKeyshares?.map((e) => IndexedEncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIndexedEncryptedKeyshare(): IndexedEncryptedKeyshare { + return { encryptedKeyshareValue: "", encryptedKeyshareIndex: 0 }; +} + +export const IndexedEncryptedKeyshare: MessageFns = { + encode(message: IndexedEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedKeyshareValue !== "") { + writer.uint32(10).string(message.encryptedKeyshareValue); + } + if (message.encryptedKeyshareIndex !== 0) { + writer.uint32(16).uint64(message.encryptedKeyshareIndex); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexedEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexedEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedKeyshareValue = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.encryptedKeyshareIndex = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexedEncryptedKeyshare { + return { + encryptedKeyshareValue: isSet(object.encryptedKeyshareValue) + ? globalThis.String(object.encryptedKeyshareValue) + : "", + encryptedKeyshareIndex: isSet(object.encryptedKeyshareIndex) + ? globalThis.Number(object.encryptedKeyshareIndex) + : 0, + }; + }, + + toJSON(message: IndexedEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.encryptedKeyshareValue !== "") { + obj.encryptedKeyshareValue = message.encryptedKeyshareValue; + } + if (message.encryptedKeyshareIndex !== 0) { + obj.encryptedKeyshareIndex = Math.round(message.encryptedKeyshareIndex); + } + return obj; + }, + + create, I>>(base?: I): IndexedEncryptedKeyshare { + return IndexedEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexedEncryptedKeyshare { + const message = createBaseIndexedEncryptedKeyshare(); + message.encryptedKeyshareValue = object.encryptedKeyshareValue ?? ""; + message.encryptedKeyshareIndex = object.encryptedKeyshareIndex ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/authorized_address.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/authorized_address.ts new file mode 100644 index 00000000..30941721 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/authorized_address.ts @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/authorized_address.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** AuthorizedAddress defines if an address is authorized to submit keyshares */ +export interface AuthorizedAddress { + target: string; + isAuthorized: boolean; + authorizedBy: string; +} + +function createBaseAuthorizedAddress(): AuthorizedAddress { + return { target: "", isAuthorized: false, authorizedBy: "" }; +} + +export const AuthorizedAddress: MessageFns = { + encode(message: AuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.authorizedBy !== "") { + writer.uint32(26).string(message.authorizedBy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorizedBy = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + authorizedBy: isSet(object.authorizedBy) ? globalThis.String(object.authorizedBy) : "", + }; + }, + + toJSON(message: AuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.authorizedBy !== "") { + obj.authorizedBy = message.authorizedBy; + } + return obj; + }, + + create, I>>(base?: I): AuthorizedAddress { + return AuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthorizedAddress { + const message = createBaseAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.authorizedBy = object.authorizedBy ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/commitments.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/commitments.ts new file mode 100644 index 00000000..bcda4b78 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/commitments.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/commitments.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Commitments defines the list of commitments to verify the + * keyshares submitted by validators + */ +export interface Commitments { + commitments: string[]; +} + +function createBaseCommitments(): Commitments { + return { commitments: [] }; +} + +export const Commitments: MessageFns = { + encode(message: Commitments, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commitments) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commitments { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitments(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commitments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commitments { + return { + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Commitments): unknown { + const obj: any = {}; + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + return obj; + }, + + create, I>>(base?: I): Commitments { + return Commitments.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commitments { + const message = createBaseCommitments(); + message.commitments = object.commitments?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/decryption_key.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/decryption_key.ts new file mode 100644 index 00000000..04e233b4 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/decryption_key.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Decryption key defines the structure and height for a decryption key */ +export interface DecryptionKey { + height: number; + data: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/genesis.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/genesis.ts new file mode 100644 index 00000000..875617b6 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/genesis.ts @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { AuthorizedAddress } from "./authorized_address"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** GenesisState defines the keyshare module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + validatorSetList: ValidatorSet[]; + keyshareList: Keyshare[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; + authorizedAddressList: AuthorizedAddress[]; + requestCount: number; + generalKeyshareList: GeneralKeyshare[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + validatorSetList: [], + keyshareList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + authorizedAddressList: [], + requestCount: 0, + generalKeyshareList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.validatorSetList) { + ValidatorSet.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.keyshareList) { + Keyshare.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(50).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(58).fork()).join(); + } + for (const v of message.authorizedAddressList) { + AuthorizedAddress.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.generalKeyshareList) { + GeneralKeyshare.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validatorSetList.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshareList.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.authorizedAddressList.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.generalKeyshareList.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + validatorSetList: globalThis.Array.isArray(object?.validatorSetList) + ? object.validatorSetList.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + keyshareList: globalThis.Array.isArray(object?.keyshareList) + ? object.keyshareList.map((e: any) => Keyshare.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + authorizedAddressList: globalThis.Array.isArray(object?.authorizedAddressList) + ? object.authorizedAddressList.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + generalKeyshareList: globalThis.Array.isArray(object?.generalKeyshareList) + ? object.generalKeyshareList.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.validatorSetList?.length) { + obj.validatorSetList = message.validatorSetList.map((e) => ValidatorSet.toJSON(e)); + } + if (message.keyshareList?.length) { + obj.keyshareList = message.keyshareList.map((e) => Keyshare.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + if (message.authorizedAddressList?.length) { + obj.authorizedAddressList = message.authorizedAddressList.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.generalKeyshareList?.length) { + obj.generalKeyshareList = message.generalKeyshareList.map((e) => GeneralKeyshare.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.validatorSetList = object.validatorSetList?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.keyshareList = object.keyshareList?.map((e) => Keyshare.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + message.authorizedAddressList = object.authorizedAddressList?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.requestCount = object.requestCount ?? 0; + message.generalKeyshareList = object.generalKeyshareList?.map((e) => GeneralKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/keyshare.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/keyshare.ts new file mode 100644 index 00000000..7b2e6deb --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/keyshare.ts @@ -0,0 +1,542 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/keyshare.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * Keyshare defines the structure for submitting + * blockwise keyshares by validators + */ +export interface Keyshare { + validator: string; + blockHeight: number; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * GeneralKeyshare defines the structure for submitting + * general keyshares by validators + */ +export interface GeneralKeyshare { + validator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * ValidatorEncryptedKeyshare defines the structure for + * submitting encrypted keyshares by validators + */ +export interface ValidatorEncryptedKeyshare { + validator: string; + requester: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + identity: string; +} + +function createBaseKeyshare(): Keyshare { + return { + validator: "", + blockHeight: 0, + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const Keyshare: MessageFns = { + encode(message: Keyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Keyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Keyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: Keyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): Keyshare { + return Keyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Keyshare { + const message = createBaseKeyshare(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseGeneralKeyshare(): GeneralKeyshare { + return { + validator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const GeneralKeyshare: MessageFns = { + encode(message: GeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: GeneralKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): GeneralKeyshare { + return GeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralKeyshare { + const message = createBaseGeneralKeyshare(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseValidatorEncryptedKeyshare(): ValidatorEncryptedKeyshare { + return { + validator: "", + requester: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + identity: "", + }; +} + +export const ValidatorEncryptedKeyshare: MessageFns = { + encode(message: ValidatorEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.keyshare !== "") { + writer.uint32(26).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.identity !== "") { + writer.uint32(58).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.keyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorEncryptedKeyshare { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: ValidatorEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): ValidatorEncryptedKeyshare { + return ValidatorEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorEncryptedKeyshare { + const message = createBaseValidatorEncryptedKeyshare(); + message.validator = object.validator ?? ""; + message.requester = object.requester ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.identity = object.identity ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/module/module.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/module/module.ts new file mode 100644 index 00000000..a29ec78f --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/packet.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/packet.ts new file mode 100644 index 00000000..2485cba5 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/packet.ts @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/packet.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** KeysharePacketData defines all the packet types of the keyshare module */ +export interface KeysharePacketData { + noData?: NoData | undefined; + requestDecryptionKeyPacket?: RequestDecryptionKeyPacketData | undefined; + getDecryptionKeyPacket?: GetDecryptionKeyPacketData | undefined; + decryptionKeyDataPacket?: DecryptionKeyDataPacketData | undefined; + privateDecryptionKeyDataPacket?: PrivateDecryptionKeyDataPacketData | undefined; + currentKeysPacket?: CurrentKeysPacketData | undefined; + requestPrivateDecryptionKeyPacket?: RequestPrivateDecryptionKeyPacketData | undefined; + getPrivateDecryptionKeyPacket?: GetPrivateDecryptionKeyPacketData | undefined; +} + +/** NoData defines a blank packet */ +export interface NoData { +} + +/** RequestDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestDecryptionKeyPacketData { + requester: string; + proposalId?: string | undefined; + requestId?: string | undefined; + estimatedDelay: Duration | undefined; +} + +/** RequestPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface RequestPrivateDecryptionKeyPacketData { + requester: string; + requestId: string; +} + +/** RequestPrivateDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestPrivateDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** RequestDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface RequestDecryptionKeyPacketAck { + identity: string; + pubkey: string; +} + +/** GetDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetDecryptionKeyPacketData { + identity: string; +} + +/** GetDecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface GetDecryptionKeyPacketAck { +} + +/** GetPrivateDecryptionKeyPacketData defines a struct for the packet payload */ +export interface GetPrivateDecryptionKeyPacketData { + identity: string; + requester: string; + secpPubkey: string; +} + +/** GetPrivateKeysharePacketAck defines a struct for the packet acknowledgment */ +export interface GetPrivateDecryptionKeyPacketAck { +} + +/** DecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface DecryptionKeyDataPacketData { + identity: string; + pubkey: string; + decryptionKey: string; + aggrHeight: string; + /** used for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + retries: number; +} + +/** DecryptionKeyPacketAck defines a struct for the packet acknowledgment */ +export interface DecryptionKeyPacketAck { +} + +/** PrivateDecryptionKeyDataPacketData defines a struct for the packet payload */ +export interface PrivateDecryptionKeyDataPacketData { + identity: string; + pubkey: string; + requestId: string; + privateDecryptionKey: PrivateDecryptionKey[]; +} + +/** PrivateDecryptionKeyPacketAck defines a struct for the packet payload */ +export interface PrivateDecryptionKeyPacketAck { +} + +/** CurrentKeysPacketData defines a struct for the packet payload */ +export interface CurrentKeysPacketData { +} + +/** CurrentKeysPacketAck defines a struct for the packet acknowledgment */ +export interface CurrentKeysPacketAck { + activeKey: ActivePublicKey | undefined; + queuedKey: QueuedPublicKey | undefined; +} + +function createBaseKeysharePacketData(): KeysharePacketData { + return { + noData: undefined, + requestDecryptionKeyPacket: undefined, + getDecryptionKeyPacket: undefined, + decryptionKeyDataPacket: undefined, + privateDecryptionKeyDataPacket: undefined, + currentKeysPacket: undefined, + requestPrivateDecryptionKeyPacket: undefined, + getPrivateDecryptionKeyPacket: undefined, + }; +} + +export const KeysharePacketData: MessageFns = { + encode(message: KeysharePacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).join(); + } + if (message.requestDecryptionKeyPacket !== undefined) { + RequestDecryptionKeyPacketData.encode(message.requestDecryptionKeyPacket, writer.uint32(18).fork()).join(); + } + if (message.getDecryptionKeyPacket !== undefined) { + GetDecryptionKeyPacketData.encode(message.getDecryptionKeyPacket, writer.uint32(26).fork()).join(); + } + if (message.decryptionKeyDataPacket !== undefined) { + DecryptionKeyDataPacketData.encode(message.decryptionKeyDataPacket, writer.uint32(34).fork()).join(); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + PrivateDecryptionKeyDataPacketData.encode(message.privateDecryptionKeyDataPacket, writer.uint32(42).fork()) + .join(); + } + if (message.currentKeysPacket !== undefined) { + CurrentKeysPacketData.encode(message.currentKeysPacket, writer.uint32(50).fork()).join(); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + RequestPrivateDecryptionKeyPacketData.encode(message.requestPrivateDecryptionKeyPacket, writer.uint32(58).fork()) + .join(); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + GetPrivateDecryptionKeyPacketData.encode(message.getPrivateDecryptionKeyPacket, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeysharePacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeysharePacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.noData = NoData.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.getDecryptionKeyPacket = GetDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.decryptionKeyDataPacket = DecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.currentKeysPacket = CurrentKeysPacketData.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.decode( + reader, + reader.uint32(), + ); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KeysharePacketData { + return { + noData: isSet(object.noData) ? NoData.fromJSON(object.noData) : undefined, + requestDecryptionKeyPacket: isSet(object.requestDecryptionKeyPacket) + ? RequestDecryptionKeyPacketData.fromJSON(object.requestDecryptionKeyPacket) + : undefined, + getDecryptionKeyPacket: isSet(object.getDecryptionKeyPacket) + ? GetDecryptionKeyPacketData.fromJSON(object.getDecryptionKeyPacket) + : undefined, + decryptionKeyDataPacket: isSet(object.decryptionKeyDataPacket) + ? DecryptionKeyDataPacketData.fromJSON(object.decryptionKeyDataPacket) + : undefined, + privateDecryptionKeyDataPacket: isSet(object.privateDecryptionKeyDataPacket) + ? PrivateDecryptionKeyDataPacketData.fromJSON(object.privateDecryptionKeyDataPacket) + : undefined, + currentKeysPacket: isSet(object.currentKeysPacket) + ? CurrentKeysPacketData.fromJSON(object.currentKeysPacket) + : undefined, + requestPrivateDecryptionKeyPacket: isSet(object.requestPrivateDecryptionKeyPacket) + ? RequestPrivateDecryptionKeyPacketData.fromJSON(object.requestPrivateDecryptionKeyPacket) + : undefined, + getPrivateDecryptionKeyPacket: isSet(object.getPrivateDecryptionKeyPacket) + ? GetPrivateDecryptionKeyPacketData.fromJSON(object.getPrivateDecryptionKeyPacket) + : undefined, + }; + }, + + toJSON(message: KeysharePacketData): unknown { + const obj: any = {}; + if (message.noData !== undefined) { + obj.noData = NoData.toJSON(message.noData); + } + if (message.requestDecryptionKeyPacket !== undefined) { + obj.requestDecryptionKeyPacket = RequestDecryptionKeyPacketData.toJSON(message.requestDecryptionKeyPacket); + } + if (message.getDecryptionKeyPacket !== undefined) { + obj.getDecryptionKeyPacket = GetDecryptionKeyPacketData.toJSON(message.getDecryptionKeyPacket); + } + if (message.decryptionKeyDataPacket !== undefined) { + obj.decryptionKeyDataPacket = DecryptionKeyDataPacketData.toJSON(message.decryptionKeyDataPacket); + } + if (message.privateDecryptionKeyDataPacket !== undefined) { + obj.privateDecryptionKeyDataPacket = PrivateDecryptionKeyDataPacketData.toJSON( + message.privateDecryptionKeyDataPacket, + ); + } + if (message.currentKeysPacket !== undefined) { + obj.currentKeysPacket = CurrentKeysPacketData.toJSON(message.currentKeysPacket); + } + if (message.requestPrivateDecryptionKeyPacket !== undefined) { + obj.requestPrivateDecryptionKeyPacket = RequestPrivateDecryptionKeyPacketData.toJSON( + message.requestPrivateDecryptionKeyPacket, + ); + } + if (message.getPrivateDecryptionKeyPacket !== undefined) { + obj.getPrivateDecryptionKeyPacket = GetPrivateDecryptionKeyPacketData.toJSON( + message.getPrivateDecryptionKeyPacket, + ); + } + return obj; + }, + + create, I>>(base?: I): KeysharePacketData { + return KeysharePacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeysharePacketData { + const message = createBaseKeysharePacketData(); + message.noData = (object.noData !== undefined && object.noData !== null) + ? NoData.fromPartial(object.noData) + : undefined; + message.requestDecryptionKeyPacket = + (object.requestDecryptionKeyPacket !== undefined && object.requestDecryptionKeyPacket !== null) + ? RequestDecryptionKeyPacketData.fromPartial(object.requestDecryptionKeyPacket) + : undefined; + message.getDecryptionKeyPacket = + (object.getDecryptionKeyPacket !== undefined && object.getDecryptionKeyPacket !== null) + ? GetDecryptionKeyPacketData.fromPartial(object.getDecryptionKeyPacket) + : undefined; + message.decryptionKeyDataPacket = + (object.decryptionKeyDataPacket !== undefined && object.decryptionKeyDataPacket !== null) + ? DecryptionKeyDataPacketData.fromPartial(object.decryptionKeyDataPacket) + : undefined; + message.privateDecryptionKeyDataPacket = + (object.privateDecryptionKeyDataPacket !== undefined && object.privateDecryptionKeyDataPacket !== null) + ? PrivateDecryptionKeyDataPacketData.fromPartial(object.privateDecryptionKeyDataPacket) + : undefined; + message.currentKeysPacket = (object.currentKeysPacket !== undefined && object.currentKeysPacket !== null) + ? CurrentKeysPacketData.fromPartial(object.currentKeysPacket) + : undefined; + message.requestPrivateDecryptionKeyPacket = + (object.requestPrivateDecryptionKeyPacket !== undefined && object.requestPrivateDecryptionKeyPacket !== null) + ? RequestPrivateDecryptionKeyPacketData.fromPartial(object.requestPrivateDecryptionKeyPacket) + : undefined; + message.getPrivateDecryptionKeyPacket = + (object.getPrivateDecryptionKeyPacket !== undefined && object.getPrivateDecryptionKeyPacket !== null) + ? GetPrivateDecryptionKeyPacketData.fromPartial(object.getPrivateDecryptionKeyPacket) + : undefined; + return message; + }, +}; + +function createBaseNoData(): NoData { + return {}; +} + +export const NoData: MessageFns = { + encode(_: NoData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NoData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): NoData { + return {}; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): NoData { + return NoData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): NoData { + const message = createBaseNoData(); + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketData(): RequestDecryptionKeyPacketData { + return { requester: "", proposalId: undefined, requestId: undefined, estimatedDelay: undefined }; +} + +export const RequestDecryptionKeyPacketData: MessageFns = { + encode(message: RequestDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.proposalId !== undefined) { + writer.uint32(18).string(message.proposalId); + } + if (message.requestId !== undefined) { + writer.uint32(26).string(message.requestId); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposalId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : undefined, + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : undefined, + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + }; + }, + + toJSON(message: RequestDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.proposalId !== undefined) { + obj.proposalId = message.proposalId; + } + if (message.requestId !== undefined) { + obj.requestId = message.requestId; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketData { + return RequestDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketData { + const message = createBaseRequestDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.proposalId = object.proposalId ?? undefined; + message.requestId = object.requestId ?? undefined; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketData(): RequestPrivateDecryptionKeyPacketData { + return { requester: "", requestId: "" }; +} + +export const RequestPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requester !== "") { + writer.uint32(10).string(message.requester); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requester = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketData { + return { + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketData { + return RequestPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketData { + const message = createBaseRequestPrivateDecryptionKeyPacketData(); + message.requester = object.requester ?? ""; + message.requestId = object.requestId ?? ""; + return message; + }, +}; + +function createBaseRequestPrivateDecryptionKeyPacketAck(): RequestPrivateDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestPrivateDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrivateDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): RequestPrivateDecryptionKeyPacketAck { + return RequestPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestPrivateDecryptionKeyPacketAck { + const message = createBaseRequestPrivateDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseRequestDecryptionKeyPacketAck(): RequestDecryptionKeyPacketAck { + return { identity: "", pubkey: "" }; +} + +export const RequestDecryptionKeyPacketAck: MessageFns = { + encode(message: RequestDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestDecryptionKeyPacketAck { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + }; + }, + + toJSON(message: RequestDecryptionKeyPacketAck): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + return obj; + }, + + create, I>>(base?: I): RequestDecryptionKeyPacketAck { + return RequestDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestDecryptionKeyPacketAck { + const message = createBaseRequestDecryptionKeyPacketAck(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketData(): GetDecryptionKeyPacketData { + return { identity: "" }; +} + +export const GetDecryptionKeyPacketData: MessageFns = { + encode(message: GetDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetDecryptionKeyPacketData { + return { identity: isSet(object.identity) ? globalThis.String(object.identity) : "" }; + }, + + toJSON(message: GetDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketData { + return GetDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetDecryptionKeyPacketData { + const message = createBaseGetDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseGetDecryptionKeyPacketAck(): GetDecryptionKeyPacketAck { + return {}; +} + +export const GetDecryptionKeyPacketAck: MessageFns = { + encode(_: GetDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetDecryptionKeyPacketAck { + return GetDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetDecryptionKeyPacketAck { + const message = createBaseGetDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketData(): GetPrivateDecryptionKeyPacketData { + return { identity: "", requester: "", secpPubkey: "" }; +} + +export const GetPrivateDecryptionKeyPacketData: MessageFns = { + encode(message: GetPrivateDecryptionKeyPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.requester !== "") { + writer.uint32(18).string(message.requester); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requester = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPrivateDecryptionKeyPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: GetPrivateDecryptionKeyPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.requester !== "") { + obj.requester = message.requester; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketData { + return GetPrivateDecryptionKeyPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetPrivateDecryptionKeyPacketData { + const message = createBaseGetPrivateDecryptionKeyPacketData(); + message.identity = object.identity ?? ""; + message.requester = object.requester ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseGetPrivateDecryptionKeyPacketAck(): GetPrivateDecryptionKeyPacketAck { + return {}; +} + +export const GetPrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: GetPrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: GetPrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): GetPrivateDecryptionKeyPacketAck { + return GetPrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): GetPrivateDecryptionKeyPacketAck { + const message = createBaseGetPrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseDecryptionKeyDataPacketData(): DecryptionKeyDataPacketData { + return { identity: "", pubkey: "", decryptionKey: "", aggrHeight: "", proposalId: "", requestId: "", retries: 0 }; +} + +export const DecryptionKeyDataPacketData: MessageFns = { + encode(message: DecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + if (message.aggrHeight !== "") { + writer.uint32(34).string(message.aggrHeight); + } + if (message.proposalId !== "") { + writer.uint32(42).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.retries !== 0) { + writer.uint32(56).uint64(message.retries); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aggrHeight = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.proposalId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.retries = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + aggrHeight: isSet(object.aggrHeight) ? globalThis.String(object.aggrHeight) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0, + }; + }, + + toJSON(message: DecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.aggrHeight !== "") { + obj.aggrHeight = message.aggrHeight; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyDataPacketData { + return DecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyDataPacketData { + const message = createBaseDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.aggrHeight = object.aggrHeight ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.retries = object.retries ?? 0; + return message; + }, +}; + +function createBaseDecryptionKeyPacketAck(): DecryptionKeyPacketAck { + return {}; +} + +export const DecryptionKeyPacketAck: MessageFns = { + encode(_: DecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): DecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: DecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): DecryptionKeyPacketAck { + return DecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): DecryptionKeyPacketAck { + const message = createBaseDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBasePrivateDecryptionKeyDataPacketData(): PrivateDecryptionKeyDataPacketData { + return { identity: "", pubkey: "", requestId: "", privateDecryptionKey: [] }; +} + +export const PrivateDecryptionKeyDataPacketData: MessageFns = { + encode(message: PrivateDecryptionKeyDataPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.requestId !== "") { + writer.uint32(26).string(message.requestId); + } + for (const v of message.privateDecryptionKey) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyDataPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyDataPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.requestId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKey.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyDataPacketData { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + privateDecryptionKey: globalThis.Array.isArray(object?.privateDecryptionKey) + ? object.privateDecryptionKey.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateDecryptionKeyDataPacketData): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.privateDecryptionKey?.length) { + obj.privateDecryptionKey = message.privateDecryptionKey.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PrivateDecryptionKeyDataPacketData { + return PrivateDecryptionKeyDataPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PrivateDecryptionKeyDataPacketData { + const message = createBasePrivateDecryptionKeyDataPacketData(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.requestId = object.requestId ?? ""; + message.privateDecryptionKey = object.privateDecryptionKey?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePrivateDecryptionKeyPacketAck(): PrivateDecryptionKeyPacketAck { + return {}; +} + +export const PrivateDecryptionKeyPacketAck: MessageFns = { + encode(_: PrivateDecryptionKeyPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): PrivateDecryptionKeyPacketAck { + return {}; + }, + + toJSON(_: PrivateDecryptionKeyPacketAck): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyPacketAck { + return PrivateDecryptionKeyPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): PrivateDecryptionKeyPacketAck { + const message = createBasePrivateDecryptionKeyPacketAck(); + return message; + }, +}; + +function createBaseCurrentKeysPacketData(): CurrentKeysPacketData { + return {}; +} + +export const CurrentKeysPacketData: MessageFns = { + encode(_: CurrentKeysPacketData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): CurrentKeysPacketData { + return {}; + }, + + toJSON(_: CurrentKeysPacketData): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketData { + return CurrentKeysPacketData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CurrentKeysPacketData { + const message = createBaseCurrentKeysPacketData(); + return message; + }, +}; + +function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { + return { activeKey: undefined, queuedKey: undefined }; +} + +export const CurrentKeysPacketAck: MessageFns = { + encode(message: CurrentKeysPacketAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeKey !== undefined) { + ActivePublicKey.encode(message.activeKey, writer.uint32(10).fork()).join(); + } + if (message.queuedKey !== undefined) { + QueuedPublicKey.encode(message.queuedKey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CurrentKeysPacketAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCurrentKeysPacketAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeKey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedKey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CurrentKeysPacketAck { + return { + activeKey: isSet(object.activeKey) ? ActivePublicKey.fromJSON(object.activeKey) : undefined, + queuedKey: isSet(object.queuedKey) ? QueuedPublicKey.fromJSON(object.queuedKey) : undefined, + }; + }, + + toJSON(message: CurrentKeysPacketAck): unknown { + const obj: any = {}; + if (message.activeKey !== undefined) { + obj.activeKey = ActivePublicKey.toJSON(message.activeKey); + } + if (message.queuedKey !== undefined) { + obj.queuedKey = QueuedPublicKey.toJSON(message.queuedKey); + } + return obj; + }, + + create, I>>(base?: I): CurrentKeysPacketAck { + return CurrentKeysPacketAck.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CurrentKeysPacketAck { + const message = createBaseCurrentKeysPacketAck(); + message.activeKey = (object.activeKey !== undefined && object.activeKey !== null) + ? ActivePublicKey.fromPartial(object.activeKey) + : undefined; + message.queuedKey = (object.queuedKey !== undefined && object.queuedKey !== null) + ? QueuedPublicKey.fromPartial(object.queuedKey) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/params.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/params.ts new file mode 100644 index 00000000..51435c5b --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/params.ts @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** Params defines the parameters for the module. */ +export interface Params { + keyExpiry: number; + minimumBonded: number; + maxIdledBlock: number; + trustedAddresses: string[]; + slashFractionNoKeyshare: Uint8Array; + slashFractionWrongKeyshare: Uint8Array; +} + +function createBaseParams(): Params { + return { + keyExpiry: 0, + minimumBonded: 0, + maxIdledBlock: 0, + trustedAddresses: [], + slashFractionNoKeyshare: new Uint8Array(0), + slashFractionWrongKeyshare: new Uint8Array(0), + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyExpiry !== 0) { + writer.uint32(8).uint64(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + writer.uint32(16).uint64(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + writer.uint32(24).uint64(message.maxIdledBlock); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.slashFractionNoKeyshare.length !== 0) { + writer.uint32(42).bytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + writer.uint32(50).bytes(message.slashFractionWrongKeyshare); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.keyExpiry = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.minimumBonded = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxIdledBlock = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFractionNoKeyshare = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFractionWrongKeyshare = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyExpiry: isSet(object.keyExpiry) ? globalThis.Number(object.keyExpiry) : 0, + minimumBonded: isSet(object.minimumBonded) ? globalThis.Number(object.minimumBonded) : 0, + maxIdledBlock: isSet(object.maxIdledBlock) ? globalThis.Number(object.maxIdledBlock) : 0, + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + slashFractionNoKeyshare: isSet(object.slashFractionNoKeyshare) + ? bytesFromBase64(object.slashFractionNoKeyshare) + : new Uint8Array(0), + slashFractionWrongKeyshare: isSet(object.slashFractionWrongKeyshare) + ? bytesFromBase64(object.slashFractionWrongKeyshare) + : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyExpiry !== 0) { + obj.keyExpiry = Math.round(message.keyExpiry); + } + if (message.minimumBonded !== 0) { + obj.minimumBonded = Math.round(message.minimumBonded); + } + if (message.maxIdledBlock !== 0) { + obj.maxIdledBlock = Math.round(message.maxIdledBlock); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.slashFractionNoKeyshare.length !== 0) { + obj.slashFractionNoKeyshare = base64FromBytes(message.slashFractionNoKeyshare); + } + if (message.slashFractionWrongKeyshare.length !== 0) { + obj.slashFractionWrongKeyshare = base64FromBytes(message.slashFractionWrongKeyshare); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyExpiry = object.keyExpiry ?? 0; + message.minimumBonded = object.minimumBonded ?? 0; + message.maxIdledBlock = object.maxIdledBlock ?? 0; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.slashFractionNoKeyshare = object.slashFractionNoKeyshare ?? new Uint8Array(0); + message.slashFractionWrongKeyshare = object.slashFractionWrongKeyshare ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).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 as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/pubkey.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/pubkey.ts new file mode 100644 index 00000000..e6b67c51 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/pubkey.ts @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/pubkey.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * EncryptedKeyshare defines the structure for storing + * the keyshare of the master secret key distributed to the validators + */ +export interface EncryptedKeyshare { + data: string; + validator: string; +} + +/** ActivePubkey defines the structure of the active public key */ +export interface ActivePubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** QueuedPubkey defines the structure of the queued public key */ +export interface QueuedPubkey { + publicKey: string; + creator: string; + expiry: number; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +function createBaseEncryptedKeyshare(): EncryptedKeyshare { + return { data: "", validator: "" }; +} + +export const EncryptedKeyshare: MessageFns = { + encode(message: EncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedKeyshare { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: EncryptedKeyshare): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): EncryptedKeyshare { + return EncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedKeyshare { + const message = createBaseEncryptedKeyshare(); + message.data = object.data ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseActivePubkey(): ActivePubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const ActivePubkey: MessageFns = { + encode(message: ActivePubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivePubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivePubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivePubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ActivePubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ActivePubkey { + return ActivePubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ActivePubkey { + const message = createBaseActivePubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuedPubkey(): QueuedPubkey { + return { publicKey: "", creator: "", expiry: 0, numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const QueuedPubkey: MessageFns = { + encode(message: QueuedPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.publicKey !== "") { + writer.uint32(10).string(message.publicKey); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.expiry !== 0) { + writer.uint32(24).uint64(message.expiry); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuedPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuedPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.publicKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.expiry = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuedPubkey { + return { + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + expiry: isSet(object.expiry) ? globalThis.Number(object.expiry) : 0, + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueuedPubkey): unknown { + const obj: any = {}; + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.expiry !== 0) { + obj.expiry = Math.round(message.expiry); + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueuedPubkey { + return QueuedPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuedPubkey { + const message = createBaseQueuedPubkey(); + message.publicKey = object.publicKey ?? ""; + message.creator = object.creator ?? ""; + message.expiry = object.expiry ?? 0; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/query.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/query.ts new file mode 100644 index 00000000..e9da6c11 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/query.ts @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; +import { DecryptionKey } from "./decryption_key"; +import { GeneralKeyshare, Keyshare } from "./keyshare"; +import { Params } from "./params"; +import { ActivePubkey, QueuedPubkey } from "./pubkey"; +import { ValidatorSet } from "./validator_set"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * QueryVerifiableRandomnessRequest is the request type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessRequest { +} + +/** + * QueryVerifiableRandomnessResponse is the response type for + * the Query/VerifiableRandomness method + */ +export interface QueryVerifiableRandomnessResponse { + randomness: string; + round: number; +} + +/** 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 | undefined; +} + +/** QueryCommitmentsRequest is request type for the Query/Commitments RPC method. */ +export interface QueryCommitmentsRequest { +} + +/** QueryCommitmentsResponse is response type for the Query/Commitments RPC method */ +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + +/** QueryValidatorSetRequest is request type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetRequest { + index: string; +} + +/** QueryValidatorSetResponse is response type for the Query/ValidatorSet RPC method. */ +export interface QueryValidatorSetResponse { + validatorSet: ValidatorSet | undefined; +} + +/** QueryValidatorSetAllRequest is request type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryValidatorSetAllResponse is response type for the Query/ValidatorSetAll RPC method. */ +export interface QueryValidatorSetAllResponse { + validatorSet: ValidatorSet[]; + pagination: PageResponse | undefined; +} + +/** QueryKeyshareRequest is request type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareRequest { + validator: string; + blockHeight: number; +} + +/** QueryKeyshareResponse is response type for the Query/Keyshare RPC method. */ +export interface QueryKeyshareResponse { + keyshare: Keyshare | undefined; +} + +/** QueryKeyshareAllRequest is request type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryKeyshareAllResponse is response type for the Query/KeyshareAll RPC method. */ +export interface QueryKeyshareAllResponse { + keyshare: Keyshare[]; + pagination: PageResponse | undefined; +} + +/** QueryDecryptionKeyRequest is request type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyRequest { + height: number; +} + +/** QueryDecryptionKeyResponse is response type for the Query/DecryptionKey RPC method. */ +export interface QueryDecryptionKeyResponse { + decryptionKey: DecryptionKey | undefined; +} + +/** QueryDecryptionKeyAllRequest is request type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryDecryptionKeyAllResponse is response type for the Query/DecryptionKeyAll RPC method. */ +export interface QueryDecryptionKeyAllResponse { + decryptionKeys: DecryptionKey[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePubkey | undefined; + queuedPubkey: QueuedPubkey | undefined; +} + +/** QueryAuthorizedAddressRequest is request type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressRequest { + target: string; +} + +/** QueryAuthorizedAddressResponse is response type for the Query/AuthorizedAddress RPC method. */ +export interface QueryAuthorizedAddressResponse { + authorizedAddress: AuthorizedAddress | undefined; +} + +/** QueryAuthorizedAddressAllRequest is request type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryAuthorizedAddressAllResponse is response type for the Query/AuthorizedAddressAll RPC method. */ +export interface QueryAuthorizedAddressAllResponse { + authorizedAddress: AuthorizedAddress[]; + pagination: PageResponse | undefined; +} + +/** QueryGeneralKeyshareRequest is request type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareRequest { + validator: string; + idType: string; + idValue: string; +} + +/** QueryGeneralKeyshareResponse is response type for the Query/GeneralKeyshare RPC method. */ +export interface QueryGeneralKeyshareResponse { + generalKeyshare: GeneralKeyshare | undefined; +} + +/** QueryGeneralKeyshareAllRequest is request type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralKeyshareAllResponse is response type for the Query/GeneralKeyshareAll RPC method. */ +export interface QueryGeneralKeyshareAllResponse { + generalKeyshare: GeneralKeyshare[]; + pagination: PageResponse | undefined; +} + +function createBaseQueryVerifiableRandomnessRequest(): QueryVerifiableRandomnessRequest { + return {}; +} + +export const QueryVerifiableRandomnessRequest: MessageFns = { + encode(_: QueryVerifiableRandomnessRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVerifiableRandomnessRequest { + return {}; + }, + + toJSON(_: QueryVerifiableRandomnessRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessRequest { + return QueryVerifiableRandomnessRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): QueryVerifiableRandomnessRequest { + const message = createBaseQueryVerifiableRandomnessRequest(); + return message; + }, +}; + +function createBaseQueryVerifiableRandomnessResponse(): QueryVerifiableRandomnessResponse { + return { randomness: "", round: 0 }; +} + +export const QueryVerifiableRandomnessResponse: MessageFns = { + encode(message: QueryVerifiableRandomnessResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.randomness !== "") { + writer.uint32(10).string(message.randomness); + } + if (message.round !== 0) { + writer.uint32(16).uint64(message.round); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifiableRandomnessResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifiableRandomnessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.randomness = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVerifiableRandomnessResponse { + return { + randomness: isSet(object.randomness) ? globalThis.String(object.randomness) : "", + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + }; + }, + + toJSON(message: QueryVerifiableRandomnessResponse): unknown { + const obj: any = {}; + if (message.randomness !== "") { + obj.randomness = message.randomness; + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryVerifiableRandomnessResponse { + return QueryVerifiableRandomnessResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryVerifiableRandomnessResponse { + const message = createBaseQueryVerifiableRandomnessResponse(); + message.randomness = object.randomness ?? ""; + message.round = object.round ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest: MessageFns = { + encode(_: QueryCommitmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsRequest { + return QueryCommitmentsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse: MessageFns = { + encode(message: QueryCommitmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).join(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + if (message.activeCommitments !== undefined) { + obj.activeCommitments = Commitments.toJSON(message.activeCommitments); + } + if (message.queuedCommitments !== undefined) { + obj.queuedCommitments = Commitments.toJSON(message.queuedCommitments); + } + return obj; + }, + + create, I>>(base?: I): QueryCommitmentsResponse { + return QueryCommitmentsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetRequest(): QueryValidatorSetRequest { + return { index: "" }; +} + +export const QueryValidatorSetRequest: MessageFns = { + encode(message: QueryValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetRequest { + return { index: isSet(object.index) ? globalThis.String(object.index) : "" }; + }, + + toJSON(message: QueryValidatorSetRequest): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetRequest { + return QueryValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetRequest { + const message = createBaseQueryValidatorSetRequest(); + message.index = object.index ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorSetResponse(): QueryValidatorSetResponse { + return { validatorSet: undefined }; +} + +export const QueryValidatorSetResponse: MessageFns = { + encode(message: QueryValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetResponse { + return { validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined }; + }, + + toJSON(message: QueryValidatorSetResponse): unknown { + const obj: any = {}; + if (message.validatorSet !== undefined) { + obj.validatorSet = ValidatorSet.toJSON(message.validatorSet); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetResponse { + return QueryValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetResponse { + const message = createBaseQueryValidatorSetResponse(); + message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null) + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllRequest(): QueryValidatorSetAllRequest { + return { pagination: undefined }; +} + +export const QueryValidatorSetAllRequest: MessageFns = { + encode(message: QueryValidatorSetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryValidatorSetAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllRequest { + return QueryValidatorSetAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllRequest { + const message = createBaseQueryValidatorSetAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSetAllResponse(): QueryValidatorSetAllResponse { + return { validatorSet: [], pagination: undefined }; +} + +export const QueryValidatorSetAllResponse: MessageFns = { + encode(message: QueryValidatorSetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validatorSet) { + ValidatorSet.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorSet.push(ValidatorSet.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSetAllResponse { + return { + validatorSet: globalThis.Array.isArray(object?.validatorSet) + ? object.validatorSet.map((e: any) => ValidatorSet.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSetAllResponse): unknown { + const obj: any = {}; + if (message.validatorSet?.length) { + obj.validatorSet = message.validatorSet.map((e) => ValidatorSet.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSetAllResponse { + return QueryValidatorSetAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSetAllResponse { + const message = createBaseQueryValidatorSetAllResponse(); + message.validatorSet = object.validatorSet?.map((e) => ValidatorSet.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareRequest(): QueryKeyshareRequest { + return { validator: "", blockHeight: 0 }; +} + +export const QueryKeyshareRequest: MessageFns = { + encode(message: QueryKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.blockHeight !== 0) { + writer.uint32(16).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: QueryKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareRequest { + return QueryKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareRequest { + const message = createBaseQueryKeyshareRequest(); + message.validator = object.validator ?? ""; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseQueryKeyshareResponse(): QueryKeyshareResponse { + return { keyshare: undefined }; +} + +export const QueryKeyshareResponse: MessageFns = { + encode(message: QueryKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshare !== undefined) { + Keyshare.encode(message.keyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare = Keyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareResponse { + return { keyshare: isSet(object.keyshare) ? Keyshare.fromJSON(object.keyshare) : undefined }; + }, + + toJSON(message: QueryKeyshareResponse): unknown { + const obj: any = {}; + if (message.keyshare !== undefined) { + obj.keyshare = Keyshare.toJSON(message.keyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareResponse { + return QueryKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareResponse { + const message = createBaseQueryKeyshareResponse(); + message.keyshare = (object.keyshare !== undefined && object.keyshare !== null) + ? Keyshare.fromPartial(object.keyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllRequest(): QueryKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryKeyshareAllRequest: MessageFns = { + encode(message: QueryKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllRequest { + return QueryKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllRequest { + const message = createBaseQueryKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryKeyshareAllResponse(): QueryKeyshareAllResponse { + return { keyshare: [], pagination: undefined }; +} + +export const QueryKeyshareAllResponse: MessageFns = { + encode(message: QueryKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keyshare) { + Keyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshare.push(Keyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryKeyshareAllResponse { + return { + keyshare: globalThis.Array.isArray(object?.keyshare) ? object.keyshare.map((e: any) => Keyshare.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.keyshare?.length) { + obj.keyshare = message.keyshare.map((e) => Keyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryKeyshareAllResponse { + return QueryKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryKeyshareAllResponse { + const message = createBaseQueryKeyshareAllResponse(); + message.keyshare = object.keyshare?.map((e) => Keyshare.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyRequest(): QueryDecryptionKeyRequest { + return { height: 0 }; +} + +export const QueryDecryptionKeyRequest: MessageFns = { + encode(message: QueryDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyRequest { + return QueryDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyRequest { + const message = createBaseQueryDecryptionKeyRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryDecryptionKeyResponse(): QueryDecryptionKeyResponse { + return { decryptionKey: undefined }; +} + +export const QueryDecryptionKeyResponse: MessageFns = { + encode(message: QueryDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptionKey !== undefined) { + DecryptionKey.encode(message.decryptionKey, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKey = DecryptionKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyResponse { + return { decryptionKey: isSet(object.decryptionKey) ? DecryptionKey.fromJSON(object.decryptionKey) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyResponse): unknown { + const obj: any = {}; + if (message.decryptionKey !== undefined) { + obj.decryptionKey = DecryptionKey.toJSON(message.decryptionKey); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyResponse { + return QueryDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyResponse { + const message = createBaseQueryDecryptionKeyResponse(); + message.decryptionKey = (object.decryptionKey !== undefined && object.decryptionKey !== null) + ? DecryptionKey.fromPartial(object.decryptionKey) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllRequest(): QueryDecryptionKeyAllRequest { + return { pagination: undefined }; +} + +export const QueryDecryptionKeyAllRequest: MessageFns = { + encode(message: QueryDecryptionKeyAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDecryptionKeyAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllRequest { + return QueryDecryptionKeyAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptionKeyAllRequest { + const message = createBaseQueryDecryptionKeyAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDecryptionKeyAllResponse(): QueryDecryptionKeyAllResponse { + return { decryptionKeys: [], pagination: undefined }; +} + +export const QueryDecryptionKeyAllResponse: MessageFns = { + encode(message: QueryDecryptionKeyAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.decryptionKeys) { + DecryptionKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptionKeyAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptionKeyAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptionKeys.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptionKeyAllResponse { + return { + decryptionKeys: globalThis.Array.isArray(object?.decryptionKeys) + ? object.decryptionKeys.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDecryptionKeyAllResponse): unknown { + const obj: any = {}; + if (message.decryptionKeys?.length) { + obj.decryptionKeys = message.decryptionKeys.map((e) => DecryptionKey.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptionKeyAllResponse { + return QueryDecryptionKeyAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryDecryptionKeyAllResponse { + const message = createBaseQueryDecryptionKeyAllResponse(); + message.decryptionKeys = object.decryptionKeys?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePubkey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPubkey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePubkey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPubkey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePubkey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPubkey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePubkey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPubkey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePubkey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPubkey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressRequest(): QueryAuthorizedAddressRequest { + return { target: "" }; +} + +export const QueryAuthorizedAddressRequest: MessageFns = { + encode(message: QueryAuthorizedAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressRequest { + return { target: isSet(object.target) ? globalThis.String(object.target) : "" }; + }, + + toJSON(message: QueryAuthorizedAddressRequest): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressRequest { + return QueryAuthorizedAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressRequest { + const message = createBaseQueryAuthorizedAddressRequest(); + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressResponse(): QueryAuthorizedAddressResponse { + return { authorizedAddress: undefined }; +} + +export const QueryAuthorizedAddressResponse: MessageFns = { + encode(message: QueryAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorizedAddress !== undefined) { + AuthorizedAddress.encode(message.authorizedAddress, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress = AuthorizedAddress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressResponse { + return { + authorizedAddress: isSet(object.authorizedAddress) + ? AuthorizedAddress.fromJSON(object.authorizedAddress) + : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress !== undefined) { + obj.authorizedAddress = AuthorizedAddress.toJSON(message.authorizedAddress); + } + return obj; + }, + + create, I>>(base?: I): QueryAuthorizedAddressResponse { + return QueryAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressResponse { + const message = createBaseQueryAuthorizedAddressResponse(); + message.authorizedAddress = (object.authorizedAddress !== undefined && object.authorizedAddress !== null) + ? AuthorizedAddress.fromPartial(object.authorizedAddress) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllRequest(): QueryAuthorizedAddressAllRequest { + return { pagination: undefined }; +} + +export const QueryAuthorizedAddressAllRequest: MessageFns = { + encode(message: QueryAuthorizedAddressAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAuthorizedAddressAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllRequest { + return QueryAuthorizedAddressAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllRequest { + const message = createBaseQueryAuthorizedAddressAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAuthorizedAddressAllResponse(): QueryAuthorizedAddressAllResponse { + return { authorizedAddress: [], pagination: undefined }; +} + +export const QueryAuthorizedAddressAllResponse: MessageFns = { + encode(message: QueryAuthorizedAddressAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorizedAddress) { + AuthorizedAddress.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorizedAddressAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorizedAddressAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorizedAddress.push(AuthorizedAddress.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAuthorizedAddressAllResponse { + return { + authorizedAddress: globalThis.Array.isArray(object?.authorizedAddress) + ? object.authorizedAddress.map((e: any) => AuthorizedAddress.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAuthorizedAddressAllResponse): unknown { + const obj: any = {}; + if (message.authorizedAddress?.length) { + obj.authorizedAddress = message.authorizedAddress.map((e) => AuthorizedAddress.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryAuthorizedAddressAllResponse { + return QueryAuthorizedAddressAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryAuthorizedAddressAllResponse { + const message = createBaseQueryAuthorizedAddressAllResponse(); + message.authorizedAddress = object.authorizedAddress?.map((e) => AuthorizedAddress.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareRequest(): QueryGeneralKeyshareRequest { + return { validator: "", idType: "", idValue: "" }; +} + +export const QueryGeneralKeyshareRequest: MessageFns = { + encode(message: QueryGeneralKeyshareRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareRequest { + return { + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + }; + }, + + toJSON(message: QueryGeneralKeyshareRequest): unknown { + const obj: any = {}; + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareRequest { + return QueryGeneralKeyshareRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareRequest { + const message = createBaseQueryGeneralKeyshareRequest(); + message.validator = object.validator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareResponse(): QueryGeneralKeyshareResponse { + return { generalKeyshare: undefined }; +} + +export const QueryGeneralKeyshareResponse: MessageFns = { + encode(message: QueryGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.generalKeyshare !== undefined) { + GeneralKeyshare.encode(message.generalKeyshare, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare = GeneralKeyshare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareResponse { + return { + generalKeyshare: isSet(object.generalKeyshare) ? GeneralKeyshare.fromJSON(object.generalKeyshare) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare !== undefined) { + obj.generalKeyshare = GeneralKeyshare.toJSON(message.generalKeyshare); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareResponse { + return QueryGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralKeyshareResponse { + const message = createBaseQueryGeneralKeyshareResponse(); + message.generalKeyshare = (object.generalKeyshare !== undefined && object.generalKeyshare !== null) + ? GeneralKeyshare.fromPartial(object.generalKeyshare) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllRequest(): QueryGeneralKeyshareAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralKeyshareAllRequest: MessageFns = { + encode(message: QueryGeneralKeyshareAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralKeyshareAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllRequest { + return QueryGeneralKeyshareAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllRequest { + const message = createBaseQueryGeneralKeyshareAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralKeyshareAllResponse(): QueryGeneralKeyshareAllResponse { + return { generalKeyshare: [], pagination: undefined }; +} + +export const QueryGeneralKeyshareAllResponse: MessageFns = { + encode(message: QueryGeneralKeyshareAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.generalKeyshare) { + GeneralKeyshare.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralKeyshareAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralKeyshareAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.generalKeyshare.push(GeneralKeyshare.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralKeyshareAllResponse { + return { + generalKeyshare: globalThis.Array.isArray(object?.generalKeyshare) + ? object.generalKeyshare.map((e: any) => GeneralKeyshare.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralKeyshareAllResponse): unknown { + const obj: any = {}; + if (message.generalKeyshare?.length) { + obj.generalKeyshare = message.generalKeyshare.map((e) => GeneralKeyshare.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralKeyshareAllResponse { + return QueryGeneralKeyshareAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralKeyshareAllResponse { + const message = createBaseQueryGeneralKeyshareAllResponse(); + message.generalKeyshare = object.generalKeyshare?.map((e) => GeneralKeyshare.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 { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Commitments queries the lists of active and queued commitments */ + Commitments(request: QueryCommitmentsRequest): Promise; + /** Queries a ValidatorSet by index. */ + ValidatorSet(request: QueryValidatorSetRequest): Promise; + /** Queries a list of ValidatorSet items. */ + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise; + /** Queries a Keyshare by index. */ + Keyshare(request: QueryKeyshareRequest): Promise; + /** Queries a list of Keyshare items. */ + KeyshareAll(request: QueryKeyshareAllRequest): Promise; + /** DecryptionKey queries a DecryptionKey item by height. */ + DecryptionKey(request: QueryDecryptionKeyRequest): Promise; + /** DecryptionKeyAll Queries a list of DecryptionKey items. */ + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a AuthorizedAddress item by target. */ + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise; + /** Queries a list of AuthorizedAddress items */ + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise; + /** Queries a GeneralKeyshare item by validator address and identity. */ + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise; + /** Queries a list of GeneralKeyshare items */ + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise; + /** Queries verifiable randomness */ + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise; +} + +export const QueryServiceName = "fairyring.keyshare.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Commitments = this.Commitments.bind(this); + this.ValidatorSet = this.ValidatorSet.bind(this); + this.ValidatorSetAll = this.ValidatorSetAll.bind(this); + this.Keyshare = this.Keyshare.bind(this); + this.KeyshareAll = this.KeyshareAll.bind(this); + this.DecryptionKey = this.DecryptionKey.bind(this); + this.DecryptionKeyAll = this.DecryptionKeyAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.AuthorizedAddress = this.AuthorizedAddress.bind(this); + this.AuthorizedAddressAll = this.AuthorizedAddressAll.bind(this); + this.GeneralKeyshare = this.GeneralKeyshare.bind(this); + this.GeneralKeyshareAll = this.GeneralKeyshareAll.bind(this); + this.VerifiableRandomness = this.VerifiableRandomness.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 BinaryReader(data))); + } + + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new BinaryReader(data))); + } + + ValidatorSet(request: QueryValidatorSetRequest): Promise { + const data = QueryValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSet", data); + return promise.then((data) => QueryValidatorSetResponse.decode(new BinaryReader(data))); + } + + ValidatorSetAll(request: QueryValidatorSetAllRequest): Promise { + const data = QueryValidatorSetAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSetAll", data); + return promise.then((data) => QueryValidatorSetAllResponse.decode(new BinaryReader(data))); + } + + Keyshare(request: QueryKeyshareRequest): Promise { + const data = QueryKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Keyshare", data); + return promise.then((data) => QueryKeyshareResponse.decode(new BinaryReader(data))); + } + + KeyshareAll(request: QueryKeyshareAllRequest): Promise { + const data = QueryKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "KeyshareAll", data); + return promise.then((data) => QueryKeyshareAllResponse.decode(new BinaryReader(data))); + } + + DecryptionKey(request: QueryDecryptionKeyRequest): Promise { + const data = QueryDecryptionKeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKey", data); + return promise.then((data) => QueryDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + DecryptionKeyAll(request: QueryDecryptionKeyAllRequest): Promise { + const data = QueryDecryptionKeyAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptionKeyAll", data); + return promise.then((data) => QueryDecryptionKeyAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddress(request: QueryAuthorizedAddressRequest): Promise { + const data = QueryAuthorizedAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddress", data); + return promise.then((data) => QueryAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + AuthorizedAddressAll(request: QueryAuthorizedAddressAllRequest): Promise { + const data = QueryAuthorizedAddressAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AuthorizedAddressAll", data); + return promise.then((data) => QueryAuthorizedAddressAllResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshare(request: QueryGeneralKeyshareRequest): Promise { + const data = QueryGeneralKeyshareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshare", data); + return promise.then((data) => QueryGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + GeneralKeyshareAll(request: QueryGeneralKeyshareAllRequest): Promise { + const data = QueryGeneralKeyshareAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralKeyshareAll", data); + return promise.then((data) => QueryGeneralKeyshareAllResponse.decode(new BinaryReader(data))); + } + + VerifiableRandomness(request: QueryVerifiableRandomnessRequest): Promise { + const data = QueryVerifiableRandomnessRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifiableRandomness", data); + return promise.then((data) => QueryVerifiableRandomnessResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/requested_decryption_key.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/requested_decryption_key.ts new file mode 100644 index 00000000..3892ed00 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/requested_decryption_key.ts @@ -0,0 +1,642 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/requested_decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.keyshare"; + +/** DecryptionKeyRequest defines the storage structure for general keyshare requests */ +export interface DecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + decryptionKey: string; + /** This is only used when the request is for private governance */ + proposalId: string; + /** might be useful to destination chains to sort out the response */ + requestId: string; + sent: boolean; +} + +/** + * IBCInfo defines the structure to verify request for + * general and private keyshares in case the request was made over IBC + */ +export interface IBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * CounterPartyIBCInfo defines the structure to send general + * and private keyshares if the request was made over IBC + */ +export interface CounterPartyIBCInfo { + clientId: string; + connectionId: string; + channelId: string; + portId: string; +} + +/** + * PrivateDecryptionKeyRequest defines the stroage structure for private + * encrypted and unaggregated decryption key requests + */ +export interface PrivateDecryptionKeyRequest { + identity: string; + pubkey: string; + /** Used only when the request is made via IBC */ + ibcInfo: + | IBCInfo + | undefined; + /** Used only when the request is made via IBC */ + counterparty: CounterPartyIBCInfo | undefined; + privateDecryptionKeys: PrivateDecryptionKey[]; + requestId: string; + sent: boolean; +} + +function createBaseDecryptionKeyRequest(): DecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + decryptionKey: "", + proposalId: "", + requestId: "", + sent: false, + }; +} + +export const DecryptionKeyRequest: MessageFns = { + encode(message: DecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(42).string(message.decryptionKey); + } + if (message.proposalId !== "") { + writer.uint32(50).string(message.proposalId); + } + if (message.requestId !== "") { + writer.uint32(58).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(64).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.proposalId = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requestId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + proposalId: isSet(object.proposalId) ? globalThis.String(object.proposalId) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: DecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.proposalId !== "") { + obj.proposalId = message.proposalId; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKeyRequest { + return DecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKeyRequest { + const message = createBaseDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + message.proposalId = object.proposalId ?? ""; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +function createBaseIBCInfo(): IBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const IBCInfo: MessageFns = { + encode(message: IBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: IBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): IBCInfo { + return IBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IBCInfo { + const message = createBaseIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBaseCounterPartyIBCInfo(): CounterPartyIBCInfo { + return { clientId: "", connectionId: "", channelId: "", portId: "" }; +} + +export const CounterPartyIBCInfo: MessageFns = { + encode(message: CounterPartyIBCInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(34).string(message.portId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CounterPartyIBCInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterPartyIBCInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.portId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CounterPartyIBCInfo { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + }; + }, + + toJSON(message: CounterPartyIBCInfo): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.portId !== "") { + obj.portId = message.portId; + } + return obj; + }, + + create, I>>(base?: I): CounterPartyIBCInfo { + return CounterPartyIBCInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CounterPartyIBCInfo { + const message = createBaseCounterPartyIBCInfo(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, +}; + +function createBasePrivateDecryptionKeyRequest(): PrivateDecryptionKeyRequest { + return { + identity: "", + pubkey: "", + ibcInfo: undefined, + counterparty: undefined, + privateDecryptionKeys: [], + requestId: "", + sent: false, + }; +} + +export const PrivateDecryptionKeyRequest: MessageFns = { + encode(message: PrivateDecryptionKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.ibcInfo !== undefined) { + IBCInfo.encode(message.ibcInfo, writer.uint32(26).fork()).join(); + } + if (message.counterparty !== undefined) { + CounterPartyIBCInfo.encode(message.counterparty, writer.uint32(34).fork()).join(); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.requestId !== "") { + writer.uint32(50).string(message.requestId); + } + if (message.sent !== false) { + writer.uint32(56).bool(message.sent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateDecryptionKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateDecryptionKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ibcInfo = IBCInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.counterparty = CounterPartyIBCInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.requestId = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.sent = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateDecryptionKeyRequest { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + ibcInfo: isSet(object.ibcInfo) ? IBCInfo.fromJSON(object.ibcInfo) : undefined, + counterparty: isSet(object.counterparty) ? CounterPartyIBCInfo.fromJSON(object.counterparty) : undefined, + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, + }; + }, + + toJSON(message: PrivateDecryptionKeyRequest): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.ibcInfo !== undefined) { + obj.ibcInfo = IBCInfo.toJSON(message.ibcInfo); + } + if (message.counterparty !== undefined) { + obj.counterparty = CounterPartyIBCInfo.toJSON(message.counterparty); + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.sent !== false) { + obj.sent = message.sent; + } + return obj; + }, + + create, I>>(base?: I): PrivateDecryptionKeyRequest { + return PrivateDecryptionKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateDecryptionKeyRequest { + const message = createBasePrivateDecryptionKeyRequest(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.ibcInfo = (object.ibcInfo !== undefined && object.ibcInfo !== null) + ? IBCInfo.fromPartial(object.ibcInfo) + : undefined; + message.counterparty = (object.counterparty !== undefined && object.counterparty !== null) + ? CounterPartyIBCInfo.fromPartial(object.counterparty) + : undefined; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + message.requestId = object.requestId ?? ""; + message.sent = object.sent ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/tx.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/tx.ts new file mode 100644 index 00000000..5f75e3f8 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/tx.ts @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Params } from "./params"; +import { EncryptedKeyshare } from "./pubkey"; + +export const protobufPackage = "fairyring.keyshare"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. */ +export interface MsgUpdateParamsResponse { +} + +/** MsgRegisterValidator is the Msg/RegisterValidator request type. */ +export interface MsgRegisterValidator { + creator: string; +} + +/** + * MsgRegisterValidatorResponse defines the response structure for + * executing a MsgRegisterValidator message. + */ +export interface MsgRegisterValidatorResponse { + creator: string; +} + +/** MsgDeRegisterValidator is the Msg/DeRegisterValidator request type. */ +export interface MsgDeRegisterValidator { + creator: string; +} + +/** + * MsgDeRegisterValidatorResponse defines the response structure for + * executing a MsgDeRegisterValidator message. + */ +export interface MsgDeRegisterValidatorResponse { + creator: string; +} + +/** MsgSendKeyshare is the Msg/SendKeyshare request type. */ +export interface MsgSendKeyshare { + creator: string; + message: string; + keyshareIndex: number; + blockHeight: number; +} + +/** + * MsgSendKeyshareResponse defines the response structure for + * executing a MsgSendKeyshare message. + */ +export interface MsgSendKeyshareResponse { + creator: string; + keyshare: string; + keyshareIndex: number; + blockHeight: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgCreateLatestPubkey is the Msg/CreateLatestPubkey request type. */ +export interface MsgCreateLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgCreateLatestPubkeyResponse defines the response structure for + * executing a MsgCreateLatestPubkey message. + */ +export interface MsgCreateLatestPubkeyResponse { +} + +/** MsgOverrideLatestPubkey is the Msg/OverrideLatestPubkey request type. */ +export interface MsgOverrideLatestPubkey { + creator: string; + publicKey: string; + commitments: string[]; + numberOfValidators: number; + encryptedKeyshares: EncryptedKeyshare[]; +} + +/** + * MsgOverrideLatestPubkeyResponse defines the response structure for + * executing a MsgOverrideLatestPubkey message. + */ +export interface MsgOverrideLatestPubkeyResponse { +} + +/** MsgCreateAuthorizedAddress is the Msg/CreateAuthorizedAddress request type. */ +export interface MsgCreateAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgCreateAuthorizedAddressResponse defines the response structure for + * executing a MsgCreateAuthorizedAddress message. + */ +export interface MsgCreateAuthorizedAddressResponse { +} + +/** MsgUpdateAuthorizedAddress is the Msg/UpdateAuthorizedAddress request type. */ +export interface MsgUpdateAuthorizedAddress { + target: string; + isAuthorized: boolean; + creator: string; +} + +/** + * MsgUpdateAuthorizedAddressResponse defines the response structure for + * executing a MsgUpdateAuthorizedAddress message. + */ +export interface MsgUpdateAuthorizedAddressResponse { +} + +/** MsgDeleteAuthorizedAddress is the Msg/DeleteAuthorizedAddress request type. */ +export interface MsgDeleteAuthorizedAddress { + target: string; + creator: string; +} + +/** + * MsgDeleteAuthorizedAddressResponse defines the response structure for + * executing a MsgDeleteAuthorizedAddress message. + */ +export interface MsgDeleteAuthorizedAddressResponse { +} + +/** MsgSubmitGeneralKeyshare is the Msg/CreateGeneralKeyshare request type. */ +export interface MsgSubmitGeneralKeyshare { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; +} + +/** + * MsgSubmitGeneralKeyshareResponse defines the response structure for + * executing a MsgSubmitGeneralKeyshare message. + */ +export interface MsgSubmitGeneralKeyshareResponse { + creator: string; + idType: string; + idValue: string; + keyshare: string; + keyshareIndex: number; + receivedBlockHeight: number; + success: boolean; + errorMessage: string; +} + +/** MsgSubmitEncryptedKeyshare is the Msg/SubmitEncryptedKeyshare request type. */ +export interface MsgSubmitEncryptedKeyshare { + creator: string; + identity: string; + encryptedKeyshare: string; + keyshareIndex: number; + receivedTimestamp: number; + receivedBlockHeight: number; + requester: string; +} + +/** + * MsgSubmitEncryptedKeyshareResponse defines the response structure for + * executing a MsgSubmitEncryptedKeyshare message. + */ +export interface MsgSubmitEncryptedKeyshareResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgRegisterValidator(): MsgRegisterValidator { + return { creator: "" }; +} + +export const MsgRegisterValidator: MessageFns = { + encode(message: MsgRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidator { + return MsgRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidator { + const message = createBaseMsgRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterValidatorResponse(): MsgRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgRegisterValidatorResponse: MessageFns = { + encode(message: MsgRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterValidatorResponse { + return MsgRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterValidatorResponse { + const message = createBaseMsgRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidator(): MsgDeRegisterValidator { + return { creator: "" }; +} + +export const MsgDeRegisterValidator: MessageFns = { + encode(message: MsgDeRegisterValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidator { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidator): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidator { + return MsgDeRegisterValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeRegisterValidator { + const message = createBaseMsgDeRegisterValidator(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeRegisterValidatorResponse(): MsgDeRegisterValidatorResponse { + return { creator: "" }; +} + +export const MsgDeRegisterValidatorResponse: MessageFns = { + encode(message: MsgDeRegisterValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeRegisterValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeRegisterValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeRegisterValidatorResponse { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: MsgDeRegisterValidatorResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeRegisterValidatorResponse { + return MsgDeRegisterValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgDeRegisterValidatorResponse { + const message = createBaseMsgDeRegisterValidatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgSendKeyshare(): MsgSendKeyshare { + return { creator: "", message: "", keyshareIndex: 0, blockHeight: 0 }; +} + +export const MsgSendKeyshare: MessageFns = { + encode(message: MsgSendKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + }; + }, + + toJSON(message: MsgSendKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshare { + return MsgSendKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshare { + const message = createBaseMsgSendKeyshare(); + message.creator = object.creator ?? ""; + message.message = object.message ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSendKeyshareResponse(): MsgSendKeyshareResponse { + return { + creator: "", + keyshare: "", + keyshareIndex: 0, + blockHeight: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSendKeyshareResponse: MessageFns = { + encode(message: MsgSendKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.keyshare !== "") { + writer.uint32(18).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(24).uint64(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + writer.uint32(32).uint64(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(40).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(48).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(58).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.keyshare = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockHeight = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.success = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSendKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSendKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>(base?: I): MsgSendKeyshareResponse { + return MsgSendKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSendKeyshareResponse { + const message = createBaseMsgSendKeyshareResponse(); + message.creator = object.creator ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.blockHeight = object.blockHeight ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkey(): MsgCreateLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgCreateLatestPubkey: MessageFns = { + encode(message: MsgCreateLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkey { + return MsgCreateLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateLatestPubkey { + const message = createBaseMsgCreateLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreateLatestPubkeyResponse(): MsgCreateLatestPubkeyResponse { + return {}; +} + +export const MsgCreateLatestPubkeyResponse: MessageFns = { + encode(_: MsgCreateLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgCreateLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateLatestPubkeyResponse { + return MsgCreateLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateLatestPubkeyResponse { + const message = createBaseMsgCreateLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkey(): MsgOverrideLatestPubkey { + return { creator: "", publicKey: "", commitments: [], numberOfValidators: 0, encryptedKeyshares: [] }; +} + +export const MsgOverrideLatestPubkey: MessageFns = { + encode(message: MsgOverrideLatestPubkey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.publicKey !== "") { + writer.uint32(18).string(message.publicKey); + } + for (const v of message.commitments) { + writer.uint32(26).string(v!); + } + if (message.numberOfValidators !== 0) { + writer.uint32(32).uint64(message.numberOfValidators); + } + for (const v of message.encryptedKeyshares) { + EncryptedKeyshare.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.publicKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commitments.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.numberOfValidators = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedKeyshares.push(EncryptedKeyshare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgOverrideLatestPubkey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "", + commitments: globalThis.Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => globalThis.String(e)) + : [], + numberOfValidators: isSet(object.numberOfValidators) ? globalThis.Number(object.numberOfValidators) : 0, + encryptedKeyshares: globalThis.Array.isArray(object?.encryptedKeyshares) + ? object.encryptedKeyshares.map((e: any) => EncryptedKeyshare.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgOverrideLatestPubkey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.publicKey !== "") { + obj.publicKey = message.publicKey; + } + if (message.commitments?.length) { + obj.commitments = message.commitments; + } + if (message.numberOfValidators !== 0) { + obj.numberOfValidators = Math.round(message.numberOfValidators); + } + if (message.encryptedKeyshares?.length) { + obj.encryptedKeyshares = message.encryptedKeyshares.map((e) => EncryptedKeyshare.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkey { + return MsgOverrideLatestPubkey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgOverrideLatestPubkey { + const message = createBaseMsgOverrideLatestPubkey(); + message.creator = object.creator ?? ""; + message.publicKey = object.publicKey ?? ""; + message.commitments = object.commitments?.map((e) => e) || []; + message.numberOfValidators = object.numberOfValidators ?? 0; + message.encryptedKeyshares = object.encryptedKeyshares?.map((e) => EncryptedKeyshare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgOverrideLatestPubkeyResponse(): MsgOverrideLatestPubkeyResponse { + return {}; +} + +export const MsgOverrideLatestPubkeyResponse: MessageFns = { + encode(_: MsgOverrideLatestPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgOverrideLatestPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgOverrideLatestPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgOverrideLatestPubkeyResponse { + return {}; + }, + + toJSON(_: MsgOverrideLatestPubkeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgOverrideLatestPubkeyResponse { + return MsgOverrideLatestPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgOverrideLatestPubkeyResponse { + const message = createBaseMsgOverrideLatestPubkeyResponse(); + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddress(): MsgCreateAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgCreateAuthorizedAddress: MessageFns = { + encode(message: MsgCreateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgCreateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateAuthorizedAddress { + return MsgCreateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { + const message = createBaseMsgCreateAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { + return {}; +} + +export const MsgCreateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgCreateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgCreateAuthorizedAddressResponse { + return MsgCreateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgCreateAuthorizedAddressResponse { + const message = createBaseMsgCreateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { + return { target: "", isAuthorized: false, creator: "" }; +} + +export const MsgUpdateAuthorizedAddress: MessageFns = { + encode(message: MsgUpdateAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.isAuthorized !== false) { + writer.uint32(16).bool(message.isAuthorized); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isAuthorized = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + isAuthorized: isSet(object.isAuthorized) ? globalThis.Boolean(object.isAuthorized) : false, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgUpdateAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.isAuthorized !== false) { + obj.isAuthorized = message.isAuthorized; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateAuthorizedAddress { + return MsgUpdateAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { + const message = createBaseMsgUpdateAuthorizedAddress(); + message.target = object.target ?? ""; + message.isAuthorized = object.isAuthorized ?? false; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { + return {}; +} + +export const MsgUpdateAuthorizedAddressResponse: MessageFns = { + encode(_: MsgUpdateAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgUpdateAuthorizedAddressResponse { + return MsgUpdateAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgUpdateAuthorizedAddressResponse { + const message = createBaseMsgUpdateAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { + return { target: "", creator: "" }; +} + +export const MsgDeleteAuthorizedAddress: MessageFns = { + encode(message: MsgDeleteAuthorizedAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== "") { + writer.uint32(10).string(message.target); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.target = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeleteAuthorizedAddress { + return { + target: isSet(object.target) ? globalThis.String(object.target) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: MsgDeleteAuthorizedAddress): unknown { + const obj: any = {}; + if (message.target !== "") { + obj.target = message.target; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): MsgDeleteAuthorizedAddress { + return MsgDeleteAuthorizedAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { + const message = createBaseMsgDeleteAuthorizedAddress(); + message.target = object.target ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { + return {}; +} + +export const MsgDeleteAuthorizedAddressResponse: MessageFns = { + encode(_: MsgDeleteAuthorizedAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { + return {}; + }, + + toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgDeleteAuthorizedAddressResponse { + return MsgDeleteAuthorizedAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgDeleteAuthorizedAddressResponse { + const message = createBaseMsgDeleteAuthorizedAddressResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshare(): MsgSubmitGeneralKeyshare { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; +} + +export const MsgSubmitGeneralKeyshare: MessageFns = { + encode(message: MsgSubmitGeneralKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralKeyshare { + return MsgSubmitGeneralKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralKeyshare { + const message = createBaseMsgSubmitGeneralKeyshare(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitGeneralKeyshareResponse(): MsgSubmitGeneralKeyshareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyshare: "", + keyshareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; +} + +export const MsgSubmitGeneralKeyshareResponse: MessageFns = { + encode(message: MsgSubmitGeneralKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyshare !== "") { + writer.uint32(34).string(message.keyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(40).uint64(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success !== false) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.idType = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.idValue = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.keyshare = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.success = reader.bool(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralKeyshareResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + idType: isSet(object.idType) ? globalThis.String(object.idType) : "", + idValue: isSet(object.idValue) ? globalThis.String(object.idValue) : "", + keyshare: isSet(object.keyshare) ? globalThis.String(object.keyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralKeyshareResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.idType !== "") { + obj.idType = message.idType; + } + if (message.idValue !== "") { + obj.idValue = message.idValue; + } + if (message.keyshare !== "") { + obj.keyshare = message.keyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralKeyshareResponse { + return MsgSubmitGeneralKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgSubmitGeneralKeyshareResponse { + const message = createBaseMsgSubmitGeneralKeyshareResponse(); + message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyshare = object.keyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshare(): MsgSubmitEncryptedKeyshare { + return { + creator: "", + identity: "", + encryptedKeyshare: "", + keyshareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + requester: "", + }; +} + +export const MsgSubmitEncryptedKeyshare: MessageFns = { + encode(message: MsgSubmitEncryptedKeyshare, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.encryptedKeyshare !== "") { + writer.uint32(26).string(message.encryptedKeyshare); + } + if (message.keyshareIndex !== 0) { + writer.uint32(32).uint64(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(40).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.requester !== "") { + writer.uint32(58).string(message.requester); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshare { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedKeyshare = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.keyshareIndex = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.receivedTimestamp = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.receivedBlockHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.requester = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedKeyshare { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + encryptedKeyshare: isSet(object.encryptedKeyshare) ? globalThis.String(object.encryptedKeyshare) : "", + keyshareIndex: isSet(object.keyshareIndex) ? globalThis.Number(object.keyshareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? globalThis.Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? globalThis.Number(object.receivedBlockHeight) : 0, + requester: isSet(object.requester) ? globalThis.String(object.requester) : "", + }; + }, + + toJSON(message: MsgSubmitEncryptedKeyshare): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.encryptedKeyshare !== "") { + obj.encryptedKeyshare = message.encryptedKeyshare; + } + if (message.keyshareIndex !== 0) { + obj.keyshareIndex = Math.round(message.keyshareIndex); + } + if (message.receivedTimestamp !== 0) { + obj.receivedTimestamp = Math.round(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + obj.receivedBlockHeight = Math.round(message.receivedBlockHeight); + } + if (message.requester !== "") { + obj.requester = message.requester; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedKeyshare { + return MsgSubmitEncryptedKeyshare.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedKeyshare { + const message = createBaseMsgSubmitEncryptedKeyshare(); + message.creator = object.creator ?? ""; + message.identity = object.identity ?? ""; + message.encryptedKeyshare = object.encryptedKeyshare ?? ""; + message.keyshareIndex = object.keyshareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.requester = object.requester ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedKeyshareResponse(): MsgSubmitEncryptedKeyshareResponse { + return {}; +} + +export const MsgSubmitEncryptedKeyshareResponse: MessageFns = { + encode(_: MsgSubmitEncryptedKeyshareResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedKeyshareResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedKeyshareResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedKeyshareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitEncryptedKeyshareResponse { + return MsgSubmitEncryptedKeyshareResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitEncryptedKeyshareResponse { + const message = createBaseMsgSubmitEncryptedKeyshareResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * RegisterValidator defines a operation to register validator which + * is then eligible to participate in sending keyshares + */ + RegisterValidator(request: MsgRegisterValidator): Promise; + /** + * DeRegisterValidator defines an operation to de-register + * a registered validator + */ + DeRegisterValidator(request: MsgDeRegisterValidator): Promise; + /** + * SendKeyshare defines an operation to submit keyshares + * every block from registered validators + */ + SendKeyshare(request: MsgSendKeyshare): Promise; + /** + * CreateLatestPubkey defines an operation to add a + * public key to the chain (can only be done by an authorized address) + */ + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise; + /** OverrideLatestPubkey defines an operation to override the current active pubkey */ + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise; + /** + * CreateAuthorizedAddress defines an operation to mark an address + * as authorized to create and/or update pubkeys on the chain + */ + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; + /** + * UpdateAuthorizedAddress defines an operation to update the + * list of authorized addresses + */ + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; + /** + * DeleteAuthorizedAddress defines an operation to revoke the + * authorization of a previously authorized address + */ + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; + /** + * SubmitGeneralKeyshare defines an operation to submit a + * general keyshare from a registered validator + */ + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise; + /** + * SubmitEncryptedKeyshare defines an operation to submit + * an encrypted keyshare from a registered validator + */ + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise; +} + +export const MsgServiceName = "fairyring.keyshare.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.RegisterValidator = this.RegisterValidator.bind(this); + this.DeRegisterValidator = this.DeRegisterValidator.bind(this); + this.SendKeyshare = this.SendKeyshare.bind(this); + this.CreateLatestPubkey = this.CreateLatestPubkey.bind(this); + this.OverrideLatestPubkey = this.OverrideLatestPubkey.bind(this); + this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); + this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); + this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); + this.SubmitGeneralKeyshare = this.SubmitGeneralKeyshare.bind(this); + this.SubmitEncryptedKeyshare = this.SubmitEncryptedKeyshare.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 BinaryReader(data))); + } + + RegisterValidator(request: MsgRegisterValidator): Promise { + const data = MsgRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterValidator", data); + return promise.then((data) => MsgRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + DeRegisterValidator(request: MsgDeRegisterValidator): Promise { + const data = MsgDeRegisterValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeRegisterValidator", data); + return promise.then((data) => MsgDeRegisterValidatorResponse.decode(new BinaryReader(data))); + } + + SendKeyshare(request: MsgSendKeyshare): Promise { + const data = MsgSendKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SendKeyshare", data); + return promise.then((data) => MsgSendKeyshareResponse.decode(new BinaryReader(data))); + } + + CreateLatestPubkey(request: MsgCreateLatestPubkey): Promise { + const data = MsgCreateLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateLatestPubkey", data); + return promise.then((data) => MsgCreateLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + OverrideLatestPubkey(request: MsgOverrideLatestPubkey): Promise { + const data = MsgOverrideLatestPubkey.encode(request).finish(); + const promise = this.rpc.request(this.service, "OverrideLatestPubkey", data); + return promise.then((data) => MsgOverrideLatestPubkeyResponse.decode(new BinaryReader(data))); + } + + CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { + const data = MsgCreateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateAuthorizedAddress", data); + return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { + const data = MsgUpdateAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAuthorizedAddress", data); + return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { + const data = MsgDeleteAuthorizedAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeleteAuthorizedAddress", data); + return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralKeyshare(request: MsgSubmitGeneralKeyshare): Promise { + const data = MsgSubmitGeneralKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralKeyshare", data); + return promise.then((data) => MsgSubmitGeneralKeyshareResponse.decode(new BinaryReader(data))); + } + + SubmitEncryptedKeyshare(request: MsgSubmitEncryptedKeyshare): Promise { + const data = MsgSubmitEncryptedKeyshare.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedKeyshare", data); + return promise.then((data) => MsgSubmitEncryptedKeyshareResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/validator_set.ts b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/validator_set.ts new file mode 100644 index 00000000..29cbe6c9 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/keyshare/validator_set.ts @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/keyshare/validator_set.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.keyshare"; + +/** + * ValidatorSet defines the structure for storing the list of + * validators who will be eligible to send keyshares + */ +export interface ValidatorSet { + index: string; + validator: string; + consAddr: string; + isActive: boolean; +} + +function createBaseValidatorSet(): ValidatorSet { + return { index: "", validator: "", consAddr: "", isActive: false }; +} + +export const ValidatorSet: MessageFns = { + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.validator !== "") { + writer.uint32(18).string(message.validator); + } + if (message.consAddr !== "") { + writer.uint32(26).string(message.consAddr); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consAddr = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + index: isSet(object.index) ? globalThis.String(object.index) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + consAddr: isSet(object.consAddr) ? globalThis.String(object.consAddr) : "", + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.index !== "") { + obj.index = message.index; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + if (message.consAddr !== "") { + obj.consAddr = message.consAddr; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.index = object.index ?? ""; + message.validator = object.validator ?? ""; + message.consAddr = object.consAddr ?? ""; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/pep/decryption_key.ts b/ts-client/ibc.core.connection.v1/types/fairyring/pep/decryption_key.ts new file mode 100644 index 00000000..6758aad8 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/pep/decryption_key.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/decryption_key.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * DecryptionKey defines the structure to store + * the decryption key of a particular identity + */ +export interface DecryptionKey { + height: number; + data: string; + creator: string; +} + +function createBaseDecryptionKey(): DecryptionKey { + return { height: 0, data: "", creator: "" }; +} + +export const DecryptionKey: MessageFns = { + encode(message: DecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecryptionKey { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + }; + }, + + toJSON(message: DecryptionKey): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): DecryptionKey { + return DecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecryptionKey { + const message = createBaseDecryptionKey(); + message.height = object.height ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/pep/encrypted_tx.ts b/ts-client/ibc.core.connection.v1/types/fairyring/pep/encrypted_tx.ts new file mode 100644 index 00000000..c3e6fabf --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/pep/encrypted_tx.ts @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/encrypted_tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** + * EncryptedTx defines the structure to store an encrypted transaction + * by execution height + */ +export interface EncryptedTx { + targetHeight: number; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; + processedAtChainHeight: number; + expired: boolean; +} + +/** EncryptedTxArray defines a list of EncryptedTx */ +export interface EncryptedTxArray { + encryptedTxs: EncryptedTx[]; +} + +/** + * GeneralEncryptedTx defines the structure to store a + * general encrypted transaction by identity + */ +export interface GeneralEncryptedTx { + identity: string; + index: number; + data: string; + creator: string; + chargedGas: Coin | undefined; +} + +/** GeneralEncryptedTxArray defines a list of GeneralEncryptedTx */ +export interface GeneralEncryptedTxArray { + encryptedTxs: GeneralEncryptedTx[]; +} + +/** + * IdentityExecutionEntry defines the structure to queue up + * identities that have decryption keys available and + * are ready to execute any associated contracts or encrypted transactions + */ +export interface IdentityExecutionEntry { + creator: string; + requestId: string; + identity: string; + pubkey: string; + txList: GeneralEncryptedTxArray | undefined; + decryptionKey: string; +} + +function createBaseEncryptedTx(): EncryptedTx { + return { + targetHeight: 0, + index: 0, + data: "", + creator: "", + chargedGas: undefined, + processedAtChainHeight: 0, + expired: false, + }; +} + +export const EncryptedTx: MessageFns = { + encode(message: EncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + if (message.processedAtChainHeight !== 0) { + writer.uint32(48).uint64(message.processedAtChainHeight); + } + if (message.expired !== false) { + writer.uint32(56).bool(message.expired); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.processedAtChainHeight = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.expired = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTx { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + processedAtChainHeight: isSet(object.processedAtChainHeight) + ? globalThis.Number(object.processedAtChainHeight) + : 0, + expired: isSet(object.expired) ? globalThis.Boolean(object.expired) : false, + }; + }, + + toJSON(message: EncryptedTx): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + if (message.processedAtChainHeight !== 0) { + obj.processedAtChainHeight = Math.round(message.processedAtChainHeight); + } + if (message.expired !== false) { + obj.expired = message.expired; + } + return obj; + }, + + create, I>>(base?: I): EncryptedTx { + return EncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTx { + const message = createBaseEncryptedTx(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + message.processedAtChainHeight = object.processedAtChainHeight ?? 0; + message.expired = object.expired ?? false; + return message; + }, +}; + +function createBaseEncryptedTxArray(): EncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const EncryptedTxArray: MessageFns = { + encode(message: EncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + EncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(EncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => EncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => EncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EncryptedTxArray { + return EncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedTxArray { + const message = createBaseEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => EncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneralEncryptedTx(): GeneralEncryptedTx { + return { identity: "", index: 0, data: "", creator: "", chargedGas: undefined }; +} + +export const GeneralEncryptedTx: MessageFns = { + encode(message: GeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.chargedGas !== undefined) { + Coin.encode(message.chargedGas, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.chargedGas = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTx { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + chargedGas: isSet(object.chargedGas) ? Coin.fromJSON(object.chargedGas) : undefined, + }; + }, + + toJSON(message: GeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.chargedGas !== undefined) { + obj.chargedGas = Coin.toJSON(message.chargedGas); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTx { + return GeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTx { + const message = createBaseGeneralEncryptedTx(); + message.identity = object.identity ?? ""; + message.index = object.index ?? 0; + message.data = object.data ?? ""; + message.creator = object.creator ?? ""; + message.chargedGas = (object.chargedGas !== undefined && object.chargedGas !== null) + ? Coin.fromPartial(object.chargedGas) + : undefined; + return message; + }, +}; + +function createBaseGeneralEncryptedTxArray(): GeneralEncryptedTxArray { + return { encryptedTxs: [] }; +} + +export const GeneralEncryptedTxArray: MessageFns = { + encode(message: GeneralEncryptedTxArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxs) { + GeneralEncryptedTx.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneralEncryptedTxArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneralEncryptedTxArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxs.push(GeneralEncryptedTx.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneralEncryptedTxArray { + return { + encryptedTxs: globalThis.Array.isArray(object?.encryptedTxs) + ? object.encryptedTxs.map((e: any) => GeneralEncryptedTx.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneralEncryptedTxArray): unknown { + const obj: any = {}; + if (message.encryptedTxs?.length) { + obj.encryptedTxs = message.encryptedTxs.map((e) => GeneralEncryptedTx.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneralEncryptedTxArray { + return GeneralEncryptedTxArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneralEncryptedTxArray { + const message = createBaseGeneralEncryptedTxArray(); + message.encryptedTxs = object.encryptedTxs?.map((e) => GeneralEncryptedTx.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIdentityExecutionEntry(): IdentityExecutionEntry { + return { creator: "", requestId: "", identity: "", pubkey: "", txList: undefined, decryptionKey: "" }; +} + +export const IdentityExecutionEntry: MessageFns = { + encode(message: IdentityExecutionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.requestId !== "") { + writer.uint32(18).string(message.requestId); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(34).string(message.pubkey); + } + if (message.txList !== undefined) { + GeneralEncryptedTxArray.encode(message.txList, writer.uint32(42).fork()).join(); + } + if (message.decryptionKey !== "") { + writer.uint32(50).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityExecutionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityExecutionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.requestId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pubkey = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txList = GeneralEncryptedTxArray.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IdentityExecutionEntry { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + requestId: isSet(object.requestId) ? globalThis.String(object.requestId) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + txList: isSet(object.txList) ? GeneralEncryptedTxArray.fromJSON(object.txList) : undefined, + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: IdentityExecutionEntry): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.txList !== undefined) { + obj.txList = GeneralEncryptedTxArray.toJSON(message.txList); + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): IdentityExecutionEntry { + return IdentityExecutionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IdentityExecutionEntry { + const message = createBaseIdentityExecutionEntry(); + message.creator = object.creator ?? ""; + message.requestId = object.requestId ?? ""; + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.txList = (object.txList !== undefined && object.txList !== null) + ? GeneralEncryptedTxArray.fromPartial(object.txList) + : undefined; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/pep/genesis.ts b/ts-client/ibc.core.connection.v1/types/fairyring/pep/genesis.ts new file mode 100644 index 00000000..e19062b5 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/pep/genesis.ts @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/genesis.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ActivePublicKey, QueuedPublicKey } from "../common/shared_types"; +import { DecryptionKey } from "./decryption_key"; +import { EncryptedTxArray } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; +import { RequestId } from "./request_id"; + +export const protobufPackage = "fairyring.pep"; + +/** GenesisState defines the pep module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + portId: string; + encryptedTxArray: EncryptedTxArray[]; + pepNonceList: PepNonce[]; + decryptionKeyList: DecryptionKey[]; + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; + requestCount: number; + requestIdList: RequestId[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + portId: "", + encryptedTxArray: [], + pepNonceList: [], + decryptionKeyList: [], + activePubkey: undefined, + queuedPubkey: undefined, + requestCount: 0, + requestIdList: [], + }; +} + +export const GenesisState: MessageFns = { + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.pepNonceList) { + PepNonce.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.decryptionKeyList) { + DecryptionKey.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(58).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(66).fork()).join(); + } + if (message.requestCount !== 0) { + writer.uint32(72).uint64(message.requestCount); + } + for (const v of message.requestIdList) { + RequestId.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.portId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pepNonceList.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.decryptionKeyList.push(DecryptionKey.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.requestCount = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.requestIdList.push(RequestId.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + portId: isSet(object.portId) ? globalThis.String(object.portId) : "", + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pepNonceList: globalThis.Array.isArray(object?.pepNonceList) + ? object.pepNonceList.map((e: any) => PepNonce.fromJSON(e)) + : [], + decryptionKeyList: globalThis.Array.isArray(object?.decryptionKeyList) + ? object.decryptionKeyList.map((e: any) => DecryptionKey.fromJSON(e)) + : [], + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0, + requestIdList: globalThis.Array.isArray(object?.requestIdList) + ? object.requestIdList.map((e: any) => RequestId.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.portId !== "") { + obj.portId = message.portId; + } + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pepNonceList?.length) { + obj.pepNonceList = message.pepNonceList.map((e) => PepNonce.toJSON(e)); + } + if (message.decryptionKeyList?.length) { + obj.decryptionKeyList = message.decryptionKeyList.map((e) => DecryptionKey.toJSON(e)); + } + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + if (message.requestCount !== 0) { + obj.requestCount = Math.round(message.requestCount); + } + if (message.requestIdList?.length) { + obj.requestIdList = message.requestIdList.map((e) => RequestId.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) + ? Params.fromPartial(object.params) + : undefined; + message.portId = object.portId ?? ""; + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pepNonceList = object.pepNonceList?.map((e) => PepNonce.fromPartial(e)) || []; + message.decryptionKeyList = object.decryptionKeyList?.map((e) => DecryptionKey.fromPartial(e)) || []; + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + message.requestCount = object.requestCount ?? 0; + message.requestIdList = object.requestIdList?.map((e) => RequestId.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/pep/module/module.ts b/ts-client/ibc.core.connection.v1/types/fairyring/pep/module/module.ts new file mode 100644 index 00000000..c855c4c7 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/pep/module/module.ts @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/module/module.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep.module"; + +/** Module is the config object for the module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} + +function createBaseModule(): Module { + return { authority: "" }; +} + +export const Module: MessageFns = { + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { authority: isSet(object.authority) ? globalThis.String(object.authority) : "" }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/pep/params.ts b/ts-client/ibc.core.connection.v1/types/fairyring/pep/params.ts new file mode 100644 index 00000000..dcd4728d --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/pep/params.ts @@ -0,0 +1,299 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "../../cosmos/base/v1beta1/coin"; + +export const protobufPackage = "fairyring.pep"; + +/** Params defines the parameters for the module. */ +export interface Params { + /** option (gogoproto.equal) = true; */ + keyshareChannelId: string; + isSourceChain: boolean; + trustedCounterParties: TrustedCounterParty[]; + trustedAddresses: string[]; + minGasPrice: Coin | undefined; + privateDecryptionKeyPrice: Coin | undefined; +} + +/** + * TrustedCounterParty defines the structure to store the ibc info + * of the source chain (fairyring) to reliably fetch active keys and + * general/private decryption keys + */ +export interface TrustedCounterParty { + clientId: string; + connectionId: string; + channelId: string; +} + +function createBaseParams(): Params { + return { + keyshareChannelId: "", + isSourceChain: false, + trustedCounterParties: [], + trustedAddresses: [], + minGasPrice: undefined, + privateDecryptionKeyPrice: undefined, + }; +} + +export const Params: MessageFns = { + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyshareChannelId !== "") { + writer.uint32(10).string(message.keyshareChannelId); + } + if (message.isSourceChain !== false) { + writer.uint32(16).bool(message.isSourceChain); + } + for (const v of message.trustedCounterParties) { + TrustedCounterParty.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.trustedAddresses) { + writer.uint32(34).string(v!); + } + if (message.minGasPrice !== undefined) { + Coin.encode(message.minGasPrice, writer.uint32(42).fork()).join(); + } + if (message.privateDecryptionKeyPrice !== undefined) { + Coin.encode(message.privateDecryptionKeyPrice, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.keyshareChannelId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isSourceChain = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.trustedCounterParties.push(TrustedCounterParty.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trustedAddresses.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.minGasPrice = Coin.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.privateDecryptionKeyPrice = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + keyshareChannelId: isSet(object.keyshareChannelId) ? globalThis.String(object.keyshareChannelId) : "", + isSourceChain: isSet(object.isSourceChain) ? globalThis.Boolean(object.isSourceChain) : false, + trustedCounterParties: globalThis.Array.isArray(object?.trustedCounterParties) + ? object.trustedCounterParties.map((e: any) => TrustedCounterParty.fromJSON(e)) + : [], + trustedAddresses: globalThis.Array.isArray(object?.trustedAddresses) + ? object.trustedAddresses.map((e: any) => globalThis.String(e)) + : [], + minGasPrice: isSet(object.minGasPrice) ? Coin.fromJSON(object.minGasPrice) : undefined, + privateDecryptionKeyPrice: isSet(object.privateDecryptionKeyPrice) + ? Coin.fromJSON(object.privateDecryptionKeyPrice) + : undefined, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.keyshareChannelId !== "") { + obj.keyshareChannelId = message.keyshareChannelId; + } + if (message.isSourceChain !== false) { + obj.isSourceChain = message.isSourceChain; + } + if (message.trustedCounterParties?.length) { + obj.trustedCounterParties = message.trustedCounterParties.map((e) => TrustedCounterParty.toJSON(e)); + } + if (message.trustedAddresses?.length) { + obj.trustedAddresses = message.trustedAddresses; + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = Coin.toJSON(message.minGasPrice); + } + if (message.privateDecryptionKeyPrice !== undefined) { + obj.privateDecryptionKeyPrice = Coin.toJSON(message.privateDecryptionKeyPrice); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.keyshareChannelId = object.keyshareChannelId ?? ""; + message.isSourceChain = object.isSourceChain ?? false; + message.trustedCounterParties = object.trustedCounterParties?.map((e) => TrustedCounterParty.fromPartial(e)) || []; + message.trustedAddresses = object.trustedAddresses?.map((e) => e) || []; + message.minGasPrice = (object.minGasPrice !== undefined && object.minGasPrice !== null) + ? Coin.fromPartial(object.minGasPrice) + : undefined; + message.privateDecryptionKeyPrice = + (object.privateDecryptionKeyPrice !== undefined && object.privateDecryptionKeyPrice !== null) + ? Coin.fromPartial(object.privateDecryptionKeyPrice) + : undefined; + return message; + }, +}; + +function createBaseTrustedCounterParty(): TrustedCounterParty { + return { clientId: "", connectionId: "", channelId: "" }; +} + +export const TrustedCounterParty: MessageFns = { + encode(message: TrustedCounterParty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TrustedCounterParty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTrustedCounterParty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.connectionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TrustedCounterParty { + return { + clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "", + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + }; + }, + + toJSON(message: TrustedCounterParty): unknown { + const obj: any = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.connectionId !== "") { + obj.connectionId = message.connectionId; + } + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): TrustedCounterParty { + return TrustedCounterParty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TrustedCounterParty { + const message = createBaseTrustedCounterParty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/pep/pep_nonce.ts b/ts-client/ibc.core.connection.v1/types/fairyring/pep/pep_nonce.ts new file mode 100644 index 00000000..e522a1e5 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/pep/pep_nonce.ts @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/pep_nonce.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "fairyring.pep"; + +/** + * PepNonce defines the nonce of an account to send encrypted transactions. + * It is incremanted seperately from the nonce maintained by the auth module + */ +export interface PepNonce { + address: string; + nonce: number; +} + +function createBasePepNonce(): PepNonce { + return { address: "", nonce: 0 }; +} + +export const PepNonce: MessageFns = { + encode(message: PepNonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PepNonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePepNonce(); + 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.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PepNonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: PepNonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): PepNonce { + return PepNonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PepNonce { + const message = createBasePepNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/pep/query.ts b/ts-client/ibc.core.connection.v1/types/fairyring/pep/query.ts new file mode 100644 index 00000000..d2781225 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/pep/query.ts @@ -0,0 +1,1846 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/query.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; +import { ActivePublicKey, PrivateDecryptionKey, QueuedPublicKey } from "../common/shared_types"; +import { EncryptedTx, EncryptedTxArray, IdentityExecutionEntry } from "./encrypted_tx"; +import { Params } from "./params"; +import { PepNonce } from "./pep_nonce"; + +export const protobufPackage = "fairyring.pep"; + +/** 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 | undefined; +} + +/** QueryGeneralIdentityRequest is request type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityRequest { + reqId: string; +} + +/** QueryGeneralIdentityResponse is response type for the Query/GeneralIdentity RPC method. */ +export interface QueryGeneralIdentityResponse { + requestDetails: IdentityExecutionEntry | undefined; +} + +/** QueryGeneralIdentityAllRequest is request type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryGeneralIdentityAllResponse is response type for the Query/GeneralIdentityAll RPC method. */ +export interface QueryGeneralIdentityAllResponse { + requestDetailsList: IdentityExecutionEntry[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxRequest is request type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxRequest { + targetHeight: number; + index: number; +} + +/** QueryEncryptedTxResponse is response type for the Query/EncryptedTx RPC method. */ +export interface QueryEncryptedTxResponse { + encryptedTx: EncryptedTx | undefined; +} + +/** QueryEncryptedTxAllRequest is request type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryEncryptedTxAllResponse is response type for the Query/EncryptedTxAll RPC method. */ +export interface QueryEncryptedTxAllResponse { + encryptedTxArray: EncryptedTxArray[]; + pagination: PageResponse | undefined; +} + +/** QueryEncryptedTxAllFromHeightRequest is request type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightRequest { + targetHeight: number; +} + +/** QueryEncryptedTxAllFromHeightResponse is response type for the Query/EncryptedTxAllFromHeight RPC method. */ +export interface QueryEncryptedTxAllFromHeightResponse { + encryptedTxArray: EncryptedTxArray | undefined; +} + +/** QueryLatestHeightRequest is request type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightRequest { +} + +/** QueryLatestHeightResponse is response type for the Query/LatestHeight RPC method. */ +export interface QueryLatestHeightResponse { + height: number; +} + +/** QueryPepNonceRequest is request type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceRequest { + address: string; +} + +/** QueryPepNonceResponse is response type for the Query/PepNonce RPC method. */ +export interface QueryPepNonceResponse { + pepNonce: PepNonce | undefined; +} + +/** QueryPepNonceAllRequest is request type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllRequest { + pagination: PageRequest | undefined; +} + +/** QueryPepNonceAllResponse is response type for the Query/PepNonceAll RPC method. */ +export interface QueryPepNonceAllResponse { + pepNonce: PepNonce[]; + pagination: PageResponse | undefined; +} + +/** QueryPubkeyRequest is request type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyRequest { +} + +/** QueryPubkeyResponse is response type for the Query/Pubkey RPC method. */ +export interface QueryPubkeyResponse { + activePubkey: ActivePublicKey | undefined; + queuedPubkey: QueuedPublicKey | undefined; +} + +/** QueryPrivateIdentityRequest is request type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityRequest { + reqId: string; +} + +/** QueryPrivateIdentityResponse is response type for the Query/PrivateIdentity RPC method. */ +export interface QueryPrivateIdentityResponse { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** QueryDecryptDataRequest is request type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataRequest { + pubkey: string; + decryptionKey: string; + encryptedData: string; +} + +/** QueryDecryptDataResponse is response type for the Query/DecryptData RPC method. */ +export interface QueryDecryptDataResponse { + decryptedData: string; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest: MessageFns = { + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse: MessageFns = { + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + 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) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityRequest(): QueryGeneralIdentityRequest { + return { reqId: "" }; +} + +export const QueryGeneralIdentityRequest: MessageFns = { + encode(message: QueryGeneralIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryGeneralIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityRequest { + return QueryGeneralIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityRequest { + const message = createBaseQueryGeneralIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryGeneralIdentityResponse(): QueryGeneralIdentityResponse { + return { requestDetails: undefined }; +} + +export const QueryGeneralIdentityResponse: MessageFns = { + encode(message: QueryGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requestDetails !== undefined) { + IdentityExecutionEntry.encode(message.requestDetails, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetails = IdentityExecutionEntry.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityResponse { + return { + requestDetails: isSet(object.requestDetails) ? IdentityExecutionEntry.fromJSON(object.requestDetails) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.requestDetails !== undefined) { + obj.requestDetails = IdentityExecutionEntry.toJSON(message.requestDetails); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityResponse { + return QueryGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGeneralIdentityResponse { + const message = createBaseQueryGeneralIdentityResponse(); + message.requestDetails = (object.requestDetails !== undefined && object.requestDetails !== null) + ? IdentityExecutionEntry.fromPartial(object.requestDetails) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllRequest(): QueryGeneralIdentityAllRequest { + return { pagination: undefined }; +} + +export const QueryGeneralIdentityAllRequest: MessageFns = { + encode(message: QueryGeneralIdentityAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryGeneralIdentityAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllRequest { + return QueryGeneralIdentityAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllRequest { + const message = createBaseQueryGeneralIdentityAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGeneralIdentityAllResponse(): QueryGeneralIdentityAllResponse { + return { requestDetailsList: [], pagination: undefined }; +} + +export const QueryGeneralIdentityAllResponse: MessageFns = { + encode(message: QueryGeneralIdentityAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestDetailsList) { + IdentityExecutionEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGeneralIdentityAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGeneralIdentityAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.requestDetailsList.push(IdentityExecutionEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGeneralIdentityAllResponse { + return { + requestDetailsList: globalThis.Array.isArray(object?.requestDetailsList) + ? object.requestDetailsList.map((e: any) => IdentityExecutionEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGeneralIdentityAllResponse): unknown { + const obj: any = {}; + if (message.requestDetailsList?.length) { + obj.requestDetailsList = message.requestDetailsList.map((e) => IdentityExecutionEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGeneralIdentityAllResponse { + return QueryGeneralIdentityAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryGeneralIdentityAllResponse { + const message = createBaseQueryGeneralIdentityAllResponse(); + message.requestDetailsList = object.requestDetailsList?.map((e) => IdentityExecutionEntry.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxRequest(): QueryEncryptedTxRequest { + return { targetHeight: 0, index: 0 }; +} + +export const QueryEncryptedTxRequest: MessageFns = { + encode(message: QueryEncryptedTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + if (message.index !== 0) { + writer.uint32(16).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxRequest { + return { + targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + }; + }, + + toJSON(message: QueryEncryptedTxRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxRequest { + return QueryEncryptedTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxRequest { + const message = createBaseQueryEncryptedTxRequest(); + message.targetHeight = object.targetHeight ?? 0; + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxResponse(): QueryEncryptedTxResponse { + return { encryptedTx: undefined }; +} + +export const QueryEncryptedTxResponse: MessageFns = { + encode(message: QueryEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTx !== undefined) { + EncryptedTx.encode(message.encryptedTx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTx = EncryptedTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxResponse { + return { encryptedTx: isSet(object.encryptedTx) ? EncryptedTx.fromJSON(object.encryptedTx) : undefined }; + }, + + toJSON(message: QueryEncryptedTxResponse): unknown { + const obj: any = {}; + if (message.encryptedTx !== undefined) { + obj.encryptedTx = EncryptedTx.toJSON(message.encryptedTx); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxResponse { + return QueryEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxResponse { + const message = createBaseQueryEncryptedTxResponse(); + message.encryptedTx = (object.encryptedTx !== undefined && object.encryptedTx !== null) + ? EncryptedTx.fromPartial(object.encryptedTx) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllRequest(): QueryEncryptedTxAllRequest { + return { pagination: undefined }; +} + +export const QueryEncryptedTxAllRequest: MessageFns = { + encode(message: QueryEncryptedTxAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryEncryptedTxAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllRequest { + return QueryEncryptedTxAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllRequest { + const message = createBaseQueryEncryptedTxAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllResponse(): QueryEncryptedTxAllResponse { + return { encryptedTxArray: [], pagination: undefined }; +} + +export const QueryEncryptedTxAllResponse: MessageFns = { + encode(message: QueryEncryptedTxAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.encryptedTxArray) { + EncryptedTxArray.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray.push(EncryptedTxArray.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllResponse { + return { + encryptedTxArray: globalThis.Array.isArray(object?.encryptedTxArray) + ? object.encryptedTxArray.map((e: any) => EncryptedTxArray.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray?.length) { + obj.encryptedTxArray = message.encryptedTxArray.map((e) => EncryptedTxArray.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryEncryptedTxAllResponse { + return QueryEncryptedTxAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEncryptedTxAllResponse { + const message = createBaseQueryEncryptedTxAllResponse(); + message.encryptedTxArray = object.encryptedTxArray?.map((e) => EncryptedTxArray.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightRequest(): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: 0 }; +} + +export const QueryEncryptedTxAllFromHeightRequest: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetHeight !== 0) { + writer.uint32(8).uint64(message.targetHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.targetHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightRequest { + return { targetHeight: isSet(object.targetHeight) ? globalThis.Number(object.targetHeight) : 0 }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightRequest): unknown { + const obj: any = {}; + if (message.targetHeight !== 0) { + obj.targetHeight = Math.round(message.targetHeight); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightRequest { + return QueryEncryptedTxAllFromHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightRequest { + const message = createBaseQueryEncryptedTxAllFromHeightRequest(); + message.targetHeight = object.targetHeight ?? 0; + return message; + }, +}; + +function createBaseQueryEncryptedTxAllFromHeightResponse(): QueryEncryptedTxAllFromHeightResponse { + return { encryptedTxArray: undefined }; +} + +export const QueryEncryptedTxAllFromHeightResponse: MessageFns = { + encode(message: QueryEncryptedTxAllFromHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedTxArray !== undefined) { + EncryptedTxArray.encode(message.encryptedTxArray, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEncryptedTxAllFromHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encryptedTxArray = EncryptedTxArray.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEncryptedTxAllFromHeightResponse { + return { + encryptedTxArray: isSet(object.encryptedTxArray) ? EncryptedTxArray.fromJSON(object.encryptedTxArray) : undefined, + }; + }, + + toJSON(message: QueryEncryptedTxAllFromHeightResponse): unknown { + const obj: any = {}; + if (message.encryptedTxArray !== undefined) { + obj.encryptedTxArray = EncryptedTxArray.toJSON(message.encryptedTxArray); + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryEncryptedTxAllFromHeightResponse { + return QueryEncryptedTxAllFromHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): QueryEncryptedTxAllFromHeightResponse { + const message = createBaseQueryEncryptedTxAllFromHeightResponse(); + message.encryptedTxArray = (object.encryptedTxArray !== undefined && object.encryptedTxArray !== null) + ? EncryptedTxArray.fromPartial(object.encryptedTxArray) + : undefined; + return message; + }, +}; + +function createBaseQueryLatestHeightRequest(): QueryLatestHeightRequest { + return {}; +} + +export const QueryLatestHeightRequest: MessageFns = { + encode(_: QueryLatestHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryLatestHeightRequest { + return {}; + }, + + toJSON(_: QueryLatestHeightRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightRequest { + return QueryLatestHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryLatestHeightRequest { + const message = createBaseQueryLatestHeightRequest(); + return message; + }, +}; + +function createBaseQueryLatestHeightResponse(): QueryLatestHeightResponse { + return { height: 0 }; +} + +export const QueryLatestHeightResponse: MessageFns = { + encode(message: QueryLatestHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryLatestHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLatestHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryLatestHeightResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryLatestHeightResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryLatestHeightResponse { + return QueryLatestHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryLatestHeightResponse { + const message = createBaseQueryLatestHeightResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseQueryPepNonceRequest(): QueryPepNonceRequest { + return { address: "" }; +} + +export const QueryPepNonceRequest: MessageFns = { + encode(message: QueryPepNonceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryPepNonceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceRequest { + return QueryPepNonceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceRequest { + const message = createBaseQueryPepNonceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryPepNonceResponse(): QueryPepNonceResponse { + return { pepNonce: undefined }; +} + +export const QueryPepNonceResponse: MessageFns = { + encode(message: QueryPepNonceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pepNonce !== undefined) { + PepNonce.encode(message.pepNonce, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce = PepNonce.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceResponse { + return { pepNonce: isSet(object.pepNonce) ? PepNonce.fromJSON(object.pepNonce) : undefined }; + }, + + toJSON(message: QueryPepNonceResponse): unknown { + const obj: any = {}; + if (message.pepNonce !== undefined) { + obj.pepNonce = PepNonce.toJSON(message.pepNonce); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceResponse { + return QueryPepNonceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceResponse { + const message = createBaseQueryPepNonceResponse(); + message.pepNonce = (object.pepNonce !== undefined && object.pepNonce !== null) + ? PepNonce.fromPartial(object.pepNonce) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllRequest(): QueryPepNonceAllRequest { + return { pagination: undefined }; +} + +export const QueryPepNonceAllRequest: MessageFns = { + encode(message: QueryPepNonceAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryPepNonceAllRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllRequest { + return QueryPepNonceAllRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllRequest { + const message = createBaseQueryPepNonceAllRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPepNonceAllResponse(): QueryPepNonceAllResponse { + return { pepNonce: [], pagination: undefined }; +} + +export const QueryPepNonceAllResponse: MessageFns = { + encode(message: QueryPepNonceAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pepNonce) { + PepNonce.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPepNonceAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPepNonceAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pepNonce.push(PepNonce.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPepNonceAllResponse { + return { + pepNonce: globalThis.Array.isArray(object?.pepNonce) ? object.pepNonce.map((e: any) => PepNonce.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPepNonceAllResponse): unknown { + const obj: any = {}; + if (message.pepNonce?.length) { + obj.pepNonce = message.pepNonce.map((e) => PepNonce.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryPepNonceAllResponse { + return QueryPepNonceAllResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPepNonceAllResponse { + const message = createBaseQueryPepNonceAllResponse(); + message.pepNonce = object.pepNonce?.map((e) => PepNonce.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryPubkeyRequest(): QueryPubkeyRequest { + return {}; +} + +export const QueryPubkeyRequest: MessageFns = { + encode(_: QueryPubkeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPubkeyRequest { + return {}; + }, + + toJSON(_: QueryPubkeyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPubkeyRequest { + return QueryPubkeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPubkeyRequest { + const message = createBaseQueryPubkeyRequest(); + return message; + }, +}; + +function createBaseQueryPubkeyResponse(): QueryPubkeyResponse { + return { activePubkey: undefined, queuedPubkey: undefined }; +} + +export const QueryPubkeyResponse: MessageFns = { + encode(message: QueryPubkeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.activePubkey !== undefined) { + ActivePublicKey.encode(message.activePubkey, writer.uint32(10).fork()).join(); + } + if (message.queuedPubkey !== undefined) { + QueuedPublicKey.encode(message.queuedPubkey, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPubkeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPubkeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activePubkey = ActivePublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queuedPubkey = QueuedPublicKey.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPubkeyResponse { + return { + activePubkey: isSet(object.activePubkey) ? ActivePublicKey.fromJSON(object.activePubkey) : undefined, + queuedPubkey: isSet(object.queuedPubkey) ? QueuedPublicKey.fromJSON(object.queuedPubkey) : undefined, + }; + }, + + toJSON(message: QueryPubkeyResponse): unknown { + const obj: any = {}; + if (message.activePubkey !== undefined) { + obj.activePubkey = ActivePublicKey.toJSON(message.activePubkey); + } + if (message.queuedPubkey !== undefined) { + obj.queuedPubkey = QueuedPublicKey.toJSON(message.queuedPubkey); + } + return obj; + }, + + create, I>>(base?: I): QueryPubkeyResponse { + return QueryPubkeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPubkeyResponse { + const message = createBaseQueryPubkeyResponse(); + message.activePubkey = (object.activePubkey !== undefined && object.activePubkey !== null) + ? ActivePublicKey.fromPartial(object.activePubkey) + : undefined; + message.queuedPubkey = (object.queuedPubkey !== undefined && object.queuedPubkey !== null) + ? QueuedPublicKey.fromPartial(object.queuedPubkey) + : undefined; + return message; + }, +}; + +function createBaseQueryPrivateIdentityRequest(): QueryPrivateIdentityRequest { + return { reqId: "" }; +} + +export const QueryPrivateIdentityRequest: MessageFns = { + encode(message: QueryPrivateIdentityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityRequest { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: QueryPrivateIdentityRequest): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityRequest { + return QueryPrivateIdentityRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityRequest { + const message = createBaseQueryPrivateIdentityRequest(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseQueryPrivateIdentityResponse(): QueryPrivateIdentityResponse { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const QueryPrivateIdentityResponse: MessageFns = { + encode(message: QueryPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPrivateIdentityResponse { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPrivateIdentityResponse { + return QueryPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPrivateIdentityResponse { + const message = createBaseQueryPrivateIdentityResponse(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDecryptDataRequest(): QueryDecryptDataRequest { + return { pubkey: "", decryptionKey: "", encryptedData: "" }; +} + +export const QueryDecryptDataRequest: MessageFns = { + encode(message: QueryDecryptDataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pubkey !== "") { + writer.uint32(10).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(18).string(message.decryptionKey); + } + if (message.encryptedData !== "") { + writer.uint32(26).string(message.encryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pubkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decryptionKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataRequest { + return { + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + encryptedData: isSet(object.encryptedData) ? globalThis.String(object.encryptedData) : "", + }; + }, + + toJSON(message: QueryDecryptDataRequest): unknown { + const obj: any = {}; + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + if (message.encryptedData !== "") { + obj.encryptedData = message.encryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataRequest { + return QueryDecryptDataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataRequest { + const message = createBaseQueryDecryptDataRequest(); + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + message.encryptedData = object.encryptedData ?? ""; + return message; + }, +}; + +function createBaseQueryDecryptDataResponse(): QueryDecryptDataResponse { + return { decryptedData: "" }; +} + +export const QueryDecryptDataResponse: MessageFns = { + encode(message: QueryDecryptDataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.decryptedData !== "") { + writer.uint32(10).string(message.decryptedData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDecryptDataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDecryptDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.decryptedData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDecryptDataResponse { + return { decryptedData: isSet(object.decryptedData) ? globalThis.String(object.decryptedData) : "" }; + }, + + toJSON(message: QueryDecryptDataResponse): unknown { + const obj: any = {}; + if (message.decryptedData !== "") { + obj.decryptedData = message.decryptedData; + } + return obj; + }, + + create, I>>(base?: I): QueryDecryptDataResponse { + return QueryDecryptDataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDecryptDataResponse { + const message = createBaseQueryDecryptDataResponse(); + message.decryptedData = object.decryptedData ?? ""; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; + /** Queries a EncryptedTx by index. */ + EncryptedTx(request: QueryEncryptedTxRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise; + /** Queries a list of EncryptedTx items. */ + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise; + /** Queries a list of LatestHeight items. */ + LatestHeight(request: QueryLatestHeightRequest): Promise; + /** Queries a PepNonce by index. */ + PepNonce(request: QueryPepNonceRequest): Promise; + /** Queries a list of PepNonce items. */ + PepNonceAll(request: QueryPepNonceAllRequest): Promise; + /** Queries the public keys */ + Pubkey(request: QueryPubkeyRequest): Promise; + /** Queries a General Identity request by request id */ + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise; + /** Queries a list of General Identity requests */ + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise; + /** Queries a Private Identity request item by req id. */ + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise; + /** Queries a list of DecryptData items. */ + DecryptData(request: QueryDecryptDataRequest): Promise; +} + +export const QueryServiceName = "fairyring.pep.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.EncryptedTx = this.EncryptedTx.bind(this); + this.EncryptedTxAll = this.EncryptedTxAll.bind(this); + this.EncryptedTxAllFromHeight = this.EncryptedTxAllFromHeight.bind(this); + this.LatestHeight = this.LatestHeight.bind(this); + this.PepNonce = this.PepNonce.bind(this); + this.PepNonceAll = this.PepNonceAll.bind(this); + this.Pubkey = this.Pubkey.bind(this); + this.GeneralIdentity = this.GeneralIdentity.bind(this); + this.GeneralIdentityAll = this.GeneralIdentityAll.bind(this); + this.PrivateIdentity = this.PrivateIdentity.bind(this); + this.DecryptData = this.DecryptData.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 BinaryReader(data))); + } + + EncryptedTx(request: QueryEncryptedTxRequest): Promise { + const data = QueryEncryptedTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTx", data); + return promise.then((data) => QueryEncryptedTxResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAll(request: QueryEncryptedTxAllRequest): Promise { + const data = QueryEncryptedTxAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAll", data); + return promise.then((data) => QueryEncryptedTxAllResponse.decode(new BinaryReader(data))); + } + + EncryptedTxAllFromHeight( + request: QueryEncryptedTxAllFromHeightRequest, + ): Promise { + const data = QueryEncryptedTxAllFromHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EncryptedTxAllFromHeight", data); + return promise.then((data) => QueryEncryptedTxAllFromHeightResponse.decode(new BinaryReader(data))); + } + + LatestHeight(request: QueryLatestHeightRequest): Promise { + const data = QueryLatestHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "LatestHeight", data); + return promise.then((data) => QueryLatestHeightResponse.decode(new BinaryReader(data))); + } + + PepNonce(request: QueryPepNonceRequest): Promise { + const data = QueryPepNonceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonce", data); + return promise.then((data) => QueryPepNonceResponse.decode(new BinaryReader(data))); + } + + PepNonceAll(request: QueryPepNonceAllRequest): Promise { + const data = QueryPepNonceAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PepNonceAll", data); + return promise.then((data) => QueryPepNonceAllResponse.decode(new BinaryReader(data))); + } + + Pubkey(request: QueryPubkeyRequest): Promise { + const data = QueryPubkeyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pubkey", data); + return promise.then((data) => QueryPubkeyResponse.decode(new BinaryReader(data))); + } + + GeneralIdentity(request: QueryGeneralIdentityRequest): Promise { + const data = QueryGeneralIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentity", data); + return promise.then((data) => QueryGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + GeneralIdentityAll(request: QueryGeneralIdentityAllRequest): Promise { + const data = QueryGeneralIdentityAllRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GeneralIdentityAll", data); + return promise.then((data) => QueryGeneralIdentityAllResponse.decode(new BinaryReader(data))); + } + + PrivateIdentity(request: QueryPrivateIdentityRequest): Promise { + const data = QueryPrivateIdentityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrivateIdentity", data); + return promise.then((data) => QueryPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + DecryptData(request: QueryDecryptDataRequest): Promise { + const data = QueryDecryptDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DecryptData", data); + return promise.then((data) => QueryDecryptDataResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/pep/request_id.ts b/ts-client/ibc.core.connection.v1/types/fairyring/pep/request_id.ts new file mode 100644 index 00000000..94fb8d6a --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/pep/request_id.ts @@ -0,0 +1,501 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/request_id.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PrivateDecryptionKey } from "../common/shared_types"; + +export const protobufPackage = "fairyring.pep"; + +/** + * RequestId defines the structure for storing request ids + * that have already been registered to prevent overlap + */ +export interface RequestId { + creator: string; + reqId: string; +} + +/** + * PrivateRequest defines the structure for storing private + * decryption key requests along with the unaggregated encrypted keyshares + */ +export interface PrivateRequest { + creator: string; + reqId: string; + pubkey: string; + privateDecryptionKeys: PrivateDecryptionKey[]; +} + +/** + * ContractDetails defines the structure to store the details of a + * contract that has been registered to execute automatically when + * the identity associated with it has a decryption key available + */ +export interface ContractDetails { + registrar: string; + contractAddress: string; +} + +/** + * RegisteredContract defines the structure to store the list of + * contracts that have been registered with a particular identity + */ +export interface RegisteredContract { + identity: string; + contracts: ContractDetails[]; +} + +/** ExecuteContractMsg defines the structure to callback registered contracts */ +export interface ExecuteContractMsg { + identity: string; + pubkey: string; + decryptionKey: string; +} + +function createBaseRequestId(): RequestId { + return { creator: "", reqId: "" }; +} + +export const RequestId: MessageFns = { + encode(message: RequestId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestId { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: RequestId): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): RequestId { + return RequestId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestId { + const message = createBaseRequestId(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBasePrivateRequest(): PrivateRequest { + return { creator: "", reqId: "", pubkey: "", privateDecryptionKeys: [] }; +} + +export const PrivateRequest: MessageFns = { + encode(message: PrivateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.pubkey !== "") { + writer.uint32(26).string(message.pubkey); + } + for (const v of message.privateDecryptionKeys) { + PrivateDecryptionKey.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pubkey = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.privateDecryptionKeys.push(PrivateDecryptionKey.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivateRequest { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + privateDecryptionKeys: globalThis.Array.isArray(object?.privateDecryptionKeys) + ? object.privateDecryptionKeys.map((e: any) => PrivateDecryptionKey.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PrivateRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.privateDecryptionKeys?.length) { + obj.privateDecryptionKeys = message.privateDecryptionKeys.map((e) => PrivateDecryptionKey.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PrivateRequest { + return PrivateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivateRequest { + const message = createBasePrivateRequest(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.pubkey = object.pubkey ?? ""; + message.privateDecryptionKeys = object.privateDecryptionKeys?.map((e) => PrivateDecryptionKey.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseContractDetails(): ContractDetails { + return { registrar: "", contractAddress: "" }; +} + +export const ContractDetails: MessageFns = { + encode(message: ContractDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registrar !== "") { + writer.uint32(10).string(message.registrar); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.registrar = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractDetails { + return { + registrar: isSet(object.registrar) ? globalThis.String(object.registrar) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + }; + }, + + toJSON(message: ContractDetails): unknown { + const obj: any = {}; + if (message.registrar !== "") { + obj.registrar = message.registrar; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + return obj; + }, + + create, I>>(base?: I): ContractDetails { + return ContractDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractDetails { + const message = createBaseContractDetails(); + message.registrar = object.registrar ?? ""; + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseRegisteredContract(): RegisteredContract { + return { identity: "", contracts: [] }; +} + +export const RegisteredContract: MessageFns = { + encode(message: RegisteredContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + for (const v of message.contracts) { + ContractDetails.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(ContractDetails.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisteredContract { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e: any) => ContractDetails.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisteredContract): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => ContractDetails.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RegisteredContract { + return RegisteredContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisteredContract { + const message = createBaseRegisteredContract(); + message.identity = object.identity ?? ""; + message.contracts = object.contracts?.map((e) => ContractDetails.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecuteContractMsg(): ExecuteContractMsg { + return { identity: "", pubkey: "", decryptionKey: "" }; +} + +export const ExecuteContractMsg: MessageFns = { + encode(message: ExecuteContractMsg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identity !== "") { + writer.uint32(10).string(message.identity); + } + if (message.pubkey !== "") { + writer.uint32(18).string(message.pubkey); + } + if (message.decryptionKey !== "") { + writer.uint32(26).string(message.decryptionKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identity = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubkey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.decryptionKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecuteContractMsg { + return { + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + pubkey: isSet(object.pubkey) ? globalThis.String(object.pubkey) : "", + decryptionKey: isSet(object.decryptionKey) ? globalThis.String(object.decryptionKey) : "", + }; + }, + + toJSON(message: ExecuteContractMsg): unknown { + const obj: any = {}; + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.pubkey !== "") { + obj.pubkey = message.pubkey; + } + if (message.decryptionKey !== "") { + obj.decryptionKey = message.decryptionKey; + } + return obj; + }, + + create, I>>(base?: I): ExecuteContractMsg { + return ExecuteContractMsg.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecuteContractMsg { + const message = createBaseExecuteContractMsg(); + message.identity = object.identity ?? ""; + message.pubkey = object.pubkey ?? ""; + message.decryptionKey = object.decryptionKey ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = 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; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/fairyring/pep/tx.ts b/ts-client/ibc.core.connection.v1/types/fairyring/pep/tx.ts new file mode 100644 index 00000000..87ff98ff --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/fairyring/pep/tx.ts @@ -0,0 +1,1665 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: fairyring/pep/tx.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../../google/protobuf/duration"; +import { Params } from "./params"; + +export const protobufPackage = "fairyring.pep"; + +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** NOTE: All parameters must be supplied. */ + params: Params | undefined; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** MsgSubmitEncryptedTx is the Msg/SubmitEncryptedTx request type. */ +export interface MsgSubmitEncryptedTx { + creator: string; + data: string; + targetBlockHeight: number; +} + +/** + * MsgSubmitEncryptedTxResponse defines the response structure for executing a + * MsgSubmitEncryptedTx message. + */ +export interface MsgSubmitEncryptedTxResponse { +} + +/** MsgSubmitGeneralEncryptedTx is the Msg/SubmitGeneralEncryptedTx request type. */ +export interface MsgSubmitGeneralEncryptedTx { + creator: string; + data: string; + reqId: string; +} + +/** + * MsgSubmitGeneralEncryptedTxResponse defines the response structure for executing a + * MsgSubmitGeneralEncryptedTx message. + */ +export interface MsgSubmitGeneralEncryptedTxResponse { +} + +/** MsgSubmitDecryptionKey is the Msg/SubmitDecryptionKey request type. */ +export interface MsgSubmitDecryptionKey { + creator: string; + height: number; + data: string; +} + +/** + * MsgSubmitDecryptionKeyResponse defines the response structure for executing a + * MsgSubmitDecryptionKey message. + */ +export interface MsgSubmitDecryptionKeyResponse { +} + +/** MsgRequestGeneralIdentity is the Msg/RequestGeneralIdentity request type. */ +export interface MsgRequestGeneralIdentity { + creator: string; + estimatedDelay: Duration | undefined; + reqId: string; +} + +/** + * MsgRequestGeneralIdentityResponse defines the response structure for executing a + * MsgRequestGeneralIdentity message. + */ +export interface MsgRequestGeneralIdentityResponse { + reqId: string; +} + +/** MsgRequestGeneralDecryptionKey is the Msg/RequestGeneralDecryptionKey request type. */ +export interface MsgRequestGeneralDecryptionKey { + creator: string; + reqId: string; +} + +/** + * MsgRequestGeneralDecryptionKeyResponse defines the response structure for executing a + * MsgRequestGeneralDecryptionKey message. + */ +export interface MsgRequestGeneralDecryptionKeyResponse { +} + +/** MsgRequestPrivateIdentity is the Msg/RequestPrivateIdentity request type. */ +export interface MsgRequestPrivateIdentity { + creator: string; + reqId: string; +} + +/** + * MsgRequestPrivateIdentityResponse defines the response structure for executing a + * MsgRequestPrivateIdentity message. + */ +export interface MsgRequestPrivateIdentityResponse { + reqId: string; +} + +/** MsgRequestPrivateDecryptionKey is the Msg/RequestPrivateDecryptionKey request type. */ +export interface MsgRequestPrivateDecryptionKey { + creator: string; + reqId: string; + secpPubkey: string; +} + +/** + * MsgRequestPrivateDecryptionKeyResponse defines the response structure for executing a + * MsgRequestPrivateDecryptionKey message. + */ +export interface MsgRequestPrivateDecryptionKeyResponse { +} + +/** MsgRegisterContract is the Msg/RegisterContract request type. */ +export interface MsgRegisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgRegisterContractResponse defines the response structure for executing a + * MsgRegisterContract message. + */ +export interface MsgRegisterContractResponse { +} + +/** MsgUnregisterContract is the Msg/UnregisterContract request type. */ +export interface MsgUnregisterContract { + creator: string; + contractAddress: string; + identity: string; +} + +/** + * MsgUnregisterContractResponse defines the response structure for executing a + * MsgUnregisterContract message. + */ +export interface MsgUnregisterContractResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams: MessageFns = { + encode(message: MsgUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + 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 ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse: MessageFns = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTx(): MsgSubmitEncryptedTx { + return { creator: "", data: "", targetBlockHeight: 0 }; +} + +export const MsgSubmitEncryptedTx: MessageFns = { + encode(message: MsgSubmitEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.targetBlockHeight !== 0) { + writer.uint32(24).uint64(message.targetBlockHeight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.targetBlockHeight = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + targetBlockHeight: isSet(object.targetBlockHeight) ? globalThis.Number(object.targetBlockHeight) : 0, + }; + }, + + toJSON(message: MsgSubmitEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.targetBlockHeight !== 0) { + obj.targetBlockHeight = Math.round(message.targetBlockHeight); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTx { + return MsgSubmitEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEncryptedTx { + const message = createBaseMsgSubmitEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.targetBlockHeight = object.targetBlockHeight ?? 0; + return message; + }, +}; + +function createBaseMsgSubmitEncryptedTxResponse(): MsgSubmitEncryptedTxResponse { + return {}; +} + +export const MsgSubmitEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitEncryptedTxResponse { + return MsgSubmitEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitEncryptedTxResponse { + const message = createBaseMsgSubmitEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTx(): MsgSubmitGeneralEncryptedTx { + return { creator: "", data: "", reqId: "" }; +} + +export const MsgSubmitGeneralEncryptedTx: MessageFns = { + encode(message: MsgSubmitGeneralEncryptedTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.data !== "") { + writer.uint32(18).string(message.data); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitGeneralEncryptedTx { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + data: isSet(object.data) ? globalThis.String(object.data) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgSubmitGeneralEncryptedTx): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitGeneralEncryptedTx { + return MsgSubmitGeneralEncryptedTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitGeneralEncryptedTx { + const message = createBaseMsgSubmitGeneralEncryptedTx(); + message.creator = object.creator ?? ""; + message.data = object.data ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitGeneralEncryptedTxResponse(): MsgSubmitGeneralEncryptedTxResponse { + return {}; +} + +export const MsgSubmitGeneralEncryptedTxResponse: MessageFns = { + encode(_: MsgSubmitGeneralEncryptedTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitGeneralEncryptedTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitGeneralEncryptedTxResponse { + return {}; + }, + + toJSON(_: MsgSubmitGeneralEncryptedTxResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgSubmitGeneralEncryptedTxResponse { + return MsgSubmitGeneralEncryptedTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgSubmitGeneralEncryptedTxResponse { + const message = createBaseMsgSubmitGeneralEncryptedTxResponse(); + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKey(): MsgSubmitDecryptionKey { + return { creator: "", height: 0, data: "" }; +} + +export const MsgSubmitDecryptionKey: MessageFns = { + encode(message: MsgSubmitDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.data !== "") { + writer.uint32(26).string(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + }; + }, + + toJSON(message: MsgSubmitDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.data !== "") { + obj.data = message.data; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKey { + return MsgSubmitDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitDecryptionKey { + const message = createBaseMsgSubmitDecryptionKey(); + message.creator = object.creator ?? ""; + message.height = object.height ?? 0; + message.data = object.data ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitDecryptionKeyResponse(): MsgSubmitDecryptionKeyResponse { + return {}; +} + +export const MsgSubmitDecryptionKeyResponse: MessageFns = { + encode(_: MsgSubmitDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSubmitDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgSubmitDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSubmitDecryptionKeyResponse { + return MsgSubmitDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSubmitDecryptionKeyResponse { + const message = createBaseMsgSubmitDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentity(): MsgRequestGeneralIdentity { + return { creator: "", estimatedDelay: undefined, reqId: "" }; +} + +export const MsgRequestGeneralIdentity: MessageFns = { + encode(message: MsgRequestGeneralIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.estimatedDelay !== undefined) { + Duration.encode(message.estimatedDelay, writer.uint32(18).fork()).join(); + } + if (message.reqId !== "") { + writer.uint32(26).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.estimatedDelay = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + estimatedDelay: isSet(object.estimatedDelay) ? Duration.fromJSON(object.estimatedDelay) : undefined, + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.estimatedDelay !== undefined) { + obj.estimatedDelay = Duration.toJSON(message.estimatedDelay); + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralIdentity { + return MsgRequestGeneralIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestGeneralIdentity { + const message = createBaseMsgRequestGeneralIdentity(); + message.creator = object.creator ?? ""; + message.estimatedDelay = (object.estimatedDelay !== undefined && object.estimatedDelay !== null) + ? Duration.fromPartial(object.estimatedDelay) + : undefined; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralIdentityResponse(): MsgRequestGeneralIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestGeneralIdentityResponse: MessageFns = { + encode(message: MsgRequestGeneralIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestGeneralIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralIdentityResponse { + return MsgRequestGeneralIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralIdentityResponse { + const message = createBaseMsgRequestGeneralIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKey(): MsgRequestGeneralDecryptionKey { + return { creator: "", reqId: "" }; +} + +export const MsgRequestGeneralDecryptionKey: MessageFns = { + encode(message: MsgRequestGeneralDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestGeneralDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestGeneralDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestGeneralDecryptionKey { + return MsgRequestGeneralDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestGeneralDecryptionKey { + const message = createBaseMsgRequestGeneralDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestGeneralDecryptionKeyResponse(): MsgRequestGeneralDecryptionKeyResponse { + return {}; +} + +export const MsgRequestGeneralDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestGeneralDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestGeneralDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestGeneralDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestGeneralDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestGeneralDecryptionKeyResponse { + return MsgRequestGeneralDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestGeneralDecryptionKeyResponse { + const message = createBaseMsgRequestGeneralDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentity(): MsgRequestPrivateIdentity { + return { creator: "", reqId: "" }; +} + +export const MsgRequestPrivateIdentity: MessageFns = { + encode(message: MsgRequestPrivateIdentity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentity { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + }; + }, + + toJSON(message: MsgRequestPrivateIdentity): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateIdentity { + return MsgRequestPrivateIdentity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRequestPrivateIdentity { + const message = createBaseMsgRequestPrivateIdentity(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateIdentityResponse(): MsgRequestPrivateIdentityResponse { + return { reqId: "" }; +} + +export const MsgRequestPrivateIdentityResponse: MessageFns = { + encode(message: MsgRequestPrivateIdentityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reqId !== "") { + writer.uint32(10).string(message.reqId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateIdentityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateIdentityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reqId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateIdentityResponse { + return { reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "" }; + }, + + toJSON(message: MsgRequestPrivateIdentityResponse): unknown { + const obj: any = {}; + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateIdentityResponse { + return MsgRequestPrivateIdentityResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateIdentityResponse { + const message = createBaseMsgRequestPrivateIdentityResponse(); + message.reqId = object.reqId ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKey(): MsgRequestPrivateDecryptionKey { + return { creator: "", reqId: "", secpPubkey: "" }; +} + +export const MsgRequestPrivateDecryptionKey: MessageFns = { + encode(message: MsgRequestPrivateDecryptionKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.reqId !== "") { + writer.uint32(18).string(message.reqId); + } + if (message.secpPubkey !== "") { + writer.uint32(26).string(message.secpPubkey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reqId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.secpPubkey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRequestPrivateDecryptionKey { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "", + secpPubkey: isSet(object.secpPubkey) ? globalThis.String(object.secpPubkey) : "", + }; + }, + + toJSON(message: MsgRequestPrivateDecryptionKey): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.reqId !== "") { + obj.reqId = message.reqId; + } + if (message.secpPubkey !== "") { + obj.secpPubkey = message.secpPubkey; + } + return obj; + }, + + create, I>>(base?: I): MsgRequestPrivateDecryptionKey { + return MsgRequestPrivateDecryptionKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgRequestPrivateDecryptionKey { + const message = createBaseMsgRequestPrivateDecryptionKey(); + message.creator = object.creator ?? ""; + message.reqId = object.reqId ?? ""; + message.secpPubkey = object.secpPubkey ?? ""; + return message; + }, +}; + +function createBaseMsgRequestPrivateDecryptionKeyResponse(): MsgRequestPrivateDecryptionKeyResponse { + return {}; +} + +export const MsgRequestPrivateDecryptionKeyResponse: MessageFns = { + encode(_: MsgRequestPrivateDecryptionKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRequestPrivateDecryptionKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRequestPrivateDecryptionKeyResponse { + return {}; + }, + + toJSON(_: MsgRequestPrivateDecryptionKeyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgRequestPrivateDecryptionKeyResponse { + return MsgRequestPrivateDecryptionKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): MsgRequestPrivateDecryptionKeyResponse { + const message = createBaseMsgRequestPrivateDecryptionKeyResponse(); + return message; + }, +}; + +function createBaseMsgRegisterContract(): MsgRegisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgRegisterContract: MessageFns = { + encode(message: MsgRegisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgRegisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterContract { + return MsgRegisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterContract { + const message = createBaseMsgRegisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterContractResponse(): MsgRegisterContractResponse { + return {}; +} + +export const MsgRegisterContractResponse: MessageFns = { + encode(_: MsgRegisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterContractResponse { + return {}; + }, + + toJSON(_: MsgRegisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterContractResponse { + return MsgRegisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterContractResponse { + const message = createBaseMsgRegisterContractResponse(); + return message; + }, +}; + +function createBaseMsgUnregisterContract(): MsgUnregisterContract { + return { creator: "", contractAddress: "", identity: "" }; +} + +export const MsgUnregisterContract: MessageFns = { + encode(message: MsgUnregisterContract, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.identity !== "") { + writer.uint32(26).string(message.identity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identity = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnregisterContract { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + contractAddress: isSet(object.contractAddress) ? globalThis.String(object.contractAddress) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + }; + }, + + toJSON(message: MsgUnregisterContract): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContract { + return MsgUnregisterContract.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnregisterContract { + const message = createBaseMsgUnregisterContract(); + message.creator = object.creator ?? ""; + message.contractAddress = object.contractAddress ?? ""; + message.identity = object.identity ?? ""; + return message; + }, +}; + +function createBaseMsgUnregisterContractResponse(): MsgUnregisterContractResponse { + return {}; +} + +export const MsgUnregisterContractResponse: MessageFns = { + encode(_: MsgUnregisterContractResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnregisterContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnregisterContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnregisterContractResponse { + return {}; + }, + + toJSON(_: MsgUnregisterContractResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnregisterContractResponse { + return MsgUnregisterContractResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnregisterContractResponse { + const message = createBaseMsgUnregisterContractResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the module + * parameters. The authority defaults to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SubmitEncryptedTx defines an operation to submit an + * encrypted transaction for a particular target block height + */ + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise; + /** + * SubmitGeneralEncryptedTx defines an operation to submit an + * encrypted transaction for a particular identity + */ + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise; + /** + * SubmitDecryptionKey defines an operation to submit a + * decryption to a destination chain + */ + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise; + /** + * RequestGeneralIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit keyshares + */ + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise; + /** + * RequestGeneralDecryptionKey defines an operation to signal validators to start + * submitting keyshares for a particular identity + */ + RequestGeneralDecryptionKey(request: MsgRequestGeneralDecryptionKey): Promise; + /** + * RequestPrivateIdentity defines an operation to request the + * creation of a new identity to which validators will be required + * to submit encrypted keyshares + */ + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise; + /** + * RequestPrivateDecryptionKey defines an operation to signal validators to start + * submitting encrypted keyshares for a particular identity + */ + RequestPrivateDecryptionKey(request: MsgRequestPrivateDecryptionKey): Promise; + /** + * RegisterContract defines an operation to make an instantiated + * contract eligible to be automatically executed when a particular + * identity has decryption key available for it + */ + RegisterContract(request: MsgRegisterContract): Promise; + /** + * UnregisterContract defines an operation to remove a registered contract + * from the list of contracts set to be automatically executed when + * decryption key is available for a particular identity + */ + UnregisterContract(request: MsgUnregisterContract): Promise; +} + +export const MsgServiceName = "fairyring.pep.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.SubmitEncryptedTx = this.SubmitEncryptedTx.bind(this); + this.SubmitGeneralEncryptedTx = this.SubmitGeneralEncryptedTx.bind(this); + this.SubmitDecryptionKey = this.SubmitDecryptionKey.bind(this); + this.RequestGeneralIdentity = this.RequestGeneralIdentity.bind(this); + this.RequestGeneralDecryptionKey = this.RequestGeneralDecryptionKey.bind(this); + this.RequestPrivateIdentity = this.RequestPrivateIdentity.bind(this); + this.RequestPrivateDecryptionKey = this.RequestPrivateDecryptionKey.bind(this); + this.RegisterContract = this.RegisterContract.bind(this); + this.UnregisterContract = this.UnregisterContract.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 BinaryReader(data))); + } + + SubmitEncryptedTx(request: MsgSubmitEncryptedTx): Promise { + const data = MsgSubmitEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEncryptedTx", data); + return promise.then((data) => MsgSubmitEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitGeneralEncryptedTx(request: MsgSubmitGeneralEncryptedTx): Promise { + const data = MsgSubmitGeneralEncryptedTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitGeneralEncryptedTx", data); + return promise.then((data) => MsgSubmitGeneralEncryptedTxResponse.decode(new BinaryReader(data))); + } + + SubmitDecryptionKey(request: MsgSubmitDecryptionKey): Promise { + const data = MsgSubmitDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitDecryptionKey", data); + return promise.then((data) => MsgSubmitDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestGeneralIdentity(request: MsgRequestGeneralIdentity): Promise { + const data = MsgRequestGeneralIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralIdentity", data); + return promise.then((data) => MsgRequestGeneralIdentityResponse.decode(new BinaryReader(data))); + } + + RequestGeneralDecryptionKey( + request: MsgRequestGeneralDecryptionKey, + ): Promise { + const data = MsgRequestGeneralDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestGeneralDecryptionKey", data); + return promise.then((data) => MsgRequestGeneralDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RequestPrivateIdentity(request: MsgRequestPrivateIdentity): Promise { + const data = MsgRequestPrivateIdentity.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateIdentity", data); + return promise.then((data) => MsgRequestPrivateIdentityResponse.decode(new BinaryReader(data))); + } + + RequestPrivateDecryptionKey( + request: MsgRequestPrivateDecryptionKey, + ): Promise { + const data = MsgRequestPrivateDecryptionKey.encode(request).finish(); + const promise = this.rpc.request(this.service, "RequestPrivateDecryptionKey", data); + return promise.then((data) => MsgRequestPrivateDecryptionKeyResponse.decode(new BinaryReader(data))); + } + + RegisterContract(request: MsgRegisterContract): Promise { + const data = MsgRegisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterContract", data); + return promise.then((data) => MsgRegisterContractResponse.decode(new BinaryReader(data))); + } + + UnregisterContract(request: MsgUnregisterContract): Promise { + const data = MsgUnregisterContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnregisterContract", data); + return promise.then((data) => MsgUnregisterContractResponse.decode(new BinaryReader(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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/gogoproto/gogo.ts b/ts-client/ibc.core.connection.v1/types/gogoproto/gogo.ts index ecf800e0..c9ab057a 100644 --- a/ts-client/ibc.core.connection.v1/types/gogoproto/gogo.ts +++ b/ts-client/ibc.core.connection.v1/types/gogoproto/gogo.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: gogoproto/gogo.proto + /* eslint-disable */ export const protobufPackage = "gogoproto"; diff --git a/ts-client/ibc.core.connection.v1/types/google/api/annotations.ts b/ts-client/ibc.core.connection.v1/types/google/api/annotations.ts index c2161053..d089209b 100644 --- a/ts-client/ibc.core.connection.v1/types/google/api/annotations.ts +++ b/ts-client/ibc.core.connection.v1/types/google/api/annotations.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/annotations.proto + /* eslint-disable */ export const protobufPackage = "google.api"; diff --git a/ts-client/ibc.core.connection.v1/types/google/api/http.ts b/ts-client/ibc.core.connection.v1/types/google/api/http.ts index 9010600b..9ee09880 100644 --- a/ts-client/ibc.core.connection.v1/types/google/api/http.ts +++ b/ts-client/ibc.core.connection.v1/types/google/api/http.ts @@ -1,5 +1,11 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/api/http.proto + /* eslint-disable */ -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.api"; @@ -16,7 +22,7 @@ export interface Http { */ rules: HttpRule[]; /** - * When set to true, URL path parmeters will be fully URI-decoded except in + * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * @@ -27,90 +33,91 @@ export interface Http { } /** - * `HttpRule` defines the mapping of an RPC method to one or more HTTP - * REST API methods. The mapping specifies how different portions of the RPC - * request message are mapped to URL path, URL query parameters, and - * HTTP request body. The mapping is typically specified as an - * `google.api.http` annotation on the RPC method, - * see "google/api/annotations.proto" for details. - * - * The mapping consists of a field specifying the path template and - * method kind. The path template can refer to fields in the request - * message, as in the example below which describes a REST GET - * operation on a resource collection of messages: + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; * } * } * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // mapped to the URL - * SubMessage sub = 2; // `sub.subfield` is url-mapped + * string name = 1; // Mapped to URL path. * } * message Message { - * string text = 1; // content of the resource + * string text = 1; // The resource content. * } * - * The same http annotation can alternatively be expressed inside the - * `GRPC API Configuration` YAML file. - * - * http: - * rules: - * - selector: .Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * This definition enables an automatic, bidrectional mapping of HTTP - * JSON to RPC. Example: + * This enables an HTTP REST to gRPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` * - * In general, not only fields but also field paths can be referenced - * from a path pattern. Fields mapped to the path pattern cannot be - * repeated and must have a primitive (non-message) type. - * - * Any fields in the request message which are not bound by the path - * pattern automatically become (optional) HTTP query - * parameters. Assume the following definition of the request message: + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: * * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http).get = "/v1/messages/{message_id}"; + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } - * string message_id = 1; // mapped to the URL - * int64 revision = 2; // becomes a parameter - * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. * } * * This enables a HTTP JSON to RPC mapping as below: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` * - * Note that fields which are mapped to HTTP parameters must have a - * primitive type or a repeated primitive type. Message types are not - * allowed. In the case of a repeated type, the parameter can be - * repeated in the URL, as in `...?param=A¶m=B`. + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. * - * For HTTP method kinds which allow a request body, the `body` field + * For HTTP methods that allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "message" * }; * } @@ -124,9 +131,8 @@ export interface Http { * representation of the JSON in the request body is determined by * protos JSON encoding: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the @@ -136,7 +142,7 @@ export interface Http { * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { - * put: "/v1/messages/{message_id}" + * patch: "/v1/messages/{message_id}" * body: "*" * }; * } @@ -148,13 +154,12 @@ export interface Http { * * The following HTTP JSON to RPC mapping is enabled: * - * HTTP | RPC - * -----|----- - * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` * * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice of + * the body. This makes this option more rarely used in practice when * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * @@ -176,31 +181,34 @@ export interface Http { * string user_id = 2; * } * - * This enables the following two alternative HTTP JSON to RPC - * mappings: + * This enables the following two alternative HTTP JSON to RPC mappings: * - * HTTP | RPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` * - * # Rules for HTTP mapping + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` * - * The rules for mapping HTTP path, query parameters, and body fields - * to the request message are as follows: + * Rules for HTTP mapping * - * 1. The `body` field specifies either `*` or a field path, or is - * omitted. If omitted, it indicates there is no HTTP request body. - * 2. Leaf fields (recursive expansion of nested messages in the - * request) can be classified into three types: - * (a) Matched in the URL template. - * (b) Covered by body (if body is `*`, everything except (a) fields; - * else everything under the body field) - * (c) All other fields. - * 3. URL query parameters found in the HTTP request are mapped to (c) fields. - * 4. Any body sent with an HTTP request can contain only (b) fields. + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. * - * The syntax of the path template is as follows: + * Path template syntax * * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; @@ -209,59 +217,114 @@ export interface Http { * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * - * The syntax `*` matches a single path segment. The syntax `**` matches zero - * or more path segments, which must be the last part of the path except the - * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. * * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path, all characters - * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the - * Discovery Document as `{var}`. - * - * If a variable contains one or more path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path, all - * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables - * show up in the Discovery Document as `{+var}`. - * - * NOTE: While the single segment variable matches the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 - * Simple String Expansion, the multi segment variable **does not** match - * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. * - * NOTE: the field paths in variables and in the `body` must not refer to - * repeated fields or map fields. + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. */ export interface HttpRule { /** - * Selects methods to which this rule applies. + * 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; - /** Used for listing and getting information about resources. */ + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ get?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PUT. Used for replacing a resource. */ put?: | string | undefined; - /** Used for creating a resource. */ + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ post?: | string | undefined; - /** Used for deleting a resource. */ + /** Maps to HTTP DELETE. Used for deleting a resource. */ delete?: | string | undefined; - /** Used for updating a resource. */ + /** Maps to HTTP PATCH. Used for updating a resource. */ patch?: | string | undefined; @@ -275,16 +338,21 @@ export interface HttpRule { | CustomHttpPattern | undefined; /** - * The name of the request field whose value is mapped to the HTTP body, or - * `*` for mapping all fields not captured by the path pattern to the HTTP - * body. NOTE: the referred field must not be a repeated field and must be - * present at the top-level of request message type. + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. */ body: string; /** * Optional. The name of the response field whose value is mapped to the HTTP - * body of response. Other response fields are ignored. When - * not set, the response message will be used as HTTP body of response. + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. */ responseBody: string; /** @@ -307,19 +375,19 @@ function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(10).fork()).join(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttp(); while (reader.pos < end) { @@ -343,16 +411,16 @@ export const Http = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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)) : [], fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) : false, }; }, @@ -362,7 +430,7 @@ export const Http = { if (message.rules?.length) { obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== false) { obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; } return obj; @@ -394,8 +462,8 @@ function createBaseHttpRule(): HttpRule { }; } -export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } @@ -415,7 +483,7 @@ export const HttpRule = { writer.uint32(50).string(message.patch); } if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); } if (message.body !== "") { writer.uint32(58).string(message.body); @@ -424,13 +492,13 @@ export const HttpRule = { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + HttpRule.encode(v!, writer.uint32(90).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHttpRule(); while (reader.pos < end) { @@ -510,23 +578,23 @@ export const HttpRule = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -592,8 +660,8 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } -export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } @@ -603,8 +671,8 @@ export const CustomHttpPattern = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomHttpPattern(); while (reader.pos < end) { @@ -628,13 +696,16 @@ export const CustomHttpPattern = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(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 { @@ -662,7 +733,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; @@ -673,3 +745,12 @@ export type Exact = P extends Builtin ? P function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/google/protobuf/descriptor.ts b/ts-client/ibc.core.connection.v1/types/google/protobuf/descriptor.ts index 0ea8d82d..16f43aa8 100644 --- a/ts-client/ibc.core.connection.v1/types/google/protobuf/descriptor.ts +++ b/ts-client/ibc.core.connection.v1/types/google/protobuf/descriptor.ts @@ -1,9 +1,133 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/descriptor.proto + /* eslint-disable */ -import Long from "long"; -import _m0 from "protobufjs/minimal"; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -15,9 +139,13 @@ export interface FileDescriptorSet { /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ - name: string; + name?: + | string + | undefined; /** e.g. "foo", "foo.bar", etc. */ - package: string; + package?: + | string + | undefined; /** Names of files imported by this file. */ dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ @@ -32,7 +160,7 @@ export interface FileDescriptorProto { enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; - options: + options?: | FileOptions | undefined; /** @@ -41,26 +169,32 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo: + sourceCodeInfo?: | SourceCodeInfo | undefined; /** * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". */ - syntax: string; + syntax?: + | string + | undefined; + /** The edition of the proto file. */ + edition?: Edition | undefined; } /** Describes a message type. */ export interface DescriptorProto { - name: string; + name?: string | undefined; field: FieldDescriptorProto[]; extension: FieldDescriptorProto[]; nestedType: DescriptorProto[]; enumType: EnumDescriptorProto[]; extensionRange: DescriptorProto_ExtensionRange[]; oneofDecl: OneofDescriptorProto[]; - options: MessageOptions | undefined; + options?: MessageOptions | undefined; reservedRange: DescriptorProto_ReservedRange[]; /** * Reserved field names, which may not be used by fields in the same message. @@ -71,10 +205,12 @@ export interface DescriptorProto { export interface DescriptorProto_ExtensionRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; - options: ExtensionRangeOptions | undefined; + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; } /** @@ -84,26 +220,118 @@ export interface DescriptorProto_ExtensionRange { */ export interface DescriptorProto_ReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Exclusive. */ - end: number; + end?: number | undefined; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; } /** Describes a field within a message. */ export interface FieldDescriptorProto { - name: string; - number: number; - label: FieldDescriptorProto_Label; + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; /** * 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; + type?: + | FieldDescriptorProto_Type + | undefined; /** * 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 @@ -111,45 +339,52 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; + typeName?: + | string + | undefined; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; + extendee?: + | string + | undefined; /** * 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? */ - defaultValue: string; + defaultValue?: + | string + | undefined; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; + oneofIndex?: + | number + | undefined; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; - options: + jsonName?: string | undefined; + options?: | FieldOptions | undefined; /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -163,7 +398,7 @@ export interface FieldDescriptorProto { * Proto2 optional fields do not set this flag, because they already indicate * optional with `LABEL_OPTIONAL`. */ - proto3Optional: boolean; + proto3Optional?: boolean | undefined; } export enum FieldDescriptorProto_Type { @@ -190,9 +425,10 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -320,8 +556,13 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, UNRECOGNIZED = -1, } @@ -330,12 +571,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor 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 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; case -1: case "UNRECOGNIZED": default: @@ -347,10 +588,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La 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.LABEL_REQUIRED: + return "LABEL_REQUIRED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -359,15 +600,15 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La /** Describes a oneof. */ export interface OneofDescriptorProto { - name: string; - options: OneofOptions | undefined; + name?: string | undefined; + options?: OneofOptions | undefined; } /** Describes an enum type. */ export interface EnumDescriptorProto { - name: string; + name?: string | undefined; value: EnumValueDescriptorProto[]; - options: + options?: | EnumOptions | undefined; /** @@ -393,41 +634,47 @@ export interface EnumDescriptorProto { */ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ - start: number; + start?: + | number + | undefined; /** Inclusive. */ - end: number; + end?: number | undefined; } /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { - name: string; - number: number; - options: EnumValueOptions | undefined; + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; } /** Describes a service. */ export interface ServiceDescriptorProto { - name: string; + name?: string | undefined; method: MethodDescriptorProto[]; - options: ServiceOptions | undefined; + options?: ServiceOptions | undefined; } /** Describes a method of a service. */ export interface MethodDescriptorProto { - name: string; + name?: + | string + | undefined; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; - outputType: string; - options: + inputType?: string | undefined; + outputType?: string | undefined; + options?: | MethodOptions | undefined; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; + clientStreaming?: + | boolean + | undefined; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; + serverStreaming?: boolean | undefined; } export interface FileOptions { @@ -437,7 +684,9 @@ export interface FileOptions { * inappropriate because proto packages do not normally start with backwards * domain names. */ - javaPackage: string; + javaPackage?: + | string + | undefined; /** * Controls the name of the wrapper Java class generated for the .proto file. * That class will always contain the .proto file's getDescriptor() method as @@ -445,7 +694,9 @@ export interface FileOptions { * If java_multiple_files is disabled, then all the other classes from the * .proto file will be nested inside the single wrapper outer class. */ - javaOuterClassname: string; + javaOuterClassname?: + | string + | undefined; /** * If enabled, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -454,23 +705,33 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; + javaMultipleFiles?: + | boolean + | undefined; /** * This option does nothing. * * @deprecated */ - javaGenerateEqualsAndHash: boolean; + javaGenerateEqualsAndHash?: + | boolean + | undefined; /** - * 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. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -478,7 +739,9 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; + goPackage?: + | string + | undefined; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -491,59 +754,82 @@ export interface FileOptions { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; + ccEnableArenas?: + | boolean + | undefined; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; + objcClassPrefix?: + | string + | undefined; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; + csharpNamespace?: + | string + | undefined; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; + swiftPrefix?: + | string + | undefined; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; + phpClassPrefix?: + | string + | undefined; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; + phpNamespace?: + | string + | undefined; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; + phpMetadataNamespace?: + | string + | undefined; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; + rubyPackage?: + | string + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -615,20 +901,26 @@ export interface MessageOptions { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - messageSetWireFormat: boolean; + messageSetWireFormat?: + | boolean + | undefined; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; + noStandardDescriptorAccessor?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -652,27 +944,59 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * 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! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ - ctype: FieldOptions_CType; + ctype?: + | FieldOptions_CType + | undefined; /** * 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. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. */ - packed: boolean; + packed?: + | boolean + | undefined; /** * 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 @@ -686,7 +1010,9 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; + jstype?: + | FieldOptions_JSType + | undefined; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -705,27 +1031,49 @@ export interface FieldOptions { * 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. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. */ - lazy: boolean; + unverifiedLazy?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** For Google-internal migration only. Do not use. */ - weak: boolean; + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -733,6 +1081,14 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -812,7 +1168,182 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -822,14 +1353,35 @@ export interface EnumOptions { * Set this option to true to allow mapping different tag names to the same * value. */ - allowAlias: boolean; + allowAlias?: + | boolean + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -841,19 +1393,43 @@ export interface EnumValueOptions { * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: + | boolean + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** * 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; + deprecated?: + | boolean + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -865,8 +1441,14 @@ export interface MethodOptions { * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -931,20 +1513,20 @@ export interface UninterpretedOption { * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: number; - negativeIntValue: number; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; } /** * 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". + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". */ export interface UninterpretedOption_NamePart { namePart: string; @@ -952,38 +1534,335 @@ export interface UninterpretedOption_NamePart { } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. */ -export interface 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 +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * 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 @@ -1010,8 +1889,8 @@ export interface SourceCodeInfo_Location { * 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: + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: * file.message_type(3) // 4, 3 @@ -1067,13 +1946,13 @@ export interface SourceCodeInfo_Location { * // Comment attached to baz. * // Another line attached to baz. * - * // Comment attached to qux. + * // Comment attached to moo. * // - * // Another line attached to qux. - * optional double qux = 4; + * // Another line attached to moo. + * optional double moo = 4; * * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from + * // to moo or corge because there are blank lines separating it from * // both. * * // Detached comment for corge paragraph 2. @@ -1088,8 +1967,8 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; - trailingComments: string; + leadingComments?: string | undefined; + trailingComments?: string | undefined; leadingDetachedComments: string[]; } @@ -1113,34 +1992,85 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; + sourceFile?: + | string + | undefined; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; + begin?: + | number + | undefined; /** * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past + * relates to the identified object. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } } function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } -export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorSet(); while (reader.pos < end) { @@ -1157,13 +2087,15 @@ export const FileDescriptorSet = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1198,15 +2130,16 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", + edition: 0, }; } -export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1216,38 +2149,41 @@ export const FileDescriptorProto = { for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(90).fork(); for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); + writer.join(); for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); } if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); } if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { writer.uint32(98).string(message.syntax); } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileDescriptorProto(); while (reader.pos < end) { @@ -1357,44 +2293,60 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, }; }, toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.package !== "") { + if (message.package !== undefined && message.package !== "") { obj.package = message.package; } if (message.dependency?.length) { @@ -1424,9 +2376,12 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); } - if (message.syntax !== "") { + if (message.syntax !== undefined && message.syntax !== "") { obj.syntax = message.syntax; } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } return obj; }, @@ -1451,6 +2406,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; return message; }, }; @@ -1470,34 +2426,34 @@ function createBaseDescriptorProto(): DescriptorProto { }; } -export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); } for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); } for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); } for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); } if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); } for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); } for (const v of message.reservedName) { writer.uint32(82).string(v!); @@ -1505,8 +2461,8 @@ export const DescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto(); while (reader.pos < end) { @@ -1586,39 +2542,45 @@ export const DescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: DescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.field?.length) { @@ -1676,22 +2638,22 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa 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) { +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ExtensionRange(); while (reader.pos < end) { @@ -1722,25 +2684,25 @@ export const DescriptorProto_ExtensionRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } if (message.options !== undefined) { @@ -1769,19 +2731,19 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang 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) { +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescriptorProto_ReservedRange(); while (reader.pos < end) { @@ -1805,21 +2767,24 @@ export const DescriptorProto_ReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -1839,19 +2804,28 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [] }; + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; } -export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); while (reader.pos < end) { @@ -1864,20 +2838,48 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, }; }, @@ -1886,6 +2888,15 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } return obj; }, @@ -1895,66 +2906,194 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; return message; }, }; -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; } -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); +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); } - if (message.type !== 1) { - writer.uint32(40).int32(message.type); - } - if (message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== "") { - writer.uint32(18).string(message.extendee); + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); } - if (message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); } - if (message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); } - if (message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldDescriptorProto(); while (reader.pos < end) { @@ -2041,60 +3180,60 @@ export const FieldDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } - if (message.label !== 1) { + if (message.label !== undefined && message.label !== 1) { obj.label = fieldDescriptorProto_LabelToJSON(message.label); } - if (message.type !== 1) { + if (message.type !== undefined && message.type !== 1) { obj.type = fieldDescriptorProto_TypeToJSON(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined && message.typeName !== "") { obj.typeName = message.typeName; } - if (message.extendee !== "") { + if (message.extendee !== undefined && message.extendee !== "") { obj.extendee = message.extendee; } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined && message.defaultValue !== "") { obj.defaultValue = message.defaultValue; } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { obj.oneofIndex = Math.round(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined && message.jsonName !== "") { obj.jsonName = message.jsonName; } if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2126,19 +3265,19 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } -export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOneofDescriptorProto(); while (reader.pos < end) { @@ -2162,21 +3301,21 @@ export const OneofDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.options !== undefined) { @@ -2202,19 +3341,19 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; } -export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); } for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); } for (const v of message.reservedName) { writer.uint32(42).string(v!); @@ -2222,8 +3361,8 @@ export const EnumDescriptorProto = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto(); while (reader.pos < end) { @@ -2268,26 +3407,30 @@ export const EnumDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.value?.length) { @@ -2326,19 +3469,19 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ 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) { +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && 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 : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumDescriptorProto_EnumReservedRange(); while (reader.pos < end) { @@ -2362,21 +3505,24 @@ export const EnumDescriptorProto_EnumReservedRange = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; - if (message.start !== 0) { + if (message.start !== undefined && message.start !== 0) { obj.start = Math.round(message.start); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } return obj; @@ -2401,22 +3547,22 @@ 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 !== "") { +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueDescriptorProto(); while (reader.pos < end) { @@ -2447,25 +3593,25 @@ export const EnumValueDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.number !== 0) { + if (message.number !== undefined && message.number !== 0) { obj.number = Math.round(message.number); } if (message.options !== undefined) { @@ -2492,22 +3638,22 @@ 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 !== "") { +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); } if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceDescriptorProto(); while (reader.pos < end) { @@ -2538,22 +3684,24 @@ export const ServiceDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.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 = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } if (message.method?.length) { @@ -2590,31 +3738,31 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { }; } -export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodDescriptorProto(); while (reader.pos < end) { @@ -2666,40 +3814,40 @@ export const MethodDescriptorProto = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; - if (message.name !== "") { + if (message.name !== undefined && message.name !== "") { obj.name = message.name; } - if (message.inputType !== "") { + if (message.inputType !== undefined && message.inputType !== "") { obj.inputType = message.inputType; } - if (message.outputType !== "") { + if (message.outputType !== undefined && message.outputType !== "") { obj.outputType = message.outputType; } if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -2734,9 +3882,8 @@ function createBaseFileOptions(): FileOptions { ccGenericServices: false, javaGenericServices: false, pyGenericServices: false, - phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -2744,80 +3891,81 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", + features: undefined, uninterpretedOption: [], }; } -export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.javaPackage !== "") { +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { - writer.uint32(336).bool(message.phpGenericServices); - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); while (reader.pos < end) { @@ -2893,13 +4041,6 @@ export const FileOptions = { message.pyGenericServices = reader.bool(); continue; - case 42: - if (tag !== 336) { - break; - } - - message.phpGenericServices = reader.bool(); - continue; case 23: if (tag !== 184) { break; @@ -2963,6 +4104,13 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -2974,36 +4122,36 @@ export const FileOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3011,66 +4159,66 @@ export const FileOptions = { toJSON(message: FileOptions): unknown { const obj: any = {}; - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined && message.javaPackage !== "") { obj.javaPackage = message.javaPackage; } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } - if (message.optimizeFor !== 1) { + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined && message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { - obj.phpGenericServices = message.phpGenericServices; - } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { obj.objcClassPrefix = message.objcClassPrefix; } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { obj.csharpNamespace = message.csharpNamespace; } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { obj.swiftPrefix = message.swiftPrefix; } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { obj.phpClassPrefix = message.phpClassPrefix; } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { obj.phpNamespace = message.phpNamespace; } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { obj.phpMetadataNamespace = message.phpMetadataNamespace; } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3092,9 +4240,8 @@ export const FileOptions = { message.ccGenericServices = object.ccGenericServices ?? false; message.javaGenericServices = object.javaGenericServices ?? false; message.pyGenericServices = object.pyGenericServices ?? false; - message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3102,6 +4249,9 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3113,32 +4263,42 @@ function createBaseMessageOptions(): MessageOptions { noStandardDescriptorAccessor: false, deprecated: false, mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, uninterpretedOption: [], }; } -export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); while (reader.pos < end) { @@ -3172,6 +4332,20 @@ export const MessageOptions = { message.mapEntry = reader.bool(); continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3183,20 +4357,26 @@ export const MessageOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3204,18 +4384,26 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined && message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3231,43 +4419,85 @@ export const MessageOptions = { message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseFieldOptions(): FieldOptions { - return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpretedOption: [] }; + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ctype !== 0) { +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { writer.uint32(80).bool(message.weak); } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); while (reader.pos < end) { @@ -3301,6 +4531,13 @@ export const FieldOptions = { message.lazy = reader.bool(); continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -3315,6 +4552,58 @@ export const FieldOptions = { message.weak = reader.bool(); continue; + case 16: + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3326,7 +4615,7 @@ export const FieldOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, @@ -3334,12 +4623,25 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3347,24 +4649,45 @@ export const FieldOptions = { toJSON(message: FieldOptions): unknown { const obj: any = {}; - if (message.ctype !== 0) { + if (message.ctype !== undefined && message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined && message.packed !== false) { obj.packed = message.packed; } - if (message.jstype !== 0) { + if (message.jstype !== undefined && message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined && message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== undefined && message.weak !== false) { obj.weak = message.weak; } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3380,146 +4703,392 @@ export const FieldOptions = { message.packed = object.packed ?? false; message.jstype = object.jstype ?? 0; message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; message.deprecated = object.deprecated ?? false; message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseOneofOptions(): OneofOptions { - return { uninterpretedOption: [] }; +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; } -export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); + const message = createBaseFieldOptions_EditionDefault(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (tag !== 7994) { + case 3: + if (tag !== 24) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): OneofOptions { + fromJSON(object: any): FieldOptions_EditionDefault { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: FieldOptions_EditionDefault): unknown { const obj: any = {}; - if (message.uninterpretedOption?.length) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; } return obj; }, - create, I>>(base?: I): OneofOptions { - return OneofOptions.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneofOptions { - const message = createBaseOneofOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; return message; }, }; -function createBaseEnumOptions(): EnumOptions { - return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; } -export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { - writer.uint32(16).bool(message.allowAlias); +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); } - if (message.deprecated === true) { - writer.uint32(24).bool(message.deprecated); + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); + const message = createBaseFieldOptions_FeatureSupport(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; case 2: if (tag !== 16) { break; } - message.allowAlias = reader.bool(); + message.editionDeprecated = reader.int32() as any; continue; case 3: - if (tag !== 24) { + if (tag !== 26) { break; } - message.deprecated = reader.bool(); + message.deprecationWarning = reader.string(); continue; - case 999: - if (tag !== 7994) { + case 4: + if (tag !== 32) { break; } - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + message.editionRemoved = reader.int32() as any; continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, - fromJSON(object: any): EnumOptions { + fromJSON(object: any): FieldOptions_FeatureSupport { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) - ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) - : [], + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: FieldOptions_FeatureSupport): unknown { const obj: any = {}; - if (message.allowAlias === true) { - obj.allowAlias = message.allowAlias; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); } - if (message.deprecated === true) { - obj.deprecated = message.deprecated; + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -3534,28 +5103,47 @@ export const EnumOptions = { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; } -export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); while (reader.pos < end) { @@ -3568,6 +5156,27 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3579,15 +5188,20 @@ export const EnumValueOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3595,9 +5209,18 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3610,33 +5233,50 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { deprecated: false, uninterpretedOption: [] }; + return { features: undefined, deprecated: false, uninterpretedOption: [] }; } -export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServiceOptions(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 33: if (tag !== 264) { break; @@ -3655,15 +5295,16 @@ export const ServiceOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3671,7 +5312,10 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -3685,6 +5329,9 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -3692,25 +5339,28 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; } -export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); while (reader.pos < end) { @@ -3730,6 +5380,13 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; case 999: if (tag !== 7994) { break; @@ -3741,18 +5398,19 @@ export const MethodOptions = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3760,12 +5418,15 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== undefined && message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.idempotencyLevel !== 0) { + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -3779,6 +5440,9 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -3796,34 +5460,34 @@ function createBaseUninterpretedOption(): UninterpretedOption { }; } -export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption(); while (reader.pos < end) { @@ -3848,14 +5512,14 @@ export const UninterpretedOption = { break; } - message.positiveIntValue = longToNumber(reader.uint64() as Long); + message.positiveIntValue = longToNumber(reader.uint64()); continue; case 5: if (tag !== 40) { break; } - message.negativeIntValue = longToNumber(reader.int64() as Long); + message.negativeIntValue = longToNumber(reader.int64()); continue; case 6: if (tag !== 49) { @@ -3882,20 +5546,22 @@ export const UninterpretedOption = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -3904,22 +5570,22 @@ export const UninterpretedOption = { if (message.name?.length) { obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined && message.identifierValue !== "") { obj.identifierValue = message.identifierValue; } - if (message.positiveIntValue !== 0) { + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { obj.positiveIntValue = Math.round(message.positiveIntValue); } - if (message.negativeIntValue !== 0) { + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { obj.negativeIntValue = Math.round(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined && message.doubleValue !== 0) { obj.doubleValue = message.doubleValue; } - if (message.stringValue.length !== 0) { + if (message.stringValue !== undefined && message.stringValue.length !== 0) { obj.stringValue = base64FromBytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { obj.aggregateValue = message.aggregateValue; } return obj; @@ -3945,19 +5611,19 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart return { namePart: "", isExtension: false }; } -export const UninterpretedOption_NamePart = { - encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUninterpretedOption_NamePart(); while (reader.pos < end) { @@ -3981,15 +5647,15 @@ export const UninterpretedOption_NamePart = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -3998,7 +5664,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -4015,20 +5681,356 @@ export const UninterpretedOption_NamePart = { }, }; +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } -export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo(); while (reader.pos < end) { @@ -4045,14 +6047,14 @@ export const SourceCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -4080,22 +6082,22 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; } -export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); + writer.join(); writer.uint32(18).fork(); for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -4104,8 +6106,8 @@ export const SourceCodeInfo_Location = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSourceCodeInfo_Location(); while (reader.pos < end) { @@ -4170,19 +6172,19 @@ export const SourceCodeInfo_Location = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -4195,10 +6197,10 @@ export const SourceCodeInfo_Location = { if (message.span?.length) { obj.span = message.span.map((e) => Math.round(e)); } - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined && message.leadingComments !== "") { obj.leadingComments = message.leadingComments; } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined && message.trailingComments !== "") { obj.trailingComments = message.trailingComments; } if (message.leadingDetachedComments?.length) { @@ -4225,16 +6227,16 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } -export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo(); while (reader.pos < end) { @@ -4251,14 +6253,14 @@ export const GeneratedCodeInfo = { if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -4283,30 +6285,33 @@ export const GeneratedCodeInfo = { }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0 }; + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; } -export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { writer.uint32(32).int32(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGeneratedCodeInfo_Annotation(); while (reader.pos < end) { @@ -4350,21 +6355,29 @@ export const GeneratedCodeInfo_Annotation = { message.end = reader.int32(); continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; } if ((tag & 7) === 4 || tag === 0) { break; } - reader.skipType(tag & 7); + reader.skip(tag & 7); } return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, }; }, @@ -4373,15 +6386,18 @@ export const GeneratedCodeInfo_Annotation = { if (message.path?.length) { obj.path = message.path.map((e) => Math.round(e)); } - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined && message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } - if (message.begin !== 0) { + if (message.begin !== undefined && message.begin !== 0) { obj.begin = Math.round(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined && message.end !== 0) { obj.end = Math.round(message.end); } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } return obj; }, @@ -4394,34 +6410,16 @@ export const GeneratedCodeInfo_Annotation = { message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; return message; }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: 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 (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -4431,21 +6429,22 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + 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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -4453,18 +6452,26 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; } function isSet(value: any): boolean { return value !== null && value !== undefined; } + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/google/protobuf/duration.ts b/ts-client/ibc.core.connection.v1/types/google/protobuf/duration.ts new file mode 100644 index 00000000..8ac2b038 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/google/protobuf/duration.ts @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(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; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/ts-client/ibc.core.connection.v1/types/route-name.eta b/ts-client/ibc.core.connection.v1/types/route-name.eta new file mode 100644 index 00000000..7ad6f7a2 --- /dev/null +++ b/ts-client/ibc.core.connection.v1/types/route-name.eta @@ -0,0 +1,45 @@ +<% +const { routeInfo, utils } = it; +const { + operationId, + method, + route, + moduleName, + responsesTypes, + description, + tags, + summary, + pathArgs, +} = routeInfo; +const { _, fmtToJSDocLine, require } = utils; + +const methodAliases = { + get: (pathName, hasPathInserts) => + _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), + post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), + put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), + patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), + delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), +}; + +const createCustomOperationId = (method, route, moduleName) => { + const hasPathInserts = /\{(\w){1,}\}/g.test(route); + const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); + const routeParts = (splitedRouteBySlash.length > 1 + ? splitedRouteBySlash.splice(1) + : splitedRouteBySlash + ).join("_"); + return routeParts.length > 3 && methodAliases[method] + ? methodAliases[method](routeParts, hasPathInserts) + : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; +}; + +if (operationId) { + let routeName = operationId.replace('_',''); + return routeName[0].toLowerCase() + routeName.slice(1); +} +if (route === "/") + return _.camelCase(`${_.lowerCase(method)}Root`); + +return createCustomOperationId(method, route, moduleName); +%> \ No newline at end of file